views:

65

answers:

2

I've been checking out using a system called ROS (http://www.ros.org) for some work.

There are lots of different types of data that get sent between network nodes in ROS. You define a struct of data that you want to send in a message, and ROS will handle opening a specific port between the two nodes that will only send that struct of data.

So if there are 5 different messages, there will be 5 different ports.

As opposed to this scenario, I have seen other platforms that just push all the different messages across one port. This means that there needs to be a sort of multiplexing/demultiplexing (done by some sort of message parsing on the receivers end).

What I wonder is... which is better from a performance perspective?

Do operating systems switch based on ports quickly, so that a system like ROS doesn't have to do too much work to work out what is in the message and interpreting it?

OR

Is opening lots of ports going to mean lots of slower kernel calls, and the cost of having to work out and translate message types end up being more then the time spent switching between ports?

When this scales to a large amount of data at high rates and lots of different messages types there will be lots of ports. So I imagine that when scaling each of these topologies that performance will be a big factor in selecting the way to work.

I should also point out that these nodes usually exist on one small network, or most of the time on the one machine in which networking is used as a force of inter-process communication. So the transmission time is only a very small factor in the overall system timing.

ROS being an architecture for robots may have one node for every sensor and actuator, so depending on the complexity of your system we may be talking about 20-30 nodes pushing small-ish (100bytes or so) data between 10-100Hz

+1  A: 

It depends. I do not know the specifics of ROS but in networking it comes down to the following constraints:

  • Distance: speed of light is fast but over a distance it starts making a difference

  • Protocol Overhead: connection oriented vs. connection-less

On the OS side, maintaining a list of free ports isn't such much of an overhead - of course there is a cost to it but everything is relative: if you are talking about a distributed system with long distance links, then it is easy to argue that cycling through OS network ports ranks as lower concern compared to managing communication quality.

Without a more specific question, I'll stop here.

jldupont
thanks jldupont, I'll update the question with more details.I hadnt considered the problem at that level
Fuzz
+1  A: 

I don't have any data on this, but it seems plausible that multiple ports might be handled more efficiently by multi-core systems, as opposed to demultiplexing within the program.

mbyrne215
I'd like to think this is the case too... but who knows how the underlying operating systems would handle it
Fuzz