Fibers (rails, ruby 1.9) and SAPI

Discussion in 'Ruby/Rails' started by Grzegorz Derebecki, Aug 10, 2010.

  1. Grzegorz Derebecki

    Grzegorz Derebecki New Member

    Did you plan support Fibers in sapi?

    What is Fibers? It is async no- blocking rails instances that can handle more that 1 request at the same time (no threads!).

    More info you can get here: http://blog.envylabs.com/2010/07/no-callbacks-no-threads-ruby-1-9/

    I tested it with Thin and works greate - from 0.5 req/s (slow action) i get to 2.4 r/s on ruby instance.

    I'm consider to switch from sapi to thin if you not plan support it.
  2. mistwang

    mistwang LiteSpeed Staff

    This is a dramatic change in ruby/rails infrastructure, not sure it is can be mature enough and being adopted widely. After all, many code is not friendly with non-blocking mode. It is going to be disastrous if ruby blocked somewhere for some reason.

    It could save on memory, but I am not sure it going to be really faster than profork mode, comparing one non-blocking ruby handling 10 concurrent requests to 10 prefork ruby handling 10 concurrent requests. The non-blocking ruby may not able to take advantage SMP server if only one instance is used.

    We will see how it evolves then make decision on whether to provide a non-blocking LSAPI interface.
  3. Grzegorz Derebecki

    Grzegorz Derebecki New Member

    Here is exemple app http://github.com/igrigorik/async-rails/
    There is already mysql async gem, rack async (rack-fiber_pool) and http async.

    I'm wonder if we can join prefork with fibers (lets say 4 rails process all supports async request).

Share This Page