Data considerations
Remember that applications write data to TCP, which then stores the data into a local send buffer, generating a new segment whenever it is convenient or prudent to do so. Although segment sizes are typically calculated based on the available buffer space and MTU/MRU values associated with a given virtual circuit, sometimes the nature of the data itself mandates that a segment be generated, even if that segment won’t be the most efficient size.
For example, if an application sends only a little bit of data, then TCP will not be able to create a large segment since there just isn’t much data to send to the remote endpoint. This is regardless of the inefficiencies of sending small amounts of data; if there isn’t a lot of data to send, TCP can’t send large segments.
The decision process that TCP goes through to figure out when to send small amounts of data incorporates many different factors. If an application is able to tell TCP how much data is being written—and if TCP isn’t busy doing other stuff—then TCP could choose to send the data immediately. Conversely, TCP could choose to just sit on the data, waiting for more data to arrive.
Sometimes, an application knows that it will be sending only a little bit of data, and can explicitly tell TCP to immediately send whatever data is being written. This service is provided through the use of a “push” service within TCP, allowing an application to tell TCP to go ahead and immediately send whatever data it gets.
The push ...
Get Internet Core Protocols: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.