From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=1.0 required=3.0 tests=AWL,HK_RANDOM_FROM, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: notes for streaming responses with Rails 3.1 Date: Fri, 29 Apr 2011 17:44:53 -0700 Message-ID: <20110430004453.GA6871@dcvr.yhbt.net> References: <20110427223243.GA32368@dcvr.yhbt.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1304124421 17343 80.91.229.12 (30 Apr 2011 00:47:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Apr 2011 00:47:01 +0000 (UTC) To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Sat Apr 30 02:46:57 2011 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Content-Disposition: inline In-Reply-To: <20110427223243.GA32368-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:232 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QFyKl-0003yC-LT for gclrrg-rainbows-talk@m.gmane.org; Sat, 30 Apr 2011 02:46:55 +0200 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id E9E9418583A7; Fri, 29 Apr 2011 20:46:54 -0400 (EDT) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 1726718583A6 for ; Fri, 29 Apr 2011 20:45:00 -0400 (EDT) Received: from localhost (unknown [127.0.2.5]) by dcvr.yhbt.net (Postfix) with ESMTP id 99E991F6AE; Sat, 30 Apr 2011 00:44:59 +0000 (UTC) Eric Wong wrote: > == Rainbows! concurrency options > > === ThreadPool/ThreadSpawn ==== Linux-only I also added XEpollThreadSpawn to rainbows.git which basically uses epoll to maintain idle keepalive connections but is otherwise the same as ThreadSpawn for "hot" connections (including streaming "rack.input" and also streaming respond_body#each with no enforced userspace buffering). ==== Ruby 1.9 + Linux-only The key advantage of the XEpoll* relying on epoll (and not more portable things) is we can have one (native) thread stuck in epoll_wait() can be woken up by another (native) thread adding to the epoll set with epoll_ctl(). We combine this with the ability to do real blocking accept() calls under 1.9 with "wake one" behavior[1] in the Linux kernel, we can expect less contention and fairer load balancing across multiple acceptors/processes. The behavior I'm describing with multi-threading epoll isn't possible with poll() or select(). I'm unsure about kqueue, nor do I know if *BSDs implement "wake one" behavior with blocking accept() in the kernel... [1] http://www.citi.umich.edu/projects/linux-scalability/reports/accept.html -- 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