Nginx + PHP-FPM Too Many Resources

Posted by user3393046 on Server Fault See other posts from Server Fault or by user3393046
Published on 2014-06-08T11:54:10Z Indexed on 2014/06/08 15:30 UTC
Read the original article Hit count: 273

Filed under:
|
|

My Server has the following Specs

CPU: 6 Cores Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
RAM: 32 GB

I have a problem with nginx+php-fpm. They are taking too many resources for an unknown reason. Even if i restart the nginx + php-fpm the start up processes will use many resources.

My nginx Config is the following:

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

worker_rlimit_nofile 300000;
events {
    worker_connections  6000;
    use epoll;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;


#tcp_nopush     on;

keepalive_timeout  65;

#gzip  on;

include /etc/nginx/conf.d/*.conf;

}

My php-fpm pool config is the following

[www]
user = nginx
group = nginx
listen = /var/run/php5-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.allowed_clients = 127.0.0.1
pm = ondemand
pm.max_children = 1500;
pm.process_idle_timeout = 5;
chdir = /
security.limit_extensions = .php

I'm using on pm.ondemand since my website has to support many concurrent connections at the same time and i was unable to to it with dynamic/static.

I guess this isnt the problem because as i said earlier when i restart nginx+php-fpm at the same time, they are taking too much resources without any request.

Here is the screenshot with the CPU Usage

http://s28.postimg.org/v54q25zod/Untitled.png

© Server Fault or respective owner

Related posts about nginx

Related posts about php-fpm