Closed janosh closed 2 years ago
(2 x $num_cores) + 1
is actually the recommendation in the gunicorn docs under the logic "one worker will be reading or writing from the socket while the other worker is processing a request."
I can't speak for this code specifically, but in my experience num workers > num CPUs can be helpful if your workers are IO bound (eg see gevent workers for this too).
For FireWorks specifically, since there is typically only going to be a single person accessing the UI, I agree this is likely more workers than necessary, but people have had multi-user deployments before.
For FireWorks specifically, since there is typically only going to be a single person accessing the UI, I agree this is likely more workers than necessary, but people have had multi-user deployments before.
Seems like in that case the ideal setup would be 1 - 2 workers by default and people with a multi-user setup can pass a flag to increase workers.
Yeah, the main problem with excess workers is typically the memory requirements, and I'm not sure off-hand if that is onerous with the FireWorks GUI or not. If it's not onerous, having the gunicorn-recommended num workers is probably fine.
I should clarify that I don't maintain the FireWorks package, I'm just loitering here :)
I only have 16 GB of memory on my machine so I always appreciate when apps use resources judiciously. It's also too verbose atm having the terminal fill up with process IDs every time I launch the GUI. Usability would also benefit IMO.
When launching the web GUI, fireworks instantiates what seems to me an unnecessarily large number of workers based on the available CPU thread count.
My guess is one worker would be enough rather than the 33 created based on my
multiprocessing.cpu_count()
being 16. The large number of workers seem to come from this copy-pastedgunicorn
examplehttps://github.com/materialsproject/fireworks/blob/8ff239a8d5dd67c8c5ccf78368aca8a9714165ae/fireworks/flask_site/gunicorn.py#L1-L20
Copy-paste source from wayback machine:
https://web.archive.org/web/20190831205610/http://docs.gunicorn.org:80/en/19.6.0/custom.html