Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.7k
(2.14) [IMPROVED] JetStream header indexing#7454
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
sciascid left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'd love to see the getters, as mentioned in the first comment, unless you see downsides. The second comment is totally optional, and just for consideration.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
3f664fc toa7d979cCompare
sciascid left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
When ingesting messages into a JetStream stream, the speed becomes limited if headers are set on a message due to needing to do all header checks. These header checks currently continuously re-scan the headers for different keys, instead of indexing these headers once and then being able to fetch the values quickly.
This PR proposes an improvement by indexing the headers once and using that throughout for stream ingest. Using an async publish benchmark with the only header of
k: v(just to contain headers and require the server to scan even if the server doesn't need to act on them), for both R1 and R3 there's a performance improvement between 12-26%. Using a R1 withPersistMode: async(async flush) even shows a performance improvement of ~39% (915k msgs/s -> 1.3M msgs/s).The current implementation of a pointer to
jsHdrIndex, the usage ofsync.Pooland referencing[]bytewas benchmarked and came out as the most performant when compared with amapto a range or[]byte, without returning a pointer, and when returning a range intohdrinstead of[]byte.Signed-off-by: Maurice van Veengithub@mauricevanveen.com