Wire psrpc bus compression into the message bus constructor - #831
Merged
Merged
Conversation
psrpc v0.7.6 added opt-in gzip at the bus boundary and protocol surfaced it as rpc.PSRPCConfig.Compression with a BusOptions() conversion. livekit-server, egress and ingress have all landed the wiring; sip had no psrpc: block at all, so the setting was unreachable here. More importantly, sip on psrpc v0.7.5 cannot decode a compressed payload — the subscription read loop drops the message without an error — so bumping sip is a precondition for enabling compression anywhere on the shared bus. Compression stays off by default. Enabling it is a two-stage operator action: roll psrpc v0.7.6+ out to every node on the bus first, then raise quality at the publishers. The README says so at the setting. go mod tidy also drops a stale golang.org/x/mod indirect requirement; that drift predates this change and is not caused by the bump.
paulwe
force-pushed
the
psrpc-bus-compression
branch
from
September 6, 2026 16:42
35730c8 to
3f84c6c
Compare
boks1971
approved these changes
Sep 6, 2026
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. livekit-server (#4844), egress and ingress have all landed the wiring.sip was the straggler, which mattered in two ways: it had no
psrpc:config block at all, so the setting was unreachable here; and sip on psrpc v0.7.5 cannot decode a compressed payload — psrpc's subscription read loop drops undecodable messages without an error. Bumping sip is therefore a precondition for enabling compression anywhere on the shared bus.Compression is off by default
qualitydefaults to 0. Enabling it is a two-stage operator action: roll psrpc v0.7.6+ out to LiveKit server, egress, ingress, SIP and any agent workers first, then raisequalityat the publishers. The README says so at the setting, along with a note that the otherPSRPCConfigkeys (max_attempts,timeout,backoff,buffer_size) parse but are unused here —NewConfiguses non-strictyaml.Unmarshal, so they'd otherwise silently look effective.max_decompressed_sizedefaults to 0, unlimited, so nothing starts being dropped by a cap nobody set.Shape
Follows egress (
cmd/server/main.go:117) and ingress (cmd/server/main.go:132) exactly: aPSRPC rpc.PSRPCConfigfield seeded withrpc.DefaultPSRPCConfigin theNewConfigliteral beforeyaml.Unmarshal, so a partial override keeps the seededthreshold.Seeded in
NewConfigonly, notInit(). A zero-valuedrpc.PSRPCConfigis behaviourally identical to the old no-options bus —newCompressorreturns nil forQuality <= 0,getBusOptsre-seedsThresholdtoDefaultCompressionThresholdwhen it's<= 0, andMaxDecompressedSize: 0is unlimited on read — so the two test paths that bypassNewConfigneed no rescue.Init()also runs afterNewConfig, so it couldn't assign wholesale without clobbering YAML values.Both test bus call sites are wired too, so
grep NewRedisMessageBus\|NewLocalMessageBusfinds no stragglers. Neither changes behaviour.Dependency bump
protocol→v1.51.1-0.20260905133529-a4f4b5c0c23fandpsrpc→v0.7.6, the same revisions egress and ingress are on.The protocol range carries one behavioural rider sip actually uses:
TEL-955: fix potential panic in sip, which guards an empty INVITE user part inEvaluateDispatchRule. A fix sip wants. The rest are inert here — the grpc v1.83.1 security bump is already satisfied,sdp: harden SDPFragment.Unmarshaltouches a package sip imports in zero files, and the billing-reporter and agent-simulation commits are additive protobuf in packages sip doesn't import.go mod tidyalso drops a stalegolang.org/x/modindirect requirement. That drift predates this change — running tidy on the unbumped deps produces the identical removal — but it rides along rather than being hand-restored.Testing
go build ./...,go vet ./...andgo test -race ./pkg/...pass; bothtest/packages compile.quality=6 threshold=1024 max=4096.thresholdsurviving at 1024 rather than resetting to 0 is what proves the seed-before-unmarshal ordering. Defaults yieldquality=0 threshold=1024 max=0.pkg/config/config_test.go— this package has never had tests and this change doesn't introduce the first one. Worth knowing that leaves the seed-before-unmarshal ordering unguarded: moving thePSRPC:line belowyaml.Unmarshalwould silently resetthresholdto 0 and start compressing every small message. Happy to add two short tests if reviewers want it closed.Note on formatting
pkg/config/config.goandcmd/livekit-sip/main.goare already non-gofmt-clean onmain, in regions untouched here (theMediaTimeout/RTPDrainingalignment block, and the long one-liner atmain.go:102). Running the formatter would have swept that unrelated churn into this diff, so I didn't — every line added here is independently goimports-clean. CI runs only staticcheck, no formatter, which is why the drift survives. Happy to fix it separately.