简体   繁体   中英

Queueing or not queueing for low latency

I'm writing a low-latency program in C++ which receives data from a source, processes the data and sends to a target via a TCP socket. I have a separate thread for all these 3 modules, receiver thread, processor thread, sender thread. All these threads are communicating with lock-free queues.
Do you think that sending the message directly and not using the queue for the sender part would give lower latency? Does it affect performance stability?
Thanks

If the three threads are pinned to different physical cores, having a separate sender thread would give lower latency than processor thread doing the send operation, specially if there are retries happening in the send process. Even if it is a best effort async send, you could still save the marginal time it takes to write to the socket.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM