From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.76.159.169 with SMTP id xd9csp146409oab; Mon, 14 Jul 2014 21:09:47 -0700 (PDT) Return-Path: Received-SPF: pass (google.com: domain of rack-devel+bncBD75LW742ECRBC6TSKPAKGQE6REH4XA@googlegroups.com designates 10.140.51.18 as permitted sender) client-ip=10.140.51.18 Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncBD75LW742ECRBC6TSKPAKGQE6REH4XA@googlegroups.com designates 10.140.51.18 as permitted sender) smtp.mail=rack-devel+bncBD75LW742ECRBC6TSKPAKGQE6REH4XA@googlegroups.com; dkim=pass header.i=@googlegroups.com X-Received: from mr.google.com ([10.140.51.18]) by 10.140.51.18 with SMTP id t18mr29124qga.27.1405397387710 (num_hops = 1); Mon, 14 Jul 2014 21:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; bh=MTKBMFjq0qM4rHrB6CxglDkOR/nX3lxEJAJo5WUoZK4=; b=UbRHGjPy1UZAsBKnI6PN4zxjn01YwxaAErk5kfPRZbAp39SWDKho7VxmmbeDfumg+7 qNcpgVqFcXr6JMPdd+8WZa8Y/LbYNwR2nCklMP8wsjq8n0zNJYqXCaUSXU2TCKjc0b27 hTzU//XBCZwIsOexqtmrS2T2cHiaOobKNMk2mBTVNKtgdTOomjSYgaPTCkx6pe2ysNJH YlBffn7Iywam5wtPPWuXI7kHuXcexOjj5OvWIUS07eq0UNLQlcenqIJpYoyvC+4I7fRQ QweNiaibrnLmNGrULHR+OcUeBwqPMV/LKMBqu03im9/E1w7LxU1o6TksbBjv4hcsXDVS ZxPg== X-Received: by 10.140.51.18 with SMTP id t18mr3674qga.27.1405397387579; Mon, 14 Jul 2014 21:09:47 -0700 (PDT) X-BeenThere: rack-devel@googlegroups.com Received: by 10.140.92.140 with SMTP id b12ls881236qge.88.gmail; Mon, 14 Jul 2014 21:09:46 -0700 (PDT) X-Received: by 10.236.168.101 with SMTP id j65mr8687883yhl.30.1405397386902; Mon, 14 Jul 2014 21:09:46 -0700 (PDT) Received: from mail-ob0-x232.google.com (mail-ob0-x232.google.com [2607:f8b0:4003:c01::232]) by gmr-mx.google.com with ESMTPS id k15si697627igt.1.2014.07.14.21.09.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Jul 2014 21:09:46 -0700 (PDT) Received-SPF: pass (google.com: domain of jftucker@gmail.com designates 2607:f8b0:4003:c01::232 as permitted sender) client-ip=2607:f8b0:4003:c01::232; Received: by mail-ob0-x232.google.com with SMTP id nu7so5213591obb.37 for ; Mon, 14 Jul 2014 21:09:46 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.79.104 with SMTP id i8mr12579437oex.67.1405397386730; Mon, 14 Jul 2014 21:09:46 -0700 (PDT) Received: by 10.76.71.197 with HTTP; Mon, 14 Jul 2014 21:09:46 -0700 (PDT) In-Reply-To: <20131106031207.GA4213@dcvr.yhbt.net> References: <1380755407-40487-1-git-send-email-ruby@tmm1.net> <5F09D3FD-B53A-4166-9F63-438F075E4A7C@finn.de> <20131029175419.GA14881@dcvr.yhbt.net> <20131106025752.GA1712@dcvr.yhbt.net> <20131106031207.GA4213@dcvr.yhbt.net> Date: Mon, 14 Jul 2014 21:09:46 -0700 Message-ID: Subject: Re: [PATCH] builder: avoid to_app on every request when using map From: James Tucker To: rack-devel@googlegroups.com Cc: Aman Gupta X-Original-Sender: jftucker@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jftucker@gmail.com designates 2607:f8b0:4003:c01::232 as permitted sender) smtp.mail=jftucker@gmail.com; dkim=pass header.i=@gmail.com; dmarc=pass (p=NONE dis=NONE) header.from=gmail.com Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: X-Google-Group-Id: 486215384060 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Content-Type: multipart/alternative; boundary=089e0118289a01237904fe339433 --089e0118289a01237904fe339433 Content-Type: text/plain; charset=UTF-8 Thanks! On Tue, Nov 5, 2013 at 7:12 PM, Eric Wong wrote: > Eric Wong wrote: > > Eric Wong wrote: > > > James Tucker wrote: > > > > Yeah, Builder#call leads to mistakes all the time and then people > claiming > > > > performance sucks. I don't think the simple use case there ever > helped. > > > > > > Just curious, is this in test suites or code running on live servers? > > > I can't imagine there are many one-off webservers existing and using > > > that directly... > > > > Answering my own question, the "map" directive in Builder seems to > > trigger Builder#to_app in every single request. > > > > It looks like map completely defeats warmup and preloading... > > OK, I can't tell if my this has any bad side effects (specs pass!), > but I'm already running this on yhbt.net: > > From: Eric Wong > Date: Wed, 6 Nov 2013 03:02:48 +0000 > Subject: [PATCH] builder: avoid to_app on every request when using map > > By calling to_app immediately after initializing the per-map > Rack::Builder instances. Otherwise, benefits of warmup and web > servers taking advantage of CoW are lost. > > This passes tests, and is lightly tested and I have not verified > this for any negative consequences or incompatibilities. > --- > lib/rack/builder.rb | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/rack/builder.rb b/lib/rack/builder.rb > index fa3a1ea..2aa37b6 100644 > --- a/lib/rack/builder.rb > +++ b/lib/rack/builder.rb > @@ -157,7 +157,7 @@ module Rack > > def generate_map(default_app, mapping) > mapped = default_app ? {'/' => default_app} : {} > - mapping.each { |r,b| mapped[r] = self.class.new(default_app, &b) } > + mapping.each { |r,b| mapped[r] = self.class.new(default_app, > &b).to_app } > URLMap.new(mapped) > end > end > -- > The following changes since commit > df1506b0825a096514fcb3821563bf9e8fd52743: > > Merge pull request #617 from tmm1/builder-warmup (2013-10-25 21:10:40 > -0700) > > are available in the git repository at: > > git://git.bogomips.org/rack.git builder-map-to_app > > for you to fetch changes up to fd023bafed0ad97e08d15381f35600e3a5b32808: > > builder: avoid to_app on every request when using map (2013-11-06 > 03:08:38 +0000) > > ---------------------------------------------------------------- > Eric Wong (1): > builder: avoid to_app on every request when using map > > -- > > --- > You received this message because you are subscribed to the Google Groups > "Rack Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rack-devel+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- --- You received this message because you are subscribed to the Google Groups "Rack Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout. --089e0118289a01237904fe339433 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks!


