Bilal Gümüş
New Pleskian
Hi, sorry for the title i can't find a correct title to ask about the problem.
I have a droplet(4GB ram) with CentOS 6.7 and Plesk 12.5.30 #18 installed from digitalocean. A week ago my server shut down temporarily because of a security breach on one of the sites. After i clean it and the server back online again, i updated the latest update package from plesk panel. And i update everything from yum-update. Then the high cpu usage started. I tried few adjustment but now im lost and its still %99 most of the time. So i want to ask if where did i go wrong.
I have 125 domains on my panel, about 90 of them active wordpress sites with not much high traffic. Like i said a week ago cpu and ram usage is not alert levels at all.
PHP-FPM 5.4.45 by OS vendor
PHP-FPM 5.4.45
PHP-FPM 5.6.16
PHP-FPM 5.5.30
I guess the confusion starts after i upgraded to 12.5 version. The PHP_FPM 5.4.4.5 by OS vendor is shown selected and i got lots of nginx errors. Then i switched a subscription with few websites to PHP-FPM 5.4.45 and nginx errors stopped. PHP-FPM 5.6.16 and PHP-FPM 5.5.30 is two sites of two clients which complaint a lot about the errors. So my first question is which php version should i pick and use for all the packages/subscriptions ?
For nginx i added these in additional nginx directives section:
gzip_proxied any;
# wordpress nginx directive for wordpress
# Wordpress permalinks
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
location ~ .php$ {
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
}
And the nginx.conf is like that right now:
#user nginx;
worker_processes 1;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
#pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 0;
keepalive_timeout 65;
#tcp_nodelay on;
#gzip on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";
server_tokens off;
include /etc/nginx/conf.d/*.conf;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
gzip on;
gzip_comp_level 9;
gzip_http_version 1.1;
gzip_proxied any;
gzip_min_length 10;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/xhtml+xml;
# Disable for IE < 6 because there are some known problems
gzip_disable “MSIE [1-6].(?!.*SV1)”;
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;
}
# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
Is there anything to change here ?
Another thing i probably messed up is the /var/lib/php/session permissions. It's now owner/root user/root. I tried nginx/nginx and changed accordingly in etc/php.fpmd/www.conf but nothing changed. What is the correct permissions for this?
Another one is httpd.conf What about this settings?
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 60
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15
##
## Server-Pool Size Regulation (MPM specific)
##
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 4
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
And finally i check newrelic just right now and this is how cpu usage look liked. About %50 stolen. The firs image is 7 days view, second is last 30 mins.
So where should i begin, what should i change to resolve this full cpu usage issue? I'll be glad if someone assist me about that. Sorry for the long post and my English. Thanks
I have a droplet(4GB ram) with CentOS 6.7 and Plesk 12.5.30 #18 installed from digitalocean. A week ago my server shut down temporarily because of a security breach on one of the sites. After i clean it and the server back online again, i updated the latest update package from plesk panel. And i update everything from yum-update. Then the high cpu usage started. I tried few adjustment but now im lost and its still %99 most of the time. So i want to ask if where did i go wrong.
I have 125 domains on my panel, about 90 of them active wordpress sites with not much high traffic. Like i said a week ago cpu and ram usage is not alert levels at all.
PHP-FPM 5.4.45 by OS vendor
PHP-FPM 5.4.45
PHP-FPM 5.6.16
PHP-FPM 5.5.30
I guess the confusion starts after i upgraded to 12.5 version. The PHP_FPM 5.4.4.5 by OS vendor is shown selected and i got lots of nginx errors. Then i switched a subscription with few websites to PHP-FPM 5.4.45 and nginx errors stopped. PHP-FPM 5.6.16 and PHP-FPM 5.5.30 is two sites of two clients which complaint a lot about the errors. So my first question is which php version should i pick and use for all the packages/subscriptions ?
For nginx i added these in additional nginx directives section:
gzip_proxied any;
# wordpress nginx directive for wordpress
# Wordpress permalinks
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
location ~ .php$ {
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
}
And the nginx.conf is like that right now:
#user nginx;
worker_processes 1;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
#pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 0;
keepalive_timeout 65;
#tcp_nodelay on;
#gzip on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";
server_tokens off;
include /etc/nginx/conf.d/*.conf;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
gzip on;
gzip_comp_level 9;
gzip_http_version 1.1;
gzip_proxied any;
gzip_min_length 10;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/xhtml+xml;
# Disable for IE < 6 because there are some known problems
gzip_disable “MSIE [1-6].(?!.*SV1)”;
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;
}
# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
Is there anything to change here ?
Another thing i probably messed up is the /var/lib/php/session permissions. It's now owner/root user/root. I tried nginx/nginx and changed accordingly in etc/php.fpmd/www.conf but nothing changed. What is the correct permissions for this?
Another one is httpd.conf What about this settings?
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 60
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15
##
## Server-Pool Size Regulation (MPM specific)
##
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 4
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
And finally i check newrelic just right now and this is how cpu usage look liked. About %50 stolen. The firs image is 7 days view, second is last 30 mins.
So where should i begin, what should i change to resolve this full cpu usage issue? I'll be glad if someone assist me about that. Sorry for the long post and my English. Thanks