Ruby Enterprise Edition (REE) is a branch of the official Ruby interpreter which is capable of reducing your Rails applications’ memory usage by 33% on average, as well as improving your applications’ performance. This is possible because REE includes copy-on-write enhancements for the garbage collector, as well as an improved memory allocator (tcmalloc). REE has been out for several months now and is already used by many high-profile websites and organizations, such as New York Times, Shopify and 37signals.

“We switched to enterprise ruby to get the full benefit of the [copy-on-write] memory characteristics and we can absolutely confirm the memory savings of 30% some others have reported. This is many thousand dollars of savings even at today’s hardware prices.” – Tobias Lütke (Shopify)

And just like Phusion Passenger, Ruby Enterprise Edition is 100% open source.

Recent developments

REE has just become better. We had been talking with DHH from 37signals about a possible sponsorship campaign for supporting REE development. The campaign has recently ended, and so we’re presenting the world with Ruby Enterprise Edition version 1.8.6-20081205.

These patches allow one to tweak various garbage collector settings. 37signals uses this to greatly improve server performance. The RailsBench GC patches did not work on REE in previous releases, but now we’ve properly integrated them into REE.

Better Mac OS X support

Previous versions sort-of support Mac OS X, but some people have reported problems. We’ve improved Mac OS X support as follows:

Installation should now work out-of-the-box on Mac OS X.

The tcmalloc memory allocator has been properly integrated with Mac OS X. Tcmalloc is what makes REE faster than the standard Ruby interpreter. In previous versions, tcmalloc was disabled when installing on OS X because it didn’t work properly on OS X. This not only meant that there were no performance gains compared to standard Ruby, it also meant that the copy-on-write optimizations were a bit less effective than they could be. By properly integrating tcmalloc on OS X, which was a tough task, OS X users can now fully enjoy the improved performance and copy-on-write optimizations.

Various OS X-related crashes have been fixed.

Special thanks to Stephen Heuer from Arux Software Inc. for providing access to an OS X testing environment.

Better 64-bit support

Even though previous versions support 64-bit platforms, many people experienced problems. We’ve spent some time making sure that installation works out-of-the-box on 64-bit platforms. We’ve tested against 64-bit FreeBSD 7 and 64-bit Ubuntu 8.10 Server.

Better Solaris support

We’ve made sure that installation works out-of-the-box.
Special thanks goes out to our friends at Sun for providing us with access to a Solaris testing environment.

In addition, this release also comes with various non-sponsored improvements and changes:

caller_for_all_threads

Philippe Hanrigou’s caller_for_all_threads patches have been integrated into REE. This feature allows one to dump the stack trace of all running threads in a Ruby application. This feature is a must-have for debugging multithreaded web applications.

Phusion Passenger’s development version has already been updated to take advantage of this feature, when available. It will be available starting from Phusion Passenger version 2.1.0 (which hasn’t been released yet at the moment of writing).

One of the most often requested features is that REE’s RubyGems should be able to use the gems that are already installed (i.e. the gems that have been installed for the system’s Ruby interpreter). The previous REE release implemented this feature.

However, it turns out that this can cause problems with native extensions, e.g. RMagick and the Ruby MySQL library. If one uses REE to load a native extension that was originally compiled for the system’s Ruby, then REE might crash. So this feature has been removed. You should install all gems that you need with REE’s RubyGems.

ree-version

An ‘ree-version’ command is now provided. This command prints out the REE version number. This makes it easier for people to track REE updates.

The sponsors

Many thanks to the following people and organizations for sponsoring this release (list sorted in alphabetical order):

We had a MySQL problem earlier so we lost some comments. But to answer the people who asked why they get a 404 Not Found error on the download page: it’s because RubyForge is still updating their mirrors.

http://hungrymachine.com Aaron Batalion

You mention better 64-bit support. does that mean the memory allocator now works on 64-bit platforms?

