| From | Sent On | Attachments |
|---|---|---|
| Florian Munz | Jan 22, 2007 11:41 am | |
| Igor Sysoev | Jan 22, 2007 12:28 pm | |
| Jonathan Vanasco | Jan 22, 2007 12:43 pm | |
| Ezra Zygmuntowicz | Jan 22, 2007 1:01 pm | |
| Florian Munz | Jan 22, 2007 1:10 pm | |
| Igor Sysoev | Jan 22, 2007 1:11 pm | |
| Igor Sysoev | Jan 22, 2007 1:15 pm | |
| Ezra Zygmuntowicz | Jan 22, 2007 1:19 pm | |
| Bob Ippolito | Jan 22, 2007 1:21 pm | |
| Aleksandar Lazic | Jan 22, 2007 11:22 pm | |
| Jure Pečar | Jan 23, 2007 12:27 am |
| Subject: | Re: HTTP load balancing algorithm | |
|---|---|---|
| From: | Ezra Zygmuntowicz (ezmo...@public.gmane.org) | |
| Date: | Jan 22, 2007 1:19:53 pm | |
| List: | ru.sysoev.nginx | |
On Jan 22, 2007, at 1:12 PM, Igor Sysoev wrote:
On Mon, 22 Jan 2007, Ezra Zygmuntowicz wrote:
On Jan 22, 2007, at 12:43 PM, Jonathan Vanasco wrote:
On Jan 22, 2007, at 3:28 PM, Igor Sysoev wrote:
I do not know ROR and Mongrel, but as I understand you may try to route slow requests to the dedicated backends:
that's what I thought of too, and you can do that with any proxy ( though i prefer nginx ) i'd be deathly scared of running a loadbalancer that automagically handled slow/fast requests the way you expect. the configuration would be a nightmare, and it would be doing so much logging and profiling of request timings, it might negate the purpose of a load balancer to begin with.
The ideal way that nginx's proxy could work best for rails/ mongrel backends would be an optional proxy setting for not sending a request to a backend until said backend returns from a request.
Rails is not thread safe and so there is a mutex lock around each rails request. It would be better for nginx to queue these up instead of mongrel's queuing these up. Each mongrel can only serve *one* rails request at a time. So if a slow action happens then nginx will continue to send requests to that mongrel where they will stack up and each have to wait for the one before it to finish.
If nginx was able to send a request to a backend, and then not send another request to that same backend until it returns the request it's working on. This would make the requests queue in nginx and be sent to the first backend that returns from a request.
If support was added to the proxy module to only send one request to each backend at a time then it would significantly increase the performance of rails applications running on mongrels behind nginx. I know that Haproxy has this feature but I don't know of any of the webserver/proxy balancers currently used with rails that has this. This feature would give a substantial edge to nginx in the rails application world.
I plan to add someting like this:
upstream name { server host:9000 max_conn=5 max_wait=100 wait_time=60s; }
This would be perfect.
Also Igor, what is the algorithm that nginx uses for proxy module? Is it a round robin or something else?
Yes, currently it's round-robin only.
Ok thanks Igor.
-- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez-NLltGlunAUd/unjJ...@public.gmane.org -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)





