Reduce WebSocket buffer sizes from 10MB to 64KB per connection (v0.52.12)
Some checks are pending
Go / build-and-release (push) Waiting to run
Some checks are pending
Go / build-and-release (push) Waiting to run
Previous: 10MB read + 10MB write = 20MB per connection New: 64KB read + 64KB write = 128KB per connection With 100 connections: - Before: 2GB just for buffers - After: 12.5MB for buffers The read limit (SetReadLimit) still allows 10MB messages, but the internal buffers don't need to be that large. Files modified: - app/handle-websocket.go: Reduce buffer sizes - pkg/version/version: Bump to v0.52.12 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -100,8 +100,10 @@ whitelist:
|
||||
var conn *websocket.Conn
|
||||
|
||||
// Configure upgrader for this connection
|
||||
upgrader.ReadBufferSize = int(DefaultMaxMessageSize)
|
||||
upgrader.WriteBufferSize = int(DefaultMaxMessageSize)
|
||||
// Use reasonable buffer sizes (64KB) instead of max message size (10MB)
|
||||
// to prevent memory exhaustion with many connections
|
||||
upgrader.ReadBufferSize = 64 * 1024 // 64KB
|
||||
upgrader.WriteBufferSize = 64 * 1024 // 64KB
|
||||
|
||||
if conn, err = upgrader.Upgrade(w, r, nil); chk.E(err) {
|
||||
log.E.F("websocket accept failed from %s: %v", remote, err)
|
||||
|
||||
@@ -1 +1 @@
|
||||
v0.52.11
|
||||
v0.52.12
|
||||
|
||||
Reference in New Issue
Block a user