Nginx file upload: server slows down terribly during upload

I am using 2 Nginx worker processes (1024 connections). Nginx proxies
the requests to 4 mongrel instances. I have noticed that during file
uploads (files are approx. 10 MB each), the server(machine) slows down
quite a lot even though ‘top’ command does not show any spikes in memory
or CPU usage. Nginx is configured to send out static content. I suspect
this is a problem with my Nginx setup because during uploads, all static
content is served very slowly.

I wonder if anyone can give me any ideas why this might be happening?

Below are parts fron the nginx.conf I am using.

worker_processes 4;
events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

access_log    /var/log/nginx/access.log;
gzip on;
gzip_min_length  1100;
gzip_buffers     4 8k;
gzip_types       text/plain text/html text/css

application/x-javascript text/xml app
lication/xml application/xml+rss text/javascript;

sendfile       on;
tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
tcp_nodelay        off;

Thanks!

Correction: I am using 2 worker processes and not 4, as the nginx.conf
shows in my previous post.

My suspicion would be IO load.

Nginx buffers the upload to a file on disk before then transfering the
upload in full to mongrel (so there is a big read load at that point).
Mongrel then writes the file to disk (writes conflicting with reads),
then rails unpacks the file into its mime components (look in your
temp directory), so more read and write load.

What does iostat or vmstat say? What is your IO subsystem like ? what
does hdparm say, etc, etc.

Cheers

Dave

It seems stupid but if you max out your upload speed, your download
speed
will be down to a minimum. If you start uploading a file and then open
another website which you know is usually fast, is it slow again? Check
to
see if it is not your internet connection that is the problem rather
than
nginx+server.
Kiril

Thanks Dave, Kiril. I’m going to give your suggestions a try.