From: Eric Hodel Date: 2010-12-15T04:07:53+09:00 Subject: Re: Ruby 1.9.2 : Io performance when application use multithread On Dec 14, 2010, at 05:34, Regis d'Aubarede wrote: > The file attachment is an simple script for measure performance > between client TCP and server, in Mbyte/s. > > With Ruby 1.9.2, when the server run in multi thread > ( Thread.new(serv.accept()) {...} ) the script give > a very poor transfer rate ( 3Mbyte on connection on localhost ). > > When none-multi thread, performance is good : > same as jruby and MRI ( 470 Mbyte/s ) > (ironRuby give a stange 110 Mbyte/s). > > Usage : >> ruby gbits.rb server 4040 # server (monothread) >> ruby gbits.rb server 4040 t # server (multihread) > >> ruby gbits.rb client 127.0.0.1 4040 10 # 10=> 10 MB data length > > OS: Windows 7 > Proc: core i7, 1 Gbps ethernet > Ruby: 1.9.2dev (2010-07-02) [i386-mingw32] > jruby: 1.5.0 > ir: 1.1.0.0 on .NET 4.0.30319.1 > ruby: 1.8.6 > > > Tested on Linux > Ubuntu 10.4 (same machine with Virtalbox) > ruby 1.9.1p378 (2010-01-10 revision 26273) [i486-linux] > > server threaded : 844 MB/s > server non-threaded: 989 MB/s > same delta with jruby On OS X 10.6 I don't see a performance drop for threaded vs non threaded. I ran your script with an argument of 1000 instead of 10 as the results for 10 were too variable. ruby 1.9.3dev (2010-12-04 trunk 30078) [x86_64-darwin10.5.0] runs ~ 420MB/s both ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0] runs ~ 420MB/s both ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.2.0] runs ~ 460MB/s without t ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.2.0] runs ~ 455MB/s with t ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] runs ~ 490MB/s without t ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] runs ~ 470MB/s with t