我在vmware-esxi虚拟化中使用debian 7 x64.
每个客户端的最大下载量为1mb / s,nginx一起使用不超过50mbps,我的问题是什么可能导致传输速度变慢?
服务器
**Settings for eth1:
Supported ports: [ TP ]
Supported link modes: 1000baseT/Full
10000baseT/Full**
root@www:~# iostat
Linux 3.2.0-4-amd64 (www) 09.02.2015 _x86_64_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
1,75 0,00 0,76 0,64 0,00 96,84
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 173,93 1736,11 219,06 354600 44744
root@www:~# free -m
total used free shared buffers cached
Mem: 12048 1047 11000 0 106 442
-/+ buffers/cache: 498 11549
Swap: 713 0 713
nginx.cof
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 3072;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 5;
types_hash_max_size 2048;
server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
## Start: Size Limits & Buffer Overflows ##
client_body_buffer_size 1k;
client_header_buffer_size 1k;
client_max_body_size 4M;
large_client_header_buffers 2 1k;
## END: Size Limits & Buffer Overflows ##
## Start: Timeouts ##
client_body_timeout 10;
client_header_timeout 10;
send_timeout 10;
## End: Timeouts ##
## END: Size Limits & Buffer Overflof
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
/etc/sysctl.conf中
# Increase system IP port limits to allow for more connections
net.ipv4.ip_local_port_range = 2000 65000
net.ipv4.tcp_window_scaling = 1
# number of packets to keep in backlog before the kernel starts dropping them
net.ipv4.tcp_max_syn_backlog = 3240000
# increase socket listen backlog
net.core.somaxconn = 3240000
net.ipv4.tcp_max_tw_buckets = 1440000
# Increase TCP buffer sizes
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
更新:
调试日志完全为空,只有当我手动取消下载时才会出现以下错误
2015/02/09 20:05:32 [info] 4452#0: *2786 client prematurely closed connection while sending response to client, client: 83.11.xxx.xxx, server: xxx.com, request: "GET filename HTTP/1.1", host: "xxx.com"
卷曲输出:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1309M 100 1309M 0 0 374M 0 0:00:03 0:00:03 --:--:-- 382M