-
Notifications
You must be signed in to change notification settings - Fork 458
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
[BUG] Performance about Service & NetworkPolicy #4605
Comments
Hey @zsxsoft, I'm here to help you with any bugs, questions, or becoming a contributor! 😊 To address the performance issue related to Service creation and NetworkPolicy updates in Kube-OVN, you can consider the following optimizations:
These steps aim to mitigate the high latency and potential blocking of operations in large clusters. |
The purpose is to add the svc ClusterIP to networkpolicy generated ACLs. The current implementation do generate lots of duplicated events, I think we can use set to store all the networkpolicies that need to be updated and then generate related events to reduce the duplication. |
I updated my workflow to circumvent this issue temporarily, can't test it for now |
Kube-OVN Version
v1.12.26
Kubernetes Version
v1.27.4
Operation-system/Kernel Version
TencentOS Server 4.0
6.6.6-2401.0.1.tl4.4.x86_64
Description
I have a cluster with ~300 Pods and ~100 NetworkPolicies. I've noticed that every time I create a Service, a significant number of UpdateNp logs are added to the
kube-ovn-controller.log
, and at the same time, the Dashboard shows a Work Queue Latency reaching about 1 minute.Then I checked the code:
https://github.com/kubeovn/kube-ovn/blob/v1.12.26/pkg/controller/network_policy.go#L855-L878
The above code seems to indicate that whenever a Service is created, all Pods within the corresponding Namespace are retrieved, and then all NetworkPolicies are matched to create an 'UpdateNp' queue. This not only results in an O(n^2) time complexity, in my cluster, is equivalent to updating all NetworkPolicies
#1167
Since Pods already match and respond to UpdateNp requests when they are created, and no additional operations are performed on NetworkPolicies during the creation of a Service, I don't quite understand the purpose here.
Moreover, in large-scale clusters, creating/deleting Services should be a relatively common operation. In this case, I'm afraid that all requests for creating/deleting Pods will be blocked after the creation of a Service.
Is there any solution?
Steps To Reproduce
Current Behavior
/
Expected Behavior
/
The text was updated successfully, but these errors were encountered: