-
Notifications
You must be signed in to change notification settings - Fork 366
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
Install all Endpoint flows belong to a Service via single bundle #2476
Conversation
/test-all |
/test-integration |
Codecov Report
@@ Coverage Diff @@
## main #2476 +/- ##
==========================================
+ Coverage 59.82% 64.77% +4.94%
==========================================
Files 284 284
Lines 22168 25583 +3415
==========================================
+ Hits 13263 16572 +3309
+ Misses 7483 7456 -27
- Partials 1422 1555 +133
Flags with carried forward coverage won't be shown. Click here to find out more.
|
pkg/agent/openflow/client.go
Outdated
_, ok := cache.Load(flowCacheKey) | ||
// If a flow cache entry already exists for the key, skip it. | ||
if ok { | ||
klog.V(2).Infof("Flows with cache key %s are already installed", flowCacheKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
structured logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -313,6 +313,41 @@ func (c *client) addFlows(cache *flowCategoryCache, flowCacheKey string, flows [ | |||
return nil | |||
} | |||
|
|||
// addFlowsWithMultipleKeys installs the flows with different flowCache keys and adds them into the cache on success. | |||
// Same as addFlows, it will skip flows whose cache already exists. All flows will be installed via a bundle. | |||
func (c *client) addFlowsWithMultipleKeys(cache *flowCategoryCache, keyToFlows map[string][]binding.Flow) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it kinds of feels like this function should either call addFlows
and re-use the code, or should replace it altogether. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, addFlows
can leverage addFlowsWithMultipleKeys
. I have made the change to reduce code redundancy.
556e2ac
to
904bcaa
Compare
It was observed that installing a bundle took around 1~3ms. In InstallEndpointFlows, agent created a bundle for each Endpoint and installed them sequentially. If there are many Services and Endpoints, it could take long time to install flows in this fashion when agent restarts. For instance, it took ~78s to install all flows for 4K Services and 28K Endpoints. This patch uses single bundle for all Endpoint flows belong to a Service to reduce the number of bundles. In the above scale, the execution time was reduced from ~78s to ~30s. Signed-off-by: Quan Tian <qtian@vmware.com>
904bcaa
to
383d7c0
Compare
/test-all |
It was observed that installing a bundle took around 1~3ms. In
InstallEndpointFlows, agent created a bundle for each Endpoint and
installed them sequentially. If there are many Services and Endpoints,
it could take long time to install flows in this fashion when agent
restarts. For instance, it took ~78s to install all flows for 4K
Services and 28K Endpoints.
This patch uses single bundle for all Endpoint flows belong to a Service
to reduce the number of bundles. In the above scale, the execution time
was reduced from ~78s to ~30s.
Signed-off-by: Quan Tian qtian@vmware.com