I’m creating a PoC where the end-goal is to generate a PNG from a HTML page.
I’ve found many solutions, but the problem is the performance. My current implementation using headless chrome takes around 500ms to generate the PNG.
The goal is to replace an existing system which manages to generate a PNG in around 7ms.
I’m not sure if that kind of performance is possible with HTML, but if i can get to around 100ms, i could most likely reach the desired performance by horizontal scaling and load balancing.
Things i’ve tried:
Generate PNG using headless chrome
Generate PNG using Python (Selenium, Pillows etc.)
I’ve only got experience in Web technologies, but i’m open to any approach.
Some more (optional) context:
The system that i plan to replace takes batch requests of JSON data, generates a layout using this data and ultimately generates/saves a png. These request can range from anywhere between a few hundreds at a time to a million or more in extreme cases, so the system is very performant.
However, that performance comes at some cost. Creating new Layouts is a huge pain. There is no proper way to visualize the layout other than creating a png every time. Configurations like font, font-size, etc. are a pain. Handling edge-cases (what to do if text exceeds length, image is too big etc.) is a pain.
Basically, the current system is very performant, but it’s absolutely not suited for implementing new layouts, which we have to do.