MM-33893: Disable TCP_NO_DELAY for websocket connections (#17129)
* MM-33893: Disable TCP_NO_DELAY for websocket connections In very large installations, websocket messages cause too much traffic congestion by sending too small packets and thereby cause a drop in throughput. To counter this, we disable the TCP_NO_DELAY flag for websocket connections. This has shown to give noticeable improvements in load tests. We wrap this in a feature flag for now to let it soak in Community first. ```release-note NONE ``` https://mattermost.atlassian.net/browse/MM-33893 * fix gorilla specific conn
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1f165799e0
Коммит
f60b7437da
@@ -7,6 +7,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
@@ -61,6 +62,17 @@ func (a *App) NewWebConn(ws *websocket.Conn, session model.Session, t i18n.Trans
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if a.srv.Config().FeatureFlags.WebSocketDelay {
|
||||||
|
// Disable TCP_NO_DELAY for higher throughput
|
||||||
|
tcpConn, ok := ws.UnderlyingConn().(*net.TCPConn)
|
||||||
|
if ok {
|
||||||
|
err := tcpConn.SetNoDelay(false)
|
||||||
|
if err != nil {
|
||||||
|
mlog.Warn("Error in setting NoDelay socket opts", mlog.Err(err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wc := &WebConn{
|
wc := &WebConn{
|
||||||
App: a,
|
App: a,
|
||||||
send: make(chan model.WebSocketMessage, sendQueueSize),
|
send: make(chan model.WebSocketMessage, sendQueueSize),
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ type FeatureFlags struct {
|
|||||||
PluginIncidentManagement string `plugin_id:"com.mattermost.plugin-incident-management"`
|
PluginIncidentManagement string `plugin_id:"com.mattermost.plugin-incident-management"`
|
||||||
// Toggle on and off support for Files search
|
// Toggle on and off support for Files search
|
||||||
FilesSearch bool
|
FilesSearch bool
|
||||||
|
// Feature flag to control setting the TCP_NO_DELAY setting for websockets.
|
||||||
|
WebSocketDelay bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FeatureFlags) SetDefaults() {
|
func (f *FeatureFlags) SetDefaults() {
|
||||||
@@ -32,6 +34,7 @@ func (f *FeatureFlags) SetDefaults() {
|
|||||||
f.CollapsedThreads = false
|
f.CollapsedThreads = false
|
||||||
f.FilesSearch = false
|
f.FilesSearch = false
|
||||||
f.PluginIncidentManagement = "1.6.0"
|
f.PluginIncidentManagement = "1.6.0"
|
||||||
|
f.WebSocketDelay = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FeatureFlags) Plugins() map[string]string {
|
func (f *FeatureFlags) Plugins() map[string]string {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user