Load Balancing Mongrel with Pen on Windows 2003 server x64 64bit 64 bit

Rails, Windows

Alright – so there was a stupid software company. And they write in ASP.net and c# for web based apps. Ew.

So they said – we need a windows server that has 64 bits.

This server is also the server my company wants me to deploy my Ruby on Rails app onto, which is not fun.

First off its windows…and windows doesn’t always place nice unlike its friendly penguin counterpart…oh and this other company wanted everything running out of Microsoft SQL instead of MySQL…ew again.

So I complied and got my app switched to MsSQL (that’s a whole other post). And its nearly impossible to run a rails app behind another app that’s using IIS on a 64 bit machine (it requires $100 software and that’s another post too.)

Hokay so, turns out the other company’s program didn’t work and I got to remove it. Yay! Now I can use Mongrel instead of IIS…Yay! Well here’s the rub – turns out Mongrel wasn’t able to run as a service on 64 bit machine until one of the Mongrel guys figured it out about 6 weeks ago.

To get mongrel running you need to install the service with mongrel:service and but you have to include the FULL PATH to ruby.exe – then it works!

Ok great now I have some mongrels that run as service and startup when the server restarts. I decide to go with Pen for load balancing: easy and lightweight sounds great. So I try to install Pen as a service so I don’t have to login and run it everytime the windows server crashes and restarts (hopefully not ever but the gods are against me and I probably won’t be at this company to start the webservers up for them in the future).

No go with installing Pen as a service with the usual SrVany.exe route – maybe I just don’t know how to edit the registry correctly or setup SrVany on a 64 bit machine – but the usual route was giving me “service would not start promptly” error immediately when I press “start” under the services control panel.

Today I figured out a workaround – I used Scheduled Tasks to add a command prompt task every time the server starts. Then I changed the program from c:\system\someDir\cmd.exe under advanced options to a .bat file that contained my startup script: d:\pen\pen.bat

echo Start Pen for Mongrel Balancing
"d:\path\to\pen\pen.exe" -H 80 localhost:3000 localhost:3001 localhost:3002 localhost:3003
echo end of Batch file

I tested it and it works!


4 thoughts on “Load Balancing Mongrel with Pen on Windows 2003 server x64 64bit 64 bit

  1. Very interesting! We signed up with Server Intellect because they have their own independently licensed copy of Windows Server 2003, and it can be rebooted independently. It’s managed with the Terminal Services/Remote Desktop, has its own System Registry, Applications and System Files. It’s a great value.

  2. @Danny
    Danny, the “other software company” I mention at the beginning of the post sort of forced the company I contract for to purchase a x64 Windows 2003 server. So its here in the office and it’d be a waste (maybe not) to not use a Xeon chip with 8gb of RAM for my own disposal – the thing is lightning fast but getting a Rails config working on it was a nightmare until mongrel got updated and I got apache setup (see my post about apache on windows 2003)

  3. What are your reasons for choosing apache instead of a “hardware” load balancers even when the HLBs have come down to prices around 2500 with full functionality and support?

  4. @kevin
    The company I was working for was extremely stodgy when it came to buying anything hardware or software related. It was like pulling teeth to get them to buy $300 computers for the business people to use (even though the owner drives a $350,000 Ferrari when the weather’s nice oh and his daily driver is a $100,000 Benz). Terrible company.

    Anyway, I’m now using haproxy to load balance between clusters of mongrels and stunnel in front for ssl and nginx for redirecting port 80 to 443 and to serve images. But now i have the pleasure of not dealing with Windows boxes (CentOS now).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s