Is there a way to overcome the port limit on a linux system? We have a server running that accepts incoming connection and it uses very little memory and cpu. It's rather silly that we have to build a cluster of small linux boxes just to overcome a software limit (number of points of around 60k). Any ideas?
- 1Can you give any more information about the use-case here?jcolebrand– jcolebrand2010-08-16 21:30:43 +00:00Commented Aug 16, 2010 at 21:30
- 3Have you tried using secondary IP addresses on the same interface?a'r– a'r2010-08-16 21:33:12 +00:00Commented Aug 16, 2010 at 21:33
- @ar: that's a viable solution since the OP is already using multiple IP addresses. Post it as an answer so it can properly get voted and/or accepted.slebetman– slebetman2010-08-16 21:58:49 +00:00Commented Aug 16, 2010 at 21:58
- possible duplicate of Max number of socket on LinuxcHao– cHao2010-08-16 22:13:17 +00:00Commented Aug 16, 2010 at 22:13
- It's been possible for a long time to have Linux boxes supporting well over 100,000 simultaneous inbound connections. You are hitting a configuration or resource limit - what is the actual error that makes you think you have hit a port limit?caf– caf2010-08-17 00:06:59 +00:00Commented Aug 17, 2010 at 0:06
3 Answers
There is no limit of 60k tcp or udp sockets, you just think there is. The actual limit is much higher. There are 64k ports, but the same port may be used for more than one connection, as only the pair of addresses/ports needs to be unique.
Having said that, if you have 60k distinct clients concurrently connected, you may a have high availability requirement which means you'll need to have several machines anyway.
Comments
This isn't a software limit of ports, it's a networking limit.
http://en.wikipedia.org/wiki/TCP_and_UDP_port
There are only only a certain number of ports available on an IP network (65k). Your problem isn't a port limit, but perhaps how those ports are being used.
3 Comments
It's not Linux, it's TCP/IP design limitation - port number is a 16-bit unsigned integer, thus 64K limit. Assign multiple addresses - IP aliases - to an interface (or use multiple hardware interfaces), make different servers listen on different IPs. Each interface will give you a separate port range.