-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reuse of electron.BrowserWindow / BrowserWindow pool #234
Comments
That seems like a reasonable idea. Feel free to submit a PR. What exactly are you running inside of your docker container? You're keeping the Electron process running right? I haven't profiled my export server to see where the hotspots are, and we don't service hundreds of requests per second so this hasn't been a problem for me yet. |
My Plan was to run an node express with the electron-pdf integrated handling the requests. Although this is not an issue with only a couple of requests, not having a limitation on the number of open BrowserWindows means a simple DoS of a couple 100 requests will quickly fill up the memory on the VM/server. So the solution IMHO is to make sure the requests are queued and the number of "worker" BrowserWindow instances can not exceed a configurable number. I think that it would gain a couple of milliseconds per request to keep the BrowserWindow open and to reuse it. |
As long as all of the browser windows shared the same options that would be fine. I won't have time to implement this feature myself anytime soon. But if you want to submit a PR I'm fine adding that functionality to the project. A few thoughts:
|
@749 Is this still something you're interested in? I am starting to work on this for my own use case, but I suspect it is different than yours. I'll mention a few points about that here.
The problem I am about to address is improving the response time for a request with a large number of URLs. By implementing both a pool and support for making the requests concurrently. |
I am planning to run a site which may get spikes of serveral hundreds of PDF generation requests.
Of course this cannot be handled by a single server, so I have put your library into a self-contained docker.
However my local tests show that most of the time seems to be wasted on trying to open the BrowserWindow and then closing it again.
Would it be possible to reuse a pool of a configurable number of open BrowserWindow instances?
The text was updated successfully, but these errors were encountered: