-
Notifications
You must be signed in to change notification settings - Fork 189
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
Simple server in multi-threaded julia #151
Comments
@h4rm Thanks for reporting this - this will take a bit of digging. Basically, it's about adding support for it. Isn't it simple to start Julia on a single worker and spawn the computations within the server thread (in the controller or model)? |
@essenciary Hi Adrian, thx for the quick response. At some point I need to add threads before |
Hi, I bumped into a similar issue (when I start extra processes with Do you expect this to break anything? Thanks. |
@Ankur-deDev tbh I don't think it will break things. To be sure we can start with the tests we have and maybe devise some new ones for parallel execution? |
Note that there seems to be a confusion here. The command So the title of this thread (no pun intended) should be changed. It appears to have nothing to do with multi-threading. Further reading in the Julia doc: multi-processing vs multi-threading |
Count me too, I would like to replace the bog-standard HTTP.jl + WebSockets.jl with Genie.jl. However, the lack of full support for Distributed.jl with #workers > 1 is a show-stopper. Have just tested Genie.jl. As of September 2021 running the test code with "julia -p 4" (anything greater than 1) produces "Error: GET / 404". End of the story... |
@jvo203 Thanks for surfacing this - we might have a bit of bandwidth to tackle this soon. Contributions would be more than welcomed (and I'd be happy to support and join any efforts around this issue). |
Thanks but no thanks! I need to prioritise the scarce development time, there are deadlines at work. As it stands the hurdles in adopting Genie.jl are pretty high:
Had Genie.jl worked out-of-the-box with #workers > 1 I might have given it a try, and even tried to convert the JavaScript WebSockets code to work with channels. Is there an easy way to use vanilla WebSockets in Genie.jl, not channels? The application I am working on uses custom HTTP handlers (including low-level HTTP chunking) + real-time WebSockets handlers. Can one easily do low-level HTTP chunking in Genie.jl? It is dead easy in HTTP.jl. And as Genie.jl uses HTTP.jl under the hood, I guess chunked streaming of HTTP responses should be possible in Genie. |
The choice is yours - you're welcome. |
You could have just used multi-threading Threads.@threads that would run on multiple cores. |
Hi, |
@essenciary I'm willing to do a simple pull request for fixing this, but I need to understand your rationale for using Alternatively we could use |
I've been working on this recently with good success, managed to load and serve a simple app on multiple workers. However, some more advanced things are broken so it needs a bit more work. This will land soon. |
Hi @essenciary, I wonder if there has been any update on this? I'm currently using Oxygen, which supports multi-threading, and could find some time to give you a hand with this. |
@cjproud yes, did some experiments - it's not a big deal. The issue is really code loading (loading dependencies and resources on all workers) so I ended up with loading the app on each worker. From there it just works. What's needed: |
yeah I would highly recommend anyone who wants to use multi-threading to switch to https://github.com/ndortega/Oxygen.jl Genie doesn't support that out of the box as Oxygen does. |
Whilst Oxygen does seem to have a lot of functionality covered, the one major thing that's missing is WebSockets. |
@jvo203 well I think you can handle them with custom middleware. Here is an issue/PR that has added that this summer |
Great! |
We have this ready to roll out in Genie 6. |
Any estimates on the release date for version 6? I use Genie.jl a lot, this will be very useful. |
In the end, most likely we'll release the Genie 6 features into Genie 5 - as some of the breaking changes didn't provide the performance gains I was expecting. That would be ideal anyway. |
We could use help with porting features from the v6 branch into |
hey any updates on this? What’s the best practice now to run genie with some multi-thread computation-intensive function? |
Describe the bug
I like to run a server on the main thread in a multi-threaded julia (e.g.
julia -p4
). I don't need to handle requests on multiple threads, however, I need the threads for some calculations.I get the following error:
To Reproduce
Run the following code with
julia -p 2
Open the site.
Expected behavior
The request is handled by the main thread.
The text was updated successfully, but these errors were encountered: