Propagate server-side gRPC message-size limits to clients #725
Unanswered
DevMattG
asked this question in
Feature Requests, Ideas
Replies: 1 comment
|
Regarding the open questions:
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
mosaicod and its clients each reason about gRPC message size independently, and the two are not related today:
max_grpc_message_size(default 50MB, clamped to [4MB, 128MB], configurable viaMOSAICOD_MAX_GRPC_MESSAGE_SIZE) on tonic'smax_decoding_message_size/max_encoding_message_size(mosaicod-grpc/src/server.rs). It also derives an internaltarget_message_size, used only for its own Arrow batch sizing.PYARROW_OUT_OF_RANGE_BYTES= 16MB andDEFAULT_MAX_BATCH_BYTES= 10MB as pre-send size checks. These numbers have no connection to whatever the server is actually configured with.Consequence: if an operator raises
MOSAICOD_MAX_GRPC_MESSAGE_SIZEto e.g. 128MB, clients still cap themselves at 16MB for no reason. If an operator lowers it below the client's assumed ceiling, the client's local check passes, but the server rejects the message with a decoding error instead of a clean client-side error.Proposal
Expose the server's configured limits to clients via the existing
do_actionmechanism, rather than inventing a new negotiation channel. There's already a precedent for exactly this kind of server → client info exchange: the "version" action misc::version()), which the Python client calls during connection setup (_wait_for_available).Concretely:
ActionRequest::Configvariant ("config" tag) alongside version, returningmax_grpc_message_size(and possiblytarget_message_size) from params::params().versioncall), caches the result, and uses it — instead of the hard-coded constants — to decide when to flush/reject oversized batches.Alternatives considered
Open questions
target_message_sizeat all, or ismax_grpc_message_sizesufficient (client derives its own flush threshold as a fraction of it)? Fewer fields to keep in sync either way.max_grpc_message_sizejust be added to the existing version response instead of a new action?All reactions