Skip to content
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

perf: optimize zone aware load balancing #227

Merged
merged 9 commits into from
Nov 17, 2016
Merged

Conversation

RomanDzhabarov
Copy link
Member

No description provided.

const HostSet& host_set_;
const HostSet* local_host_set_;

bool early_exit_zone_routing_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: just initialize {true} here with the other initializers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, early_exit_zone_routing_ and route_directly_ are mutually exclusive. Combine these into a state_ enum which has something like [NoZoneRouting, ZoneDirect, ZoneResidual] or something. You can have cleaner logic and better asserts this way.

}
};

bool LoadBalancerBase::earlyExitNonZoneRoutingRuntime() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would get rid of this function. Everything in here can either be done ahead of time (min cluster size, etc.) or can be moved into the tryChooseLocalZoneHosts() function

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll move runtime checks into tryChooseLocalZoneHosts(), we need access runtime values on each iteration if we are not in NoZoneRouting

return host_set_.healthyHosts();
}

ASSERT(local_host_set_ != nullptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove assert will just crash on next line


// Do not perform zone routing for small clusters.
uint64_t min_cluster_size = runtime_.snapshot().getInteger(RuntimeMinClusterSize, 6U);
if (host_set_.healthyHosts().size() < min_cluster_size) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be precomputed. it can't change outside of the callback.

};

bool LoadBalancerBase::earlyExitNonZoneRouting() {
uint32_t number_of_zones = host_set_.healthyHostsPerZone().size();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local var not needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

if (local_host_set_ == nullptr || local_host_set_->hosts().empty() ||
isGlobalPanic(*local_host_set_)) {
stats_.lb_local_cluster_not_ok_.inc();
const std::vector<HostPtr>& local_zone_healthy_hosts = host_set_.healthyHostsPerZone()[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local var not needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

}

zone_routing_state_ = ZoneRoutingState::ZoneResidual;
// If we cannot route all requests to the same zone, calculate what percentage can be routed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: newline before this line

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg after nit

@RomanDzhabarov RomanDzhabarov merged commit bb93ab7 into master Nov 17, 2016
@RomanDzhabarov RomanDzhabarov deleted the optimize_performance branch November 17, 2016 02:23
liuxu623 pushed a commit to liuxu623/envoy that referenced this pull request Jul 14, 2020
wolfguoliang pushed a commit to wolfguoliang/envoy that referenced this pull request Jan 23, 2021
标题:zh-translation: docs/root/intro/arch_overview/observability/access_logging.rst
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Update the docs to reflect new analyses following the libevent fixes from envoyproxy/envoy-mobile#215.

Signed-off-by: Michael Rebello <[email protected]>
Signed-off-by: JP Simard <[email protected]>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Update the docs to reflect new analyses following the libevent fixes from envoyproxy/envoy-mobile#215.

Signed-off-by: Michael Rebello <[email protected]>
Signed-off-by: JP Simard <[email protected]>
soulxu pushed a commit to soulxu/envoy that referenced this pull request Feb 27, 2024
* Add SGX private key provider and fuzz tests (envoyproxy#227) 

* Add fuzz test for sgx private key protection (envoyproxy#151)

* Fix factory_context issues.

* Fix fallback method in sgx private_key_provider.

* temporarily disable sgx fuzz testing

* Fix duplicate udpa symbols.

Signed-off-by: Liu, Qiming <[email protected]>
Signed-off-by: Huang Xin <[email protected]>
Signed-off-by: Qiming Liu <[email protected]>
Co-authored-by: Qiming <[email protected]>
arminabf pushed a commit to arminabf/envoy that referenced this pull request Jun 5, 2024
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