Only detecting stale connections for UDP ports in kube-proxy.
The detectStaleConnections function in kube-proxy is very expensive in terms of CPU utilization. The results of this function are only actually used for UDP ports. This adds a protocol attribute to ServicePortName to make it simple to only run this function for UDP connections. For clusters with primarily TCP connections this can improve kube-proxy performance by 2x.
This commit is contained in:
@@ -145,8 +145,11 @@ func (cache *EndpointSliceCache) endpointInfoByServicePort(serviceNN types.Names
|
||||
continue
|
||||
}
|
||||
|
||||
svcPortName := ServicePortName{NamespacedName: serviceNN}
|
||||
svcPortName.Port = *port.Name
|
||||
svcPortName := ServicePortName{
|
||||
NamespacedName: serviceNN,
|
||||
Port: *port.Name,
|
||||
Protocol: *port.Protocol,
|
||||
}
|
||||
|
||||
endpointInfoBySP[svcPortName] = cache.addEndpointsByIP(serviceNN, int(*port.Port), endpointInfoBySP[svcPortName], sliceInfo.Endpoints)
|
||||
}
|
||||
|
Reference in New Issue
Block a user