I have Linode 768mb RAM server on Linode. And i have Wordpress blog. On my server installed ubuntu, nginx as frontend and apache2 as backend. And i have APC and memcache modules. Sometimes site is crashing. But CPU usage of server is less than the critical levels (only max 60-70). However, during site crashing i can see the critical levels of hard disk I/O usage. I have read that this may be related to incorrect settings of mysql.
My nginx.conf:
worker_processes 2;
events {
worker_connections 1024;
# multi_accept on;
}
http {
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 12;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
My nginx proxy.conf:
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
#client_header_buffer_size 64k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 32 16k;
proxy_busy_buffers_size 64k;
My nginx site conf:
server {
listen 80;
server_name mysite.org;
location / {
proxy_pass http://127.0.0.1:8080;
include /etc/nginx/conf.d/proxy.conf;
root /home/mysite/www/;
index index.html index.htm index.php;
}
location ~* ^.+\.(jpg|jpeg|cur|flv|avi|gif|png|ico|zip|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf)$ {
root /home/mysite/www/;
}
location ~* ^.+\.(htm|html|js|htc|css|tgz|gz|rar|bz2)$ {
root /home/mysite/www/;
gzip_static on;
}
My.cnf
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
Hardware:
cpu (4x): Intel(R) Xeon(R) CPU L5520 @ 2.27GHz, 2260 MHz
storage: Xen Virtual Storage 0, Xen Virtual Storage 1
memory: 768mb
Apache conf:
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_event_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
Linode statistics links: http://ridna.ua/temp/mysite_io_rate.png and http://ridna.ua/temp/mysite_cpu_rate.png
How i can optimize my nginx+apache2+mysql settings to avoid site downs? Thanks..
*3301 upstream timed out (110: Connection timed out) while reading response header from upstream