Skip to content

Conversation

@you-looks-not-tasty
Copy link
Collaborator

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

POST /vs/{VipPort}/rs
PUT  /vs/{VipPort}
@ywc689 ywc689 added the pr/to-review-codes review codes line by line and check if problem exists. label Feb 11, 2025
update = true
}

if vsModel != nil {
Copy link
Collaborator

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) {
Copy link
Collaborator

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
}
Copy link
Collaborator

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?

Comment on lines +116 to +119
newFlags := vs.GetFlags()
newFlagsNOT := ^newFlags
tmpFlags := vsModel.RAMFlags ^ newFlagsNOT
if (tmpFlags & vsModel.RAMFlags) != newFlags {
Copy link
Collaborator

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()?

@ywc689 ywc689 removed the pr/to-review-codes review codes line by line and check if problem exists. label Mar 5, 2025
@ywc689 ywc689 requested a review from Copilot April 28, 2025 01:35
Copy link

Copilot AI left a 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

Comment on lines +89 to +96
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
Copy link

Copilot AI Apr 28, 2025

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.'

Suggested change
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.
Comment on lines +95 to +96
h.logger.Info("Try update update. vs rss len has changed.", "VipPort", params.VipPort)
update = true
Copy link

Copilot AI Apr 28, 2025

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.

Suggested change
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants