Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News MagLev Ruby VM Now Available, Brings GemStone's Persistence to Ruby

MagLev Ruby VM Now Available, Brings GemStone's Persistence to Ruby

Leia em Português

This item in japanese

MagLev is a Ruby implementation built by GemStone on their Smalltalk VM. GemStone/S, which is GemStone's Smalltalk product, been around for decades and is particularly known for it's mature distribution and persistence capabilities.

MagLev was announced in 2008, and the team has been busy working on it ever since. After a while in a private alpha, the cat is now out of the bag: a public version of MagLev is now available, which includes the MagLev source code which is hosted at GitHub.

To try MagLev, first get the source with a quick

git clone git://

followed by a


in the MagLev source directory and follow the instructions it provides.

To start MagLev use

rake maglev:start

which fires up the system. A quick way to run Ruby code is maglev-irb, which will connect to the common MagLev backend;  maglev-ruby and maglev-gem are also available.

A quick dig around the examples directory brings up the hat_trick example that Avi Bryant showed at the first MagLev demo. It showed off the persistence features, which allowed to ѕet up an object in one irb instance and then access it in another.

To reproduce it, simply fire up MagLev and two maglev-irb instances. To make an object execute this in one maglev-irb instance:

Maglev.persistent do
 Maglev::PERSISTENT_ROOT[:stuff] = ["hello world"]

Switch over to the other maglev-irb instance and execute:


which will return the string "hello world".

Obviously, this is a very simple demo of the persistence features; for more details of MagLev's persistence API see the docs.

A more slightly involved example is an implementation of Ruby's PStore using the persistence features. It shows how GemStone's persistence features make it easy to keep whole object graphs persistent without having to deal with an ORM.

While Rails is not yet supported on MagLev, working Rack and Sinatra examples are available.

A public Trac for MagLev is available to track the progress. For compatibility, this graph hows the number of passed RubySpecs, whereas links to detailed results are available too.

No details about licensing seem to be available on MagLev, but GemStone does offer free versions, eg of GemStone/S that bundles the web framework Seaside and is free up to 4 GB of data.

While there's a lot of buzz around the NoSQL databases these days, GemStone/S is a mature solution that's been around for decades. MagLev now tightly integrates these features with Ruby. What's your take - will you try MagLev?

Rate this Article