Mongrel and backgroundrb

Hi All

I am wondering how can I start the backgroundrb server when I start a
mongrel server.

My setup (for a demo) is Lighttpd (load balancer) and 4 mongrels (2
mongrels on one machine). All of my machine are Windows.

On windows to start backgroundrb I do

C:\myspace\myapp>ruby script\backgroundrb\start -p 9999
start: invalid option: -p
DRb URI: druby://localhost:22222
Pid: 2336
Autostart…
done

As you can see backgroundrb start script ignores the port (i might have
to change the code)to use different ports for 2 mongrel instances.

So my question is how do I start backgroundrb when I start mongrel.

thanks
-daya

On Aug 23, 2006, at 7:13 AM, Daya S. wrote:

So my question is how do I start backgroundrb when I start mongrel.

thanks
-daya

Hey Daya-

If you get the latest version of the plugin you will find that there

is now win32 service support so you can run the drb server as a win32
service. Look in the script/backgroundrb folder for the windows
specific scripts. And about starting the drb server when you start
mongrel, here’s the thing, you have to start the drb server before
you can start mongrel or else it won’t work correctly. So the easiest
thing to do is write yourself a wrapper script that first starts the
drb server and then fires up your mongrels.

Cheers-
-Ezra

On 8/23/06, Ezra Z. [email protected] wrote:

done
Hey Daya-

Cheers-
-Ezra

Ezra

Thanks for the reply.

I can write a wrapper script to start DRb before mongrel but the DRb
start
script in script\backgroundrb\start doesn’t accept -p (port) argument.

I can’t use service for the same reason and also because I am running
multiple mongrels (from same app folder) on the same machine and for
each I
want to start the DRb at different port.

Any idea on how I can do this…

thanks
-daya

running multiple mongrels (from same app folder) on the same
machine and for each I want to start the DRb at different port.

Any idea on how I can do this…

thanks
-daya

Daya-

Are you running multiple mongrels for just one app? Or are you

running multiple sites of the same codebase? If you are running the
same app on multiple mongrels then you do not want to run each drb
server on its own port as this will cause all kinds of errors.
Because each request that comes into your app will go to a different
mongrel backend so you are not gauranteed to get the same MiddleMan
that is holding your jobs.

On the other hand if each drb server you want to run is running for

a whole app then you can use the -c option to tell the drb server
where to look for a config file. So you would create a separate
backgroundrb.yml file for each drb server you want to run, ie:
backgroundrb1.yml, backgroundrb2.yml, etc… Then when you start the
drb server for each app you use the -c option to tell it where to
read its config from:

script/backgroundrb/start -c /path/to/configfile.yml

-Ezra

Ezra Z. wrote:

running multiple mongrels (from same app folder) on the same
machine and for each I want to start the DRb at different port.

Any idea on how I can do this…

thanks
-daya

Daya-

Are you running multiple mongrels for just one app? Or are you
running multiple sites of the same codebase? If you are running the
same app on multiple mongrels then you do not want to run each drb
server on its own port as this will cause all kinds of errors.
Because each request that comes into your app will go to a different
mongrel backend so you are not gauranteed to get the same MiddleMan
that is holding your jobs.

On the other hand if each drb server you want to run is running for
a whole app then you can use the -c option to tell the drb server
where to look for a config file. So you would create a separate
backgroundrb.yml file for each drb server you want to run, ie:
backgroundrb1.yml, backgroundrb2.yml, etc… Then when you start the
drb server for each app you use the -c option to tell it where to
read its config from:

script/backgroundrb/start -c /path/to/configfile.yml

-Ezra

Ezra-

Thanks a ton for these wonderful tips and saving me many many hours of
headache. You were right in pointing out and yes I was going to run a
single app with multiple mongrels and each having DRb on different port.

This has helped me a lot and if you don’t mind helping me understand one
more problem posted in this mailing list with subject “Load testing
Rails on Mongrel-Lighttpd - configuration q’s”. If you find some
questions stupid please let me know that too, I am learning and I don’t
mind people proving me wrong.

thanks once again
-daya