Repository navigation
fix(www): queue API requests during cron bursts instead of returning 502 - #1309
Conversation
|
Thanks, queueing works as described when I test it. Client aborts can overflow the backlog. When a client gives up while queued (499), nginx frees the # well above max_conns - processes: aborted connections stay in the backlog
# after nginx has released their max_conns slot
listen = 4096(4096 is the container's somaxconn.) Minor:
|
76d029e to
74893cd
Compare
|
Thanks, addressed the main finding, and the 3rd minor one. The 4th minor one is n/a. The first two are risks I'd accept (processing time is usually not above 1s, and bursts happen mainly at modulo-5' points in time, not all the time). |
nginx allowed only as many upstream connections as the api has worker processes, and open-source nginx cannot queue requests beyond max_conns. Whenever all workers were busy, further requests therefore got an immediate 502 "no live upstreams". This happens in the seconds after 5-minute marks, when cron-driven clients (dynDNS updates, among others) fire at once. Let additional connections wait in uwsgi's listen backlog for a free worker, so that bursts are delayed briefly instead of failing; this does not add worker processes, memory, or database connections. As each waiting request holds a client and an upstream connection, raise nginx's worker_connections (already insufficient at times) and the workers' file descriptor limit to match.
74893cd to
e79d655
Compare
nginx allowed only as many upstream connections as the api has worker processes, and open-source nginx cannot queue requests beyond max_conns. Whenever all workers were busy, further requests therefore got an immediate 502 "no live upstreams". This happens in the seconds after 5-minute marks, when cron-driven clients (dynDNS updates, among others) fire at once.
Let additional connections wait in uwsgi's listen backlog for a free worker, so that bursts are delayed briefly instead of failing; this does not add worker processes, memory, or database connections. As each waiting request holds a client and an upstream connection, raise nginx's worker_connections (already insufficient at times) and the workers' file descriptor limit to match.