JuliaWeb / HTTP.jl

HTTP for Julia
https://juliaweb.github.io/HTTP.jl/stable/
Other
626 stars 177 forks source link

Make it easy to set TCP_NODELAY and TCP_QUICKACK on client sockets #1124

Closed chelyabinsk closed 2 months ago

chelyabinsk commented 8 months ago

Similar to this PR. I compared latency times in Python WebSockets vs this package and I found that while Python latency essentially equaled my ping to the server, Julia took nearly twice as long.

I did some digging and I found that I can match the times by doing the following

HTTP.WebSockets.open("wss://localhost") do ws
  Sockets.nagle(ws.io.io.io, false)
  Sockets.quickack(ws.io.io.io, true)
end

I propose 4 options

  1. Make this behaviour more explicit in the documentation
  2. I find ws.io.io.io path quite funky, and maybe it will be possible to make it more easily accessible from ws object.
  3. Disable Nagle algorithm and enable TCP_QUICKACK by default
  4. Create an option to pass these options into the open method

I am using

I didn't submit my code I used for benchmarking, but I am happy to do so if requested. I can implement the changes, but I want to know which of the 4 options would best align with the vision of this project