[YBA] TCP connection rate

[YBA] TCP connection rate

Jonathan Ben Avraham yba at tkos.co.il
Tue Feb 3 12:49:22 IST 2009


Super!

On Tue, 3 Feb 2009, Gilad Ben-Yossef wrote:

> Date: Tue, 03 Feb 2009 10:25:14 +0200
> From: Gilad Ben-Yossef <gilad at codefidence.com>
> To: Jonathan Ben Avraham <yba at tkos.co.il>
> Cc: marc at swiftouch.com, ILUG <linux-il at cs.huji.ac.il>
> Subject: Re: [YBA] TCP connection rate
> 
> Jonathan Ben Avraham wrote:
>
>> Hi Marc,
>> The .NET client has a bug that prevents use of persistent MySQL 
>> connections. The application is already cached up the wazoo.
>> 
>> Where would I look in the kernel to see if it is rejecting the connections 
>> as opposed to MySQL? Or is this just unlikely given that the hardware is 
>> fairly robust?
>
> I don't know of a way to get the statistics from the kernel for that, but 
> maybe this will help:
>
> "The duration that affects the rate at which new connections are accepted is 
> the time spent on the queue of pending incoming connections. This duration is 
> equal to the round trip time for the SYN|ACK message and its ACK response 
> plus the time taken for the client to process the SYN|ACK message plus the 
> delay for the server to process the ACK and call *accept()*.
>
> The rate at which new connections can be accepted is equal to the number of 
> entries which can fit on the listen queue divided by the average length of 
> time each entry spends on the queue. Therefore, the larger the queue, the 
> greater the rate at which new connection requests can be accepted."
>
>
> http://www.linuxjournal.com/files/linuxjournal.com/linuxjournal/articles/023/2333/2333s2.html
>
>> Thanks,
>>
>>  - yba
>> 
>> 
>> On Mon, 2 Feb 2009, marc at swiftouch.com wrote:
>> 
>>> Date: Mon, 2 Feb 2009 18:28:21 +0200 (IST)
>>> From: marc at swiftouch.com
>>> To: Jonathan Ben Avraham <yba at tkos.co.il>
>>> Cc: Gilad Ben-Yossef <gilad at codefidence.com>, ILUG 
>>> <linux-il at cs.huji.ac.il>
>>> Subject: Re: [YBA] TCP connection rate
>>> 
>>> Hi all
>>> 
>>> Without delving into the stack behaviour, I would try the (potentially) 
>>> cheaper route - is there a possibility of amalgamating queries to the 
>>> database, thereby reducing the per second metric? Or - perish the thought 
>>> (caveat emptor, I am not acquainted with the app) - caching replies at the 
>>> client?
>>> 
>>> I am not sure the netstat trick can work in this case - both since (as YBA 
>>> noted) the connexions are brief and because netstat deals with connections 
>>> very late in their lifecycle. I am not sure how connexions pending on the 
>>> stack would show up.
>>> 
>>> M
>>> 
>>> ---MAV
>>> Marc. Volovic
>>> +972-54-467-6764
>>> marc at swiftouch.com
>>> Sent from my iPhone
>>> 
>>> On Feb 2, 2009, at 5:06 PM, Jonathan Ben Avraham <yba at tkos.co.il> wrote:
>>> 
>>>> Hi Gilad,
>>>> Thanks. The problem is that the connections are exceedingly short-lived. 
>>>> By the time I type in "netstat -na" already 1000 of them have come and 
>>>> gone.
>>>> 
>>>> - yba
>>>> 
>>>> 
>>>> On Mon, 2 Feb 2009, Gilad Ben-Yossef wrote:
>>>> 
>>>>> Date: Mon, 02 Feb 2009 16:29:23 +0200
>>>>> From: Gilad Ben-Yossef <gilad at codefidence.com>
>>>>> To: Jonathan Ben Avraham <yba at tkos.co.il>
>>>>> Cc: ILUG <linux-il at cs.huji.ac.il>
>>>>> Subject: Re: [YBA] TCP connection rate
>>>>> Jonathan Ben Avraham wrote:
>>>>> 
>>>>>> Dear list members,
>>>>>> What limits the rate that the Linux kernel TCP stack can accept new 
>>>>>> connections? How is that rate related to the rate that the application 
>>>>>> listening on a port can handle the connections? That is, if I try to 
>>>>>> connect and get ECONNREFUSED is there a way for me to know if I got it 
>>>>>> because the kernel could not handle the connection rate or if I got it 
>>>>>> because I had more connection attempts than the backlog parameter of my 
>>>>>> listen() call? In other words, do I need to tune the kernel or the 
>>>>>> application (MySQL) for the desired high connection rate and how would 
>>>>>> I know?
>>>>> 
>>>>> Just check what the value of the backlog parameter is and then use 
>>>>> netstat to watch the application connections when you get ECONNREFUSED 
>>>>> error. If the number of connections in netstat is equal (or at least 
>>>>> very close to) the backlog parameter then it's the backlog parameter, 
>>>>> otherwise it's something else.
>>>>> 
>>>>> Gilad
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA    ~. .~   Tk Open 
>>>> Systems
>>>> =}------------------------------------------------ooO--U--Ooo------------{=
>>>>    - yba at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
>>>> 
>>>> _______________________________________________
>>>> Linux-il mailing list
>>>> Linux-il at cs.huji.ac.il
>>>> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>> 
>
>
>

-- 
  EE 77 7F 30 4A 64 2E C5  83 5F E7 49 A6 82 29 BA    ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
      - yba at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -



More information about the Linux-il mailing list