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
why it was so horribly slow compared to Linux. Linux on the same
was getting about 800 req/sec, and FreeBSD was maybe pushing 23 req/sec.
I managed to tweak the thread model in Mongrel and get FreeBSD up to
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
any changes to Mongrel. I have no idea what Ruby is doing in the
version (or why in the hell a thread library based on select also uses
pthreads), but this simple change completely solved all my performance
So, word to the wise: pthreads do not give you performance.
Zed A. Shaw