From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 68886633817; Sat, 20 Dec 2014 22:25:15 +0000 (UTC) Date: Sat, 20 Dec 2014 22:25:15 +0000 From: Eric Wong To: yahns-public@yhbt.net Subject: Re: [PATCH] preliminary HTTP/2 support for Rack 1.x apps Message-ID: <20141220222515.GA28045@dcvr.yhbt.net> References: <1419048706-32113-1-git-send-email-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1419048706-32113-1-git-send-email-e@80x24.org> List-Id: Eric Wong wrote: > +++ b/examples/yahns_http2_rack1.conf.rb > +app(:rack, "config.ru", preload: false) do > + protocols "http", "http2" Maybe the new config option should actually be something like: queue(protocol: 'http2') do backlog 128 worker_threads 8 end This means we'd have a third type of thread pool... > +++ b/lib/yahns/http2_rack1.rb > + stream.on(:half_close) do > + log.info "dispatch: #{req.inspect}" > + req = rack_env_for(req, input) > + h2_res_emit(stream, *self.class.app.call(req)) > + end And maybe enqueue work here: stream.on(:half_close) do @http2_queue.push([stream, req, input]) end And making h2_res_emit thread-safe when called from another thread. This would also make lazy, synchronous reading of rack.input for TeeInput/StreamInput easier. And yeah, the whole SPDY/HTTP-2 thing of reinventing a multi-stream socket layer inside of TCP connections smells bad to me.