netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Howard Chu <hyc@symas.com>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: netdev@vger.kernel.org
Subject: Re: TCP 2MSL on loopback
Date: Tue, 06 Mar 2007 01:22:18 -0800	[thread overview]
Message-ID: <45ED32CA.5080709@symas.com> (raw)
In-Reply-To: <200703051528.02564.dada1@cosmosbay.com>

Eric Dumazet wrote:
> On Monday 05 March 2007 12:20, Howard Chu wrote:
>> Why is the Maximum Segment Lifetime a global parameter? Surely the
>> maximum possible lifetime of a particular TCP segment depends on the
>> actual connection. At the very least, it would be useful to be able to
>> set it on a per-interface basis. E.g., in the case of the loopback
>> interface, it would be useful to be able to set it to a very small
>> duration.
> 
> Hi Howard
> 
> I think you should address these questions on netdev instead of linux-kernel.

OK, I just subscribed to netdev...

>> As I note in this draft
>> http://www.ietf.org/internet-drafts/draft-chu-ldap-ldapi-00.txt
>> when doing a connection soak test of OpenLDAP using clients connected
>> through localhost, the entire port range is exhausted in well under a
>> second, at which point the test stalls until a port comes out of
>> TIME_WAIT state so the next connection can be opened.
>>
>> These days it's not uncommon for an OpenLDAP slapd server to handle tens
>> of thousands of connections per second in real use (e.g., at Google, or
>> at various telcos). While the LDAP server is fast enough to saturate
>> even 10gbit ethernet using contemporary CPUs, we have to resort to
>> multiple virtual interfaces just to make sure we have enough port
>> numbers available.

> I dont uderstand... doesnt slapd server listen for connections on a given 
> port, like http ? Or is it doing connections like a ftp server ?

No, you're right, it listens on a single port. There is a standard port 
(389) though of course you can use any port you want.
> 
> Of course, if you want to open more than 60.000 concurrent connections, using 
> 127.0.0.1 address, you might have a problem...

This is probably not something that happens in real world deployments. I 
But it's not 60,000 concurrent connections, it's 60,000 within a 2 
minute span.

I'm not saying this is a high priority problem, I only encountered it in 
a test scenario where I was deliberately trying to max out the server.

>> Ideally the 2MSL parameter would be dynamically adjusted based on the
>> route to the destination and the weights associated with those routes.
>> In the simplest case, connections between machines on the same subnet
>> (i.e., no router hops involved) should have a much smaller default value
>> than connections that traverse any routers. I'd settle for a two-level
>> setting - with no router hops, use the small value; with any router hops
>> use the large value.
> 
> Well, is it really a MSL problem ?

> I did a small test (linux-2.6.21-rc1) and was able to get 1.000.000 
> connections on localhost on my dual proc machine in one minute, without an 
> error.

It's a combination of 2MSL and /proc/sys/net/ipv4/ip_local_port_range - 
on my system the default port range is 32768-61000. That means if I use 
up 28232 ports in less than 2MSL then everything stops. netstat will 
show that all the available port numbers are in TIME_WAIT state. And 
this is particularly bad because while waiting for the timeout, I can't 
initiate any new outbound connections of any kind at all - telnet, ssh, 
whatever, you have to wait for at least one port to free up. 
(Interesting denial of service there....)

Granted, I was running my test on 2.6.18, perhaps 2.6.21 behaves 
differently.

-- 
   -- Howard Chu
   Chief Architect, Symas Corp.  http://www.symas.com
   Director, Highland Sun        http://highlandsun.com/hyc
   Chief Architect, OpenLDAP     http://www.openldap.org/project/

  parent reply	other threads:[~2007-03-06 10:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <45EBFD13.1060106@symas.com>
2007-03-05 14:28 ` TCP 2MSL on loopback Eric Dumazet
2007-03-05 15:09   ` [PATCH] twcal_jiffie should be unsigned long, not int Eric Dumazet
2007-03-05 21:33     ` David Miller
2007-03-06  9:22   ` Howard Chu [this message]
2007-03-06 10:42     ` TCP 2MSL on loopback Eric Dumazet
2007-03-06 18:39       ` Howard Chu
2007-03-06 20:07         ` Eric Dumazet
2007-03-06 20:28           ` Howard Chu
2007-03-06 20:39             ` Eric Dumazet
2007-03-06 21:05               ` Howard Chu
2007-03-06 21:25                 ` Rick Jones
2007-03-06 21:35                   ` David Miller
2007-03-06 22:07                     ` Howard Chu
2007-03-06 22:54                       ` Stephen Hemminger
2007-03-06 23:22                         ` Howard Chu
2007-03-06 18:04     ` David Miller
2007-03-06 18:46     ` Rick Jones
2007-03-06 19:25       ` Howard Chu
2007-03-06 20:41         ` Rick Jones
2007-03-07  3:36           ` Howard Chu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45ED32CA.5080709@symas.com \
    --to=hyc@symas.com \
    --cc=dada1@cosmosbay.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).