Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I run test for this nginx conf:

server {

    listen 80;

    #error_log  /var/log/debug.log  debug;

    server_name test1.ostrovok.ru;

    location / {
        fastcgi_pass 127.0.0.1:12345;
        client_max_body_size 20000k;
        charset  utf8;
    }

    location /photos {
        proxy_pass http://imageserver;
        proxy_store /srv/trololo/$request_uri;
        proxy_store_access   user:rw  group:rw  all:r;
        proxy_temp_path /srv/trololo/temp;
        access_log off;
    }
}

# Backend image server
server {

    listen       12346;
    server_name  localhost;

    location / {
        root /srv/trololo;
        sendfile off;
        aio on;
        output_buffers 200 10000k;
        gzip  off;
        directio 512;
        access_log off;
        expires max;
    }
}

# Upstream
upstream imageserver {
    server localhost:12346;
}

Test:

siege -c 100 -r 5 -f urls.txt -t 120s --internet

Result

Transactions:              12352 hits
Availability:             100.00 %
Elapsed time:             120.00 secs
Data transferred:        1591.91 MB
Response time:              0.46 secs
Transaction rate:         102.93 trans/sec
Throughput:            13.27 MB/sec
Concurrency:               47.13
Successful transactions:       12352
Failed transactions:               0
Longest transaction:           15.08
Shortest transaction:           0.05

Why such the difference between Longest transaction and Shortest transaction ?

The first 7 seconds of the test - good:

HTTP/1.1 200   0.05 secs:  113575 bytes ==> /photos/resize/600/900/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:   16135 bytes ==> /photos/resize/900/100/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  132249 bytes ==> /photos/resize/500/700/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:    8513 bytes ==> /photos/resize/100/300/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:    8513 bytes ==> /photos/resize/100/600/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  113575 bytes ==> /photos/resize/600/900/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   75669 bytes ==> /photos/resize/500/900/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:  113575 bytes ==> /photos/resize/600/1100/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   29708 bytes ==> /photos/resize/300/500/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:  161191 bytes ==> /photos/resize/700/300/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:  200775 bytes ==> /photos/resize/800/700/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   29708 bytes ==> /photos/resize/300/200/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   29708 bytes ==> /photos/resize/300/1000/20110901/0300/22.png

But after:

HTTP/1.1 200   5.06 secs:   52441 bytes ==> /photos/resize/400/1100/20110901/0300/22.png
HTTP/1.1 200   5.06 secs:  235335 bytes ==> /photos/resize/700/900/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   5.07 secs:  305657 bytes ==> /photos/resize/1000/500/20110901/0300/22.png
HTTP/1.1 200   5.07 secs:  252759 bytes ==> /photos/resize/900/1000/20110901/0300/22.png
HTTP/1.1 200   5.07 secs:  200775 bytes ==> /photos/resize/800/700/20110901/0300/22.png
HTTP/1.1 200   5.06 secs:   77258 bytes ==> /photos/resize/400/800/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  376880 bytes ==> /photos/resize/1100/700/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   16135 bytes ==> /photos/resize/900/100/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:  161191 bytes ==> /photos/resize/700/800/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   16135 bytes ==> /photos/resize/700/100/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   5.06 secs:   44446 bytes ==> /photos/resize/400/200/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  343273 bytes ==> /photos/resize/900/800/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:  518488 bytes ==> /photos/resize/1100/800/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  251162 bytes ==> /photos/resize/1100/300/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:  161191 bytes ==> /photos/resize/700/900/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:   16135 bytes ==> /photos/resize/300/100/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:    8513 bytes ==> /photos/resize/100/600/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:    3242 bytes ==> /photos/resize/100/300/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:   29708 bytes ==> /photos/resize/600/100/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:   24521 bytes ==> /photos/resize/200/1000/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:   29708 bytes ==> /photos/resize/300/900/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:  166648 bytes ==> /photos/resize/600/400/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:   52441 bytes ==> /photos/resize/400/500/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:  113652 bytes ==> /photos/resize/1000/400/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  233737 bytes ==> /photos/resize/800/600/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:  113575 bytes ==> /photos/resize/600/500/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   53067 bytes ==> /photos/resize/300/1100/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:   12417 bytes ==> /photos/resize/200/1100/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   99703 bytes ==> /photos/resize/800/300/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  252759 bytes ==> /photos/resize/900/700/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:    8513 bytes ==> /photos/resize/100/1000/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:    3242 bytes ==> /photos/resize/100/1000/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:   52441 bytes ==> /photos/resize/400/1100/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:   99703 bytes ==> /photos/resize/800/300/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  376880 bytes ==> /photos/resize/1100/500/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:  161191 bytes ==> /photos/resize/700/1100/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   24521 bytes ==> /photos/resize/200/1000/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  251162 bytes ==> /photos/resize/1100/300/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:  305657 bytes ==> /photos/resize/1000/500/20110901/0300/22.png
HTTP/1.1 200   0.06 secs:  518488 bytes ==> /photos/resize/1100/900/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.08 secs:  113575 bytes ==> /photos/resize/600/1000/20110901/0300/22.png
HTTP/1.1 200   5.06 secs:  166648 bytes ==> /photos/resize/600/700/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.06 secs:  235335 bytes ==> /photos/resize/700/800/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:  235335 bytes ==> /photos/resize/700/700/20110831/2048/Ekafisha-Firefox.png
HTTP/1.1 200   0.05 secs:   12417 bytes ==> /photos/resize/200/700/20110901/0300/22.png
HTTP/1.1 200   0.05 secs:   16135 bytes ==> /photos/resize/1100/100/20110831/2048/Ekafisha-Firefox.png

[Full Test Log file1

And so on

Why?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

What is a purpose of proxying static requests to /photos to the same nginx on the same localhost? If you absolutely need it it's a good idea not to store content to a disk while proxying, your proxy should be set to a fully transparent mode (you should set proxy_buffering to off). Otherwise there is a useless disk activity in your setup - nginx creates temporary files at a proxying end for your /photos location. This can be a root cause of performance degradation for certain requests.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.