mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Karl Pickett" <karl.pickett@gmail.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: tcp_tw_recycle broken?
Date: Sat, 15 Nov 2008 02:29:27 -0500	[thread overview]
Message-ID: <f9be06770811142329x7d6dcb89vd573962970d503b3@mail.gmail.com> (raw)
In-Reply-To: <20081115055748.GY24654@1wt.eu>

On Sat, Nov 15, 2008 at 12:57 AM, Willy Tarreau <w@1wt.eu> wrote:
> On Fri, Nov 14, 2008 at 11:37:06PM -0500, Karl Pickett wrote:
>> Hey.  Developing a http proxy on fedora 9 (2.6.25) and running into a
>> strange issue.
>>
>> Having the proxy set up and tear down 6000 tcp connections a second to
>> the same test server ip and port,
>> it quickly blows up (5 seconds) due to all 30000 ephemeral ports going
>> to TIME_WAIT.
>> setting tw_recycle=1 fixed the problem, and there are never more than
>> a couple hundred ports in TIME_WAIT.
>>
>> BUT...
>>
>> Changing the load test to alternate between two test server ips, it
>> blows up.  Connect: can't assign requested address. (note I am not
>> binding before hand, I tried
>> and binding first to port 0 made no difference - it just blows up then
>> during the bind).
>>
>> And there are ~28K ports in TIME_WAIT.  For example:
>>
>> proxy_ip:30000 load_test_1:8080 TIME_WAIT
>> proxy_ip:30000 load_test_2:8080 TIME_WAIT
>> ...
>> but most are not duplicates of the same local port.
>>
>>
>> What. The.  Heck.
>>
>> So short of rebuilding the kernel with time_wait as 1 second, is there
>> any other way not to brick my proxy?
>
> two things :
>  - set tcp_tw_reuse to 1 too.
>  - do a setsockopt(SO_REUSEADDR) before connect()
>
> Using this, my proxy has no problem at 35K sess/s on 2.6.25. I'm not sure
> if disabling either option above still works.
>
> Hoping this helps,
> Willy
>
>

Thanks for the help.  Well, it looks like tw_reuse is what I wanted...
not tw_recycle.  Based on a python test program over loopback,
tw_reuse alone solves the problem... so_reuseaddr doesn't do anything.
 And apparently the tcp code is too much for me...looking at the
source I thought tw_reuse only can happen when timestamps are enabled.
 But even after disabling timestamps tw_reuse still works over
loopback.

I'll have to wait until Monday to try it again in the lab.  I was
trying combinations of tw_reuse and recycle, too many to remember
apparently.

May I just confirm.. is tcp_tw_reuse NOT dependent on receiving timestamps?


-- 
Karl Pickett

  reply	other threads:[~2008-11-15  7:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-15  4:37 Karl Pickett
2008-11-15  5:57 ` Willy Tarreau
2008-11-15  7:29   ` Karl Pickett [this message]
2008-11-15 13:09     ` Andi Kleen
2008-11-15 15:47       ` Karl Pickett
2008-11-15 15:52         ` Willy Tarreau
     [not found]   ` <f9be06770811142325j79ca0831j7d5820716199811@mail.gmail.com>
2008-11-15  7:45     ` Willy Tarreau

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=f9be06770811142329x7d6dcb89vd573962970d503b3@mail.gmail.com \
    --to=karl.pickett@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®