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

Performance degradation vs curl in Julia API #1158

Open
AbrJA opened this issue Mar 5, 2024 · 1 comment
Open

Performance degradation vs curl in Julia API #1158

AbrJA opened this issue Mar 5, 2024 · 1 comment

Comments

@AbrJA
Copy link

AbrJA commented Mar 5, 2024

Hi everyone, thanks for your effort in developing this package

Exploring the Oxygen package to build APIs, it is based on your package, I found this:

I run this API locally and I reach about 560 RPS (ab -n1000 -c100 'http://localhost:8001/model')

using Oxygen

@get "/model" function()
    sleep(0.15)
    return json("ok")
end

serve(port = 8001)

When I build another API consuming the previous one, I reach only around 100 RPS even with multithreading (ab -n1000 -c100 'http://localhost:8002/test')

using Oxygen
using HTTP

@get "/test" function()
    response = HTTP.get("http://localhost:8001/model") # sleep(0.15) - Just this line is different
    return json("ok")
end

serve(port = 8002)

Changing this API to use curl instead of HTTP.jl I got a huge improvement, I go from 100 RPS to about 440 RPS

using Oxygen

@get "/test" function()
    response = run(`curl http://localhost:8001/model`) # instead of HTTP.request("GET", "http://localhost:8001/model")
    return json("ok")
end

serve(port = 8002)

Do you have any idea why this is happening?

Thank you for your help,

Abraham

  • Julia 1.10.1
  • HTTP.jl 1.10.2
  • MbedTLS.jl 1.1.9
@AbrJA
Copy link
Author

AbrJA commented Jun 18, 2024

Using EasyCurl as suggested here I get around 520 RPS

using Oxygen
using EasyCurl

@get "/test" function()
    response = curl_get("http://localhost:8001/model")
    return json("Ok")
end

serve(port = 8002)

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

1 participant