Skip to content

add bus compression settings to PSRPCConfig - #1771

Merged
paulwe merged 3 commits into
mainfrom
psrpc-bus-compression-config
Sep 5, 2026
Merged

add bus compression settings to PSRPCConfig#1771
paulwe merged 3 commits into
mainfrom
psrpc-bus-compression-config

Conversation

@paulwe

@paulwe paulwe commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Surfaces the opt-in gzip compression added in psrpc#130 (released as v0.7.6) as configuration, so services that already carry a PSRPCConfig can enable it from their psrpc: yaml block.

psrpc:
  compression:
    quality: 6
    threshold: 1024
    max_decompressed_size: 0

Shape

CompressionConfig is its own type rather than an alias for psrpc.CompressionOpts. The fields match one for one, but CompressionOpts carries no yaml tags, so keys would marshal as maxdecompressedsize, and livekit-server's configtest.CheckYAMLTags recurses into nested config structs and requires omitempty on every exported non-bool field.

BusOptions() is the single conversion into psrpc bus options, alongside the existing (*ClientParams).Options(). Value receiver, because getPSRPCConfig(conf) returns a non-addressable PSRPCConfig. It returns the option unconditionally: WithBusCompression with Quality <= 0 leaves the compressor nil, and MaxDecompressedSize still has to reach the read side when publishing is off.

It stops short of a rpc.NewMessageBus helper — livekit-server picks redis-vs-local, cloud uses NATS, and each is already a wire provider.

Default is off

Quality defaults to zero. A peer on a psrpc older than v0.7.6 cannot decode a compressed payload, and psrpc's subscription read loop drops undecodable messages, so a deployment has to be fully upgraded before publishers raise it. Threshold is seeded from psrpc.DefaultCompressionThreshold so the effective value is visible in a dumped config.

Notes

@changeset-bot

changeset-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 58b6510

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
github.com/livekit/protocol Patch
@livekit/protocol Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

psrpc v0.7.6 adds opt-in gzip at the bus boundary. Surface it as a
psrpc.compression yaml block so every service that already carries a
PSRPCConfig can enable it, and add BusOptions() as the single conversion
into psrpc bus options.

Compression stays off by default: a peer on an older psrpc cannot decode
a compressed payload and its subscription read loop drops it silently,
so a deployment has to be fully upgraded before quality is raised.

The grpc patch bump comes from psrpc v0.7.6 via MVS.
@paulwe
paulwe force-pushed the psrpc-bus-compression-config branch from f4be23a to abec128 Compare September 5, 2026 11:58
@paulwe
paulwe requested a review from a team September 5, 2026 11:59
@paulwe
paulwe force-pushed the psrpc-bus-compression-config branch from 3d53775 to 53de1cb Compare September 5, 2026 12:00
@paulwe
paulwe merged commit a4f4b5c into main Sep 5, 2026
8 checks passed
@paulwe
paulwe deleted the psrpc-bus-compression-config branch September 5, 2026 13:35
@github-actions github-actions Bot mentioned this pull request Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants