Skip to content

Commit

Permalink
feat: set tcp proxy listener buffer (#1306)
Browse files Browse the repository at this point in the history
Signed-off-by: bitliu <bitliu@tencent.com>
  • Loading branch information
Xunzhuo committed Apr 18, 2023
1 parent f8da5b4 commit ef98e16
Show file tree
Hide file tree
Showing 36 changed files with 55 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ xds:
- upgradeType: websocket
useRemoteAddress: true
name: default-eg-http
perConnectionBufferLimitBytes: 32768
- '@type': type.googleapis.com/envoy.admin.v3.RoutesConfigDump
dynamicRouteConfigs:
- routeConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@
}
}]
},
"name": "default-eg-http"
"name": "default-eg-http",
"perConnectionBufferLimitBytes": 32768
}
}
}, {
Expand Down Expand Up @@ -428,7 +429,8 @@
}
}]
},
"name": "default-eg-grpc"
"name": "default-eg-grpc",
"perConnectionBufferLimitBytes": 32768
}
}
}, {
Expand Down Expand Up @@ -479,7 +481,8 @@
"@type": "type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector"
}
}],
"name": "default-eg-tls-passthrough-backend"
"name": "default-eg-tls-passthrough-backend",
"perConnectionBufferLimitBytes": 32768
}
}
}, {
Expand Down Expand Up @@ -521,7 +524,8 @@
}
}]
}],
"name": "default-eg-tcp-backend"
"name": "default-eg-tcp-backend",
"perConnectionBufferLimitBytes": 32768
}
}
}, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ xds:
- upgradeType: websocket
useRemoteAddress: true
name: default-eg-http
perConnectionBufferLimitBytes: 32768
- activeState:
listener:
'@type': type.googleapis.com/envoy.config.listener.v3.Listener
Expand Down Expand Up @@ -291,6 +292,7 @@ xds:
statPrefix: http
useRemoteAddress: true
name: default-eg-grpc
perConnectionBufferLimitBytes: 32768
- activeState:
listener:
'@type': type.googleapis.com/envoy.config.listener.v3.Listener
Expand Down Expand Up @@ -327,6 +329,7 @@ xds:
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector
name: default-eg-tls-passthrough-backend
perConnectionBufferLimitBytes: 32768
- activeState:
listener:
'@type': type.googleapis.com/envoy.config.listener.v3.Listener
Expand Down Expand Up @@ -356,6 +359,7 @@ xds:
cluster: default-eg-tcp-backend
statPrefix: tcp
name: default-eg-tcp-backend
perConnectionBufferLimitBytes: 32768
- activeState:
listener:
'@type': type.googleapis.com/envoy.config.listener.v3.Listener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ xds:
- upgradeType: websocket
useRemoteAddress: true
name: default-eg-http
perConnectionBufferLimitBytes: 32768
- activeState:
listener:
'@type': type.googleapis.com/envoy.config.listener.v3.Listener
Expand Down Expand Up @@ -84,6 +85,7 @@ xds:
statPrefix: http
useRemoteAddress: true
name: default-eg-grpc
perConnectionBufferLimitBytes: 32768
- activeState:
listener:
'@type': type.googleapis.com/envoy.config.listener.v3.Listener
Expand Down Expand Up @@ -120,6 +122,7 @@ xds:
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector
name: default-eg-tls-passthrough-backend
perConnectionBufferLimitBytes: 32768
- activeState:
listener:
'@type': type.googleapis.com/envoy.config.listener.v3.Listener
Expand Down Expand Up @@ -149,6 +152,7 @@ xds:
cluster: default-eg-tcp-backend
statPrefix: tcp
name: default-eg-tcp-backend
perConnectionBufferLimitBytes: 32768
- activeState:
listener:
'@type': type.googleapis.com/envoy.config.listener.v3.Listener
Expand Down
7 changes: 7 additions & 0 deletions internal/xds/translator/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ import (
"github.com/envoyproxy/go-control-plane/pkg/wellknown"
"github.com/golang/protobuf/ptypes/wrappers"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/wrapperspb"

"github.com/envoyproxy/gateway/internal/ir"
)

const (
// https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/listener/v3/listener.proto#envoy-v3-api-field-config-listener-v3-listener-per-connection-buffer-limit-bytes
tcpListenerPerConnectionBufferLimitBytes = 32768
)

func buildXdsTCPListener(name, address string, port uint32) *listenerv3.Listener {
accesslogAny, _ := anypb.New(stdoutFileAccessLog)
return &listenerv3.Listener{
Expand All @@ -39,6 +45,7 @@ func buildXdsTCPListener(name, address string, port uint32) *listenerv3.Listener
Filter: listenerAccessLogFilter,
},
},
PerConnectionBufferLimitBytes: wrapperspb.UInt32(tcpListenerPerConnectionBufferLimitBytes),
Address: &corev3.Address{
Address: &corev3.Address_SocketAddress{
SocketAddress: &corev3.SocketAddress{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@
- upgradeType: websocket
useRemoteAddress: true
name: extension-listener
perConnectionBufferLimitBytes: 32768
statPrefix: mock-extension-inserted-prefix
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
statPrefix: http
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,4 @@
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@
cluster: tcp-route-simple-4
statPrefix: tcp
name: tcp-route-simple
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@
- upgradeType: websocket
useRemoteAddress: true
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@
ads: {}
resourceApiVersion: V3
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector
name: tcp-route-complex
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
cluster: tcp-route-simple
statPrefix: tcp
name: tcp-route-simple
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector
name: tcp-route-weighted-backend
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.listener.tls_inspector.v3.TlsInspector
name: tls-passthrough
perConnectionBufferLimitBytes: 32768

0 comments on commit ef98e16

Please sign in to comment.