MCPcopy Create free account
hub / github.com/apache/brpc / Feedback

Method Feedback

src/brpc/policy/locality_aware_load_balancer.cpp:359–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359void LocalityAwareLoadBalancer::Feedback(const CallInfo& info) {
360 butil::DoublyBufferedData<Servers>::ScopedPtr s;
361 if (_db_servers.Read(&s) != 0) {
362 return;
363 }
364 const size_t* pindex = s->server_map.seek(info.server_id);
365 if (NULL == pindex) {
366 return;
367 }
368 const size_t index = *pindex;
369 Weight* w = s->weight_tree[index].weight;
370 const int64_t diff = w->Update(info, index);
371 if (diff != 0) {
372 s->UpdateParentWeights(diff, index);
373 _total.fetch_add(diff, butil::memory_order_relaxed);
374 }
375}
376
377int64_t LocalityAwareLoadBalancer::Weight::Update(
378 const CallInfo& ci, size_t index) {

Callers

nothing calls this directly

Calls 5

UpdateParentWeightsMethod · 0.80
fetch_addMethod · 0.80
ReadMethod · 0.45
seekMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected