Overload Manager #1418
Replies: 1 comment 1 reply
|
Thanks for this, I like the shape a lot. A few things I'd love your take on. Two of the actions might need a tweak to fit Pingora. The upstream pool is one global LRU, private inside On heap, I think it might be the other way around? Live heap is a subset of RSS, so it can't get past the RSS cap. Where jemalloc really helps is a purge ( For cgroup memory, would subtracting On timeouts, scaling Could FDs be a monitor too? We already sample them with a reserve, and that's where dropping keep-alives matters most. Any thoughts on smoothing, since hard thresholds at 250ms could flap? PSI might be an easy answer for CPU. Could you link #421 and #1408? The gauges here are the capacity signals #1408 wants. Maybe |
Uh oh!
There was an error while loading. Please reload this page.
Problem
Today Praxis sheds load only when a hard limit is already crossed:
runtime.max_memory_bytes). A background sample of resident set size is compared with one byte threshold. Past that line, a new HTTP request is answered503withRetry-After, and a new TCP connection is closed.runtime.shed_on_fd_pressure). New work is refused when open descriptors near the process limit.runtime.max_connections, and the per-listener cap). New work is refused once the count is reached.These checks run before any filter. Refusals are counted on
praxis_overload_rejects_totalwith reasonmemory,file_descriptors,global_connections, orlistener_connections. The result is a cliff: the proxy is fully open, or it is refusing new work.That leaves these gaps:
memory.max. A configured RSS cap is independent ofmemory.currentagainst that limit.praxis_overload_rejects_totalmoves when work is already being refused. There is no series for "memory is at 90% and pools are shrinking."This is the process protecting itself. Retries, hedges, and large idle pools all add load on the proxy. An out-of-memory kill drops in-flight requests together with new ones, and the traffic moves onto the remaining replicas. Shedding cheaper resources first, and refusing new connections only once pressure is saturated, keeps this process alive.
Issue: #145
Epic: #163 (Resilience and Traffic Management)
Proposal
Add an overload manager that samples resource usage off the request path, turns each resource into a pressure value from 0 to 1, and applies protective actions as that pressure rises.
Resource monitors
memory.current/memory.max)Pressure, per resource
Each monitor has a scaling threshold and a saturation threshold. Below the scaling threshold, pressure is 0. Between the two, pressure rises linearly from 0 to 1. At the saturation threshold, pressure stays at 1.
For cgroup memory with scaling at 80% and saturation at 95%:
Actions
Each action listens to one or more monitors and uses the highest pressure:
503andRetry-After, and close a new TCP connection. Work already admitted runs to completion.The existing hard limits stay as the last backstop:
max_memory_bytes,max_connections,shed_on_fd_pressure, and the per-listener connection cap. The manager is the graduated layer in front of those cliffs.Logging and metrics
praxis_overload_rejects_totalcontinues to count refusals from "stop accepting," labeled with the saturated resource.Example configuration
With the cgroup trigger above, 88% of
memory.maxis pressure 0.53: pools shrink, timeouts shorten, keep-alive stays on, and new connections are still accepted. Around 94%, keep-alive turns off. At 96% and above, new connections are refused and the reject counter increments. Under 80%, every action is idle.All reactions