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?
Problem was rvm. Now this is solved!
https://github.com/wayneeseguin/rvm/issues/1326