10 Pines Blog

Parallel tests on Travis

jruby parallel ci

Since the last post, a lot of things happened: some things were fixed, some tests got faster and I learned that some aspects of JRuby are just slow (for now).

First of all, the author of parallel_tests was very kind to not only accept my pull requests, but to provide feedback and even fix my broken code instead of rejecting it. There was a way in RSpec to correctly calculate time spent on each file, instead of doing it per example (which resulted in the problems mentioned in the previous post). This resulted in increased CPU throughput (at least in MRI) as all processors could be loaded at the same time, instead of having them working together only a fraction of the time (because some of them finished earlier and remained idle).

18 May 2013

Parallel tests for JRuby

jruby rspec parallel

Recently, we’ve been porting one of our projects from Ruby 1.9.3 (MRI) to JRuby 1.7.3. There was a fair amount of work involved, mainly about Ruby gems and (in)compatibility with C extensions (which JRuby dropped support), but that will be left for another post. Here, I’d like to discuss the recent addition of JRuby support to the parallel_tests gem.

Our tests take about 20 minutes to run (it’s suite of ~3800 examples, which are currently undergoing refactoring to improve performance), but a lot of the machine’s processing power is unused. So I thought we could start by actually running all the code we can, before starting to profile and tune it. Also, if the delays were caused by waiting events, it wouldn’t help making the code run faster. This sounds good, but it didn’t turn out to be that easy.

7 May 2013