Skip to content

Commit bccf4a6

Browse files
UN-5213: Increase MaxStreams value for QUIC transport
The default max streams value of 100 is rather small when subject to high load in terms of connecting QUIC with streams faster than it can create new ones. This high value allows for more throughput.
1 parent 7059ef8 commit bccf4a6

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

connection/connection.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"io"
7+
"math"
78
"net/http"
89
"strconv"
910
"strings"
@@ -19,6 +20,7 @@ const (
1920
lbProbeUserAgentPrefix = "Mozilla/5.0 (compatible; Cloudflare-Traffic-Manager/1.0; +https://www.cloudflare.com/traffic-manager/;"
2021
LogFieldConnIndex = "connIndex"
2122
MaxGracePeriod = time.Minute * 3
23+
MaxConcurrentStreams = math.MaxUint32
2224
)
2325

2426
var switchingProtocolText = fmt.Sprintf("%d %s", http.StatusSwitchingProtocols, http.StatusText(http.StatusSwitchingProtocols))

connection/http2.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"io"
7-
"math"
87
"net"
98
"net/http"
109
"runtime/debug"
@@ -60,7 +59,7 @@ func NewHTTP2Connection(
6059
return &HTTP2Connection{
6160
conn: conn,
6261
server: &http2.Server{
63-
MaxConcurrentStreams: math.MaxUint32,
62+
MaxConcurrentStreams: MaxConcurrentStreams,
6463
},
6564
config: config,
6665
connOptions: connOptions,

origin/tunnel.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ func serveTunnel(
358358
config,
359359
connOptions,
360360
controlStream,
361-
connectedFuse,
362361
reconnectCh,
363362
gracefulShutdownC)
364363

@@ -509,15 +508,16 @@ func ServeQUIC(
509508
config *TunnelConfig,
510509
connOptions *tunnelpogs.ConnectionOptions,
511510
controlStreamHandler connection.ControlStreamHandler,
512-
connectedFuse connection.ConnectedFuse,
513511
reconnectCh chan ReconnectSignal,
514512
gracefulShutdownC <-chan struct{},
515513
) (err error, recoverable bool) {
516514
tlsConfig := config.EdgeTLSConfigs[connection.QUIC]
517515
quicConfig := &quic.Config{
518-
HandshakeIdleTimeout: quicHandshakeIdleTimeout,
519-
MaxIdleTimeout: quicMaxIdleTimeout,
520-
KeepAlive: true,
516+
HandshakeIdleTimeout: quicHandshakeIdleTimeout,
517+
MaxIdleTimeout: quicMaxIdleTimeout,
518+
MaxIncomingStreams: connection.MaxConcurrentStreams,
519+
MaxIncomingUniStreams: connection.MaxConcurrentStreams,
520+
KeepAlive: true,
521521
}
522522
for {
523523
select {

0 commit comments

Comments
 (0)