Add BatchSize parameter to WatchEvent #2787
Merged
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.
When dealing with large BGP instances, the path list can be so large it makes a response message larger than the gRPC max message size.
This adds a BatchSize field to the request to send at most BatchSize paths in a single WatchEventResponse message, greatly limiting the size of each stream item.
For reference, this was hit on a production BGP-EVPN instances with over 80k paths.
Setting a batch size allows us to get the current full table without resorting to ListPaths calls, with all the synchronization issues that ensues. This is pretty important because the limit can be reached quite quickly: we observed single paths well over 15kB on the wire, and even a batch size of 4096 leads to oversized messages (already a far cry from the 80k of the default implementation).