Nginx Static Content Server Maxing Out?

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.

Answer

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

Attribution
Source : Link , Question Author : Harry , Answer Author : Alexander Azarov

Leave a Comment