A small note to all the FreeBSD folks about Ruby performance. While trying to tune Mongrel to run faster on FreeBSD I was stumped as to why it was so horribly slow compared to Linux. Linux on the same machine was getting about 800 req/sec, and FreeBSD was maybe pushing 23 req/sec. Pathetic. I managed to tweak the thread model in Mongrel and get FreeBSD up to about 210 req/sec but still that wasn''t nearly good enough. Then I found the secret. FreeBSD has two versions of Ruby in the ports directory: lang/ruby18 and lang/ruby18-nopthreads. Using the nopthreads version of Ruby immediately gave me 740 req/sec without any changes to Mongrel. I have no idea what Ruby is doing in the pthreads version (or why in the hell a thread library based on select *also* uses pthreads), but this simple change completely solved all my performance problems. So, word to the wise: pthreads do not give you performance. Enjoy! Zed A. Shaw http://www.zedshaw.com/
I can''t seem to find this page anywhere. Has it moved? As it is now, the url seems to redirect back to the main page. Tony http://involution.com
> A small note to all the FreeBSD folks about Ruby performance. > > While trying to tune Mongrel to run faster on FreeBSD I was stumped as to > why it was so horribly slow compared to Linux. Linux on the same machine > was getting about 800 req/sec, and FreeBSD was maybe pushing 23 req/sec. > Pathetic. > ... > Then I found the secret. FreeBSD has two versions of Ruby in the ports > directory: lang/ruby18 and lang/ruby18-nopthreads. > > Using the nopthreads version of Ruby immediately gave me 740 req/sec without > any changes to Mongrel. I have no idea what Ruby is doing in the pthreads > version (or why in the hell a thread library based on select *also* uses > pthreads), but this simple change completely solved all my performance > problems.Thank you for sharing this. As an avid FreeBSD user I will check this in relation to ruby. What FreeBSD version are you talking about? regards Claus
On 3/19/06, Tony Perrie <tony@involution.com> wrote:> > I can''t seem to find this page anywhere. Has it moved? As it is now, the > url seems to redirect back to the main page.Since 1.0, all api docs have moved to http://api.rubyonrails.org/. /Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060320/b4322d30/attachment.html
Zed Shaw wrote:> A small note to all the FreeBSD folks about Ruby performance. > > While trying to tune Mongrel to run faster on FreeBSD I was stumped as to > why it was so horribly slow compared to Linux. Linux on the same machine > was getting about 800 req/sec, and FreeBSD was maybe pushing 23 req/sec. > Pathetic. > > I managed to tweak the thread model in Mongrel and get FreeBSD up to about > 210 req/sec but still that wasn''t nearly good enough. > > Then I found the secret. FreeBSD has two versions of Ruby in the ports > directory: lang/ruby18 and lang/ruby18-nopthreads. > > Using the nopthreads version of Ruby immediately gave me 740 req/sec without > any changes to Mongrel. I have no idea what Ruby is doing in the pthreads > version (or why in the hell a thread library based on select *also* uses > pthreads), but this simple change completely solved all my performance > problems. > > So, word to the wise: pthreads do not give you performance.Coincidentally, on the same day as your post Eric Hodel published details of the software setup at Robot Co-op: http://blog.segment7.net/articles/2006/03/20/robot-co-op-software They run on FreeBSD, and he says: "We use the lang/ruby18-nopthreads port of Ruby because we experienced an incredible load increase with the default pthread version." Info on the hardware is here: http://blog.segment7.net/articles/2006/03/15/robot-co-op-hardware Justin
On Mar 20, 2006, at 5:27 AM, Claus Guttesen wrote:>> A small note to all the FreeBSD folks about Ruby performance. >> >> While trying to tune Mongrel to run faster on FreeBSD I was >> stumped as to >> why it was so horribly slow compared to Linux. Linux on the same >> machine >> was getting about 800 req/sec, and FreeBSD was maybe pushing 23 >> req/sec. >> Pathetic. >> ... >> Then I found the secret. FreeBSD has two versions of Ruby in the >> ports >> directory: lang/ruby18 and lang/ruby18-nopthreads. >> >> Using the nopthreads version of Ruby immediately gave me 740 req/ >> sec without >> any changes to Mongrel. I have no idea what Ruby is doing in the >> pthreads >> version (or why in the hell a thread library based on select >> *also* uses >> pthreads), but this simple change completely solved all my >> performance >> problems. > > Thank you for sharing this. As an avid FreeBSD user I will check this > in relation to ruby. What FreeBSD version are you talking about?All of them. If you use Ruby with pthread-requiring C/C++ libraries, ruby- nopthreads may do bad things. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com
Interesting. Did you have to deinstall and rebuild any Ruby-related ports when you did this, or did everything Just Work? Zed Shaw wrote:> A small note to all the FreeBSD folks about Ruby performance. > > While trying to tune Mongrel to run faster on FreeBSD I was stumped as > to > why it was so horribly slow compared to Linux. Linux on the same > machine > was getting about 800 req/sec, and FreeBSD was maybe pushing 23 req/sec. > Pathetic. > > I managed to tweak the thread model in Mongrel and get FreeBSD up to > about > 210 req/sec but still that wasn''t nearly good enough. > > Then I found the secret. FreeBSD has two versions of Ruby in the ports > directory: lang/ruby18 and lang/ruby18-nopthreads.-- Posted via http://www.ruby-forum.com/.
Answered it satisfactorily for myself. Held my nose, stopped apache, ran make, deinstalled the default build of ruby and installed the nopthreads version. The performace boost seems to be dramatic. I was considering migrating from a VPS to a dedicated server and I don''t think I''ll have to for a while. Thanks. Get this on the wiki if it''s not there already. Steve Koppelman wrote:> Interesting. Did you have to deinstall and rebuild any Ruby-related > ports when you did this, or did everything Just Work? > > Zed Shaw wrote: >> A small note to all the FreeBSD folks about Ruby performance. >> >> While trying to tune Mongrel to run faster on FreeBSD I was stumped as >> to >> why it was so horribly slow compared to Linux. Linux on the same >> machine >> was getting about 800 req/sec, and FreeBSD was maybe pushing 23 req/sec. >> Pathetic.... >> Then I found the secret. FreeBSD has two versions of Ruby in the ports >> directory: lang/ruby18 and lang/ruby18-nopthreads.-- Posted via http://www.ruby-forum.com/.