Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've discovered a bit of an issue when benchmarking my server setup today. My ultimate goal is speed and reliability, which is why I chose nginx coupled with PHP-FPM, APC, and a MySQL backend for the project. Unfortunately, things are not going as planned, when got the following results. Using:

ab -n 1000 -c 100

PHP page (static, only dynamic because it must check the PHP session to see if the user is logged in)

Concurrency Level:      100
Time taken for tests:   9.548000 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      3357000 bytes
HTML transferred:       3039000 bytes
Requests per second:    104.73 [#/sec] (mean)
Time per request:       954.800 [ms] (mean)
Time per request:       9.548 [ms] (mean, across all concurrent requests)
Transfer rate:          343.32 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.9      1      25
Processing:   134  900 201.4    977    1166
Waiting:      123  899 201.5    977    1166
Total:        134  902 201.4    978    1167

Percentage of the requests served within a certain time (ms)
  50%    978
  66%    997
  75%   1011
  80%   1023
  90%   1062
  95%   1082
  98%   1099
  99%   1113
 100%   1167 (longest request)

Not particularly impressed. Even worse, the actual application (when the user is logged in) looks like this (using ab -n 100 -c 10 since increasing this seems to cause disconnection issues)

Concurrency Level:      10
Time taken for tests:   6.748000 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      1990300 bytes
HTML transferred:       1964300 bytes
Requests per second:    14.82 [#/sec] (mean)
Time per request:       674.800 [ms] (mean)
Time per request:       67.480 [ms] (mean, across all concurrent requests)
Transfer rate:          287.94 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2  10.4      1      85
Processing:   111  643 558.6    474    2651
Waiting:      111  641 558.2    473    2651
Total:        112  645 559.4    492    2652

Percentage of the requests served within a certain time (ms)
  50%    492
  66%    718
  75%    914
  80%    986
  90%   1391
  95%   1943
  98%   2568
  99%   2652
 100%   2652 (longest request)

Now, I realize there's some bottleneck in my application and in MySQL, but even with optimizing those, something seems very wrong, looking at the first results. The issue seems to be with PHP-FPM, but I'm not sure. Am I crazy, or are these benchmarks extremely poor?

Here's my PHP-FPM config (relevant pieces):

pm = dynamic
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 500

Any pointers? These tests are being run with ab against a server on my virtualbox to match up with my VPS, running Ubuntu Server 11.10, 4 cores, 512mb of RAM.

Thanks!

share|improve this question
1  
The two rules of scalability testing: (1) The bottleneck is always the database (2) You can never predict what the bottleneck will be. –  SaveTheRbtz Dec 27 '11 at 11:12
    
Yes, but in this case, I get a bottleneck even without the database being utilized (in the case of the first results). Any tips to optimize the database side of it, though? –  Jaxbot Dec 28 '11 at 12:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.