NGINX 工作进程,突发读取速度仅为 1918kb/s

NGINX 工作进程,突发读取速度仅为 1918kb/s

我在 Centos6.6 上运行着一个有多个 worker_processes 的 NGINX/1.8 服务器,然而在观察 iotop 时我注意到它们的读取速度突然达到 1918kb/s 而且很少超过这个限制。

我希望能够读取我的文件并以更快的速度提供它们(我正在提供大文件),这是我对进程的 Linux 限制还是我的 nginx 服务器配置错误。

Total DISK READ: 7.49 M/s | Total DISK WRITE: 0.00 B/s
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND                                          
 8840 be/4 nginx    1917.09 K/s    0.00 B/s  0.00 %  0.00 % nginx: worker process
 9035 be/4 nginx    1917.09 K/s    0.00 B/s  0.00 %  0.00 % nginx: worker process
 9051 be/4 nginx    1917.09 K/s    0.00 B/s  0.00 %  0.00 % nginx: worker process
 9058 be/4 nginx    1917.09 K/s    0.00 B/s  0.00 %  0.00 % nginx: worker process

/etc/nginx/nginx.conf

    # For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user              nginx;
worker_processes  auto;

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 4000;
    accept_mutex off;
    use epoll;
}

worker_rlimit_nofile 100000;

http {
    include       /etc/nginx/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;
    access_log off;



    access_log off;
    sendfile on;
    sendfile_max_chunk 1m;

    tcp_nodelay on; 
    output_buffers 1 8m;

client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    keepalive_requests 100000;

    #gzip  on;

    # Load config files from the /etc/nginx/conf.d directory
    # The default server is in conf.d/default.conf
    include /etc/nginx/conf.d/*.conf;

    open_file_cache          max=20000 inactive=1m;
    open_file_cache_valid    1m;
    open_file_cache_min_uses 1;
    open_file_cache_errors   on;

}

答案1

我认为静态文件在第一次读取时会被操作系统缓存。它们永远不会再次被读取,也不会为 iotop 生成任何 IO。

1918 kb/s 肯定是按照请求写入磁盘的日志。

下载这些文件的客户端的实际下载速度是多少?建议使用httperf命令进行快速性能测试并模拟多个客户端。

相关内容