Live data from Hacker News

The Case of the 50ms request

mysteries.wizardzines.com

81–88 of 88 posts

Re: The Case of the 50ms request

#82
post #74

Knowledge of delayed ack and nagle's algorithm wasn't necessary to solve. The explanation didn't mention the flushHeaders call, which is apparently the fix. I didn't run any tests, just looked at the JS and figured that sending 2 packets is worse than sending 1 w.r.t. latency. It's also a pretty strong intuition that the client side tends to have issues, since the server is usually well-tested and standardized. Also,…

There's a huge difference between solving an instance of a problem and understanding the problem. Enough commits of "this seems to fix the problem" and the codebase becomes really hard to work with.

It's not reasonable to expect that developers understand how everything works. There are billions of lines of code deployed that work for reasons that the developers either don't know or only think they know.

In this case, in my judgement, you only need to know about the delayed-ack/Nagling concepts if there's a engineering requirement to keep the flushHeaders call, and the 50ms latency is a dealbreaker (i.e. not merely a curiosity). Even then, it's not clear how to fix unless you can disable one of those features.

Re: The Case of the 50ms request

#83
Based on the description, guessed 'nagle' without any debugging. Not sure if it implies I was right or wrong, but it explained Nagle's algorithm.

Asked what to do about it and typed 'tcpnodelay'. It replied it wasn't smart and asked me to click a button.

Feels pretty basic to anyone who's ever really touched TCP in code.

Re: The Case of the 50ms request

#84
post #53

The interesting thing for me is that I would suspect most devs including myself would assume that if the request takes 50ms, that's how long it takes (because networks!). I wonder how many of us are able to judge how long something should take? Not me, except anecdotally.

I used to work in an overseas office and quickly learned the ping times to the other branches worldwide so got a “feel” for how long things should take. 10/10 would recommend

Re: The Case of the 50ms request

#85
"Also, the Linux kernel doesn't always enable delayed ACKs -- to reproduce this I actually had to write a Python program that explicitly turns them on. I haven't been able to find a clear explanation of exactly when delayed ACKs are used."

Delayed ACKs can be enabled on Linux kernels 3.11+ with ip(8).

  ip route change ROUTE quickack 1
On MacOS and Windows, delayed ACKs can be configured through sysctl and the registry, respectively.

Delayed ACKs may be used in response to congestion.

For example, in bulk, i.e., non-interactive, transfers with large packets, delayed ACKs can be useful.

This is covered in Chapters 15 (15.3) and 16 of Stevens' TCP/IP Illustrated Vol. 1.

This draft suggests delayed ACKs are useful during TLS handshake.

https://tools.ietf.org/id/draft-stenberg-httpbis-tcp-03.html

Also, socat allows for setting TCP options via setsockopt. No need to write a new program.

Re: The Case of the 50ms request

#86

"Also, the Linux kernel doesn't always enable delayed ACKs -- to reproduce this I actually had to write a Python program that explicitly turns them on. I haven't been able to find a clear explanation of exactly when delayed ACKs are used." Delayed ACKs can be enabled on Linux kernels 3.11+ with ip(8). ip route change ROUTE quickack 1 On MacOS and Windows, delayed ACKs can be configured through sysctl and the registry…

   ip route change ROUTE quickack 1 dev STRING

Re: The Case of the 50ms request

#87
post #44

I got it straight away, but I have a telecoms engineering and networking background. This just goes to show how poorly networking is taught in most courses (as are databases), and specially in boot camps. Self-taught programmers are also very unlikely to be exposed to this kind of topic. One thing that was not offered as an option was to use a packet analyzer like tcpdump or Wireshark, even though that is the most re…

If you're talking about the game, then there is the option to use tcpdump directly on the client.

Oh, OK, I didn't see it and I went straight to "GUess the problem" or whatever it was called.

Re: The Case of the 50ms request

#88

Earlier quoted context omitted.

Exactly. If anyone has ever seen The Price Is Right, this is the optimal strategy for the “higher / lower” game: cut the options in half each time.

Also known as: Binary Search

True, but not as catchy
Post reply on HN