Re: TCP Tuning for HTTP

Daniel Stenberg <daniel@haxx.se> Sat, 07 November 2015 14:51 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 294CF1B345D for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Sat, 7 Nov 2015 06:51:22 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.312
X-Spam-Level:
X-Spam-Status: No, score=-6.312 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, J_CHICKENPOX_37=0.6, RCVD_IN_DNSWL_HI=-5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EItA-zibg5xI for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Sat, 7 Nov 2015 06:51:19 -0800 (PST)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CAC7A1A8F35 for <httpbisa-archive-bis2Juki@lists.ietf.org>; Sat, 7 Nov 2015 06:51:19 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1Zv4lj-00071Z-CT for ietf-http-wg-dist@listhub.w3.org; Sat, 07 Nov 2015 14:47:03 +0000
Resent-Date: Sat, 07 Nov 2015 14:47:03 +0000
Resent-Message-Id: <E1Zv4lj-00071Z-CT@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <daniel@haxx.se>) id 1Zv4ld-00070s-Ev for ietf-http-wg@listhub.w3.org; Sat, 07 Nov 2015 14:46:57 +0000
Received: from giant.haxx.se ([80.67.6.50]) by maggie.w3.org with esmtp (Exim 4.80) (envelope-from <daniel@haxx.se>) id 1Zv4la-0000Pv-Rz for ietf-http-wg@w3.org; Sat, 07 Nov 2015 14:46:56 +0000
Received: from giant.haxx.se (localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-7) with ESMTP id tA7EkUrJ027789 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 7 Nov 2015 15:46:30 +0100
Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id tA7EkS5i027783; Sat, 7 Nov 2015 15:46:28 +0100
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Sat, 07 Nov 2015 15:46:28 +0100
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: Cory Benfield <cory@lukasa.co.uk>
cc: HTTP Working Group <ietf-http-wg@w3.org>
In-Reply-To: <88103DD2-02E7-4265-BC2B-F4526A15FC54@lukasa.co.uk>
Message-ID: <alpine.DEB.2.11.1511061651370.19082@tvnag.unkk.fr>
References: <alpine.DEB.2.11.1511061128150.19082@tvnag.unkk.fr> <88103DD2-02E7-4265-BC2B-F4526A15FC54@lukasa.co.uk>
User-Agent: Alpine 2.11 (DEB 23 2013-08-11)
X-fromdanielhimself: yes
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="1129329158-474755882-1446825997=:19082"
Content-ID: <alpine.DEB.2.11.1511071538180.7567@tvnag.unkk.fr>
Received-SPF: pass client-ip=80.67.6.50; envelope-from=daniel@haxx.se; helo=giant.haxx.se
X-W3C-Hub-Spam-Status: No, score=-6.2
X-W3C-Hub-Spam-Report: AWL=0.016, BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: maggie.w3.org 1Zv4la-0000Pv-Rz 2b59bc9e538ec94077a18be2ffb3c3c0
X-Original-To: ietf-http-wg@w3.org
Subject: Re: TCP Tuning for HTTP
Archived-At: <http://www.w3.org/mid/alpine.DEB.2.11.1511061651370.19082@tvnag.unkk.fr>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/30451
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

On Fri, 6 Nov 2015, Cory Benfield wrote:

>> [1] = https://www.ietf.org/id/draft-stenberg-httpbis-tcp-00.txt
>
> The first draft looks great! This is a really good start. I have a few small 
> stylistic changes that I’ll propose as PRs to your repo, but wanted to add 
> some more detail for stuff that seems missing or needs elaboration.

The draft is on github and can be found here:
    https://github.com/bagder/I-D/blob/gh-pages/httpbis-tcp/draft.md

> 1. net.core.somaxconn
>
> I did some digging here because I was interested in how this interacted with 
> the ‘backlog’ parameter to listen(). It seems that, on Linux, 
> net.core.somaxconn represents the maximum value. This means that the maximum 
> backlog on a listening socket is min(backlog, somaxconn). It would probably 
> help to elaborate this section, but elaborating that section probably 
> doesn’t make sense without also talking about the backlog argument to 
> listen() itself. I’m willing to submit some text for that if you’re 
> interested.

I'm interested! Please suggest improvements to whatever section you think you 
can improve. I'm here to help producing a document to help current and future 
implementers and I willingly take all the help I can get.

> Your description of somaxconn (“the number of incoming TCP SYNs allowed to 
> backlog”) is not actually accurate, I don’t think, because of the next 
> section.

Nah, it is a bit too simplistic I guess. I also didn't want to make a document 
that only lists lots of Linux-specific details but rather wanted to mention 
that there can be limits "in this style". I'm sure that limit will work 
slightly different in other operating systems.

I also try to avoid exact numbers in the document for that reason. Also 
because fixed limits tend to grow old very fast while general advice may live 
on longer.

> 2. tcp_max_syn_backlog
>
> You don’t mention the setting related to net.core.somaxconn, which is 
> net.ipv4.tcp_max_syn_backlog.

Correct or not, I was thinking the specific SYN (flood) handling would be 
better referred to RFC 4987. You think this option is worth mentioning 
explicitly in this document?

> 3. Separate into client, server, and both optimisations.

I've struggled back and forth on how to group the different suggestions and I 
don't think I've found the perfect layout just yet. I'm not sure it will be 
that easy to make separate sections for client, server or both and have the 
text flow naturally. Maybe it is enough to just mention the different target 
use cases in the text when they are clearly distinct?

It also most likely varies a lot depending what kind of servers or clients 
we're talking about.

Thanks a lot for your feedback and help!

-- 

  / daniel.haxx.se