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: AS33070 50.56.128.0/17 X-Spam-Status: No, score=0.5 required=3.0 tests=AWL,FROM_LOCAL_NOVOWEL, MIME_QP_LONG_LINE,MSGID_FROM_MTA_HEADER,TVD_RCVD_IP shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Damian Janowski Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: Out of band stuff? Date: Tue, 10 Apr 2012 17:24:56 -0300 Message-ID: References: <20120409030552.GA24089@dcvr.yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1334089505 24516 80.91.229.3 (10 Apr 2012 20:25:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 10 Apr 2012 20:25:05 +0000 (UTC) Cc: Rainbows! list To: Eric Wong Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Tue Apr 10 22:25:04 2012 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Bl+zQieL77gpGQObCpHy3xTko6hBYxMOSqE464chqkY=; b=Wmw5xf7Xv1488evoiYAgDXGZ07SZVKfnzbAhu/cCXcRx5sdwDOyrBDjofNw4DlA4K5 zYO8nfQnag73JcScKyUCV0S3clrFGaEci6S/POBI42h4nBGVUfa0SfS5VZbUb+DrHQuF mDJxZ8sz3B8LYWMXFAe3/j4MXw+VsJ9cnJ2pWMzwjf3q7cLtJ7UiNWRObuPgHRxs9xdn kAhdggjsrrSv/ldKXpdYAcPA1RRf4Fn0IYsR5h+7yNVvUriQbdEJxgGgdDNNSc9pjC+C DLQ3b+TSAPmOzQr7DOG5nAqvwDvdRoS27SWi+ohqVt8QzC4ctGhWNXDW7Qqxlvs19+2P HMnQ== In-Reply-To: <20120409030552.GA24089-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org> X-Google-Sender-Auth: Dt5vspc-2qXTeIZgGg_8_r_873I 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:339 Archived-At: Received: from 50-56-192-79.static.cloud-ips.com ([50.56.192.79] helo=rubyforge.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SHhcc-0005dJ-Ot for gclrrg-rainbows-talk@m.gmane.org; Tue, 10 Apr 2012 22:25:02 +0200 Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id ECA4826302F; Tue, 10 Apr 2012 20:25:00 +0000 (UTC) Received: from mail-lpp01m010-f50.google.com (mail-lpp01m010-f50.google.com [209.85.215.50]) by rubyforge.org (Postfix) with ESMTP id D61AE26302F for ; Tue, 10 Apr 2012 20:24:57 +0000 (UTC) Received: by lahm13 with SMTP id m13so192278lah.23 for ; Tue, 10 Apr 2012 13:24:56 -0700 (PDT) Received: by 10.152.125.41 with SMTP id mn9mr16095836lab.30.1334089496762; Tue, 10 Apr 2012 13:24:56 -0700 (PDT) Received: by 10.112.81.226 with HTTP; Tue, 10 Apr 2012 13:24:56 -0700 (PDT) On Mon, Apr 9, 2012 at 12:05 AM, Eric Wong wrote: > If you look at the `call' method in raindrops/watcher.rb, the important > line is this: > > =A0 =A0 =A0 =A0# @start is a Mutex and @thr is nil in the initialize meth= od. > > =A0 =A0 =A0 =A0-d7HPF+t6YlILr15SpQP/1rNAH6kLmebB@public.gmane.org { @thr ||=3D aggregator_thread(env["rac= k.logger"]) } > > I avoid starting the background thread at initialization because it'll > die on fork (meaning I'd have to recheck it all the time, anyways). > > The overhead of Mutex#synchronize and @thr||=3D assignment is negligible > in most apps. One more question. Can you confirm that this technique doesn't work as expected using Rainbows/ThreadPool? I've found that Rack::Builder creates a new instance of each middleware on every request, so you'd end up spawning infinite aggregator threads. _______________________________________________ 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