Open anke1460 opened 4 months ago
This is probably better moved into discussions as it's not an issue.
Genie supports handling multiple requests (in parallel). Always did. However, Julia supports multiple types of parallelism: https://docs.julialang.org/en/v1/manual/parallel-computing/
By default, Genie runs each request as an async task / coroutine - so each request will be handled non-blocking, but on the same CPU core.
We have the feature ready to also process the requests multi-threaded (on distinct workers/cpu cores) but it needs to be merged. It's actually been available for a while, but my tests haven't shown any performance benefit from running the requests multi-threaded vs async, so it kind of fell behind.
If I have an API that each request takes some minutes could I run those requests on different cores?
As it is now, the processing of each request would not block the app or other requests. But, as previously replied 2 months ago, Genie is using green threads -- that is, asynchronous processing of each request but on the same core. Unfortunately we haven't had the time to merge the multi-core feature. But also, as mentioned, in our tests, we haven't seen an improvement switching from green threads to multiple workers/cores (though that might be different for other types of apps). So I'd recommend you give it a quick try and see what mileage you get: the handling of the requests is asynchronous.
In addition, if your requests take minutes, you would in fact greatly benefit from using Genie with Stipple to build a reactive app. This will allow you to render the initial UI of the app while launching your computation and showing some progress bar / loading message. Then the framework will allow you to push the data to the UI once you have it. Like some of these apps do: https://learn.genieframework.com/app-gallery
The framework will also allow you to automatically manage each session, so each request/user would get their own data and have their own state (if needed).
Thanks for the answer. But in my case, the application uses the full core, so if I make a second request, I lose 50% of the performance because they are sharing the same core. Thus, if the function would take 10 mins to run, now it takes 20.
I have tried using "julia -p 2 ..." but Genie gives me a warning and then an error.
Understood - let me see if I can take some time today to merge the feature.
Any updates?
i have the same question , but not one answered