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
KV Get message rate increases with message size #4221
Comments
Hello @jjthiessen, i ran a quick benchmark to check if i could reproduce the " The numbers I'm getting are exactly what one would expect:
These numbers are for a single NATS server (which is what you are doing, according to your gist). One possibility for the numbers you are seeing is related to how |
It's not just the numbers that are being reported though, it's actual wall clock time. It isn't apparent from my original logs, but if I add
I was originally using a dev version of |
Alright, I can reproduce the odd results you are seeing if I use the same large number of keys (65k), my earlier test was using just 100 (thanks @jnmoyne!). So issue seems to be confirmed. |
Fun, right? In any case, the performance is still better than memory storage. I've been told that at least some indexing that happens for file based streams don't happen for memory based ones, making memory backed KV particularly slow. It's probably less of an issue with log/stream ingestion type loads, but I do wonder where the tipping point is (indexing overhead vs search gains). Even for log/stream ingestion/slurping, there would be some stream size (message count and/or data volume) threshold where indexing would be helpful (e.g., for subject filtered subscriptions), so it's not just a KV or object storage concern. Back to the message size vs message throughput issue, though — I imagine that it'd apply equally well to at least some other file backed JS streams (as KV is just JS with certain defaults/conventions, as I understand it), but it'd be interesting to know/see if it's specific to some/which of those options/conventions, or whether it applies more generally to all file backed streams (I haven't tried testing/playing with that). |
I will fix, I can see why it degrades, and even worse so for memory stores. Will be part of 2.9.18 next Tuesday. |
…#4232) When messages were very small and the key space was very large the performance of last message gets in the store layer (both file and memory) would degrade. If the subject is literal we can optimize and avoid sequence scans that are needed when multiple subject states need to be considered. Signed-off-by: Derek Collison <derek@nats.io> Resolves #4221
Please see my NATS KV benchmark script (just a wrapper around
nats bench
) along with transcripts/console output for two runs (one with file storage on SSD, the other with file storage on a ramfs mount) (all part of the same gist). I only included file storage results here, as memory backed KV appears to be fairly uniformly slow (much slower than file storage) at the moment.The
Put
/publish rates and trends more-or-less make sense to me/aren't surprising.However, the
Get
/subscribe message throughput rates seem to increase with message size.This is rather surprising (for me, at least) — I would expect the data throughput rate to increase with message size (as it does), but for the message throughput rate to decrease.
The effect of this is that in order to get better KV read performance, one only needs to pad values to produce larger messages (even if the extra content is otherwise useless).
Does anybody know i) why this might be the case; and ii) whether I'm holding it wrong?
For additional context see this thread on Slack.
The text was updated successfully, but these errors were encountered: