By default, HTTP.WebSockets uses a TCP socket configuration that is rather slow:
In the default setting, HTTP.WebSockets takes about 0.04s to respond to a request from a python websockets client.
An equivalent python server takes only 0.0002s to respond.
However, if one disables Nagel's algorithm on the tcp socket, the Julia implementation is on par.
In fact, with the tuned socket below I get Julia to 1e-5s response time.
function server()
server = WebSockets.listen!("127.0.0.1", 8081) do ws
# without these options below, the socket is way too slow.
Sockets.nagle(ws.io.io, false)
Sockets.quickack(ws.io.io, true)
for msg in ws
WebSockets.send(ws, msg)
end
end
end
Proposal: It would be nice to make this tuning the default and expose some relevent settings via the keywords of HTTP.WebSockets.listen! and HTTP.WebSockets.open.
By default,
HTTP.WebSockets
uses a TCP socket configuration that is rather slow:HTTP.WebSockets
takes about 0.04s to respond to a request from a python websockets client.However, if one disables Nagel's algorithm on the tcp socket, the Julia implementation is on par. In fact, with the tuned socket below I get Julia to 1e-5s response time.
Proposal: It would be nice to make this tuning the default and expose some relevent settings via the keywords of
HTTP.WebSockets.listen!
andHTTP.WebSockets.open
.