by stochastimus on 5/5/21, 6:41 PM with 79 comments
by gizmo on 5/6/21, 8:38 AM
And in this case the more complicated debugging tools didn't even explain anything. As the last page says, the answer is kind of a leap. If you already knew about this problem curl would have solved it immediately, and if you didn't you'd still be baffled even after knowing exactly why the stack traces are the way they are.
by nickkell on 5/6/21, 9:43 AM
The best job interview I ever had was framed like this. The interviewer told me there was a bug in the system and had a stack of pages he'd printed out that would provide successive clues as to what caused it. I could ask them questions, in effect using the interviewer as a search engine/debugger.
It was the closest an interview has ever come to simulating the day-to-day of a web developer.
by jvns on 5/6/21, 12:57 PM
by avidiax on 5/6/21, 4:11 PM
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, very often people are measuring wrong, so checking the JS to be sure the time recorded is accurate is also important.
by noodlesUK on 5/6/21, 6:29 AM
SPOILER FOR THE GAME
I’ve seen TCP_NODELAY all over the place before, but never known why. This was a fun way to find out.
by fmajid on 5/6/21, 10:22 AM
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 reliable and systematic way to get to the bottom of many performance problems. You'd think the popularity of the network tab in Chrome's dev tools would make this less scary.
by elric on 5/6/21, 8:40 AM
by lbriner on 5/6/21, 11:23 AM
I wonder how many of us are able to judge how long something should take? Not me, except anecdotally.
by wonnage on 5/6/21, 7:57 AM
by YarickR2 on 5/6/21, 9:16 AM
This hints to a possible XSS and/or code injection (not completely quoted input). Input was "strace -s128 -f -p <pid>" , as an answer to "how do you strace server process"
by lmilcin on 5/6/21, 7:13 AM
by CaliforniaKarl on 5/6/21, 7:07 AM
(tl;dr Try turning off delayed ACK first, especially if you can’t update the code.)
by pgt on 5/6/21, 12:07 PM
I answered "req.flushHeaders()" but surprisingly it doesn't accept that as a cause, even though the headers would be sent with the initial packet and should improve the latency.
by 1vuio0pswjnm7 on 5/7/21, 1:52 AM
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.
by emeraldd on 5/6/21, 3:58 PM
by makach on 5/6/21, 9:20 AM
To me this seems pretty obscure and you debug pretty deep into and outside of your application. One part of me thinks of this as Somebody Else's Problem, but definitively makes me rethink it as a SEP and something devs should know about. Specially in time critical/real time systems.
by axaxs on 5/6/21, 7:32 PM
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.
by tpetry on 5/6/21, 8:11 AM
by impoppy on 5/6/21, 1:56 PM
by adriancr on 5/6/21, 12:20 PM
by mansoor_ on 5/6/21, 8:28 AM
by brna on 5/6/21, 12:57 PM
``` You said: "strace -p $(ps aux| grep server.py| grep -v "grep"| awk -F ' ' '{print $2}')".
To strace the server, first you need to find its PID. You know that the program is called server.py. ```
by rhacker on 5/6/21, 3:16 PM
by 1vuio0pswjnm7 on 5/6/21, 8:46 AM