RubyConf 2008: Gregg Pollack – Scaling Ruby (without the Rails)

by javery on November 6, 2008

For the first of the split-out sessions I decided on Gregg Pollack’s Scaling Ruby talk. I am getting ready to do some work on optimizing the sds-rest library so I was hoping to get some good information from this talk on how to approach that optimization.

Gregg started out covering the Ruby basics of performance. He talked about threading and processes and how the ruby thread scheduler works. He showed a great demo using the default mysql adapter, using 10 threads it took 30 seconds since each mysql call was blocking. Then he showed using the NeverBlock mysqlplus adapter and the same calls took 3 seconds. It was a great example of the performance hit you take for blocking code.

He then covered the differences between Green Threads and native threads and how Ruby 1.9 introduces native threading but still has the issue with the global interpreter lock so they still aren’t perfect. Gregg then covered a number of tools that can be used to get around some of these issues including EventMachine and message queues. He touched on RubyInline briefly to show the performance gains you can get from writing some inline C code and RubyInline makes that much easier.

Gregg then walked through a typical usage of ruby-prof: profiling code, explaining the output, and showing some of the different possible output types from ruby-prof and how to use them.

Gregg then went through numerous performance tips and tricks on ways to optimize your Ruby code, I was familiar with a couple of the techniques but also managed to learn a couple new things I will definitely be using.

Gregg also had a great idea and has put his talk up as an envycast, so if this is a topic that interests you then you can go and buy the cast and see basically the same thing I saw. I would definitely recommend it.

-James

Comments on this entry are closed.

Previous post: RubyConf 2008: Matz Keynote

Next post: RubyConf 2008: Evan Phoenix – Rubinius