Perlbal with Mongrels

Adam Jacob adam at hjksolutions.com
Tue Nov 6 02:25:52 UTC 2007


On 11/5/07, TJ Murphy <TJ at freewebs.com> wrote:
> Using your patch, I did a little more digging.  Here's what I found:
>
> Like you noted, Perlbal's verify_backend option defaults to doing an
> HTTP OPTIONS request on the backend server at the path *
>
> Mongrel doesn't like -any- request at the path *.  It throws an error
> and doesn't respond.

Yeah, that's what I have seen as well.  I can't get Webrick to answer
one either.

> Next, I set verify_backend_path to /.  Mongrel accepted this happily and
> spit back a response as if it were an HTTP GET.

You can set a Rails route to answer this on an Options request.

  map.connect '/check',
    :controller => 'options',
    :action => 'options',
    :conditions => { :method => :options }

Then, in app/controllers/options_controller.rb:

class OptionsController < ApplicationController
  def options
    render :text => "OK"
  end
end

That same method can be expanded to provide a canary-style check for
use with load balancers, etc.

In case you didn't want mongrel answering it.

> To get this script working with a mongrel setup, just put the path to
> the script in your mongrel_cluster.yml as config_script.   You can also
> pass the script in on the command line using -S.
>
> This setup has been running for over a week under really heavy load, and
> it's holding up well.

Yeah, it's probably the right way to go.  Since Rails locks the
mongrel, having it not even enter the Rails app should be no harm/no
foul.  But the above will do it in Rails for you, if you care. :)

Adam

-- 
HJK Solutions - We Launch Startups - http://www.hjksolutions.com
Adam Jacob, Senior Partner
T: (206) 508-4759 E: adam at hjksolutions.com


More information about the perlbal mailing list