Welcome! Log In Create A New Profile

Advanced

Very high cpu consumption (Drupal7 + NginX + PHP FPM)

Posted by pankajshukla2282 
Very high cpu consumption (Drupal7 + NginX + PHP FPM)
December 22, 2015 10:58AM
We are working on an application which is using Drupal 7 on (NginX + PHP-FPM). But during performance testing we have observed that Applications Server consuming very high CPU. Average CPU consumption was in the range of 90% (Max processor is consumed by PHP-FPM). Memory consumption is on very lower side.

We have tried with various Concurrent Users load like 25-50-100. But even with this User load we observed CPU consumption was ~90% due to which response time is very high.

We are using 4 Core CPU with RHEL (AWS EC2) OS.
Application flow is Reverse Proxy (Nginx) -> Application Server (Drupal 7+NginX+PHP-FPM)


Below are the configuration changes I did-

nginx.conf:-

user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
worker_rlimit_nofile 20480;
events {
use epoll;
worker_connections 10240;
multi_accept on;
}
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;
tcp_nodelay on;
server_tokens off;
keepalive_timeout 65;
gzip on;
...
}


virtual.conf:-

location ~ '\.php$|^/update.php' {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;

fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;

include fastcgi_params;
}

php-fpm.conf:-

emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 15s
daemonize = no


php-fpm/www.conf:-

listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0664
user = nginx
group = nginx
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35


Can someone please guide us how to resolve this issue?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 154
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready