Closed israellot closed 2 years ago
Ok, I just realized that the benchmark was not realistic. Applications don't try to flood messages, and I believe the library shouldn't aim at optimizing throughput at a synthetic benchmark at the expense of everything else. I've tried to come up with a benchmark that evaluates performance at target throughputs and added to this branch.
Being more cooperative at the producer actually shows we can target to roundtrip close to 1M msg/s with acceptable latency.
I'll take a good look at this later in the week. I saw another project convert the first 4 bytes to an integer value and compare that instead of comparing byte arrays. Not sure if it's faster.
Closing in favor of https://github.com/80dB/AsyncNats/pull/7
Here I'm adding a few tricks, mainly reducing allocations and virtual calls. Also adding a benchmark project to try understand where the bottlenecks are at various use cases.
So far, here is where it stands :
It seems that we can flush data to NATS easily at 2M messages/second, but reading is imbalanced. I'm also puzzled as why bigger messages seem to perform better. My guess so far is at flow control.
Let me know your thoughts @80dB