Skip to content

v0.1.2

Choose a tag to compare

@ralyodio ralyodio released this 01 Oct 09:39
ed98f87

Fix: recycle a web worker that has grown past 768 MB (#220)

  • Every minute, the web server's primary process checks each worker's resident memory. If a worker is over WEB_WORKER_RSS_MB (default 768), the primary starts a replacement, waits until it is accepting connections, and then lets the old worker finish its requests and exit. If it hasn't exited after 30 s, it gets SIGTERM.
  • Only one worker is recycled at a time, and the pool never drops below its size.
  • The startup log line now shows each worker's heap ceiling and the recycle threshold. Each recycle is logged as it happens.

Why: #219 limited the pool to 4 workers with 1 GB of heap each. That doesn't stop a worker's memory from creeping up with age. On dev2 a worker grew from ~400 MB at one day old to ~970 MB at six days. In a local A/B test, lowering the heap ceiling didn't change workers' resident memory. Recycling caps four workers at about 3 GB.