Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepared message cache for compression, websocket upgrade performance improvements #376

Merged
merged 8 commits into from
May 8, 2024

Conversation

FZambia
Copy link
Member

@FZambia FZambia commented May 1, 2024

Add EXPERIMENTAL prepared message cache for compression scenario:

// PreparedMessageCacheMaxSize when greater than zero enables caching of WebSocket prepared
// messages and sets the maximum size of that cache in bytes. When cache is on – Centrifuge
// uses prepared WebSocket messages for connections with compression. This generally
// introduces overhead but at the same time may drastically reduce compression memory
// and CPU spikes during broadcasts. See also BenchmarkWsBroadcastCompressionCache.
// This option is EXPERIMENTAL, do not use in production. Contact maintainers if it
// works well for your use case, and you want to enable it in production.
PreparedMessageCacheMaxSize int64

Also, this PR has several tweaks in websocket package to reduce number of allocs during Upgrade: from 9 to 3.

@FZambia FZambia marked this pull request as ready for review May 8, 2024 07:09
@FZambia FZambia merged commit 8e2a8d5 into master May 8, 2024
9 checks passed
@FZambia FZambia deleted the prepared_cache_upgrade_perf branch May 8, 2024 07:23
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.

1 participant