I have a little simulation in Dash that takes ~20 seconds to run. Is there a trick that would allow the Dash app to run multiple requests simultaneously? From what I can see, Dash just queues up multiple requests and runs them serially on a single thread, regardless of how many threads Julia was started with. Am I missing something?
With earlier, lower-level prototypes it was easy to get simultaneous responses just by starting processes with @spawn/fetch but it’s not obvious to me how to do that with Dash.
Code for the Dash app is here.
This app is ultimately intended for classroom use, so I might expect 20-30 submissions within a few seconds.
I believe Dash.jl uses HTTP.jl as web server. You would have to modify Dash.jl so that HTTP.jl is loaded on all Julia threads (assuming you launch Julia multi-threaded).
But seems over-kill for classroom use. Alternatively consider pre-calling endpoints, so that your code is pre-loaded.
I am new to Julia, so maybe the question is a bit naive.
@yoh-meyers Just to clarify - it is not possible to use Julia’s threads in a Dash app? We currently have an R/shiny app designed for a single user that can start background tasks to processes data. We use
mcparallel to fork processes. In a Dash app in Julia - these would still need to be separate (forked?) processes rather than threads?
I am just looking around whether it makes sense to port our R/shiny application to Julia instead.
This would be pretty easy to implement. You can
@spawn new tasks onto other threads from a single threaded server easily.
That is actually quite easy - Thanks!
It’s still unclear for me if Dash is capable of parallel requests. It’s no use in spawning multiple jobs inside a callback if you can’t direct each result to the specific requestor. How would HTTP play into this and how to make it work?