Re:Playwright: Automate Chromium, WebKit and Firefox
by pjgalbraith on Thursday January 27, 2022 @07:14PM
(#30108986)
Yeah this is the way.
@headlessvictim2 search for "Asynchronous Request-Reply pattern" if you want more information about this kind of architecture. You will remove any bottleneck from the API server and can easily scale out from the task queue.
Re:Playwright: Automate Chromium, WebKit and Firefox
by headlessvictim2 on Thursday January 27, 2022 @07:44PM
(#30109263)
Thanks for the suggestion.
How would this work with GPU-bound machine learning models?
The model processing takes > 30 seconds and would still represent the bottleneck?
Re:Playwright: Automate Chromium, WebKit and Firefox
by pjgalbraith on Thursday January 27, 2022 @09:09PM
(#30109902)
You would still have the same bottleneck but the API request would return straight away with some sort of correllation ID. Then the workers that handle the GPU bound tasks would pull jobs when they are ready. If you get a lot of jobs all that will happen is the queue will fill up and the clients will wait longer and hit the status endpoint a few more times.
Here is an example of what it could look like: https://docs.microsoft.com/en-us/azure/architecture/patterns...
Re:Playwright: Automate Chromium, WebKit and Firefox
by headlessvictim2 on Thursday January 27, 2022 @11:49PM
(#30110797)
Thanks for the explanation.
Right now, we use ELB (Elastic Load Balancer) to sit in front of multiple GPU instances.
Is this sufficient or do you suggest adding Celery into this architecture?
The memory errors you're seeing could suggest that you may not actually be able to run multiple instances of the model, and even if you could it may not actually give you more performance than processing sequentially.
Seems like ultimately your current design can't gracefully handle too many concurrent requests, legitimate or malicious - this is a problem I recommend you address regardless of whether you manage to ban the malicious users.