0

Apart from memory and cpu limitations, I'd like to keep in mind another number for the nginx and php-fpm setup.

If there is process.max set in /etc/php5/fpm/php-fpm.conf, the max number of php process ready for serving is limited.

However, nginx never knows about this limit and tries to find and get served by another php-fpm process.

How to limit nginx to request the same max at the same moment? (independent from cpu/ram which is discussed and explained in lots of other posts)

1 Answer 1

0

nginx doesn't spawn the php-fpm workers, it doesn't need to know about the limit.

6
  • that's the conflict, isn't it? nginx will try to get even more php process' though the max number is limited and will never be more because of php-fpm's config. i wonder how this could be considered in order to have nginx not ending up in errors 502 if the number is exceeded. Commented Sep 7, 2013 at 19:13
  • Having 2 workers doesn't mean that if you get 3 simultaneous requests the last one will 502, it just gets queued until it can be handled. Commented Sep 7, 2013 at 19:28
  • The queue seems to fail or break. Whenever the request can't be served quickly enough, nginx error recv() failed (104: Connection reset by peer) while reading response header from upstream, client: and WARNING: The maximum number of processes has been reached. suggesting to consider max values. but that's not wanted. instead, i want it to wait, not to request even more at the same time or http deny with err code 502, also fail :-( Commented Sep 7, 2013 at 21:35
  • The problem is not in nginx or its configuration. The error message indicates that php-fpm closed the connection, you should try to find out why. Commented Sep 8, 2013 at 8:29
  • though php-fpm config is set to log level=notice, it only tells about WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers). it reached maximum, so i'd expect it to use a queue - not disconnect nginx. Commented Sep 8, 2013 at 8:59

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.