c10k paradigm

Eric Wong normalperson at yhbt.net
Tue Apr 16 20:48:13 UTC 2013

Alexandre Riveira <alexandre at objectdata.com.br> wrote:
> Em 16-04-2013 18:35, Eric Wong escreveu:
> >See what Mark just said.  Also, t/app_deferred.ru in the rainbows
> >source[1].  There's also a link to Ezra's old post about it in the
> >TryDefer documentation.
> >
> >[1] - git clone git://bogomips.org/rainbows && $EDITOR t/app_deferred.ru
> In file ems/rainbows-4.5.0/lib/rainbows/event_machine.rb line 74:
> server.app.respond_to?(:deferred?)
> server.app is a Rails::Rack::LogTailer class.
> should not be ActionController::Dispatcher.new or like ???

You should probably write a new middleware around/outside of your
normal Rack layer.  Something like this:

class CheckDeferred < Struct.new(:app)
  def deferred?(env)
    case env["PATH_INFO"]
    when %r{/manager/},
	 ... # whatever other paths you want multithreaded

----------- config.ru --------------
use CheckDeferred # needs to be the outermost layer of middleware

use ...
run Application.new

More information about the rainbows-talk mailing list