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 use nginx to serve the static content for a decently busy website of mine. I have the logging disabled, and 4 worker processes enabled with 5,000 connections per worker (which should yield a max connection limit of 20,000.

The server is only operating at about 10% CPU usage and 50% ram, but it's very laggy, and sometimes nginx is so slow to respond to the requests, it times out. For a small number of connections, it's fine, but once any load starts occurring (~2,500 connections), it backs up and bogs down.

Is there any other bottlenecks or limits that I might be hitting? This is a FreeBSD server, and all the static files are located locally (not NFS). The NIC is an unmetered gigabit, and it's only using around 75 megabit.

Any insight would be appreciated. Thanks.

share|improve this question
    
Are you running on VPS or dedicated server? –  Milan Babuškov Jun 9 '10 at 8:41
    
It is a dedicated server. –  Harry Jun 9 '10 at 20:30
add comment

1 Answer

up vote 1 down vote accepted

Some hints where to look at:

  • You must have error logging enabled and look in there all the time. It gives a lot of information.
  • What is IO untilization?
  • Do you have Munin installed? Munin graphs give a lot of information as well.
  • Do you have nginx-status module enabled in Nginx? If yes, what numbers it shows?
  • What else applications are running on your server? May they affect performance
  • What type of static files you are serving? Specifically of what size
share|improve this answer
    
- I've re-enabled logging, and it doesn't show anything abnormal except for the occasional message: "2010/06/09 15:32:23 [error] 63813#0: accept() failed (53: Software caused connection abort)" - iostat is reporting between a 2-15MB/sec transfer, and I don't see any blocked reads or issues. Is there anything specific I should look for? - I do have the status module installed. Here's the output: Active connections: 3007 server accepts handled requests 40440 40440 122974 Reading: 162 Writing: 412 Waiting: 2433 - Only nginx is running on this server - It's serving thousands of small jpgs –  Harry Jun 9 '10 at 21:06
    
"accept() failed (53: Software caused connection abort)" is not a critical error. It just means the client closed the connection just after Nginx has accepted the socket. I guess you have keepalive enabled? Regarding your content: do these files fit into Nginx buffers? (if not, it will store them into temporary file..) Are these small files live in directories? How deep directory hierarchy is / how many per directory? I'd also suggest to look at general FreeBSD tuning tips (I am not a FreeBSD expert). –  Alexander Azarov Jun 10 '10 at 9:59
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.