маленькая скорость + linux

deniswork at uzvik.kiev.ua deniswork at uzvik.kiev.ua
Wed May 9 23:27:36 MSD 2007


Здравствуйте, заметил, что nginx при sendfile off выдает
большую скорость(150Mb) на гигабитном канале, чем с on(70-90Mb)..
C чем это может быть связано?

Но даже 150Мб, как-то маловато для гигабитного канала ...

Думал, уперся в винты(raid5 из 4-ех 500Gb), iostat показывает 15Mb на чтение, (при параллельном запуске нескольких io tests, iostat  показал 30-35Mb)...
Окончательно понял, что не упираюсь в винты, когда при Active connections: 500  из /nginx_status
и скорости скачивания в 0,1Mb, я параллельно копировал файлы по ftp с
нормальной скоростью.

Уже настраивал и TCP,
вот мой sysctl.conf

net.core.wmem_max = 8388608
net.core.rmem_max = 8388608
net.ipv4.tcp_wmem = 4096 16384 8388608
net.ipv4.tcp_rmem = 4096 8192  8388608
net.ipv4.tcp_default_win_scale = 7
net.ipv4.tcp_moderate_rcvbuf = 1
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 2500
net.core.somaxconn = 1024
net.ipv4.tcp_max_syn_backlog = 4192

Немому добиться лучшей производительности.

Подскажите, пожалуйста, в какую сторону копать.
Спасибо.

Система:
AMD Opteron Dual Core 1212(AM2) 4GB 4x500GB

Стоит Debian
root at fs:~# uname -a
Linux fs 2.6.18-4-amd64 #1 SMP Mon Mar 26 19:17:44 UTC 2007 x86_64 GNU/Linux

Вот конфин nginx'a:

user www-data www-data;
worker_processes 2;
pid /usr/local/nginx/logs/nginx.pid;

events {
  worker_connections 1024;
  use epoll;
}

http {
  include /usr/local/nginx/conf/mime.types;
  default_type application/octet-stream;
  access_log off;

  server_names_hash_max_size 64;
  server_names_hash_bucket_size 64;

  connection_pool_size        2048;
  request_pool_size           128k;
  ignore_invalid_headers  on;

  client_body_buffer_size 128k;
  client_body_temp_path /usr/local/nginx/client_body_temp;
  client_header_buffer_size 8k;

  client_header_timeout 3m;
  client_body_timeout   3m;
  send_timeout          3m;

  keepalive_timeout 5;
  large_client_header_buffers 2 4k;
  output_buffers        4 8192; #need if sendfile off
  sendfile off;# с on отдача в 90Мб, тогда  как с off - 150Мб
  tcp_nodelay on;
  tcp_nopush on;
  
  proxy_buffer_size 2k;
  proxy_buffering off;
  proxy_buffers 32 8k;
  proxy_intercept_errors on;
  proxy_redirect off;
  proxy_connect_timeout 2m;
  proxy_read_timeout 120;
  proxy_send_timeout 3m;
  proxy_temp_path /usr/local/nginx/proxy_temp;
  proxy_max_temp_file_size  0;

  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header Host $host;
  proxy_set_header Connection close;

  sendfile_max_chunk 256k; #пробовал 64... 128 ..

  limit_zone   one  $rem_file 5m ;

    server {
        listen       xxx.xxx.xxx.xx:80 default sndbuf=16k  rcvbuf=8k;
        
        error_log  /var/log/debugng215.error_log  debug;
        access_log /var/log/ddosmain215.access_log  ddosmain;

        set   $rem_file    $proxy_add_x_forwarded_for$binary_remote_addr;
        limit_conn   one  2;

        location / {
            root   html;
            index  index.html index.htm;
            

            proxy_pass         http://yy.yyy.yyy.yyy:80/;
            proxy_redirect     off;
        }

        location /download {
            root /home;
            internal;
        }

        location /nginx_status {
            stub_status on;
            access_log   off;
            allow all;
        }
    }
}







More information about the nginx-ru mailing list