Rust Message Channel Latency

What kind of latency should I expect for sending data over message channels in Rust?

I know this answer will greatly depend on hardware, operating systems, and data types. Still, I was hoping someone had a more qualitative answer. I'm looking into using message channels to update control inputs, and receive control outputs at rates close to 500 Hz. Would messages fit this purpose? Or do they have a different primary use case?

The exact performance characteristics of Rust MPSC channels are... complicated, because Rust dynamically switches between its underlying implementation. To list some things that it depends on:

  • is there more than one producer?
  • is the consumer faster than the producer(s)?
  • is this a one-shot channel?
  • how fast are context switches? are you running with Meltdown mitigation?
3 Likes

I don't think sending 500 messages per second should be any problem, but I don't know what the latency of a message is.

2 Likes

If performance or latency is any concern, you should use crossbeam, and not the standard library.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.