Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
* updates in git://bogomips.org/rainbows.git
@ 2011-05-20 19:16 Eric Wong
       [not found] ` <20110520191655.GA11860-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2011-05-20 19:16 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw

== dropping keepalive clients on SIGQUIT

For all concurrency models where we manage idle keepalive ourselves
(anything using Cool.io or sleepy_penguin[1] epoll), SIGQUIT should drop
idle clients immediately.  These are some of the concurrency models
where maintaining keepalive clients is cheapest.

It would require more time/effort to get this working with EventMachine
(since we just rely on set_comm_inactivity_timeout in EventMachine).
Anybody really care about it?

I noticed SIGQUIT was taking a long time to take effect with long
keepalives while testing XEpoll somewhere...


== Kgio.autopush support for Thread-based concurrency models

I forgot to switch from IO#write to Kgio::SocketMethods#kgio_write.  The
latter is is needed to push pending frames if :tcp_nopush is true on a
listen socket.  This wasn't an issue for other concurrency models that
already used kgio_write/kgio_trywrite.  Most people don't use
:tcp_nopush, so this doesn't concern them, but I was testing with
:ThreadPool.

Unconfirmed, but if you're serving HTTP/0.9 clients, this may still have
adverse affect if you use sendfile/IO.copy_stream.   I'll report back
since there are probably Rainbows! users that depend heavily on HTTP/0.9
support :)


I've not written tests for either of these improvements, but will
do so before the 3.4.0 release.

[1] http://bogomips.org/sleepy_penguin/

-- 
Eric Wong
_______________________________________________
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: updates in git://bogomips.org/rainbows.git
       [not found] ` <20110520191655.GA11860-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
@ 2011-05-20 21:04   ` Eric Wong
  2011-05-20 22:25   ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2011-05-20 21:04 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw

Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
> == dropping keepalive clients on SIGQUIT
> 
> It would require more time/effort to get this working with EventMachine
> (since we just rely on set_comm_inactivity_timeout in EventMachine).
> Anybody really care about it?

Actually, it's quick for EM (within 1s) and now even quicker:

diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb
index b136518..025b795 100644
--- a/lib/rainbows/event_machine.rb
+++ b/lib/rainbows/event_machine.rb
@@ -74,11 +74,11 @@ module Rainbows::EventMachine
       conns = EM.instance_variable_get(:@conns) or
         raise RuntimeError, "EM @conns instance variable not accessible!"
       Rainbows::EventMachine::Server.const_set(:CUR, conns)
+      Rainbows.at_quit do
+        EM.next_tick { conns.each_value { |c| client_class === c and c.quit } }
+      end
       EM.add_periodic_timer(1) do
-        unless Rainbows.tick
-          conns.each_value { |c| client_class === c and c.quit }
-          EM.stop if conns.empty? && EM.reactor_running?
-        end
+        EM.stop if ! Rainbows.tick && conns.empty? && EM.reactor_running?
       end
       LISTENERS.map! do |s|
         EM.watch(s, Rainbows::EventMachine::Server) do |c|

---

Longer term, I'd like to lower the tick frequency to save power, but
it's not going to be useful for MRI 1.9.x as long as the timer thread is
waking up every 10ms
(http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/33456)

-- 
Eric Wong
_______________________________________________
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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: updates in git://bogomips.org/rainbows.git
       [not found] ` <20110520191655.GA11860-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
  2011-05-20 21:04   ` Eric Wong
@ 2011-05-20 22:25   ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2011-05-20 22:25 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw

Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
> == Kgio.autopush support for Thread-based concurrency models

<snip>

> Unconfirmed, but if you're serving HTTP/0.9 clients, this may still have
> adverse affect if you use sendfile/IO.copy_stream.   I'll report back
> since there are probably Rainbows! users that depend heavily on HTTP/0.9
> support :)

Of course Rainbows! will disconnect HTTP/0.9 (and 1.0) clients immediately
after writing the response, so they'll be uncorked + flushed then.

-- 
Eric Wong
_______________________________________________
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-20 22:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20 19:16 updates in git://bogomips.org/rainbows.git Eric Wong
     [not found] ` <20110520191655.GA11860-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2011-05-20 21:04   ` Eric Wong
2011-05-20 22:25   ` Eric Wong

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