Support opt-in psrpc bus compression - #488
Merged
Merged
Conversation
boks1971
approved these changes
Sep 6, 2026
psrpc v0.7.6 (psrpc#130) added opt-in gzip at the bus boundary, and protocol#1771 surfaced it as rpc.PSRPCConfig.Compression with a BusOptions() conversion. runService built the bus from the redis client alone, so there was no way to reach the setting. Ingress carried no rpc.PSRPCConfig at all, only a top-level psrpc_skip_claim bool, so add the whole block under a psrpc: key. That matches the layout livekit-server uses (livekit#4844) and gives egress and SIP a shape to copy. It is seeded in NewConfig rather than InitDefaults because the handler subprocess parses its config with initialize=false; without the seed, a config setting only quality would leave Threshold at zero and compress every payload, however small. The service process holds the only bus. The per-session handler subprocess talks to the parent over unix-socket gRPC IPC and never builds one, so nothing else needed threading. The integration suite bypasses NewConfig, so GetDefaultConfig carries the same seed. Compression is off by default. A peer on psrpc older than v0.7.6 ignores the compression marker -- psrpc deserializes with DiscardUnknown -- and then decodes the gzipped bytes as the payload, so the message is dropped without an error. livekit-server, egress, SIP and agent workers share this bus, so enabling it is a two-stage operator action: roll v0.7.6+ everywhere, then raise quality at the publishers. The README says so at the setting. max_decompressed_size only affects reading, so it can be set ahead of quality. pkg/config/config_test.go is new; the package had no tests. It covers the defaults and an override that leaves Threshold at its default. Verified the config actually reaches the compressor with a throwaway psrpc echo RPC over a local bus: the default config round-trips, quality 6 with threshold 1 round-trips, and adding max_decompressed_size 64 drops that same 16 KB payload -- which is what proves it was gzipped rather than skipped by the threshold. quality 0 with the cap delivers it. Not verified against a live livekit-server; that needs a peer already on psrpc v0.7.6+. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
paulwe
force-pushed
the
psrpc-bus-compression
branch
from
September 6, 2026 15:59
7d7edc3 to
b83a018
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.
psrpc v0.7.6 (psrpc#130) added opt-in gzip at the bus boundary, and protocol#1771 surfaced it as
rpc.PSRPCConfig.Compressionwith aBusOptions()conversion.runServicebuilt the bus from the redis client alone, so there was no way to reach the setting.Shape
Ingress carried no
rpc.PSRPCConfigat all, only a top-levelpsrpc_skip_claimbool, so this adds the whole block under apsrpc:key. That matches the layout livekit-server uses (livekit#4844) and gives egress and SIP a shape to copy — neither has done this yet.It is seeded in
NewConfigrather thanInitDefaults, because the handler subprocess parses its config withinitialize=false. Without the seed, a config setting onlyqualitywould leaveThresholdat zero and compress every payload, however small.The service process holds the only bus. The per-session handler subprocess talks to the parent over unix-socket gRPC IPC and never builds one, so nothing else needed threading. The integration suite bypasses
NewConfig, soGetDefaultConfigcarries the same seed.Compression is off by default
A peer on psrpc older than v0.7.6 ignores the compression marker — psrpc deserializes with
DiscardUnknown— and then decodes the gzipped bytes as the payload, so the message is dropped without an error. livekit-server, egress, SIP and agent workers share this bus, so enabling it is a two-stage operator action: roll v0.7.6+ everywhere, then raisequalityat the publishers. The README says so at the setting.max_decompressed_sizeonly affects reading, so it can be set ahead ofquality.Testing
pkg/config/config_test.gois new; the package had no tests. It covers the defaults and an override that leavesThresholdat its default.Verified the config actually reaches the compressor with a throwaway psrpc echo RPC over a local bus: the default config round-trips,
quality: 6withthreshold: 1round-trips, and addingmax_decompressed_size: 64drops that same 16 KB payload — which is what proves it was gzipped rather than skipped by the threshold.quality: 0with the same cap delivers it.Not verified against a live livekit-server; that needs a peer already on psrpc v0.7.6+.
Note on the protocol pin
v1.51.1-0.20260905133529-a4f4b5c0c23fis protocol main at the#1771merge, the same pseudo-version livekit#4844 uses. It is 14 commits ahead of the previous pin and otherwise additive.