BugFix: NATS keys > batch size returns a valid cursor#5329
Open
jfleitz wants to merge 2 commits into
Open
Conversation
Signed-off-by: Jeremy Fleitz <jeremy@cosmonic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
While load testing a configuration that uses NATS subjects for communicating between WorkloadDeployments, one of the WorkloadDeployments stopped processing due to no cursor being returned when there was >1000 keys in the NATS subject. This occurred when spamming the requests in to create a high volume.
This happens when there is an error with unwrapping the key from the stream, which the error would then impact the "skip cursor count" and shifting the page by 1.
Fix
This fix moves the "skip cursor count" tracking to after unwrapping the key value. This ensures that if there was an error, the stream processing while loop returns immediately, and thus preserving the rest of the stream values (vs just eating them and now offset by the error count), so that the next call will have the cursor at the next location.
Testing
This was tested with 4 wasm workloads using NATS to communicate processing of incoming request. I load script was used to push a total 5000 requests in at 300 concurrently. Prior to the change the load script would hang until timeout and would have values "missing in pipeline" reported.
Test architecture used:
Signed-off-by: Jeremy Fleitz jeremy@cosmonic.com