On Tue, Nov 5, 2013 at 7:12 PM, Eric Wong <normalpers= on@yhbt.net> wrote:
Eric Wong <normalperson@yhbt.net> wrote:
> Eric Wong <normalperson@yh= bt.net> wrote:
> > James Tucker <jftucker@g= mail.com> wrote:
> > > Yeah, Builder#call leads to mistakes all the time and then p= eople claiming
> > > performance sucks. I don't think the simple use case the= re ever helped.
> >
> > Just curious, is this in test suites or code running on live serv= ers?
> > I can't imagine there are many one-off webservers existing an= d using
> > that directly...
>
> Answering my own question, the "map" directive in Builder se= ems to
> trigger Builder#to_app in every single request.
>
> It looks like map completely defeats warmup and preloading...

OK, I can't tell if my this has any bad side effects (specs pass!),
but I'm already running this on yhbt.net:

From: Eric Wong <normalperson@y= hbt.net>
Date: Wed, 6 Nov 2013 03:02:48 +0000
Subject: [PATCH] builder: avoid to_app on every request when using map

By calling to_app immediately after initializing the per-map
Rack::Builder instances. =C2=A0Otherwise, benefits of warmup and web
servers taking advantage of CoW are lost.

This passes tests, and is lightly tested and I have not verified
this for any negative consequences or incompatibilities.
---
=C2=A0lib/rack/builder.rb | 2 +-
=C2=A01 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rack/builder.rb b/lib/rack/builder.rb
index fa3a1ea..2aa37b6 100644
--- a/lib/rack/builder.rb
+++ b/lib/rack/builder.rb
@@ -157,7 +157,7 @@ module Rack

=C2=A0 =C2=A0 =C2=A0def generate_map(default_app, mapping)
=C2=A0 =C2=A0 =C2=A0 =C2=A0mapped =3D default_app ? {'/' =3D> de= fault_app} : {}
- =C2=A0 =C2=A0 =C2=A0mapping.each { |r,b| mapped[r] =3D self.class.new(def= ault_app, &b) }
+ =C2=A0 =C2=A0 =C2=A0mapping.each { |r,b| mapped[r] =3D self.class.new(def= ault_app, &b).to_app }
=C2=A0 =C2=A0 =C2=A0 =C2=A0URLMap.new(mapped)
=C2=A0 =C2=A0 =C2=A0end
=C2=A0 =C2=A0end
--
The following changes since commit df1506b0825a096514fcb3821563bf9e8fd52743= :

=C2=A0 Merge pull request #617 from tmm1/builder-warmup (2013-10-25 21:10:4= 0 -0700)

are available in the git repository at:

=C2=A0 git://git.bogomips.org/rack.git builder-map-to_app

for you to fetch changes up to fd023bafed0ad97e08d15381f35600e3a5b32808:
=C2=A0 builder: avoid to_app on every request when using map (2013-11-06 03= :08:38 +0000)

----------------------------------------------------------------
Eric Wong (1):
=C2=A0 =C2=A0 =C2=A0 builder: avoid to_app on every request when using map<= br>
--

---
You received this message because you are subscribed to the Google Groups &= quot;Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to rack-d= evel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--

---
You received this message because you are subscribed to the Google Groups &= quot;Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to rack-dev= el+unsubscribe@googlegroups.com.
For more options, visit http= s://groups.google.com/d/optout.
--089e0118289a01237904fe339433--