well 128 children is too much, work out the average response time of your script then use this formulae.<br><br>requests per second * average response time = number of workers or max children<br><br>Generally a figure no higher than 30 is needed unless your script needs improvement.<br>
<br><div class="gmail_quote">On Tue, Oct 26, 2010 at 6:59 PM, Xin Liu <span dir="ltr"><<a href="mailto:liuxin84@gmail.com">liuxin84@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>I tried to use static mode, and set pm.max_children = 128.<br></div><div>Then php-fpm will take up 100% cpu.</div><div>My question is that, for a server with I3 and 4G memory, what's the right parameter for nginx.conf and php-fpm.conf.</div>
<div><div></div><div class="h5">
<div><br></div><div><br></div><br><div class="gmail_quote">On Tue, Oct 26, 2010 at 2:45 PM, SplitIce <span dir="ltr"><<a href="mailto:mat999@gmail.com" target="_blank">mat999@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Im persuming you have an opcode cache?<br><br>Also try using php-fpm in static mode, dynamic mode resulted in 502/504's and high CPU usage for me.<br><br><div class="gmail_quote"><div><div>On Tue, Oct 26, 2010 at 5:42 PM, Xin Liu <span dir="ltr"><<a href="mailto:liuxin84@gmail.com" target="_blank">liuxin84@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div>Hi all,<br></div><div><br></div><div>For yesterday, my server is getting slower and slower...</div>
<div>Sometime php-fpm is taking up 100% cpu, and there are about 1G free memory.</div>
<div>Everytime I restart nginx and php-fpm, webserver will be OK. But after about 15minutes, it'll be very slow.....</div>
<div><br></div><div><br></div><div>My server is running debian, and web server is Nginx+php-fpm+memcached+mysql.</div><div>Hardware environment is I3 and 4G memory. It's that it's not hardware problem.</div><div>
<br>
</div><div>And below is my configurations, anyone can give me a suggestion about this issue? How can I optimize server performance?</div><div><br></div><div><b><font color="#ff0000">Nginx.conf</font></b></div><div>
<br></div><div>user www-data;<br>worker_processes 4;<br>worker_cpu_affinity 0001 0010 0100 1000;<br>error_log /var/log/nginx/error.log;<br>pid /var/run/nginx.pid;<br>events {<br> use epoll;<br> worker_connections 10240;<br>
multi_accept on;<br>}<br>http {<br> include /etc/nginx/mime.types;<br> default_type application/octet-stream;<br> access_log        /var/log/nginx/access.log;<br> sendfile on;<br> tcp_nopush on;<br>
tcp_nodelay on;<br> server_names_hash_bucket_size 128;<br> server_name_in_redirect off;<br> server_tokens off;<br> keepalive_timeout 60;<br> send_timeout 60;<br> client_header_buffer_size 4k;<br>
large_client_header_buffers 4 4k;<br> client_max_body_size 20m;<br> gzip on;<br> gzip_min_length 1k;<br> gzip_buffers 4 16k;<br> gzip_http_version 1.0;<br> gzip_comp_level 9;<br> gzip_types text/plain text/css image/x-icon image/bmp application/x-javascript application/xml;<br>
gzip_vary on;<br> fastcgi_connect_timeout 300;<br> fastcgi_send_timeout 300;<br> fastcgi_read_timeout 300;<br> fastcgi_buffer_size 64k;<br> fastcgi_buffers 4 64k;<br> fastcgi_busy_buffers_size 128k;<br>
fastcgi_temp_file_write_size 128k;<br> include /etc/nginx/conf.d/*.conf;<br> include /etc/nginx/sites-enabled/*;<br>}<br><br></div><div><br></div><div><b><font color="#ff6666">php5-fpm.conf</font></b></div>
<div><br></div><div>listen = <a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a><br>user = www-data<br>group = www-data<br>pm = dynamic<br>pm.max_children = 66<br>pm.start_servers = 8<br>pm.min_spare_servers = 5<br>
pm.max_spare_servers = 16<br>
pm.max_requests = 512<br></div><div><br></div><div><br></div>
<br></div></div>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br><a href="http://thewarezscene.org" target="_blank">Warez Scene</a> <a href="http://www.nexusddl.com" target="_blank">Free Rapidshare Downloads</a><br>
<br>
</font><br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><a href="http://thewarezscene.org" target="_blank">Warez Scene</a> <a href="http://www.nexusddl.com" target="_blank">Free Rapidshare Downloads</a><br><br>