Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon & ab benchmarking troubles

Hi

I want to test Benchmarking with Phalcon compared with our coorporative framework to study a possible change. I have seen strange things, I will explain the process of benchmarking has been done:

Test Hello World: from a controller, without views, returns "Hello World" PC laptop Acer with Ubuntu Mysql PHP 5.5 without Cache extensions installed.

"Advanced REST Client" REST client extension from Chrome gives me next results:

1 single request, Coorporative Framework: 55ms { "response": { "status": 200, "result": { "data": "Hello World" } } }

1 single request, Phalcon Framework: 20ms

All OK here,,,

Now I realize ab tests, 200 requests, concurrency 10

ab -n 200 -c 10 http://lplnx013/fwkcoorp/projects/

Concurrency Level: 10 Time taken for tests: 7.170 seconds Complete requests: 200 Failed requests: 0 Total transferred: 148400 bytes HTML transferred: 14000 bytes Requests per second: 27.89 [#/sec] (mean) Time per request: 358.524 [ms] (mean) Time per request: 35.852 [ms] (mean, across all concurrent requests) Transfer rate: 20.21 [Kbytes/sec] received

Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 1.0 0 5 Processing: 145 356 52.0 351 559 Waiting: 142 334 55.9 331 547 Total: 145 356 52.1 351 559

Percentage of the requests served within a certain time (ms) 50% 351 66% 373 75% 385 80% 390 90% 412 95% 457 98% 496 99% 511 100% 559 (longest request)

ab -n 200 -c 10 http://lplnx013/fwkphalcon/projects/

Concurrency Level: 10 Time taken for tests: 100.723 seconds Complete requests: 200 Failed requests: 0 Total transferred: 133000 bytes HTML transferred: 40200 bytes Requests per second: 1.99 [#/sec] (mean) Time per request: 5036.166 [ms] (mean) Time per request: 503.617 [ms] (mean, across all concurrent requests) Transfer rate: 1.29 [Kbytes/sec] received

Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.8 0 6 Processing: 5009 5032 22.3 5026 5112 Waiting: 7 27 21.6 21 104 Total: 5009 5032 22.5 5026 5112

Percentage of the requests served within a certain time (ms) 50% 5026 66% 5031 75% 5037 80% 5046 90% 5068 95% 5083 98% 5107 99% 5112 100% 5112 (longest request)

Makes no sense giving me results Phalcon, what problem I have? someone with a similar problem?

Thanks in advance, I hope I have given the necessary information to receive a response if you need more info do not hesitate to ask.

Regards.



20.4k

Soy español, pero dudo que aquí te puedan responder si no lo haces en inglés. Esto es algo más "internacional", por así decirlo.

Y siento no poder ayudarte.

=======================================

I'm spanish, but I don't think that someone can help you if you don't ask in english. This is more "international" in a way.

And sorry that I cannot help you.

Creo que necesitamos un foro en español

Translated...



576
Accepted
answer

Fixed.

Trouble was into setStatusCode function and ab

$this->response->setStatusCode(200, 'OK');

and

$this->view->setVar('status', 200);
$this->view->setVar('content', json_encode($this->content));
$this->view->pick('success');

are no compatibility in my request success method

Just commenting //$this->response->setStatusCode(200, 'OK'); and all fixed:

Request x second: 850 :D

Thanks



264

It's old but still occurs. Reason for this error is setting custom header: https://github.com/phalcon/cphalcon/blob/master/phalcon/http/response.zep#L216

Temporary fix is to use:

http_response_code($code);

instead of:

$response->setStatusCode($code);