perf: leaderboard SWR cache + threadpool fix for season-III stalls

- Fix 1: UV_THREADPOOL_SIZE=24 via start_server.sh wrapper (libuv reads OS
  environ; process.env and PM2 env blocks don't propagate on this system)
- Fix 2: Stale-while-revalidate for leaderboards — serve cached/stale data
  instantly, refresh in background; dedicated aggregateCache isolated from
  the 100-entry responseCache; single-flight dedup for concurrent computes
- Fix 3: Background warmer precomputes current + last-completed season
  leaderboards at +20s boot and every 4 min
- Fix 5: Adaptive TTL (5 min live, 24 h completed) via aggregateCacheTtl
- Fixes 1+2 combined: player page stall 95s -> 3.6s under concurrent heavy
  leaderboard load; warm hits served in 1-4ms (was 13-53s)
This commit is contained in:
deploy
2026-06-30 12:03:43 +00:00
parent 0f8f22df29
commit 659785f8f3
4 changed files with 144 additions and 84 deletions
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# Wrapper so libuv reads UV_THREADPOOL_SIZE from the OS environ block.
# PM2's env:/env_file don't propagate to child processes on this system.
export UV_THREADPOOL_SIZE=24
exec node --max-old-space-size=6144 server.js