rajvarun77 opened a new pull request, #3526:
URL: https://github.com/apache/brpc/pull/3526

   # What & Why
   
   A server that just joined the cluster or restarted is "cold" (empty caches, 
unwarmed JIT, unestablished connection pools). Every load balancer hands it a 
full traffic share immediately, causing cold-start tail-latency spikes — and 
latency-feedback schemes (la, p2c_ewma from #3367) can even oscillate: the cold 
server scores badly, gets starved, its stats decay, it gets slammed again. This 
PR adds an opt-in cross-scheme slow-start ramp, the same remedy Envoy ships as 
`slow_start`.
   
   # Usage
   
   ```
   -lb_warmup_ms=30000          # ramp window; 0 (default) disables warm-up 
entirely
   -lb_warmup_curve=1.0         # shape: share = max(min_weight, progress^curve)
   -lb_warmup_min_weight=0.1    # initial share, validated (0, 1]
   ```
   
   # Design
   
   - Join timestamp is stamped per server at `AddServer` (deliberately not on 
`Socket` — sockets are shared across channels, so a socket-level stamp would 
leak one channel's membership change into another's ramp).
   - Ramp math centralized in `load_balancer.{h,cpp}` (`WarmupMultiplier` / 
`WarmupAccept`), one implementation for all policies.
   - `la` and `p2c_ewma` multiply the ramp into their weight so it composes 
with latency scoring instead of fighting it; `rr`, `wrr`, `random`, and 
consistent hashing divert probabilistically (chash moves to the next ring node, 
temporarily diverting part of the hash affinity).
   - The ramp is never applied on the last-chance path: a warming server that 
is the only choice still gets picked, so warm-up cannot manufacture EHOSTDOWN.
   - Re-adding a server after membership removal restarts the ramp; transient 
disconnects do not; all servers ramping together at channel init is a no-op 
(shares stay equal).
   
   # Tests & Docs
   
   8 cases in `test/brpc_lb_warmup_unittest.cpp` (disabled-by-default, ramp 
math incl. curve shaping and configurable floor, per-policy share convergence 
for rr/wrr/random/la/p2c/chash, last-chance exemption, re-add restart); full 
`brpc_load_balancer_unittest` (17/17) passing. Documented in 
`docs/cn/client.md` and `docs/en/client.md`.
   
   cc @chenBright @wwbmmm
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to