Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Alexandre Riveira <alexandre-VwDbj2YsoUp0ZRtCdD4y8VAUjnlXr6A1@public.gmane.org>
To: "Rainbows! list" <rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org>
Subject: Re: c10k paradigm [SOLVED]
Date: Tue, 16 Apr 2013 20:27:18 +0000	[thread overview]
Message-ID: <516DB426.8020602@objectdata.com.br> (raw)
In-Reply-To: <20130416204813.GA15083-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>

Tanks for all helpers. Erick, this solutions CheckDefered is pefect !And 
run in production !

1) rack middleware
class CheckDeferred

   def initialize(app)
     @app = app
   end

   def call(env)
     @app.call(env)
   end

   def deferred?(env)
     case env["PATH_INFO"]
       when /\/ecommer.*/
         false
       else
         true # erp run by thread
     end
   end
end


2) edit your config.ru
require File.expand_path "config/environment"

use CheckDeferred #first if not function
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new


Alexandre Riveira



Em 16-04-2013 20:48, Eric Wong escreveu:
> Alexandre Riveira <alexandre-VwDbj2YsoUp0ZRtCdD4y8VAUjnlXr6A1@public.gmane.org> 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/},
>           %r{/foo/bar},
> 	 ... # whatever other paths you want multithreaded
>        true
>      else
>        false
>      end
>    end
> end
>
> ----------- config.ru --------------
> use CheckDeferred # needs to be the outermost layer of middleware
>
> use ...
> run Application.new
> ------------------------------------
> _______________________________________________
> Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
> http://rubyforge.org/mailman/listinfo/rainbows-talk
> Do not quote signatures (like this one) or top post when replying
>

_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


  parent reply	other threads:[~2013-04-16 23:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 11:45 c10k paradigm Alexandre Riveira
     [not found] ` <516BE872.5060006-VwDbj2YsoUp0ZRtCdD4y8VAUjnlXr6A1@public.gmane.org>
2013-04-15 18:30   ` Eric Wong
     [not found]     ` <516C2A48.3070808@objectdata.com.br>
     [not found]       ` <516C2A48.3070808-VwDbj2YsoUp0ZRtCdD4y8VAUjnlXr6A1@public.gmane.org>
2013-04-15 19:34         ` Eric Wong
     [not found]           ` <20130415193403.GA742-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-04-16 10:59             ` Alexandre Riveira
2013-04-16 11:18             ` Alexandre Riveira
     [not found]               ` <516D338C.9060408-VwDbj2YsoUp0ZRtCdD4y8VAUjnlXr6A1@public.gmane.org>
2013-04-16 17:24                 ` Eric Wong
     [not found]                   ` <20130416172417.GA12658-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-04-16 15:11                     ` Alexandre Riveira
     [not found]                       ` <516D6A0C.50406-VwDbj2YsoUp0ZRtCdD4y8VAUjnlXr6A1@public.gmane.org>
2013-04-16 18:35                         ` Eric Wong
     [not found]                           ` <20130416183500.GA10540-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-04-16 17:19                             ` Alexandre Riveira
     [not found]                               ` <516D882B.4070402-VwDbj2YsoUp0ZRtCdD4y8VAUjnlXr6A1@public.gmane.org>
2013-04-16 20:48                                 ` Eric Wong
     [not found]                                   ` <20130416204813.GA15083-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-04-16 20:27                                     ` Alexandre Riveira [this message]
2013-04-16 18:19                     ` Mark J. Titorenko
     [not found]                       ` <37F3CDA5-C42E-4B91-A74F-E748B956D6BF-Tt5uHDgV0oUB085IDyDbTA@public.gmane.org>
2013-04-16 15:45                         ` Alexandre Riveira
     [not found]                           ` <516D7237.6000700-VwDbj2YsoUp0ZRtCdD4y8VAUjnlXr6A1@public.gmane.org>
2013-04-16 19:00                             ` Mark J. Titorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=516DB426.8020602@objectdata.com.br \
    --to=alexandre-vwdbj2ysoup0zrtcdd4y8vaujnlxr6a1@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).