Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: "Lin Jen-Shin (godfat)" <godfat-hOE/xeEBYYIdnm+yROfE0A@public.gmane.org>
To: "Rainbows! list" <rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org>
Subject: Timeout on Rainbows!
Date: Sat, 24 Aug 2013 03:13:19 +0800	[thread overview]
Message-ID: <CAA2_N1t7+9iGSGo-fzOuKFzxrtQkp==G0+8xOun3MfZ=rWq25A@mail.gmail.com> (raw)

Hi,

I am reworking on thread pool for EventMachine, and just realized that
Rainbows doesn't try to put a timeout for each request. Previously,
I thought the timeout setup in Unicorn would be used for each request.

Then I found Rainbows::ThreadTimeout is probably what I want.
I wonder, does that make sense to do something like this, wrap the
application with Rainbows::ThreadTimeout with the same timeout
time in Unicorn automatically?

  def worker_loop worker
    build_app! # This is needed for preload_app=false
    server = Rainbows.server
    server.app = Rainbows::ThreadTimeout.new(server.app,
                   :timeout => server.config.set[:timeout])
    super
  end

I did this in my attempt for EventMachineThreadPool:
https://github.com/godfat/rainbows-emtp/blob/rainbows-emtp-0.5.0/lib/rainbows/event_machine_thread_pool.rb#L14-L20

Because I saw this in EventMachine model:

  def worker_loop(worker) # :nodoc:
    init_worker_process(worker)
    server = Rainbows.server
    server.app.respond_to?(:deferred?) and
      server.app = TryDefer.new(server.app)
  [...]

and I think in most cases we would want this timeout for each
request. The down side might be that then the users cannot
use their own Rainbows::ThreadTimeout (maybe?) or setup a custom
threshold.

Probably then we could introduce another timeout/threshold config
in Configurator? I feel it would be common enough.

Thoughts? Thanks!
_______________________________________________
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


             reply	other threads:[~2013-08-23 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 19:13 Lin Jen-Shin (godfat) [this message]
     [not found] ` <CAA2_N1t7+9iGSGo-fzOuKFzxrtQkp==G0+8xOun3MfZ=rWq25A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-23 19:35   ` Eric Wong
     [not found]     ` <20130823193519.GA30201-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-08-23 20:02       ` Lin Jen-Shin (godfat)

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='CAA2_N1t7+9iGSGo-fzOuKFzxrtQkp==G0+8xOun3MfZ=rWq25A@mail.gmail.com' \
    --to=godfat-hoe/xeebyyidnm+yrofe0a@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    --subject='Re: Timeout on Rainbows'\!'' \
    /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

Code repositories for project(s) associated with this inbox:

	../../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).