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
JetStream publish performance #450
Comments
not sure if this is a good test. v1 doesn't actually seem to be publishing as fast:
|
@safayatborhan, where are you seeing the performance in your real application? Could you elaborate on your use case a little more? In your test application v1 Publish() is looking faster but overall performance doesn't show that, so a little confused about that tbh. (Thank you for the example repo btw 💯 a lot easier for me to validate the issues) |
Hi @mtmk, In actual scenario, we are trying to publish around 10000 messages/sec. Each message size is around 1kb. For processing each message the legacy NATS client (stan) took around 1.77E-05. But as it is out of life, we migrated to Jetstream and here is the data for v1 and v2 client of Jetstream: |
I see the same magnitude of difference too. Also, starting the v1 app seems to be instant, however the v2 app takes several seconds to start..... |
I'm afraid your metric above doesn't make sense to me as meaningful comparison. I'm seeing very different results on different machines with different number of concurrent tasks. But, when tuned (for example number of tasks), overall I'm not seeing hardly any difference unfortunately. I assume you're interested in throughput and I suggest to have a look at this issue: Having said that, I think there are improvements we can make in the request-reply pattern (which I will start investigating soon #453) but I don't think it would make a material difference to how many messages you can send per second. edit: I can reproduce similar results as above, when run on a single core cloud machine. but when run on my desktop machine with multiple cores, results are very different:
when compiled AOT:
(this is running code from your repo https://github.com/safayatborhan/Memory.Test with no changes) |
@safayatborhan I also cannot recreate the latency that you are seeing. I forked your What OS and hardware are you getting those results on? |
Also @safayatborhan if you can please confirm which version of the .NET Runtime your Net6 tests were run against, especially if it is not 6.0.6 or newer (just to be safe, this was something AkkaDotNet encountered, but was fixed in 6.0.6 and newer) Agreed that hardware could also make a huge difference here (and may still enlighten on opportunities.) I certainly have guesses as to what could happen with a low core count/etc but am working on being better about my tangents. :) |
@caleblloyd and @to11mtm , This is surprising to me that you are getting different result. |
|
@caleblloyd |
Observed behavior
I have a dotnet 6 application running on nats.net. If I migrate to nats.net.v2, the performance is degrading drastically. Here is the code I am running with nats.net.v2 library:
Sample output:
Here is the same code I am running with nats.net library:
Sample output:
Expected behavior
The latest library should be as fast as how it was before.
Server and client version
Nats.net 2.1.2
Host environment
No response
Steps to reproduce
Repo link, if want to reproduce.
The text was updated successfully, but these errors were encountered: