iggy
iggy copied to clipboard
Add WriteTo trait and implement it for Message struct
As we talked in https://github.com/iggy-rs/iggy/pull/650#pullrequestreview-1862058157
Write SendMessages directly to the stream to avoid unnecessary memory copies.
I compared the BenchMark results and found that the performance did not improve. I haven't figured out why yet.
Before:
send-and-poll
2024-02-09T08:33:58.789986Z INFO iggy_bench::benchmark_runner: Producer results: total throughput: 2961.25 MB/s, 2961249 messages/s, average latency: 3.38 ms, average throughput: 148.06 MB/s, total duration: 3.38 s, Consumer results: total throughput: 3029.55 MB/s, 2899094 messages/s, average latency: 3.30 ms, average throughput: 151.48 MB/s, total duration: 3.45 s
2024-02-09T08:33:58.789989Z INFO iggy_bench::benchmark_runner: Results: total throughput: 2995.76 MB/s, 2929842 messages/s, average latency: 6.68 ms, average throughput: 149.79 MB/s, total duration: 6.83 s
After:
send-and-poll
2024-02-09T08:56:44.146056Z INFO iggy_bench::benchmark_runner: Producer results: total throughput: 3617.91 MB/s, 3617908 messages/s, average latency: 2.76 ms, average throughput: 180.90 MB/s, total duration: 2.76 s, Consumer results: total throughput: 2355.45 MB/s, 2254022 messages/s, average latency: 3.80 ms, average throughput: 117.77 MB/s, total duration: 4.44 s
2024-02-09T08:56:44.146059Z INFO iggy_bench::benchmark_runner: Results: total throughput: 2840.06 MB/s, 2777568 messages/s, average latency: 6.56 ms, average throughput: 142.00 MB/s, total duration: 7.20 s