Vita Rara: A Life Uncommon

Very Excited about Goliath


Categories:

I've spent a bit of my free time over the last two weeks or so reading about Goliath from the Post Rank guys. Basically Goliath and the supporting libraries are an evented framework without the pain of evented code.

Using Ruby 1.9's support for co-routines, known as fibers in Ruby, the Post Rank team has managed to make the first evented non-blocking IO framework I'd consider using in an OO language. If you're a Rubyist and you've been looking with some envy at node.js you should really take a look at Goliath.

Get started:

I didn't really get Fibers until I read Dave Thomas's article, Pipelines Using Fibers in Ruby 1.9. The thing I found most confusing and made reading the early examples confusing was not realizing that a Fibers starts in a suspended state. You have to start the fiber with resume() before it actually starts to execute. Once I got that I was off and running.

I'm currently working on a project that is sourcing a large amount of data from the web. We're currently using JRuby and threads. Most of our time is spent in IO wait. I'm inspired by the programming model in Goliath and may run with it to create threads that manage pools of fibers to source data from the web and lower our overall server load. It's interesting time for non-blocking IO programming on Ruby.

UPDATE: Great list of articles about fibers: Ruby Fibers 8 Useful Reads on Ruby's New Concurrency Feature