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'm currently testing a new nginx/php-fpm I have setup on a new VPS with 4GB of RAM:

from my php-fpm process pool config:

pm = static
pm.max_children = 10

I have a simple load.php script which has the following simulate a long running mysql query:

<?php
echo sleep(5);
echo "you see me after 5 seconds";
?>

I then throw some load at this script as follows:

ab -n 1000 -c 100 http://mydomain.com/load.php

When I tail the nginx access logs I see a trickle of requests at a time - rather than the high throughput I was expecting.

How exactly does the data flow from nginx to the php backend and back?

If I have 10 static child processes, will the php backend process 10 requests (at 5 seconds each) before then accepting another 10 requests? Certainly from sitting looking at the logs that would appear to be roughly the case - is this correct?

If this is the case and I'm running a php app that if fairly heavy at the DB end (and consequently at the php process time layer), should I simply be increasing the number of child processes to speed up how long it takes to concurrently handle requests?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

pm.max_children means you can only have that many php processes running at once. If they are all taking a long time, then you are tied up, and other incoming connections must wait. To resolve this, increase the size of the php-fpm pool to the maximum you can get away with given your resource constraints.

share|improve this answer
    
thanks for your answer Michael - I wanted to be sure what I suspected was correct - I will increase the conn pool as much as I can –  Ed Bloom Oct 23 '12 at 16:01

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.