Re: maximum number of outgoing connections



Igor Sysoev wrote:
It seems that FreeBSD can not make more than

net.inet.ip.portrange.last - net.inet.ip.portrange.first

simultaneous outgoing connections, i.e., no more than about 64k.

If I made ~64000 connections 127.0.0.1:XXXX > 127.0.0.1:80, then
connect() to an external address returns EADDRNOTAVAIL.

net.inet.ip.portrange.randomized is 0.

sockets, etc. are enough:

ITEM SIZE LIMIT USED FREE REQUESTS FAILURES
socket: 356, 204809, 13915, 146443, 148189452, 0
inpcb: 180, 204820, 20375, 137277, 147631805, 0
tcpcb: 464, 204800, 13882, 142102, 147631805, 0
tcptw: 48, 41028, 6493, 11213, 29804665, 0

I saw it on 6.2-STABLE.



In an ideal world (Not sure if this is quite correct for FreeBSD) TCP connections are tracked with a pair of tupels source-addr:src-port -> dst-addr:dst-port

As your always connecting to the same destination service 127.0.0.1:80 and always from the same source IP 127.0.0.1 then you only have one variable left to change, the source port. If you where to use the hole of the whole of the port range minus the reserved ports you would only ever be able to make 64512 simultaneous connections. In order to make more connections the first thing that you may want to start changing is the source IP. If you added a second IP to you lo0 interface (say 127.0.0.2) and used a round robin approach to making your out bound connections then you could make around 129k outbound connections.

I am not sure if there are any other constraints that need to be taken into account such as the maximum number of sockets, RAM etc....

Tom
_______________________________________________
freebsd-net@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • sockets, closing and TIME_WAIT
    ... During heavy load the server can't follow anymore because the sockets ... my server should be able to handle 10 clients connecting ... This gets a free position in the array of connections, ...
    (comp.unix.programmer)
  • Re: network programming: how does s.accept() work?
    ... The program you contact at Google is a server. ... so, the server will usually assign a new port, say 56399, specifically ... connections to a server remain on the same port, ... sockets is what identifies them. ...
    (comp.lang.python)
  • Re: FOAK: ADSL Micro Filters
    ... what is the REN total of the units plugged into the sockets. ... I've always had terrible problems with our connections, ... and whether the new adsl modem was connected or not. ... IIRC to use UK bought phones in France, ...
    (uk.rec.motorcycles)
  • socket_select() hangs sometimes; Bug?
    ... socket_selectfor accepting new connections and dealing with existing ... The select runs on all connected sockets for read and ... the server hangs after some time. ...
    (php.general)
  • Re: high performance with a lot of outgoing connections
    ... >> outgoing connections, and it is possible to run the system out of ... >> ports under certain circumstances. ... >> a normal web server, or has a limited number of outgoing connections, ... As an option to get you more sockets. ...
    (comp.unix.bsd.freebsd.misc)