-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance degrades severely when the number of producers increases. #1119
Comments
My answer may not be correct. AFAIK, if you are using the unbounded channel, its underlying is a linked list; each node can hold 32 elements. Let's say,
If in your code, your channel now has 32 elements, so the first block is full, and you send a new element, a new node will be created (allocation required), and if the consumer consumes this element immediately, the second node will be destroyed. If this situation repeatedly happens, as Rust does not have a garbage collector, frequent alloc and dealloc may lead to slow performance. |
Thanks for your answer, I'm using a bounded channel, but your answer really made me learn. |
In the performance test of MPSC, when simulating 2 and 4 producers respectively, Crossbeam's performance is much better than Java-Disruptor, but when simulating 8 and 16 producers, Crossbeam is worse than Java-Disruptor. My testing device has 16 cores and 64GB. May I ask what caused this problem?
Here are the results of two experiments, the first with 2 producers and the second with 8 producers. The abscissa represents the buffer size and the ordinate represents the time consumption.
The text was updated successfully, but these errors were encountered: