0

Assume I have an application layer protocol that segments the packet itself. So if it has 100 MBytes of data, then it will divide the data into 10000 segments and send each segment individually to TCP. TCP will not have to do reordering. So will this kind of behavior change any parameters of the network? Will my throughput be lower? Or will the congestion control algorithms of TCP work just as well compare to an application layer protocol that sends data only once to TCP? In a way I guess this is similar to a system sending too many small-sized data over the network (mouse traffic). But I'm not sure what effect that will have either.

4

TCP will not have to do reordering.

It does that, there's no way to stop it.

If your application sends (very) small chunks of data, TCP tries to collect them and transmits them in larger segments. There's a short timeout for collection (200 ms by default, see Nagle's Algorithm) and when no more data comes from the application, the current TCP segment is sent out. This potentially increases latency and you can use the TCP_NODELAY socket option and the PSH flag to tell TCP to send and forward each chunk immediately at the possible cost of increased overhead and wasted bandwidth.

If the application already takes care of data segmentation, reordering, congestion control, and delivery confirmation you might want to consider UDP which allows total control for the application. However, trying to reinvent TCP usually fails.

| improve this answer | |
  • Let us say for example an application sends ten separate requests to TCP. And one of the requests came earlier or later. Will the TCP still reorder them? Because it is a single request and TCP is supposed to give back the response to that request. (Assuming MSS is same as the data segment given by the application layer). – nj-ath Jan 16 at 8:46
  • @nj-ath, TCP is not message-oriented like UDP is. TCP segments streams of data, and it sends the segments, whether the data is small chunks that it collects, or large chunks that it must segment. The segments will be approximately the same size, and the segments get ordered correctly before the segment payload passes to the application.. – Ron Maupin Jan 16 at 10:53
  • @nj-ath A request is an application-layer concept, there is no such a thing on the transport layer. TCP transports arbitrary-length, bilateral streams (reordering and retransmitting packetized segments as required to reassemble the original stream) while UDP transports discrete datagrams. It seems you've got a problem with TCP's logic and possibly the API you're working with, and need to read up on those. – Zac67 Jan 16 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.