I realize this question might be OS specific. I am using Ubuntu 18.04, but I am interested in answers related to any OS. I am streaming images with ROS, and wanted to know how much of a burden I am introducing to the system with each image stream I spin up.
I want to know what the bottlenecks are for streaming images over tcp connections between processes on the same system. Most importantly I would like to read the docs somewhere that describe the data flow over a tcp connection.
Edit: I am asking specifically about ROS 1, but answers about ROS 2 are also appreciated.
I assume you are talking about ROS Version 1 (as apposed to ROS2, which uses a whole different communication model). A good overview on how the communication works is given in the ROS wiki.
When two ROS nodes connect as publisher and subscriber, respectively, on a message topic, their communication will use your operating system's network stack. This means the subscriber sets up a network socket that listens on a specific port. Every incoming message will trigger your callback function that processes the message. The publisher is notified by the ROS master which IP address or hostname and port it should send the messages. Even if both nodes run on the same machine, the message passing will still happen through network sockets. However, since the destination IP will be your computer's IP address (localhost), the packages are never going to leave your computer and therefore not strain your network card.
However, the main bottleneck in your use case is most likely the serialization of messages. If you're running publisher and subscriber on the same system, this serialization (on the publisher side) and de-serialization (by the subscriber) is unnecessary compute. For this scenario, nodelets were introduced. Effectively, they allow running multiple ros modules inside a single process. The advantage is that messages between nodelets of the same process (called nodelet master) can exchange ROS messages via shared memory and therefore avoid the cost of serialization.
Finally, ROS has smarter ways to transport a stream of images beyond serializing every image individually. These protocols make use of video compression.