5
votes

We switched to a new development server and experienced that our test suite needs two times as much time. We tested database, filesystem etc. but these things are pretty fast, even faster than before.

So we wrote a small ruby benchmark test (Fibonacci) and executed it several times (average below):

time_start = Time.now
f = lambda { |x| x < 2 ? x : f.call(x-1) + f.call(x-2) }
f.call(35)
time = Time.now - time_start

puts "#{time.round(4)}s needed"

Machine before with XEN: 6s

Machine after with OpenVZ: 11,5

On both machines is Debian Squeeze with rvm installed (-> compiled) ruby-1.9.3-p194. There is no high load on these machine, memory is also ok.

The more or less only difference is virtualization engine. In production we use VMware ESXi. The benchmark needs about 11s there. We tested another server with KVM, there the benchmark needs 2,5s.


  • Machine with XEN: 6s
  • Machine with OpenVZ: 11,5s
  • Machine with VMware ESXi: 11s
  • Machine with KVM: 2,5s

So what can we change in our virtualization to make our ruby faster? Or do you have another idea what the problem can be?

3
Intersting question, but in my opinion it's hard to compare benchmarks over different virtualisation technologies! - Robin
@Sam: Unfortunatly we have no other idea what the problem could be... - MMore
I would run a non-Ruby CPU benchmark on all systems to make sure that the problem is Ruby related. Are all machines running 64 bit? - claasz

3 Answers

1
votes

I just tested it on our ESXi 5 System with Debian Squeeze and one with Ubuntu Precise (Server). On Squeeze Ruby-1.9.3-p194 has to be compiled and on Ubuntu not. But the Results are the same on both systems: 11.x Seconds. So i think we can also ignore the Kernel-Version and concentrate on the Virtualization Layer.

1
votes
0
votes

Perhaps @martinseener is on to something. You might want to look at this:
http://alisnic.net/blog/making-your-ruby-fly/

And this:
https://gist.github.com/1688857?utm_source=rubyweekly&utm_medium=email

Basically rvm is compiling ruby without optimization flags. Maybe that is the problem? The links I posted however go deeper into even more speedups with patches, but the basic fix is to enable the optimization flags while compiling ruby with rvm.

Some further discussion here:
http://www.reddit.com/r/ruby/comments/13mc3s/making_your_ruby_fly/