Re: For performance, one socket or two with dedicated send/receive?
Barry Margolin wrote:
> "Druid" <mattdruid@gmail.com> wrote:
>
> > is there a benifit to creating two TCP connections? I was thinking of
> > using one specifically for sending, and one specifically for receiving.
> > In what cases, if any, would you want to use two?
> I don't think there would be a significant benefit. If you use one
> connection, ACKs can be piggy-backed on data segments, so you may get
> slightly better performance this way.
In the case of bidirectional data flow, Barry is correct (no surprise
there) that if anything, using a single channel might provide better
performace.
....With one gotcha: Certain buggy TCPs have a problem digging
themselves out of congestion control. When cwin is throttling
transmission, an incoming ACK with a payload (LEN > 0) is misfiled as a
DUPACK.
If your application is heavily bidirectional, and the connection
suffers some packet loss, the throughput will never recover because of
this bug.
Most applications are not heavily bidirectional, so that problem is not
widely observed.
There's another reason an application might want to use two sockets,
but not for bidirectional traffic: Unidirectional data flow over a
lossy network will probably be faster with several parallel sockets
than with one big one.
Non-high performing TCPs are too considerate and won't allow a single
socket connection to push the network hard enough. Parallel
connections will find the absolute limit (ever have to coexist with
edonkey?)
/chris marget
|