I am using a high-performance two-part protocol in C ++ 14 using multithreading and currently use ZeroMQ as the network layer.
The application has the following simple architecture:
- One primary server role
- One primary client role
- Both server and client spawn a fixed number of
nthreads - Parallel pairs
n parallelperform some performance and communication, mutually, but exclusive, protocol exchange, that is, they run in nfixed pairs and should not mix / replace any data but with a fixed opponent.
My current project uses one ZeroMQ parameter, both on and on , which is shared between all -local streams and each corresponding / pair of threads creates a socket (I just increase port #) in a local, shared context for communication. Context()serverclientnclientserver ZMQ_PAIR
My question
Is there a smarter or more efficient way to do this?
ie: is there a natural way to use ROUTERSand DEALERSthat can improve performance?
I do not have much experience in programming sockets, and with my approach, the number of sockets is scaled directly with n(several client-server pairs). This can go a couple thousand, and I'm not sure if this is a problem or not.
, , , . , , .
, , , - , .. ..