Высокая нагрузка на серверах

Ares abaidulin at rambler.ru
Tue Dec 5 11:40:15 MSK 2006


Имеется 2 web-сервера на одном стоит nginx как frontend, он разруливает 
запросы на 2 Apache сервера и отдает картинки. 1-й Apache стоит на этой 
же машине, а второй - на 2-м web-сервере. PHP-скрипты лежат на 1-м 
сервере, 2-й через NFS их юзает.

Так вот, до недавнего времени все было гладко, но не понятно от куда 
появились тормоза. LA достигает 15-20. Подскажите, может у меня сама 
идея "кластера" не совсем корректна, может настройки не те...

top:
top - 11:38:30 up 75 days,  3:41,  3 users,  load average: 6.35, 6.45, 5.91
Tasks: 162 total,   6 running, 156 sleeping,   0 stopped,   0 zombie
Cpu(s): 35.0% us, 12.1% sy,  0.0% ni, 28.9% id, 24.0% wa,  0.0% hi,  0.0% si
Mem:   2074940k total,  1702872k used,   372068k free,   166328k buffers
Swap:  1052248k total,      316k used,  1051932k free,   924620k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
26781 nobody    16   0 18844 9188 2588 S   11  0.4   0:09.54 httpd -k start
26841 nobody    15   0 18948 9388 2684 S   10  0.5   0:04.48 httpd -k start
26905 nobody    15   0 18960 9280 2564 S    8  0.4   0:02.20 httpd -k start
26809 nobody    15   0 18596 8940 2588 R    7  0.4   0:07.52 httpd -k start
26861 nobody    16   0 18856 9184 2572 S    6  0.4   0:04.04 httpd -k start
26868 nobody    15   0 18636 8968 2576 S    6  0.4   0:03.74 httpd -k start
26768 nobody    16   0 18800 9144 2588 S    5  0.4   0:12.31 httpd -k start
26920 nobody    16   0 18564 8852 2508 S    5  0.4   0:01.43 httpd -k start
26930 nobody    16   0 18936 9248 2556 R    5  0.4   0:00.71 httpd -k start
26931 nobody    15   0 18736 9004 2544 R    4  0.4   0:00.12 httpd -k start
26840 nobody    16   0 18588 8924 2580 S    3  0.4   0:04.12 httpd -k start
26866 nobody    15   0 18572 8908 2580 S    3  0.4   0:03.15 httpd -k start
26922 nobody    15   0 18784 9108 2568 S    3  0.4   0:01.62 httpd -k start
26558 nobody    16   0 18636 9088 2696 S    3  0.4   0:14.25 httpd -k start
26807 nobody    16   0 18832 9176 2588 S    2  0.4   0:08.43 httpd -k start
26851 nobody    16   0 19200 9524 2568 S    2  0.5   0:04.35 httpd -k start
26871 nobody    15   0 18520 8840 2564 S    2  0.4   0:02.69 httpd -k start
26889 nobody    16   0 18712 9036 2568 R    2  0.4   0:03.35 httpd -k start
26857 nobody    16   0 18632 8964 2576 S    1  0.4   0:02.29 httpd -k start
 4067 nobody    15   0  6736 5164  668 S    1  0.2 228:56.73 nginx: worker 
process
 4068 nobody    15   0  6100 4528  668 S    1  0.2 225:22.02 nginx: worker 
process
 4069 nobody    15   0  6780 5208  668 S    1  0.3 226:35.84 nginx: worker 
process
26476 root      16   0  3792 1068  760 S    1  0.1   0:05.41 top
26853 nobody    16   0 18908 9352 2688 S    1  0.5   0:03.75 httpd -k start
26892 nobody    16   0 18564 8896 2576 S    1  0.4   0:02.86 httpd -k start
26902 nobody    16   0 18624 8952 2572 S    1  0.4   0:02.17 httpd -k start
26961 renat     16   0  3832 1008  760 R    1  0.0   0:00.04 top


nginx.conf:

user  nobody nobody;

worker_processes  3;

pid /usr/local/nginx/logs/nginx.pid;

#error_log  /usr/local/nginx/logs/error_log  error;

events {
    worker_connections   16384;
}

http {

    include       conf/mime.types;
    default_type  application/octet-stream;


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


  gzip on;
  gzip_min_length  1100;
  gzip_types       text/plain;

  output_buffers   1 32k;
  postpone_output  1460;

  keepalive_timeout  65;
  sendfile         on;
  tcp_nopush       on;
  tcp_nodelay      on;

  upstream  backend
  {
        server   127.0.0.1:80;
        server   10.14.126.8:80;
  }

  server {
          listen        212.176.118.149;

          location / {
                      proxy_pass         http://backend;
                      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_body_temp_path      /usr/local/nginx/
client_body_temp;
                      proxy_connect_timeout      90;
                      proxy_send_timeout         90;
                      proxy_read_timeout         90;
                      proxy_buffer_size          64k;
                      proxy_buffers              4 32k;
                      proxy_busy_buffers_size    64k;
                      proxy_temp_file_write_size 64k;
                      charset  UTF-8;
                      }


          location ~*
          ^.+\.(jpg|jpeg|gif|css|js|png|tiff|html|htm)$
           {
               root         /var/www;
               access_log   off;
               error_log    off;
               expires      30d;
           }


          location ^~ /wap/ {
                      proxy_pass         http://127.0.0.1:81/;
                      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_body_temp_path      /usr/local/nginx/
client_body_temp;
                      proxy_connect_timeout      90;
                      proxy_send_timeout         90;
                      proxy_read_timeout         90;
#                     proxy_send_lowat           12000;
                      proxy_buffer_size          64k;
                      proxy_buffers              4 32k;
                      proxy_busy_buffers_size    64k;
                      proxy_temp_file_write_size 64k;
#                     proxy_temp_path            /usr/local/nginx/proxy_temp;
                      charset  UTF-8;
                      }


      }
  }







More information about the nginx-ru mailing list