dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
4
share rss forum feed


shdesigns
Powered By Infinite Improbabilty Drive
Premium
join:2000-12-01
Stone Mountain, GA
Reviews:
·EarthLink
·Comcast
·Atlantic Nexus
reply to justin

Re: maximum number of open sockets, files, threads, etc..?

As memory is allocated per socket the limit of the # of sockets is probably moot.

Each socket may gave 256k TX and RX buffers (seems to be default minimum) with file descriptors allocated also. Thousands of sockets and threads would consume more memory than you have and probably thash so hard the limit of the # of sockets would probably be the least of your worries.

Given the 1024*1024 you mentioned and the probable 64k minimum buffer on a TCP sliding window socket that is 64gigs or RAM.

Gobs of RAM and 64-bit may reach the limits. I bet few are getting close to this in practice so few developers consider them.
--
Scott Henion

Embedded Systems Consultant, shenion on #ATU @irc.freenode.net
SHDesigns home



justin
..needs sleep
Australian
join:1999-05-28
kudos:15
Reviews:
·iiNet

It is a good point.

65k open sockets with 128k rmem and wmem buffers take 8.3gb

But things might not be that bad inside the kernel. Perhaps the space is only taken if it is needed:

A paper was published
»www.stdlib.net/~colmmacc/Apachec···dout.pdf

that showed off an ftp server whose record was 27,000 simultaneous downloads (under apache). And there rmem_default/rmem_max was 262k. The machine has 4gb of ram.

Unless my math is faulty, that SHOULD take 7gb of ram for read socket buffers alone (rmem_default). But clearly it didn't.



Steve
I know your IP address
Consultant
join:2001-03-10
Foothill Ranch, CA
kudos:5
reply to shdesigns

said by shdesigns:

Each socket may gave 256k TX and RX buffers (seems to be default minimum) with file descriptors allocated also.
Can TX and RX buffer sizes be tuned separately? I would think that for web-type service, maxing out the TX buffer and minimizing the RX buffer would make a big diff in scaling.

If they can't be, then this smells like a great optimization to add to the kernel.

Steve
--
Stephen J. Friedl | Unix Wizard | Microsoft Security MVP | Tustin, California USA | my web site


shdesigns
Powered By Infinite Improbabilty Drive
Premium
join:2000-12-01
Stone Mountain, GA
Reviews:
·EarthLink
·Comcast
·Atlantic Nexus

1 edit

said by Steve:

Can TX and RX buffer sizes be tuned separately? I would think that for web-type service, maxing out the TX buffer and minimizing the RX buffer would make a big diff in scaling.

If they can't be, then this smells like a great optimization to add to the kernel.

Steve
/proc/sys/net/ipv4:

tcp_rmem - 4096 87380 16777216
tcp_wmem - 4096 87380 16777216
tcp_mem - 98304 131072 196608

I think those are min/default/max

edit: I bet Apache opens sockets with its own settings.
--
Scott Henion

Embedded Systems Consultant, shenion on #ATU @irc.freenode.net
SHDesigns home