views:

650

answers:

3

There are limits imposed by available memory, bandwidth, CPU, and of course, the network connectivity. But those can often be scaled vertically. Are there any other limiting factors on linux? Can they be overcome without kernel modifications? I suspect that, if nothing else, the limiting factor would become the gigabit ethernet. But for efficient protocols it could take 50K concurrent connections to swamp that. Would something else break before I could get that high?

I'm thinking that I want a software udp and/or tcp/ip load balancer. Unfortunately nothing like that in the open-source community seems to exist, except for the http protocol. But it is not beyond my abilities to write one using epoll. I expect it would go through a lot of tweaking to get it to scale, but that's work that can be done incrementally, and I would be a better programmer for it.

+1  A: 

To your question, you are only restrained by hardware limitations. This was the design philosophy for linux systems. You are describe exactly what would be your limiting factors.

Martin Dale Lyness
+3  A: 

The one parameter you will probably have some difficulty with is jitter. Has you scale the number of connections per box, you will undoubtedly put strain on all the resources of the said system. As a result, the jitter characteristics of the forwarding function will likely suffer.

Depending on your target requirements, that might or not be an issue: if you plan to support mainly elastic traffic (traffic which does not suffer much from jitter and latency) then it's ok. If the proportion of inelastic traffic is high (e.g. interactive voice/video), then this might be more of an issue.

Of course you can always over engineer in this case ;-)

jldupont
You raise a good point about jitter and latency and the effect on inelastic traffic (i.e. specifically the kind of traffic you would use UDP for.)
Eloff
would the person that down-voted my post care to explain? drive-by down-voting without comment is just plain rude.
jldupont
For TCP, the other concern is the amount of incoming data. Incoming data occupies kernel buffers until it is processed by a user process.If your application doesn't process the memory "fast enough", then the kernel can run out of buffers and panic.This can be ameliorated by setting a small Rx buffer size on each socket.
Martin Del Vecchio
... and a small Rx buffer size in turn might run yourself in "underrun" conditions... but hey, nothing is free :-)
jldupont
+1  A: 

If you intend to have a server which holds one socket open per client, then it needs to be designed carefully so that it can efficiently check for incoming data from 10k+ clients. This is known as the 10k problem.

Modern Linux kernels can handle a lot more than 10k connections, generally at least 100k. You may need some tuning, particularly the many TCP timeouts (if using TCP) to avoid closing / stale sockets using up lots of resource if a lot of clients connect and disconnect frequently.

If you are using netfilter's conntrack module, that may also need tuning to track that many connections (this is independent of tcp/udp sockets).

There are lots of technologies for load balancing, the most well-known is LVS (Linux Virtual Server) which can act as the front end to a cluster of a real servers. I don't know how many connections it can handle, but I think we use it with at least 50k in production.

MarkR