I’m running Chromium in production, with apps that are almost constantly generating PDFs when users are using it. Over the years I tried keeping a “hot” chromium instance always ready to convert things, but the risk of memory leaks was just too high.
Today I have either a thin puppeteer wrapper on separate infra, or this same wrapper on the same host as my app. This is because some of my clients want to run on-prem and cut off from the internet.
So I run N concurrent instances of Chromium with N consuming at most 4GB of memory simultaneously, behind N queues, so there are no more than N concurrent conversion jobs, and each chrome instance is killed after each job.
As a very popular blog post states (I think it was this one : Phantom pain: the first year running headless Chrome in production but it is different than what I recall), there’s just no guaranteed way to keep RAM usage on check long term on fixed-size infra without fully stopping chrome from time to time.
I am at very low scale but high resource usage, think of 200+ pages PDFs with a lot of high definition pictures for printing.
No incidents in a few years since I abandoned the “hot chrome instance” approach.
This Gothenberg setup looks like it could be my next step, thanks a lot for sharing this link !