|
|
|
|
||||||
| comp.protocols.tcp-ip TCP and IP network protocols. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
In article <1141336756.033668.74080@t39g2000cwt.googlegroups. com>,
"Druid" <mattdruid@gmail.com> wrote: > A TCP connection can send and receive over the same connection, but > 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? This might be a > newbie question, but I've been unable to find an answer about it yet. 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. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 (permalink) |
|
Messages: n/a
Hébergeur: |
Well, the application isn't heavy bidirectional, it will be really
heavy in one direction, and light in the other. I want to guarantee that the light direction doesn't suffer from any starvation if the other direction is under heavy load. I'm not concerned about the ACKs, I'm not sure if I should be. So, would having two dedicated TCP connections (4 ports total - 2 endpoints on each side) in my application, 1 for sending, 1 for receiving, would improve performance and mitigate starvation given this context? From what you've said so far, it doesn't sound like it. |
|
|
|
#4 (permalink) |
|
Messages: n/a
Hébergeur: |
I'd just go ahead and use one socket/connection. Be certain to
provide all "logically associated" data to the transport in one call (writev, sendmsg etc). rick jones -- a wide gulf separates "what if" from "if only" these opinions are mine, all mine; HP might not want them anyway... ![]() feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH... |
|
|
|
#5 (permalink) |
|
Messages: n/a
Hébergeur: |
In article <1141657940.031014.318260@u72g2000cwu.googlegroups .com>,
"Druid" <mattdruid@gmail.com> wrote: > Well, the application isn't heavy bidirectional, it will be really > heavy in one direction, and light in the other. I want to guarantee > that the light direction doesn't suffer from any starvation if the > other direction is under heavy load. It shouldn't be a problem. The two directions are effectively independent. Implementations don't usually share any per-connection resources between the two directions, so there's nothing to starve (there may be some system-wide resources that are shared, but then the starvation would affect separate connections just as much as a single connection). -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
|
|
#6 (permalink) |
|
Messages: n/a
Hébergeur: |
In article <barmar-23B8CD.19491306032006@comcast.dca.giganews.com>,
Barry Margolin <barmar@alum.mit.edu> wrote: >> Well, the application isn't heavy bidirectional, it will be really >> heavy in one direction, and light in the other. I want to guarantee >> that the light direction doesn't suffer from any starvation if the >> other direction is under heavy load. > >It shouldn't be a problem. The two directions are effectively >independent. Implementations don't usually share any per-connection >resources between the two directions, so there's nothing to starve >(there may be some system-wide resources that are shared, but then the >starvation would affect separate connections just as much as a single >connection). Starvation can happen in the application as well as the operating system or network machinery. For example, an application I care about involves systems doing what might be described as flooding database changes to peers and expecting peers to respond with grouped "commits." Things are symmetric. Each system would rather not have incoming commits mixed with and so delayed by the far larger database changes in a single TCP pipe. The commits from a peer are relatively rare, and far quicker and easier to handle that database changes. For various reasons incoming commits should have higher priority than incoming database change requests. My solution is two TCP connections between each pair of peers. Each system handles incoming database changes only after it has attended to incoming commits. Of course, if you need to ask in a newsgroup to hear what's been said in this thread, the right answer is almost certainly "one socket." Vernon Schryver vjs@rhyolite.com |
|
|
|
#7 (permalink) |
|
Messages: n/a
Hébergeur: |
In article <duitka$30bu$1@calcite.rhyolite.com>,
vjs@calcite.rhyolite.com (Vernon Schryver) wrote: > In article <barmar-23B8CD.19491306032006@comcast.dca.giganews.com>, > Barry Margolin <barmar@alum.mit.edu> wrote: > > >> Well, the application isn't heavy bidirectional, it will be really > >> heavy in one direction, and light in the other. I want to guarantee > >> that the light direction doesn't suffer from any starvation if the > >> other direction is under heavy load. > > > >It shouldn't be a problem. The two directions are effectively > >independent. Implementations don't usually share any per-connection > >resources between the two directions, so there's nothing to starve > >(there may be some system-wide resources that are shared, but then the > >starvation would affect separate connections just as much as a single > >connection). > > Starvation can happen in the application as well as the operating system > or network machinery. For example, an application I care about involves > systems doing what might be described as flooding database changes to > peers and expecting peers to respond with grouped "commits." Things are > symmetric. Each system would rather not have incoming commits mixed > with and so delayed by the far larger database changes in a single TCP > pipe. The commits from a peer are relatively rare, and far quicker and > easier to handle that database changes. For various reasons incoming > commits should have higher priority than incoming database change > requests. My solution is two TCP connections between each pair of > peers. Each system handles incoming database changes only after it > has attended to incoming commits. This sounds like a very different issue -- you're talking about two connections for the *same* direction, or for different types of communication (e.g. FTP's Control and Data connections). The OP was specifically asking about whether to use separate connections for the opposite directions. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
|
|
#8 (permalink) |
|
Messages: n/a
Hébergeur: |
On 2006-03-07, Barry Margolin <barmar@alum.mit.edu> wrote:
> This sounds like a very different issue -- you're talking about two > connections for the *same* direction, or for different types of > communication (e.g. FTP's Control and Data connections). The OP was > specifically asking about whether to use separate connections for the > opposite directions. Thinking back in this thread to using a single TCP socket instead of multiple ones for performance, this thread reminds me of the URG flag in TCP, and how (from my own experience) this was never quite used or implemented in a useful way and how it might have ed out moving control elements of a communication faster than content. Does anyone remember / recall / have an opinion on what happened to the use of the URG bit? /dmfh ---- __| |_ __ / _| |_ ____ __ dmfh @ / _` | ' \| _| ' \ _ / _\ \ / \__,_|_|_|_|_| |_||_| (_) \__/_\_\ ---- |
|
![]() |
| Outils de la discussion | |
|
|