InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Fibers Roundup: NeverBlock Now Rails Compatible, "Poor Man's" Fibers For 1.8

Posted by Werner Schuster on Sep 10, 2008

Sections
Architecture & Design,
Development,
Operations & Infrastructure
Topics
JRuby ,
Ruby on Rails ,
Data Access ,
Ruby ,
Performance & Scalability
Tags
Ruby1.9 ,
JRuby ,
Concurrency ,
Ruby on Rails
NeverBlock is a library using Ruby Fibers for asynchronous database access. Up until now, the use of Fibers meant that NeverBlock had to run on Ruby 1.9. A new release of NeverBlock solves the issue by using a backport the Fibers functionality. Aman Gupta recently published a Fiber implementation based on Ruby Threads called "Poor Man's Fibers" (the Fiber implementation in the NeverBlock Github repository).

Emulating Fibers with Threads uses more resources than real Fibers when it comes to memory use and scheduling overhead. However, NeverBlock pools Fibers anyway, which should limit the impact of using the backport. JRuby uses a similar (experimental) approach to providing Fibers (GitHub repository for JRuby's Fiber implementation) as part of it's Ruby 1.9 support. JRuby's Fibers implementation also maps every Fiber to a Thread and thus has similar performance characteristics to the "Poor Man's Fibers". Muhammed Ali, one of the creators of NeverBlock, looked at the cost of Fibers vs. the cost of Threads, which shows Ruby 1.9's Fibers to use up much less memory and take much less time to create.

Another feature of the new NeverBlock release is built-in support for Rails
An end to end seamless support for the Ruby on Rails framework. Adding support for Rails is as easy as modifying a line in your database.yml and adding 2 lines to your environment.rb file.
The linked post contains more information which lines to add for different servers and databases.

With Fibers getting a lot more attention, and Ruby 1.9.1 starting to stabilize, have you considered using Fibers?

No comments

Watch Thread Reply

Educational Content

Jesper Boeg on Priming Kanban

In this interview, Jesper Boeg, author of the new InfoQ book – Priming Kanban, discusses the keys to using Kanban effectively, and how to get started if you are currently using other approaches.

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.