httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garrett Rooney" <roo...@electricjellyfish.net>
Subject Re: creating new lbmethod for mod_proxy_balancer
Date Mon, 25 Sep 2006 12:54:42 GMT
On 9/25/06, snacktime <snacktime@gmail.com> wrote:
> I have very little C programming experience, but I've decided to
> tackle adding another load balancing method to mod_proxy_balancer.
> The reason for a new lbmethod is to have something that works nicely
> with ruby on rails.  Both ruby and rails are not thread safe, which
> poses certain challenges.  Right now the most popular way of hosting
> rails apps is using Mongrel http://mongrel.rubyforge.org/.  Mongrel is
> a simple http server which loads and runs rails, but it can only
> process one request at a time due to rails not being thread safe.  So
> a fairly good way to serve up rails is to have a cluster of mongrels
> behind apache using balancer.  The problem is when you have a mix of
> short requests with longer requests.  Mongrel will queue up
> connections but can only service one at a time, so one mongrel might
> have several slow requests queued up, and another mongrel might only
> be serving one request.
>
> So, what I'm trying to do is implement a new lbmethod that will only
> proxy a request to a balance member that has no requests currently
> being processed.  If there are no more balance members available, I'm
> thinking the best thing is to implement a short wait cycle until a
> free mongrel is available, and possibly log a warning so you know that
> you need to add more mongrels to the cluster, and more balance members
> to apache.
>
> Any advice or hints are more then welcome, especially if for whatever
> reason this is going to get really complicated.

The major problem you're going to have is that you'll have to use some
sort of shared memory (or a similar technique) to coordinate
information between the various worker processes.  Since Apache can
run in multiprocess mode in addition to multithreaded modes you can't
easily tell other workers "hey guys, I've got this one don't use it
till I'm done".  It'd be a useful problem to solve in a generic manner
though, as the mod_proxy_fcgi module has a simlar problem.

-garrett

Mime
View raw message