Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.networking > #2102

Re: linux networking buffer

From Surinder <surinder@esurinder.net>
Newsgroups comp.os.linux.networking
Subject Re: linux networking buffer
Date 2013-04-09 10:20 +0530
Organization Netfront http://www.netfront.net/
Message-ID <51639E02.1020606@esurinder.net> (permalink)
References <GYD5t.74113$mC2.37021@newsfe29.iad> <kjngb1$aum$1@usenet01.boi.hp.com>

Show all headers | View raw


Rick Jones wrote:
> Surinder <Surinder.Singh@example.net> wrote:
>> These are my buffer values
>> RX(200), backlog(1000), net.core.rmem_max = 131071, SO_RCVBUF :262142
> 
>> packet sniffer got all 1000 reply packets.
>> packet size is about 100byte on wire and 84byte with IP header. so
>> 262142 should easily hold 2600 packets without drop.
> 
> Except that Linux socket buffer limits are applied to not just the
> packet headers/data but also the size of the buffer(s) used to hold
> the data.  So, if the NIC driver happens to post 2048 byte buffers to
> the card, that 262141 bytes would be able to hold no more than 127
> packets.  So, my guess would be that your receiver wasn't keeping-up
> with all the replies coming-in and lost the race a few times.

Rick,
Thanks for reply.
SO_RCVBUF of 262141 may be coming into picture after kernel got the 
packet and putting it into socket specific queues. I understand that
you are suggesting that total packet capacity is calculated based on
some constant size for the packet. But that would lead to wastage of
memory when the packet size are small. as tcp or udp is 65K.
buffer of 262141 could hold 4 packets of 65K each.

> 
>> changing RX didn't make difference.
> 
> Suggesting that the "queue" which overflows is not the NIC's RX
> queue(s).
Agree.

> 
>> on increasing rmem_max, all 1000 are received though.
>> There was no other traffic to the collector (as verified by packet 
>> capture tool).
> 
> That would be consistent then with the increased rmem_max size being
> sufficient to cover those cases where your receiver wasn't able to
> keep-up for a short length of time.

I got my program working properly with bigger buffer size, just that I 
want to optimise on buffer size. huge size of rmem_max could mean more
non-pagable memory reserved for kernel itself. not that I am running low
on RAM but just want to be conservative.

> 
> If your application is simply sending all 1000 requests and *then*
> looking to receive/process replies, you should alter the logic of your
> application to be able to also look for replies as you are sending
> requests.
> 
> rick jones

I could get the required reliability and performance with having 
all-sends/all-recvs in simpler and readable code.
If it hit the wall, then I would be having sender-thread/recvr-thread to 
go in parallel, which would ease load on the queues even though that 
would add complexity of synchronizing.

And also I wanted to understand que sizing mechanism between linux 
socket sender/rcvr.

This is my Linux info though I intended to ask for Linux in general.
Linux khyber 2.6.13-15.18-default #1 Tue Oct 2 17:36:20 UTC 2007 i686 
i686 i386 GNU/Linux


Thanks Again.
- Surinder

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

Back to comp.os.linux.networking | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

linux networking buffer Surinder <Surinder.Singh@example.net> - 2013-03-30 21:29 +0530
  Re: linux networking buffer Rick Jones <rick.jones2@hp.com> - 2013-04-05 21:39 +0000
    Re: linux networking buffer Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2013-04-06 19:37 +0300
      Re: linux networking buffer J G Miller <miller@yoyo.ORG> - 2013-04-06 19:36 +0000
        Re: linux networking buffer Rick Jones <rick.jones2@hp.com> - 2013-04-08 20:23 +0000
        Re: linux networking buffer Surinder <Surinder.Singh@example.net> - 2013-04-09 10:33 +0530
          Re: linux networking buffer J G Miller <miller@yoyo.ORG> - 2013-04-09 13:10 +0000
      Re: linux networking buffer Surinder <Surinder.Singh@example.net> - 2013-04-09 10:54 +0530
    Re: linux networking buffer Surinder <surinder@esurinder.net> - 2013-04-09 10:20 +0530
      Re: linux networking buffer Rick Jones <rick.jones2@hp.com> - 2013-04-09 17:19 +0000
        Re: linux networking buffer Surinder <Surinder.Singh@example.net> - 2013-04-11 22:15 +0530
        Re: linux networking buffer Surinder <Surinder.Singh@example.net> - 2013-04-13 15:07 +0530

csiph-web