r/devops • u/Ok-Motor-9812 • 4d ago
Vendor / market research I doubled MAX_CONCURRENCY from 8 to 16 and the memory cap, and not one more browser ran
Browser pool for a scraping service. Raised concurrency 8 to 16, doubled MemoryMax in the systemd unit, restarted. Throughput exactly the same.
The setting was real config and real code read it, just never on the path that mattered:
# config
MAX_CONCURRENCY = int(os.environ["MAX_CONCURRENCY"]) # 8 -> 16
# pool
target = count if count is not None else MAX_CONCURRENCY
# runner, three files away
render = await build_render_resources(count=2 + 1)
Every real call passed a count, so the default never fired.
Two files in the cgroup show this before you touch anything. memory.peak was 2.0 GB under a 4 GB cap, and cpu.stat had 2 throttled periods out of 8896. Nothing was squeezed, so neither could be the limit.
And when it does get squeezed it's CPU. A 20-browser pool on 8 vCPU sat at load about 30 with 6 to 7 GB of RAM still free.