Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set maximum number of connections to 60000 #109

Merged
merged 8 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion image/envoy-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# https://www.envoyproxy.io/docs/envoy/latest/start/quick-start/configuration-dynamic-control-plane

admin:
ignore_global_conn_limit: true
address:
socket_address:
address: 127.0.0.1
Expand Down Expand Up @@ -51,4 +52,4 @@ layered_runtime:
- name: static_layer_0
static_layer:
overload:
global_downstream_max_connections: 90000
global_downstream_max_connections: 60000
2 changes: 1 addition & 1 deletion image/install-alpine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
lineinfile:
path: /etc/rc.conf
regexp: "rc_ulimit="
line: "rc_ulimit='-n 100000'"
line: "rc_ulimit='-n 130000'"

- name: Set boot timout to 1
lineinfile:
Expand Down
2 changes: 1 addition & 1 deletion image/sysctl-yawollet.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
net.core.somaxconn = 65534
net.ipv4.tcp_max_syn_backlog = 100000
net.core.netdev_max_backlog = 100000
net.core.netdev_max_backlog = 100000
35 changes: 20 additions & 15 deletions internal/helper/yawollet.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/golang/protobuf/ptypes/wrappers"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/wrapperspb"
corev1 "k8s.io/api/core/v1"
rbac "k8s.io/api/rbac/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -56,6 +57,11 @@ type LoadbalancerConditionStatus string
// LoadbalancerMetric metric name for lbm
type LoadbalancerMetric string

// TODO: replace with constants from envoywellknown when available
const (
FilterUDPProxy string = "envoy.filters.udp_listener.udp_proxy"
)

// Condition status const
const (
ConditionTrue LoadbalancerConditionStatus = "True"
Expand Down Expand Up @@ -256,14 +262,14 @@ func createEnvoyCluster(lb *yawolv1beta1.LoadBalancer) []envoytypes.Resource {
DnsLookupFamily: envoycluster.Cluster_AUTO,
HealthChecks: healthChecks,
TransportSocket: transportSocket,
PerConnectionBufferLimitBytes: &wrappers.UInt32Value{Value: 32768}, // 32Kib
PerConnectionBufferLimitBytes: wrapperspb.UInt32(32 * 1024),
CircuitBreakers: &envoycluster.CircuitBreakers{
Thresholds: []*envoycluster.CircuitBreakers_Thresholds{
{
Priority: envoycore.RoutingPriority_DEFAULT,
MaxConnections: &wrappers.UInt32Value{Value: 10000 * uint32(hostmetrics.GetCPUNum())},
MaxRequests: &wrappers.UInt32Value{Value: 8000 * uint32(hostmetrics.GetCPUNum())},
MaxPendingRequests: &wrappers.UInt32Value{Value: 2000 * uint32(hostmetrics.GetCPUNum())},
MaxConnections: wrapperspb.UInt32(uint32(10000 * hostmetrics.GetCPUNum())),
MaxRequests: wrapperspb.UInt32(uint32(8000 * hostmetrics.GetCPUNum())),
MaxPendingRequests: wrapperspb.UInt32(uint32(2000 * hostmetrics.GetCPUNum())),
},
},
},
Expand Down Expand Up @@ -344,17 +350,17 @@ func createEnvoyTCPListener(
},
},
FilterChains: []*envoylistener.FilterChain{{
// proxy filter has to be the last in the chain
Filters: append(filters, &envoylistener.Filter{
// proxy filter has to be the last in the chain
Name: envoywellknown.TCPProxy,
ConfigType: &envoylistener.Filter_TypedConfig{
TypedConfig: listenPort,
},
}),
}},
Freebind: &wrappers.BoolValue{Value: true},
EnableReusePort: &wrappers.BoolValue{Value: true},
PerConnectionBufferLimitBytes: &wrappers.UInt32Value{Value: 32768}, // 32 Kib
Freebind: wrapperspb.Bool(true),
EnableReusePort: wrapperspb.Bool(true),
PerConnectionBufferLimitBytes: wrapperspb.UInt32(32 * 1024),
}
}

Expand Down Expand Up @@ -413,16 +419,15 @@ func createEnvoyUDPListener(
},
ListenerFilters: []*envoylistener.ListenerFilter{
{
// TODO this is not in envoywellknown
Name: "envoy.filters.udp_listener.udp_proxy",
Name: FilterUDPProxy,
ConfigType: &envoylistener.ListenerFilter_TypedConfig{
TypedConfig: listenPort,
},
},
},
Freebind: &wrappers.BoolValue{Value: true},
EnableReusePort: &wrappers.BoolValue{Value: true},
PerConnectionBufferLimitBytes: &wrappers.UInt32Value{Value: 32768}, // 32 Kib
Freebind: wrapperspb.Bool(true),
EnableReusePort: wrapperspb.Bool(true),
PerConnectionBufferLimitBytes: wrapperspb.UInt32(32 * 1024),
}
}

Expand Down Expand Up @@ -471,13 +476,13 @@ func createEnvoyRBACRules(
split := strings.Split(sourceRange, "/")

if err != nil || len(split) != 2 {
_ = kubernetes.SendErrorAsEvent(r, fmt.Errorf("%w: SourceRage: %s", ErrCouldNotParseSourceRange, sourceRange), lb)
_ = kubernetes.SendErrorAsEvent(r, fmt.Errorf("%w: SourceRange: %s", ErrCouldNotParseSourceRange, sourceRange), lb)
continue
}

prefix, err := strconv.ParseUint(split[1], 10, 32)
if err != nil {
_ = kubernetes.SendErrorAsEvent(r, fmt.Errorf("%w: SourceRage: %s", ErrCouldNotParseSourceRange, sourceRange), lb)
_ = kubernetes.SendErrorAsEvent(r, fmt.Errorf("%w: SourceRange: %s", ErrCouldNotParseSourceRange, sourceRange), lb)
continue
}

Expand Down