Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby is slow on virtual machine depending on the virtualization engine

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?

like image 980
MMore Avatar asked Nov 04 '22 10:11

MMore


1 Answers

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.

like image 102
martinseener Avatar answered Nov 12 '22 16:11

martinseener