From: Peter Booth Date: 2009-04-17T22:26:27+09:00 Subject: Re: Weird performance issue The first step is to see whether the problem is in the Ruby infrastructure or underneath. The easiest way to do that is to run a Linux CPU benchmark on each and see whether you observe the same difference. Unixbench, lmbench or the Java volano benchmark would work. 1. If its infrastructure: check your VM is using same cap and weight, same filesystem, etc ... 2. If its ruby run lsof on your test process and see whether each are opening the same libraries, then strace if necessary Peter On Apr 16, 2009, at 8:39 PM, Ryan Davis wrote: > > On Apr 16, 2009, at 16:25 , court3nay wrote: > >> Hey, I'm debugging a weird performance issue. I have two VMs on the >> same server running the same OS (arch linux) and the same version of >> "enterprise" Ruby (ruby 1.8.6 (2008-08-08 patchlevel 286) [x86_64- >> linux]). >> >> On one machine, I get these numbers >> >> irb(main):004:0> Benchmark.realtime { require 'rubygems' } >> => 0.0482780933380127 >> irb(main):005:0> Benchmark.realtime { require 'tinder' } >> => 0.395686149597168 >> >> On the other, >> >> irb(main):002:0> Benchmark.realtime { require 'rubygems' } >> => 1.20596885681152 >> irb(main):003:0> Benchmark.realtime { require 'tinder' } >> => 5.7661280632019 > > same number of gems on both slices? > > % gem list | wc -l > > you can also do something really gross like: > > % ruby -rtracer -e 'require "rubygems"' > server1.txt > > I don't think you should necessarily diff the two, but looking at > rough things like # of lines should start to explain stuff. > Something maybe like: > > % ruby -rtracer -e 'require "rubygems"' | cut -f 2 -d : | occur | head > 41672: /Library/Ruby/Site/1.8/rubygems/specification.rb > 38352: /Library/Ruby/Site/1.8/rubygems/version.rb > 3865: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/1.8/universal-darwin9.0/rbconfig.rb > 3544: /Library/Ruby/Site/1.8/rubygems/requirement.rb > 3491: /Library/Ruby/Site/1.8/rubygems/gem_path_searcher.rb > 3173: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/1.8/fileutils.rb > 2329: /Library/Ruby/Site/1.8/rubygems/source_index.rb > 1213: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/1.8/date.rb > 1087: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/1.8/optparse.rb > 847: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/1.8/yaml/tag.rb > > (occur is a simple script I wrote to aggregate input... I loves it) > >