I have jumped back into the exciting world of Ruby on Rails the last few days to make a few optimizations to my wife’s website, www.crittersdelight.com
The problem is that Rails runs so dog-ass slow compared to other interpreted languages like PHP. After a few heated debates on who is to blame with a few Rails fans at work, I concluded that Rails needs the native speed of an Apache module. I wondered how long the Rails community would take to just bite the bullet and develop the module. Its not their job (exactly), but Apache is also open-source.
Without the module, all of the solutions involve passing out the Ruby code requests to yet another server (in my case Mongrel) to process the requests.
That is, until I read about a Ruby gem named Passenger. This was the mod_rails solution I was looking for with Apache natively serving the requests!
Curiosity got to me after watching their screencast. I saw that Ubuntu was well supported (among many other OS choices) as an added bonus. The installation was absolutely painless. I performed a few steps to get the website up and running:
sudo gem1.8 install passenger sudo apt-get install ruby1.8-dev sudo apt-get install apache2-prefork-dev sudo apt-get install libapr1-dev sudo passenger-install-apache2-module
I then pointed to the compiled module from inside Apache’s configuration files (copy and paste from the setup), and deleted a lot of garbage from my old Mongrel cluster VirtualHost section. My new configuration now looks like this:
<VirtualHost 126.96.36.199:80> ServerName www.crittersdelight.com ServerAlias crittersdelight.com DocumentRoot /home/bsimpson/public_html/crittersdelight/public <Directory "/home/bsimpson/public_html/crittersdelight"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> RewriteEngine On </VirtualHost>
A quick Apache restart, and now I am natively serving this Rail’s application. Thanks to Phusion for taking the biggest Rails pain in the ass away!
*snicker* “Screw PHP! I use Rails!… god damn Rails doesn’t run as fast as PHP!”
I love it.
Yeah, thats one of the major issues that I am having with the platform. I was hoping that with the native Apache (a la PHP) it would experience an increase in speed. My Rails app is just as pokey though.
I haven’t written off PHP either – in fact I am working on a project with it right now…