Skip to content
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

Dose Genie support handling multiple requests #714

Open
anke1460 opened this issue May 11, 2024 · 7 comments
Open

Dose Genie support handling multiple requests #714

anke1460 opened this issue May 11, 2024 · 7 comments

Comments

@anke1460
Copy link

i have the same question , but not one answered

@essenciary
Copy link
Member

essenciary commented Jun 10, 2024

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.

@Thuener
Copy link

Thuener commented Aug 7, 2024

If I have an API that each request takes some minutes could I run those requests on different cores?

@essenciary
Copy link
Member

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.

@essenciary
Copy link
Member

essenciary commented Aug 7, 2024

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).

@Thuener
Copy link

Thuener commented Aug 8, 2024

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.

@essenciary
Copy link
Member

Understood - let me see if I can take some time today to merge the feature.

@Thuener
Copy link

Thuener commented Sep 12, 2024

Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants