Multiple Connections or Multiplex?

Started by
1 comment, last by hplus0603 12 years, 4 months ago
Hiya,

Given two networked machines that needs to maintain around 500 'streams' of player data between them using IP/TCP - are there any advantages to multiplexing the streams into a single connection, instead of using a single connection per stream?

If I the sockets are opened using SO_REUSEADDR, I shouldn't run out of endpoints using multiple connections, given this number of players.

I'm guessing I'll get better throughput by multiplexing, as it will reduce the amount of TCP frame-header traffic and overhead.

Could anyone give their thoughts?

Thanks!
Advertisement
Implementation could be a factor. Writing a demultiplexer that is thoroughly robust may not be as easy as just handling individual connections. Then again, depending on what you're doing with the data on those connections, it might be far easier. Hard to say for sure without knowing more details.


One distinct advantage to running multiple connections is it leaves you a lot more options for decentralization in the future, but again, without knowing what you're working on it's hard to judge if that's a pro or a con :-)

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


Given two networked machines that needs to maintain around 500 'streams' of player data between them using IP/TCP - are there any advantages to multiplexing the streams into a single connection, instead of using a single connection per stream?


Yes: flow control over a congested network works better when there is only one active/high-throughput stream between the two machines.

This is why browsers opening 6 different connections to the same HTTP server for fetching images and CSS for a web page makes no sense -- you'll just force more buffer bloat and more oscillation in throughput.

enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement