server performance issue

Xin Liu liuxin84 at gmail.com
Tue Oct 26 13:24:50 MSD 2010


It's getting worse and worse.
>From php-fpm.log, there is no error.
But from nginx error.log, there are lots of errors


[error] 21819#0: *16895 connect() to unix:/tmp/php-cgi.sock
failed (11: Resource temporarily unavailable) while connecting to upstream,
client: 119.145.137.49, server: localhost,......


On Tue, Oct 26, 2010 at 4:08 PM, SplitIce <mat999 at gmail.com> wrote:

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


More information about the nginx mailing list