From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A11FB2018B for ; Sat, 25 Jun 2016 00:45:35 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/4] http: cork chunked responses for small savings Date: Sat, 25 Jun 2016 00:45:33 +0000 Message-Id: <20160625004533.5061-5-e@80x24.org> In-Reply-To: <20160625004533.5061-1-e@80x24.org> References: <20160625004533.5061-1-e@80x24.org> List-Id: This only affects Linux users with MSG_MORE support. We can avoid extra TCP overhead for sub-optimal chunk sizes by using MSG_MORE even with chunk trailers under Linux. This breaks real-time apps which require <= 200ms latency for streaming small packets (e.g. implementing "tail -F"), but the public-inbox WWW code does not (and will never) do such things. --- lib/PublicInbox/HTTP.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index c141fc8..e19c592 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -223,7 +223,10 @@ sub chunked_wcb ($) { return if $_[0] eq ''; more($self, sprintf("%x\r\n", bytes::length($_[0]))); more($self, $_[0]); - $self->write("\r\n"); + + # use $self->write("\n\n") if you care about real-time + # streaming responses, public-inbox WWW does not. + more($self, "\r\n"); } }