Should i use different socket connections or different namespaces?


I have different channels in my implementation and there will be a LOT of data exchanged with the clients connected to those channels. So i am a bit confused as to should i use the namespace concept in which creates separate namespaces for each channel under the same socket connection or should i create different socket connections on different ports for each channel? Please give me suggestion as to how these two options will affect the performance etc?


Problem courtesy of: Bitsian


Namespaces seems like a better idea than tying up multiple sockets unnecessarily. The amount of data you can send back and forth will be limited by the overall bandwidth capacity. Opening new socket connections won't magically increase throughput unless the sockets connect to different machines, or if the single socket is used inefficiently (i.e. synchronous/blocking activity).

Solution courtesy of: Bret Copeland


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.