Static files bad loading time

grigory nginx-forum at nginx.us
Sat Apr 25 18:01:33 UTC 2015


Hey guys,

I have a dedicated server at iWeb.com (i3-540 + 8GB RAM). It has free
bandwidth, average load is around 0.05-0.2 during the day and I/O wait ratio
is very low now.

However, sometimes my Nginx 1.4.2 loads in a browser 1MB image for like
10-30 seconds. Sometimes it takes 2 seconds like it should. My bandwidth is
also free, of course. I made some tests like MTR, ping, traceroute --
everything is OK.

Updated Nginx to 1.8.0 but nothing's changed.

Here is my Nginx config:
==============================================================
worker_processes  4;
worker_rlimit_nofile  12400;

events {
    worker_connections  32768;
}

http {
    include       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"';

    sendfile        on;
    tcp_nopush     on;
    tcp_nodelay    on;

    gzip  on;
    gzip_min_length    1400;
    gzip_proxied    any;
    gzip_types    text/plain text/xml application/xml
application/x-javascript text/javascript text/css text/json;
    gzip_comp_level    6;

    map $http_host $root_dir {
        hostnames;
    }
    root $root_dir;

    server {
        listen       188.88.88.88:80;
        server_name  domain.com www.domain.com;
        access_log  /nginx/logs/domain.com-access.log  main;

        location / {
            proxy_pass        http://domain.com:8080/;
            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       20m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;

            proxy_buffer_size          128k;
            proxy_buffers              4 256k;
            proxy_busy_buffers_size    256k;
            proxy_temp_file_write_size 256k;

            root /home/www/domain.com;
        }
    }
}
==============================================================

I use server for a couple of websites (PHP+MySQL). One of websites is an
image hosting. Usually it serves images less than 1Mb but I created a couple
of tools so user can upload a bigger image now. But still 3-5Mb max.

Does anybody know what causes this loading lag?

Thanks in advance!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,258372,258372#msg-258372



More information about the nginx mailing list