Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am pretty much a noobie at nginx and i really need some help.

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....

May i get some help from anyone please?

share|improve this question
    
This belongs to serverfault.com –  Lekensteyn Feb 22 '12 at 16:03
    
Did you have a look at varnish? it's normally used as a (very high performance) caching proxy but it can also load-balance. varnish-cache.org. Apologies in advance for not actually answering your question :) –  roadmr Feb 22 '12 at 16:15
    
This question appears to be abandoned, if you are experiencing a similar issue please ask a new question with details pertaining to your problem. If you feel this question is not abandoned, please flag the question explaining that. :) –  jrg Feb 23 '12 at 21:03
add comment

closed as too localized by Lekensteyn, jrg Feb 23 '12 at 21:03

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers

Maybe it is not nginx but your kernel configuration limits, did you tried fine tuning the kernel parameters as well?

I've searched for some kind of documentation for this, as far I've found these advices: http://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html

share|improve this answer
    
i cant figure out why i am experiencing this issue: IE, 1gb nginx server handles 300 requests per second but a 2gb nginx server handles 700 requests per second. Everything else is identical in the. The weird is that the ram usage on these tests is very low. Also, no matter how much ram i give my backend servers, the requests per second stays the same. So my question is, why would increasing the total system ram affect the server performance if total ram usage is very low in the first place??? –  jay Aug 31 '11 at 4:35
add comment

It looks like you need to tune your kernel parameters. I think more memory available system-wide can make several decision making algorithms work different...

share|improve this answer
    
Please don't add "comments" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, or to add actual comments when seeking clarification of any issues. –  nitstorm Nov 6 '12 at 23:27
add comment

What is your worker_processes nginx configuration value set to? It defaults to 1 which would explain this behaviour (you're single threaded so no number of backends will change anything).

Try setting it to 4, or even 8, in the nginx config file. This will allow nginx to call more than one backend at once and should increase throughput proportionately to backends.

http://wiki.nginx.org/CoreModule#worker_processes

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.