I am using ubuntu 15.04 in my dedicated server with 40 cpu cores and 160GB of RAM with one heavy traffic wordpress site running. I am using Nginx as the webserver and varnish as the cache server. My php5-fpm.conf setting is:

listen = 127.0.0.1:7654
pm = dynamic
pm.max_children = 500
pm.start_servers = 80
pm.min_spare_servers = 20
pm.max_spare_servers = 160
pm.max_requests = 1000

But it is still showing the error:

[pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 17 idle, and 92 total children

WARNING: [pool www] server reached pm.max_children setting (200), consider raising it

I have tried increasing the numbers but still no luck. The memory used by one children is neary ~75MB. How can I figure out the best configuration for my php?

closed as too broad by symcbean, womble Oct 25 '17 at 0:05

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Generally I've found the best solution to using php-fpm in 'ondemand' mode. This seems to be much more memory efficient, less prone to memory leaks, and scalable. Would suggest along the lines of:

pm = ondemand
pm.max_children = 50
pm.process_idle_timeout = 10s
pm.max_requests = 500

max_children will need tuning to your environment. It's very much memory related, e.g. if an FPM process is going to consume 64MB, and you only have 2GB memory, you're only going to get 20-25 fpm processes before you start becoming memory constrained.

So calculate this value based on your memory, leaving some room for OS, and other services if this isn't a dedicated application server.

dedicated server with 40 cpu cores and 160GB of RAM with one heavy traffic wordpress site running

That's a really weird configuration for such a service.

We cannot advise how to fix the problem because you've not told us what the problem is. Most likely it would take a competent engineer at least a day to gather sufficient data to identify the bottleneck(s) and then longer to work out how best to address the constraint. Posting such a volume of research here as a question would be off-topic.

Capacity planning is off topic.

How can I figure out the best configuration for my php?

Learn about performance management and tuning. Make educated guesses as to the cause. Apply incremental changes. Measure the impact.

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