[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20180604.171322.1606407695103241154.davem@davemloft.net>
Date: Mon, 04 Jun 2018 17:13:22 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: zenczykowski@...il.com
Cc: maze@...gle.com, edumazet@...gle.com, netdev@...r.kernel.org,
ncardwell@...gle.com, ycheng@...gle.com, weiwan@...gle.com
Subject: Re: [PATCH] net-tcp: extend tcp_tw_reuse sysctl to enable loopback
only optimization
From: "Maciej Żenczykowski" <zenczykowski@...il.com>
Date: Sun, 3 Jun 2018 10:41:17 -0700
> From: Maciej Żenczykowski <maze@...gle.com>
>
> This changes the /proc/sys/net/ipv4/tcp_tw_reuse from a boolean
> to an integer.
>
> It now takes the values 0, 1 and 2, where 0 and 1 behave as before,
> while 2 enables timewait socket reuse only for sockets that we can
> prove are loopback connections:
> ie. bound to 'lo' interface or where one of source or destination
> IPs is 127.0.0.0/8, ::ffff:127.0.0.0/104 or ::1.
>
> This enables quicker reuse of ephemeral ports for loopback connections
> - where tcp_tw_reuse is 100% safe from a protocol perspective
> (this assumes no artificially induced packet loss on 'lo').
>
> This also makes estblishing many loopback connections *much* faster
> (allocating ports out of the first half of the ephemeral port range
> is significantly faster, then allocating from the second half)
>
> Without this change in a 32K ephemeral port space my sample program
> (it just establishes and closes [::1]:ephemeral -> [::1]:server_port
> connections in a tight loop) fails after 32765 connections in 24 seconds.
> With it enabled 50000 connections only take 4.7 seconds.
>
> This is particularly problematic for IPv6 where we only have one local
> address and cannot play tricks with varying source IP from 127.0.0.0/8
> pool.
>
> Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
Applied, thank you.
Powered by blists - more mailing lists