[LRUG] Ruby on Rail 4.2 networking breakfast (Graeme McCubbin)

Andrew White andrew.white at unboxedconsulting.com
Sun Jul 6 14:36:25 PDT 2014


On 4 Jul 2014, at 20:00, James Pike <lrug at chilon.net> wrote:

> Instead the use of asynchronous IO + Fibers (so we get the advantages of
> ASIO with the readability of blocking IO style) would make Rails seem
> more compelling than node.js without needing code to become the tangled
> mess of callback hell that many node.js projects become. It's also worth
> noting that EcmaScript 7 will have the "async function" feature which
> will essentially provide what Ruby Fibers already do. It's sad to see
> our community becoming fragmented and outpaced by a language that most
> of us will probably agree is inferior to Ruby :(

There's already been a ton of work investigating ASIO + Fibers with Ruby & Rails - here's some of the projects:

EventMachine:
https://github.com/eventmachine/eventmachine

Rack Fiber Pool
https://github.com/alebsack/rack-fiber_pool

EM-MySQL (Plus)
https://github.com/igrigorik/em-mysqlplus

and for more details you can read Ilya Grigorik's many posts on his work:

https://www.igvita.com/2008/05/27/ruby-eventmachine-the-speed-demon/
https://www.igvita.com/2011/03/08/goliath-non-blocking-ruby-19-web-server/
https://www.igvita.com/2010/04/15/non-blocking-activerecord-rails/

are just some of them.

However what's telling is that pretty much no-one is using this because the vast majority of websites built using Rails are CRUD/template heavy where 80% of the time is spent rendering HTML and a very small proportion of the time is spent on waiting for IO so the performance gains seen by most developers would be marginal.

For Rails to adopt ASIO fully would probably mean breaking compatibility with Rack and even existing apps. Given the problems most people have had on upgrading from Rails 2.3 to 3.0 I'd certainly be loathe to inflict that again for not much in the way of improvements for a typical app.


Andrew White
Rails Core Team Member


More information about the Chat mailing list