in reply to Optimizing TCP packet usage with IO::Socket::INET or similar

To make transfer as efficient as possible in terms of overhead/payload ratio it is necessary to stuff as much data into tcp packets as possible, having at least padding as possible.

This cannot be controlled from Perl; nor should you try!

You should just send your data in whatever units you get it in -- lines, blocks whatever -- and let the tcpip stack do its job and coalesce or break up those packets into whatever size chunks it knows will be best for the prevailing conditions of the circuit between you and the destination.

Anything you do at the Perl (or most other languages; barring you drop down to raw ip -- DONT!) will simply be undone and reformed into whatever the stack decides is right. And that can vary from connection to connection, and even within the life of a single connection, depending upon the capabilities of the nodes; the prevailing network loading, the routing; et al.

The mechanisms are very well tried & tested, and have been optimised over decades; anything you try is unlikely to beat them and far more likely to interact badly with them, and result in less optimal performance.

(Take this from someone who has tried :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Optimizing TCP packet usage with IO::Socket::INET or similar