1
pm = dynamic
 pm.max_children = 700
 pm.start_servers = 20
 pm.min_spare_servers = 20
 pm.max_spare_servers = 40
 pm.max_requests = 500

I am using the following. But still i am getting errors after reaching certain level of traffic. The Ram and CPU are free.

max_children * max_request = total hits? But i started to get warning after reaching 75 hits per second.

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

What will happen if i change the same setting to

pm=ondemand

pm=ondemand
pm.max_children = 700
pm.max_requests = 500

ondemand is not creating any children at startup and started to serve one by one when needed till it reaches 700.

in pm=dynamic, certain child process will be created and and be in waiting status to handle the traffic. In the end, if the traffic is reached, both would have ended with 700 children

How does these improve the performance?
pm.process_idle_timeout = 10s; the default value

pm=dynamic, the min and max spare servers are also confusing. for 700 children, how to calculate max spare servers? what will the 40 spare servers do here with 700 children?

In simple, does it mean that a children will handle 500 request per second and waits for 10seconds and dies?

Please someone give me a good understandable knowledge

Thanks

  • 1
    Max children is the number of threads available to serve requests. If it's 3, you can generate 3 pages at a time. 5 is low for a busy site. Dynamic vs on demand, google it, but you want dynamic. To solve your problem increase max children until you almost max out the CPU, taking into account other services like MySQL will need CPU. Benchmarking is your friend. – Tim Jan 21 '18 at 5:14
  • Thank you for the advice. Because it is an api site without any html css and js and changed the pm.process_idle_timeout = 5s. Can i even reduce the timeout to 2s? – Mahesh Jan 21 '18 at 5:17
  • That setting only works when it's set to on_demand. You really need to read the documentation, plus some tutorials so you have some idea what's going on. That or hire a decent consultant. – Tim Jan 21 '18 at 7:49
  • Learning is always best :) I did lot of search and people in internet are mostly posted how to set the values. They failed to explain why do we need to set those values and what they do in real. Or i have to broke the server and spoil it to experiment :) – Mahesh Jan 21 '18 at 8:49
  • Read the PHP documentation. If you don't know the knowledge / experience to set things correctly after that your choices are to use random values someone else tells you or hire someone to work out what the values should be. Looking at your original question, 700 max children / simultaneous requests is probably too high. 20 / 40 spare servers is fine if your server is very busy, but takes a lot of RAM. max_requests is ok if there's no memory leaks, I tend to use lower, maybe 50. – Tim Jan 21 '18 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.