No, tcmalloc doesn’t work on 64-bit. But the copy-on-write patches still do, they just aren’t as effective without tcmalloc. So on 32-bit systems (with tcmalloc) you get about 33% memory savings, while on 64-bit systems (without tcmalloc) you get about 25% memory savings.

Keith

Irony: you posted this literally 20 minutes after I finished installing passenger and the previous ruby-enterprise. Guess I should have taken the time to drink my coffee this morning after all 🙂 Thanks for your efforts!

http://hungrymachine.com Aaron Batalion

hongli, 25% is great…. but thats memory savings.. but the FAQ mentions performance… “slower”. Can you elaborate? Is that still the case? Beyond tcmalloc, what makes the 64bit slower?

http://www.phusion.nl/ hongli

Yes. The copy-on-write patch makes the GC about 5% slower, but this is negated by the fact that tcmalloc makes everything about 25% faster. So in summary:

@bryanl: Well no, it just means that the tradeoff is different. If you’re on 64-bit, and you value memory usage more than raw CPU usage, then REE is the way to go.

http://www.akitaonrails.com AkitaOnRails

Awesome release, I am installing it right now 🙂 And actually – I may be wrong about this – but it seems that Apache performance is worse on 64-bits. It seems related to the Linux kernel’s scheduler. For highly demanded web servers, it is better to use Linux 32-bits and if you need more RAM, use just PAE. Apache + Linux will perform better in 32-bit settings.

http://blog.viarails.net Wesley Moxam

If you value memory consumption in general, you won’t use 64-bit linux for your app servers anyways. Ruby consumes much more memory on 64-bit platforms, and there isn’t any advantage to running on 64-bit.

http://jonraptor.com Jonathan

Hi, ruby enterprise edition does not compile on Ubuntu Jaunty, using g++-4.3 or g++-4.2. Any info on that?

ste: Please calm down and stay polite, there’s no reason to get upset.

The code you pointed out is meant for improving copy-on-write efficiency, as the comment a few lines above your code piece explains:

# Preload libraries for copy-on-write semantics.

It doesn’t take into account that the library may be missing, but this has alreadybeenfixed.

ste

Sorry for sounding impolite (and I assure you that I’m *always* calm :-), but this thing really caught me by surprise. Knowing the quality of your work, I find this “bug” really surprising, in a VERY bad way.

RyanR>

Per the instructions in “REE’s RubyGems no longer makes use of the existing gems”, I installed the MySQL gem with:

Update to previous comment: I tried correcting the reference in mysql.bundle to reflect the correct location of the mysqlclient.15.dylib file, and I got seg faults instead.

http://betterlogic.com/roger roger

@ryanr — could try using it –with_mysql_config or the like
GL!
-=R

http://betterlogic.com/roger roger

Wondering–which part(s) of the gcpatch were applied?
Thanks!
-=R

Just Wondering

I’m just wondering, why is it assumed by REE developers that reinstalling all Ruby Gems on a system is ok? I have over 50 gems used across 4 Rails applications, and this needs to be done on 5 servers.

I was hoping to use GEM_PATH to continue using the already-installed gems.

http://www.phusion.nl/ hongli

@Just Wondering: Because it is not possible to use your existing gems reliably. We tried this in the past and it turns out that on some platforms, native extensions compiled against the existing Ruby installation can cause REE to crash, and the only way to prevent this is by reinstalling said gems. If there is a silver bullet we would have used it a long time ago.

http://betterlogic.com/roger roger

still wondering…Wondering–which part(s) of the gcpatch were applied?

Thanks!
-=R

http://www.phusion.nl/ hongli

@roger: Everything.

Hello, we are Phusion. We provide amazing products and services
for web apps written in Ruby, Python, Node.js and Meteor.

“Phusion” and “Phusion Passenger” are registered trademarks of Phusion. “Rails”, “Ruby on Rails” and the Rails logo are registered trademarks of David Heinemeier Hansson. All other trademarks are property of their respective owners.