Amazon

Monday, December 15, 2008

Faster New Terminal Tab/Window Scripts

Reader Eric Allen commented on a shell script he's written to create new terminal tabs in Leopard faster. Very cool.

Thanks, Eric!

Friday, December 5, 2008

Passenger Rocks!

I am referring to, of course, to Phusion Passenger, a.k.a. mod_rails.

Prior to using Passenger, I had been serving up a Rails web application I've been working on using mongrel. However, I am anticipating more people hitting it (compared to just me and one other person), so I thought it's time to move up to something more robust.

The server platform I am using is the latest version of Tiger (client edition). I already have MacPorts installed in order to get Ruby and Rails. So, after installing Apache 2 using the port command, I simply followed the instructions on Passenger's web site and installed the passenger gem and the Apache module, and was serving up my application via a sub-URI in very little time. This is significant because I am not very versed in Apache configuration!

One suggestion. If you are using Tiger, don't bother following the link from the Passenger documentation to some guy's blog about setting up Passenger for Leopard. Just stick to the official docs.

As for performance relative to mongrel, it remains to be seen when the app is under some load. But when I first practiced this on an ancient 400MHz G4 running Tiger, I noticed a 2x jump in performance. That is, Apache2+Passenger with one user hitting the server is able to serve up pages twice as fast as a single instance of mongrel (using the -d -e production flags) with only one user. The same can't be said of the actual deployment machine, both serving methods yielded similar times for the one-user test.

Furthermore, after I figured out the deployment steps, I wrote a simple Python script to automate it. Yes, I know I can use capistrano. But my deployment scenario is to simple right now that I simply don't need it.

One note on deployment. After you execute sudo apachectl start (or restart), it takes a long time to load the first page. That's probably when Apache is loading stuff into memory. After, it's all good. So I added a curl command as the last step to my deployment script to kick-start things.