Debating using https://github.com/microsoft/playwright-python to control browsers vs. puppeteer:
- Fewer JS dependencies
- Can call directly from python
- Opens up the possibility of greater control
Currently, every render request spawns a new browser; this can be somewhat problematic with multiple screens if they all refresh at the same time (memory usage) and also means refreshes are slower (as the browser has to be started from scratch).
Combined with a queueing system like maybe MQTT (see #28 ) this could be used to better control browser launching & concurrency:
- Separate process to receive render requests, route them to a browser, and respond when the page has been captured
- Concurrency control - ensure only at most N browsers are running concurrently
- Launch speedup - could keep N browsers running all the time, and maintain a pool of available browsers, so that some requests might be routed to an already running but idle browser
Would want to maintain the current behavior as the default though, for simplicity - the browser is launched each time directly in response to a render request, this avoids having the external process as a requirement for a simple setup
Debating using https://github.com/microsoft/playwright-python to control browsers vs. puppeteer:
Currently, every render request spawns a new browser; this can be somewhat problematic with multiple screens if they all refresh at the same time (memory usage) and also means refreshes are slower (as the browser has to be started from scratch).
Combined with a queueing system like maybe MQTT (see #28 ) this could be used to better control browser launching & concurrency:
Would want to maintain the current behavior as the default though, for simplicity - the browser is launched each time directly in response to a render request, this avoids having the external process as a requirement for a simple setup