Oxygen.jl is faster than FastAPI, Flask and Rocket

Running some benchmarks

---- 1000 HTTP Requests ----
Flask Server
--- 1.7611534595489502 seconds in total ---
--- 0.0017611534595489502 seconds per iteration ---
FastAPI Server
--- 1.5010621547698975 seconds in total ---
--- 0.0015010621547698975 seconds per iteration ---
Rocket Server
--- 1.741997241973877 seconds in total ---
--- 0.001741997241973877 seconds per iteration ---
Oxygen.jl Server
--- 1.1278553009033203 seconds in total ---
--- 0.0011278553009033204 seconds per iteration ---
5 Likes

Please consider adding some context to your post, what have you benchmarked? Are then benchmarks open source? What are the benchmarks representative of?

3 Likes

More context:

All servers are minimal and just return “hello world”
Running HTTP Request to each server in Julia:

n_iterations::Int64 = 1000
function test_server(server::String, iterations::Int64)
    for i in 1:iterations
        HTTP.get(server)
    end
end

## remove cold start
test_server(oxygen_server,1000)

println("---- "*string(n_iterations)*" HTTP Requests ----")
println("Flask")
@time test_server(flask_server,n_iterations)
println("Fast API")
@time test_server(fastapi_server,n_iterations)
println("Rocket")
@time test_server(rocket_server,n_iterations)
println("Oxygen.jl")
@time test_server(oxygen_server,n_iterations)

We get:

---- 1000 HTTP Requests ----
Flask
  1.010097 seconds (252.42 k allocations: 106.758 MiB, 1.55% gc time, 1.50% compilation time)
Fast API
  0.468368 seconds (183.19 k allocations: 10.974 MiB)
Rocket
  0.946827 seconds (247.34 k allocations: 77.325 MiB, 1.29% gc time)
Oxygen.jl
  0.297005 seconds (200.03 k allocations: 11.234 MiB)

My original comment did the requests in Python, so Julia is also faster in making HTTP requests.

So, this represents that you can get faster sequential responses in an oxygen based server than in any of the other alternatives.

3 Likes

Hope someone can finish this Add Oxygen to Techempower · Issue #63 · ndortega/Oxygen.jl · GitHub , which I don’ t have time in near future.

And someone did benchmark with GitHub - JuliaOnWeb/c_http_jl: wrapping c lib and benchmarking with http.jl and node . Don’ t know how easy to use that with Oxygen.

2 Likes

Oxygen is fast, simple, is a great packcage!

1 Like

Hi

Thanks for this link - the C wrapper looks very fast - what is the actual C library that has been used for the test ?

Would the results not suggest that to be a good way to implement http in Julia?

Regards

1 Like