perf: expose and reduce message publish latency

This commit is contained in:
richjohnrambo
2026-09-27 21:08:35 +08:00
parent 8e778726e0
commit bde02e8eac
15 changed files with 274 additions and 98 deletions
+5
View File
@@ -182,6 +182,8 @@ var globals struct {
tlsRedirectHTTP string
// Maximum message size allowed from peer.
maxMessageSize int64
// Log complete client packets. Disabled by default because it is expensive on the publish hot path.
logClientPackets bool
// Maximum number of group topic subscribers.
maxSubscriberCount int
// Maximum number of indexable tags.
@@ -335,6 +337,8 @@ type configType struct {
// Maximum message size allowed from client. Intended to prevent malicious client from sending
// very large files inband (does not affect out of band uploads).
MaxMessageSize int `json:"max_message_size"`
// Log every decoded client packet. Intended only for short diagnostic sessions.
LogClientPackets bool `json:"log_client_packets"`
// Maximum number of group topic subscribers.
MaxSubscriberCount int `json:"max_subscriber_count"`
// Masked tags namespaces: tags immutable on User (mask), mutable on Topic only within the mask.
@@ -670,6 +674,7 @@ func main() {
if globals.maxMessageSize <= 0 {
globals.maxMessageSize = defaultMaxMessageSize
}
globals.logClientPackets = config.LogClientPackets
// Maximum number of group topic subscribers
globals.maxSubscriberCount = config.MaxSubscriberCount
if globals.maxSubscriberCount <= 1 {