Skip to content

Commit 5c42a80

Browse files
committed
broker: size List response chunks to fit gRPC's 32KB buffer pool tier
Reduce maxJournalsPerListResponse from 1000 to 25 so that marshaled ListResponse messages stay within the 32KB gRPC buffer pool tier. At typical journal sizes (~750-1300 bytes per ListResponse_Journal), 25 journals produces messages of ~19-32KB. Previously, larger chunks produced messages > 32 KB, landing in the 1MB buffer pool tier. When many List watch streams sent responses concurrently, this caused significant memory spikes from pooled 1MB buffers.
1 parent cff796b commit 5c42a80

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

broker/list_apply_api.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,8 @@ func (svc *Service) Apply(ctx context.Context, claims pb.Claims, req *pb.ApplyRe
277277
// * In large deployments, responses would bump against gRPC maximum messages sizes.
278278
// * Unary responses can't represent a long-lived watch.
279279
//
280-
// List was updated to become a server-streaming API which addresses both issues,
281-
// while remaining compatible with older clients that expect a unary API,
282-
// so long as the entire response set can be sent as a single message.
283-
// This value is large to allow older deployments to continue to function,
284-
// without being SO large that we bump against gRPC message limits.
285-
var maxJournalsPerListResponse = 1000
280+
// List was updated to become a server-streaming API which addresses both issues.
281+
//
282+
// This value is sized to keep marshaled ListResponse messages within the 32KB
283+
// gRPC buffer pool tier for typically sized journal specs.
284+
var maxJournalsPerListResponse = 25

0 commit comments

Comments
 (0)