<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">You can't say that. Which fpm model are you using? dynamic, ondemand? Makes a huge difference.<br><br>If you have a memory leak, ensure your workers are killed on a regular basis. <br><br>Don't want you near my servers for sure!<br><br>Steve<br><br>October 18, 2017 1:17 PM, "Peter Booth" <<a target="_blank" tabindex="-1" href="mailto:%22Peter%20Booth%22%20<peter_booth@me.com>">peter_booth@me.com</a>> wrote:<br> <blockquote><div><div style="word-wrap: break-word;-webkit-nbsp-mode: space;-webkit-line-break: after-white-space"> <div>Agree,</div> <div></div> <div>I work as performance architect , specializing in improving the performance</div> <div>of trading applications and high traffic web sites. When I first began tuning</div> <div>Apache (and then nginx) I realized the the internet was full of “helpful suggestions”</div> <div>about <i>why you should set configuration X to this number.</i> </div> <div>What took me more than ten years to learn was that 95% of these tips are</div> <div>useless, because they are ideas that made sense in one setting</div> <div>at one time that got copied and passed down year after year without people</div> <div>understanding them. So be skeptical about anything that anyone suggests, including me.</div> <div></div> <div>Regarding one of these settings: max_requests.</div> <div>This is a very old setting inherited from apache that originally allowed you to</div> <div>recycle apache worker processes after they had handled N requests.</div> <div></div> <div><b>Why would you do this?</b></div> <div></div> <div>If your worker included a module that leaked memory then over time worker processes</div> <div>would grow in size - this setting would mean that each worker would get killed eventually,</div> <div>at different time, so a new fresh process could be started to take its place, avoiding a</div> <div>catastrophe where all of your your workers consume all the memory on the host.</div> <div></div> <div>In 2017 you can absolutely set iit to zero, provided you keep track of the size of your processes.</div> <div>In fact we can confirm this idea just from your <i>top</i> output.</div> <div></div> <div> <div><font face="Courier">ID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND</font></div> <div><span style="font-family: Courier">3135 nginx 20 0 393108 12112 3832 R 7.3 0.0 10:30.35 php-fpm: pool www</span></div> <div><font face="Courier">6839 nginx 20 0 392804 11832 3828 R 7.3 0.0 10:37.57 php-fpm: pool www</font></div> </div> <div></div> <div></div> <div>See how process 3135 has been running fro 10 minutes 30 seconds whilst process 6839 has been running for 10 minutes 37 seconds.</div> <div>But the longer running process has a <b>smaller</b> resident set size (RSS = memory in use)</div> <div></div> <div>If you look at all of the lines its easier to see that there is no trend of memory increasing over time:</div> <div></div> <div> <div style="margin: 0px;font-size: 11px;line-height: normal;font-family: Menlo;background-color: rgb(255, 255, 255)"><span style="font-variant-ligatures: no-common-ligatures">NewiMac:Records peter$ cat phpOutput.txt | grep php-fpm | awk '{print $11,$6}' | head -15 | awk '{print $2}' | average -M</span></div> <div style="margin: 0px;font-size: 11px;line-height: normal;font-family: Menlo;background-color: rgb(255, 255, 255)"><span style="font-variant-ligatures: no-common-ligatures">11852</span></div> <div style="margin: 0px;font-size: 11px;line-height: normal;font-family: Menlo;background-color: rgb(255, 255, 255)"><span style="font-variant-ligatures: no-common-ligatures">NewiMac:Records peter$ cat phpOutput.txt | grep php-fpm | awk '{print $11,$6}' | tail -15 | awk '{print $2}' | average -M</span></div> <div style="margin: 0px;font-size: 11px;line-height: normal;font-family: Menlo;background-color: rgb(255, 255, 255)"><span style="font-variant-ligatures: no-common-ligatures">11876</span></div> </div> <div style="margin: 0px;font-size: 11px;line-height: normal;font-family: Menlo;background-color: rgb(255, 255, 255)"></div> <div style="margin: 0px;font-size: 11px;line-height: normal;font-family: Menlo;background-color: rgb(255, 255, 255)"></div> <div style="margin: 0px;font-size: 11px;line-height: normal;font-family: Menlo;background-color: rgb(255, 255, 255)"></div> <div> <blockquote type="cite"> <div>On Oct 17, 2017, at 12:39 AM, agriz <<a rel="external nofollow noopener noreferrer" target="_blank" tabindex="-1" href="mailto:nginx-forum@forum.nginx.org">nginx-forum@forum.nginx.org</a>> wrote:</div> <div><div>Sir reading some info, i guess i cant tell any number blindly without test.<br><br>I think<br>I can first try to give these values<br><br>max_children = 100<br>start server = 34<br>spareserver min and max = 20 & 50<br><br>We have around 20GB free Ram all the time. Why can't we use it for php-fpm?<br>Are those values safe to check?<br><br>But max_requests, why should we limit the numbers to 500 or 2500? Why cant<br>we have unlimited? What is wrong in setting it to zero?<br><br>Posted at Nginx Forum: <a rel="external nofollow noopener noreferrer" target="_blank" tabindex="-1" href="https://forum.nginx.org/read.php?2,276892,276907#msg-276907">https://forum.nginx.org/read.php?2,276892,276907#msg-276907</a><br><br>_______________________________________________<br>nginx mailing list<br><a rel="external nofollow noopener noreferrer" target="_blank" tabindex="-1" href="mailto:nginx@nginx.org">nginx@nginx.org</a><br><a target="_blank" rel="noopener noreferrer" href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a> </div></div> </blockquote> </div> </div></div></blockquote> <signature></signature><br> </div></body></html>