You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This causes HTTP transactions on long-lived connections to have a 40 ms delay due to how Delayed Acks and Nagle's Algorithm interact (and they are both enabled by default).
I tested this using fortio on a Ubuntu 20.04 VM.
python -m http.server -p http/1.1
# in another session
fortio load -qps -1 -c 1 http://localhost:8000/some-file
Another option would be to expose a top-level flag to disable Nagle's with the TCP_NODELAY. Curl does this.
Exposing a TCP flag on the top level API is kinda weird, but disabling it is pretty common behaviour. For example, Golang will disable it https://news.ycombinator.com/item?id=34179426
Does anyone use http.server in an environment where this makes a difference? It is, after all, not recommended for production use.
Sorry just saw this. I hope nobody is using this this for anything performance critical. That said, I've used it in my dev environment. Setting nodelay only saves around 50ms per request, but I figured that 50ms times however many times people use this could add up.
Activity
ericvsmith commentedon Aug 31, 2023
Does anyone use http.server in an environment where this makes a difference? It is, after all, not recommended for production use.
Stevenjin8 commentedon Oct 15, 2023
Sorry just saw this. I hope nobody is using this this for anything performance critical. That said, I've used it in my dev environment. Setting
nodelayonly saves around 50ms per request, but I figured that 50ms times however many times people use this could add up.