Bad perfomance with nginx and php-fpm

Jérôme Loyet jerome at loyet.net
Fri Nov 18 07:33:32 UTC 2011


2011/11/17 Dieter Knopf <dieterknopf at googlemail.com>:
> 2011/11/17 Jérôme Loyet <jerome at loyet.net>:
>> can you test by setting pm = static and pm.max_children to something a
>> little bit hight than 10 (12 or 15).
>> Just to ensure the problem does not come from the dynamic PM.
>
> Sure. I just tested it with 20 children:
> Time taken for tests:   24.580 seconds
> Complete requests:      1000
> Failed requests:        859
>   (Connect: 0, Receive: 0, Length: 859, Exceptions: 0)
>
> The same result :-(
>
> This sould be far better with 20 php daemons, it must be another
> problem, like a timeout or something like that?

what page are you requesting ?

Start by requesting a very simple PHP page (<?php echo "toto; ?>).
It's a good start to figure out what's going on.

Here is what I have with a very short and simple page  (20 static
children on FPM  PHP 5.3 trunk and nginx 1.1.4)

fat at dev:~/web$ ab -c 10 -n 1000 http://xxxxxxxxxx/pwd.php
Server Software:        nginx/1.1.4
Server Hostname:        xxxxxx
Server Port:            80

Document Path:          /pwd.php
Document Length:        22 bytes

Concurrency Level:      10
Time taken for tests:   0.649 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      175000 bytes
HTML transferred:       22000 bytes
Requests per second:    1539.96 [#/sec] (mean)
Time per request:       6.494 [ms] (mean)
Time per request:       0.649 [ms] (mean, across all concurrent requests)
Transfer rate:          263.18 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       5
Processing:     0    6   2.6      6      37
Waiting:        0    6   2.6      6      37
Total:          1    6   2.9      6      42

Percentage of the requests served within a certain time (ms)
  50%      6
  66%      6
  75%      7
  80%      7
  90%      7
  95%      7
  98%     12
  99%     19
 100%     42 (longest request)


Then increase the size the PHP page returns (ex: 64k --> <?php echo
str_pad("", 1024*64, "x"); ?>)

fat at dev:~/web$ ab -c 10 -n 1000 http://xxxxxxx/size.php
Server Software:        nginx/1.1.4
Server Hostname:        xxxxxxx
Server Port:            80

Document Path:          /size.php
Document Length:        65536 bytes

Concurrency Level:      10
Time taken for tests:   1.242 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      65689000 bytes
HTML transferred:       65536000 bytes
Requests per second:    805.17 [#/sec] (mean)
Time per request:       12.420 [ms] (mean)
Time per request:       1.242 [ms] (mean, across all concurrent requests)
Transfer rate:          51651.05 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       5
Processing:     1   12   2.9     12      34
Waiting:        1   12   2.9     12      32
Total:          1   12   3.0     12      37

Percentage of the requests served within a certain time (ms)
  50%     12
  66%     13
  75%     14
  80%     14
  90%     16
  95%     17
  98%     18
  99%     20
 100%     37 (longest request)

Then increase the complexity (size, CPU, memory, fork, database requests, ...)

>
> Thanks
>
> Dieter
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



More information about the nginx mailing list