MagLev is a new(ish) Ruby implementation built by Gemstone Systems that focuses on providing an integrated object persistence layer and a distributed shared cache - a truly scalable Ruby implementation. Maglev has, however, had an air of vaporware about it, having been hyped up in early 2008 and only available to a small group of alpha testers till now. That changes today with the first public, alpha release!
Back in early 2008, MagLev program manager Bob Walker did an interview with InfoQ about the project where he said that 8 people were working on MagLev, so this is a pretty big deal for them. Developer Avi Bryant then did a short presentation at RailsConf 2008 where he gave a comprehensive overview of what MagLev is along with some live demonstrations.
Why Should You Care?In short, MagLev is cool for a few reasons. Two key ones being that 1) MagLev runs on the SmallTalk virtual machine which, it is claimed, should yield significant performance increases for a language like Ruby, and 2) a MagLev environment allows multiple Ruby processes over multiple machines (if you wish) to use the same objects simultaneously for easy scalability. Avi's video is great if you want to get a grasp on it:
MagLev presentation at RailsConf 2008 from Monty Williams on Vimeo.
Developer Monty Williams is keen to stress that this is an alpha, not a beta, so you can't expect it to run Rails or any gems that require C extensions. That said, it does run Sinatra, Rack, and RubyGems, plus a significant effort has been put into passing the RubySpec, so it's not as if it's a crippled implementation as such.
If you want to learn more, consider following the MagLev team on Twitter @MagLev and checking out the official mailing list "maglev-discussion."
Installation (i.e. getting to an irb prompt that works)Bear in mind that MagLev will only work on 64 bit versions of OS X, Linux, and Solaris, so if you're in the 32 bit club, there's no point in going any further (yet).
If you download the MagLev Installer script (small ZIP file), you can run the installMaglev.sh script and install the latest version like so:
./installMaglev.sh 22578
The announcement post doesn't make it clear you need to provide a version number of what version number to provide. 22578 was mentioned earlier in the day though, and it seems to work.
Once installed, MagLev provides some info about environment variables you need to add to your .bashrc or .bash_profile. Follow these, then open a new terminal and here's how you get to an irb session:
$ maglev start
startnetldi[Info]: Starting GemStone network server "gs64ldi".
startnetldi[Error]: could not start server
startstone[Info]: Starting Stone repository monitor "maglev".
startstone[Info]: GemStone server 'maglev' has been started.
$ maglev-irb
irb(main):001:0> 20 + 20
=> 40
irb(main):002:0> exit
error , SystemExit Error, nil,
during /Users/peter/Downloads/MagLev-installer/MagLev-22578.MacOSX/bin/maglev-irb
SystemExit Error, nil
Alternatively: GitHub installation
MagLev is also available from GitHub to clone. To install MagLev from GitHub:
git clone git://github.com/MagLev/maglev.git cd maglev ./install.sh
.. then follow the note about adding the path to your .bashrc or .bash_profile and running Rake in a new prompt (though still under the maglev project directory).
If you get any further with doing something interesting like, say, getting an IRB prompt up successfully on this, do post a comment ;-)
[ad] Find duplication, code smells, complex code and more in your Ruby code with Caliper! The metrics are free and setup takes just one click. Get started!