0

I am using nginx as a reverse proxy server to serve primarily as a load balancer. I am using almost only dynamic files. The back end servers are apache.

Here are my httperf results:

single apache server (1024 mb): 300 requests per second 2x 512 mb apache server, 1 nginx server( 1024 mb) :300 requests per second 2x 1024 mb apache server, 1 nginx server( 1024 mb) :300 requests per second

It seems that my nginx server is the bottleneck but i cant figure out how i can optimize it.

the cpu usage and ram usage on the apache backend server and nginx server is minimal, less than 10%.

My goal is to find a great way to scale up and by using a load balancer, but it seems that if nginx is limited in requests per second as a single apache server, then there is no point....

1 Answers1

1

Firstly set this basic :

worker_processes        2; # put here the number of CPU you got.

Regarding the operating system you use, set the best event engine : use [ kqueue | rtsig | epoll | /dev/poll | select | poll | eventport ].

Then set the number of connection per worker. Be careful here, your system should be limited for the user nginx uses. See the /etc/security/limits.conf to set the best number of file descriptor nginx can open.

events {
        use                     kqueue;  
        worker_connections      4096;
}

Then it's all about your application works. You can enable caching and/or compression to get better results. See this post for caching solutions : How to set up Nginx as a caching reverse proxy?

DrGkill
  • 986