We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This is my (failed) attempt at separating light vs. heavy workloads in different threads to retain responsiveness:
using Dates, HTTP const ROUTER = HTTP.Router() function low_latency(req) Threads.@spawn :interactive begin # also tried without this @info "$(now())> $(Threads.threadpool()) tid: $(Threads.threadid())" return "Done with low latency task" end end HTTP.register!(ROUTER, "GET", "/low", low_latency) function high_latency(req) Threads.@spawn begin s = sum(randn(10^8)) @info "$(now())> $(Threads.threadpool()) tid: $(Threads.threadid()), sum = $s" return "Done with high latency task" end end HTTP.register!(ROUTER, "GET", "/high", high_latency) function requestHandler(req) resp = ROUTER(req) return HTTP.Response(200, resp) end HTTP.serve(requestHandler, "0.0.0.0", 7777)
julia +beta -t 1,1
julia +beta -t 2,1
┌ Error: handle_connection handler error │ exception = │ AssertionError: 0 < tid <= v │ Stacktrace: │ [1] _length_assert() │ @ URIs ~/.julia/packages/URIs/6ecRe/src/URIs.jl:694 │ [2] access_threaded(f::typeof(URIs.uri_reference_regex_f), v::Vector{URIs.RegexAndMatchData}) │ @ URIs ~/.julia/packages/URIs/6ecRe/src/URIs.jl:685 │ [3] parse_uri_reference(str::String; strict::Bool) │ @ URIs ~/.julia/packages/URIs/6ecRe/src/URIs.jl:125 │ [4] parse_uri_reference │ @ ~/.julia/packages/URIs/6ecRe/src/URIs.jl:123 [inlined] │ [5] URI │ @ ~/.julia/packages/URIs/6ecRe/src/URIs.jl:146 [inlined] │ [6] gethandler │ @ ~/.julia/packages/HTTP/z8l0i/src/Handlers.jl:391 [inlined] │ [7] (::HTTP.Handlers.Router{typeof(HTTP.Handlers.default404), typeof(HTTP.Handlers.default405), Nothing})(req::HTTP.Messages.Request) │ @ HTTP.Handlers ~/.julia/packages/HTTP/z8l0i/src/Handlers.jl:427 │ [8] requestHandler(req::HTTP.Messages.Request) │ @ Main ./REPL[7]:2 │ [9] (::HTTP.Handlers.var"#1#2"{typeof(requestHandler)})(stream::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Connection{Sockets.TCPSocket}}) │ @ HTTP.Handlers ~/.julia/packages/HTTP/z8l0i/src/Handlers.jl:58 │ [10] #invokelatest#2 │ @ ./essentials.jl:816 [inlined] │ [11] invokelatest │ @ ./essentials.jl:813 [inlined] │ [12] handle_connection(f::Function, c::HTTP.ConnectionPool.Connection{Sockets.TCPSocket}, listener::HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, readtimeout::Int64, access_log::Nothing) │ @ HTTP.Servers ~/.julia/packages/HTTP/z8l0i/src/Servers.jl:447 │ [13] macro expansion │ @ ~/.julia/packages/HTTP/z8l0i/src/Servers.jl:385 [inlined] │ [14] (::HTTP.Servers.var"#16#17"{HTTP.Handlers.var"#1#2"{typeof(requestHandler)}, HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, Set{HTTP.ConnectionPool.Connection}, Int64, Nothing, Base.Semaphore, HTTP.ConnectionPool.Connection{Sockets.TCPSocket}})() │ @ HTTP.Servers ./task.jl:514 └ @ HTTP.Servers ~/.julia/packages/HTTP/z8l0i/src/Servers.jl:461
The text was updated successfully, but these errors were encountered:
Superseded by #1040
Sorry, something went wrong.
No branches or pull requests
This is my (failed) attempt at separating light vs. heavy workloads in different threads to retain responsiveness:
julia +beta -t 1,1
does not give the intended behavior, maybe due to Interactive threads in Julia v1.9.0-beta do not give expected results JuliaLang/julia#48580.julia +beta -t 2,1
will throw an error upon receiving a request:The text was updated successfully, but these errors were encountered: