Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

NeverBlock: Fast, Non-Blocking IO In Ruby Without Changing Program Flow

By Peter Cooper / August 25, 2008

neverblock.pngNeverBlock is a Ruby (1.9) library developed by eSpace - an Egyptian Web 2.0 development team - that could make your life a whole lot easier if you have to deal with blocking IO operations that hold up all your Ruby threads.

NeverBlock makes it easy to get the benefits of non-blocking IO (IO operations that aren't held up by mutexes) in your Ruby apps without having to take the usual route of redesigning your app to be event-based. You get all the benefits of event-based code (lower CPU overhead, lower memory use, less hangups) but with the benefit of a normal program flow model.

The catch? It's Ruby 1.9 only - relying heavily on fibers - and the documentation isn't particularly strong yet so it'll take a bit of work to figure out. It could be worth it, though, as in benchmarks on the NeverBlock-based Postgres library, throughput is shown as significantly increased where a percentage of queries are complex and slow (and would usually block up the client).

If you're still interested, NeverBlock is available on Github - there's also an official home page and documentation available.

This post is sponsored by AlphaSights Ltd - AlphaSights are recruiting. If you're looking for a Ruby on Rails opportunity, can work in Cambridge, UK and enjoy the buzz of a brand new well-funded startup then look no further. AlphaSights are recruiting from entry level to senior positions and offer very competitive salaries and a great working environment.

Other Posts to Enjoy

Twitter Mentions