-
Notifications
You must be signed in to change notification settings - Fork 739
Passive Update mode supported #1014
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
base: devel
Are you sure you want to change the base?
Passive Update mode supported #1014
Conversation
POST /vs/{VipPort}/rs PUT /vs/{VipPort}
update = true | ||
} | ||
|
||
if vsModel != nil { |
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's the contrary side of previous if
condition. if...else...
is more efficient.
update = true | ||
} | ||
|
||
if len(vsModel.RSs.Items) == len(rss) { |
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's the contrary side of previous if condition. if...else... is more efficient.
h.logger.Info("Try update update. rs nat mode has changed.", "VipPort", params.VipPort, "rs", newRs.ID(), "cache nat mode", cacheRs.Spec.Mode, "update nat mode", newRs.GetFwdModeString()) | ||
update = true | ||
break | ||
} |
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.
Doesn't it need to consider any other field changes in RS?
newFlags := vs.GetFlags() | ||
newFlagsNOT := ^newFlags | ||
tmpFlags := vsModel.RAMFlags ^ newFlagsNOT | ||
if (tmpFlags & vsModel.RAMFlags) != newFlags { |
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.
What's purpose of the four line codes? To tell if vsModel.RAMFlags != vs.GetFlags()
?
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.
Pull Request Overview
This PR adds support for a new passive update mode that minimizes unnecessary backend updates during high-frequency service changes. Key changes include:
- Introducing a new query parameter "passiveUpdate" in PUT and POST endpoints.
- Updating the embedded API specification to include "passiveUpdate" and adding RAMFlags to support real server snapshot sorting.
- Adjusting the update decision logic in the ipvs command handlers based on the new parameter.
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tools/dpvs-agent/restapi/operations/virtualserver/put_vs_vip_port_urlbuilder.go | Added PassiveUpdate field and query parameter generation. |
tools/dpvs-agent/restapi/operations/virtualserver/put_vs_vip_port_parameters.go | Initialized PassiveUpdate with default value and added binding. |
tools/dpvs-agent/restapi/operations/virtualserver/post_vs_vip_port_rs_urlbuilder.go | Added PassiveUpdate field and query parameter generation. |
tools/dpvs-agent/restapi/operations/virtualserver/post_vs_vip_port_rs_parameters.go | Initialized PassiveUpdate with default value and added binding. |
tools/dpvs-agent/restapi/embedded_spec.go | Updated API spec with PassiveUpdate parameter and added RAMFlags. |
tools/dpvs-agent/pkg/ipc/types/snapshot.go | New implementation of sort interface for RealServer spec expansion. |
tools/dpvs-agent/pkg/ipc/types/realserver.go | Introduced SliceRealServerSpec for sorting. |
tools/dpvs-agent/pkg/ipc/types/getmodel.go | Updated model conversion to include new RAMFlags value. |
tools/dpvs-agent/models/virtual_server_spec_expand.go | Added RAMFlags to the virtual server spec. |
tools/dpvs-agent/cmd/ipvs/put_vs_vip_port.go | Updated update logic based on PassiveUpdate and server properties. |
tools/dpvs-agent/cmd/ipvs/post_vs_vip_port_rs.go | Updated update logic based on PassiveUpdate and real server changes. |
Files not reviewed (1)
- tools/dpvs-agent/dpvs-agent-api.yaml: Language not supported
h.logger.Info("Try update update. vs not found in snapshot.", "VipPort", params.VipPort) | ||
update = true | ||
} | ||
|
||
if vsModel != nil { | ||
if len(vsModel.RSs.Items) != len(rss) { | ||
h.logger.Info("Try update update. vs rss len has changed.", "VipPort", params.VipPort) | ||
update = true |
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.
The log message contains a duplicated word 'update update'. Consider revising it to a clearer message such as 'Attempt update: vs not found in snapshot.'
h.logger.Info("Try update update. vs not found in snapshot.", "VipPort", params.VipPort) | |
update = true | |
} | |
if vsModel != nil { | |
if len(vsModel.RSs.Items) != len(rss) { | |
h.logger.Info("Try update update. vs rss len has changed.", "VipPort", params.VipPort) | |
update = true | |
h.logger.Info("Attempt update: vs not found in snapshot.", "VipPort", params.VipPort) | |
update = true | |
} | |
if vsModel != nil { | |
if len(vsModel.RSs.Items) != len(rss) { | |
h.logger.Info("Attempt update: vs rss len has changed.", "VipPort", params.VipPort) |
Copilot uses AI. Check for mistakes.
h.logger.Info("Try update update. vs rss len has changed.", "VipPort", params.VipPort) | ||
update = true |
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.
The log message uses the duplicated phrase 'update update'. Consider revising it to 'Attempt update: vs RS list length has changed.' for clarity.
h.logger.Info("Try update update. vs rss len has changed.", "VipPort", params.VipPort) | |
update = true | |
h.logger.Info("Attempt update: vs RS list length has changed.", "VipPort", params.VipPort) |
Copilot uses AI. Check for mistakes.
There will rescheduled to the header realserver while DPVS_SO_SET_ADD | DPVS_SO_SET_EDIT occurred.
The high frequent service changes may lead to backend load imbalance due to schedule resets.
POST /vs/{VipPort}/rs?passiveUpdate=true
PUT /vs/{VipPort}?passiveUpdate=true