Files
3x-ui/internal/web
Sanaei 3c8cf35734 perf(node): sync up to 32 nodes at once, like the heartbeat
The traffic sync is scheduled every 5s but synced only 8 nodes at a time,
each needing four to seven sequential requests. Past about 125 nodes 80ms
away a tick outlasted its interval, so dashboard traffic, online clients
and quota enforcement moved at a fraction of the intended cadence.

Measured with 150-300 fake nodes over real HTTP, 80ms latency, a dashboard
connected and client-IP sync on:

  SQLite, 300 nodes        8: 25-30s   16: 14-16s   32: 6-9.5s
  SQLite, 150 (20% slow)   8: 24-27s   16: 13-14s   32: 6-7.5s
  Postgres, 150 nodes      8: 13-18s   16: 7.5-10s  32: 6.5-8.3s

No database-locked, pool or writer-queue errors at any setting, and the
merged inbound and client traffic counts matched. Postgres's one-off
adoption tick is slower at 32 than at 16 (16.5s vs 9.7s) as goroutines
wait on its 25-connection pool; steady ticks are fastest at 32.
2026-09-15 20:22:19 +02:00
..