Wednesday, February 14, 2007

Taking RoR/Astrospace further

I've spent some time investigating the various possibilities and options available to us for scaling Ruby on Rails, to handle the expected work-load for the new Astrospace application.

As a test bed, I have several VM's setup. One of these is acting as a master, running the MySQL database, and the load balancer.

First stop was setting up 3 additional virtual machines (these are all running Ubuntu - just to make setting up easier.) Each of these three VMs is running RoR, with a copy of the prototype Astrospace application checked out of CVS.

We have successfully got pound up and running on the master (astrospace), serving requests to astro1, astro2 and astro3 in turn. All these 'slave' or application VMs are connecting to the same database. As an aside - all the session storage is also being done via the MySQL database to avoid any problems when two bits of a request are served by different application servers.

These application servers are using WEBRick to serve up the pages.

The next step is get Apache2 up and running on at least the master/front server. This will use mod_proxy to balance delivering requests to the application servers. Once that is up and running correctly, I will replace the WEBRick servers with localised mongrel clusters, which will mean that we can run multiple application servers on each application VM - if we so desire.

An intermediate step will be to create a capistrano recipe for deploying the application to the remote servers. At first glance, capistrano seems a little limited in having to have the application source code managed by something that doesn't require a password/passphrase - but more investigation is required.

As a last step in this research, we'll need to be able to simulate different loads on the application framework as a whole.

A series of scripts which register new astrospace users, then login and load the server as those users will be required, but can probably be knocked up in ruby or cold-fusion.