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.

Running siege on a 12KB css file served by nginx it actually drops a few requests. It's running off a VPS Ubuntu 10.04 install. Is this caused by my nginx configuration or just something I have to accept, using a VPS?

# nginx siege -d1 -t1M -c300 css-file

Lifting the server siege...      done.
Transactions:               2307 hits
Availability:              99.87 %
Elapsed time:              59.12 secs
Data transferred:          27.40 MB
Response time:              6.43 secs
Transaction rate:          39.02 trans/sec
Throughput:             0.46 MB/sec
Concurrency:              250.95
Successful transactions:        2307
Failed transactions:               3
Longest transaction:           39.22
Shortest transaction:           0.49

nginx conf:

user www-data;
worker_processes  8;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  2048;
    # multi_accept on;
    accept_mutex on;
    use epoll;
}

http {
    include       /etc/nginx/mime.types;

    access_log  /var/log/nginx/access.log;

    default_type application/octet-stream;

    sendfile        on;
    tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        off;

    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    gzip_proxied any;
    gzip_min_length 500;

    upstream app_server {
        server unix:/tmp/.sock fail_timeout=0;
    }
}
server {
    listen  80  default;
    server_name www.example.com example.com;
    # added gunicorn
    client_max_body_size 4G;
    keepalive_timeout 5;

    root /srv/static/example;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        if (!-f $request_filename) {
            proxy_pass http://app_server;
            break;
        }
    }
}
share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

What you should be doing is collecting metrics on the other end with munin or collectd and trying to figure out where (if any) your bottleneck(s) are. With the information you've provided, it could be a variety of different things, including network problems beyond your control.

Another thing, you are using the if directive inside a location block. See here:

Directive if has problems when used in location context, in some cases it doesn't do what you expect but something completely different instead. In some cases it even segfaults. It's a good idea to avoid it.

That also might be a source of issues.

share|improve this answer
    
Oh, thanks, did not know that. Have been meaning to check out munin. –  Erik Kronberg Nov 12 '10 at 14:37
add comment

I would say its quite standard to see some dropped connections when you stress your server with too many queries..

Basically, the point where you can maximise connections without losing requests is your servers throughput.. ( this is one of the things you want to find through benchmarking)

Secondly.. i wouldnt trust a VPS for "hardcore computing" :P

Hope this helps..

share|improve this answer
    
Yeah absolutely, any input helps. Thanks! –  Erik Kronberg Nov 12 '10 at 14:38
add comment

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.