Add primitive flow control (v0.33)#5
Merged
Conversation
ChandonPierre
approved these changes
Oct 15, 2025
e23e91f to
826f734
Compare
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.
This adds a primitive application-layer flow control in the
server -> agentdirection.The goal of this implementation is to tell the server to stop sending packets for this specific overlay connection when this per-connection buffer runs full.
Fundamentally, this implementation relies on the guarantees of grpc (http/2 and tcp) with TCP guaranteeing in-order delivery of the application-layer data without any loss or corruption.
The agent already today implements a kind of receive buffer via a buffered channel the size of the
xfr channel size.Because we get guaranteed packet ordering plus delivery, we can implement a simple per-packet ACK protocol to inform the server about the size of the agent's receive buffer. However, note that a sender does not have to wait for an ACK for packet
t, before it can send out packett+1- but can keep sending while the agents receive buffer is not full.Flow
NOTE: there are obvious performance improvements such as batch ACK of packets etc ---> but this is a PoC + but the konnectivity proxy is anyways not designed for high throughput scenarios (more for log streaming, execs, webhook deliveries in K8s).
NOTE 2: on the server side serving the API Server, this implements the flow control for both the
HTTPConnectandgrpcfrontends.NOTE 3: there are a bunch of comments in the code where we could insert flow control for the opposite direction, but that can be ignored for now.