Better visibility into Linux packet-dropping decisions
lwn.net
lwn.net
I threw together a half-assed POC alternative implementation in Go a couple months ago, using Matt Layher's fantastic netlink libraries:
https://github.com/superfly/dropspy
I have the impression that the drop_mon stuff isn't taken super seriously by anyone, but it's incredibly useful when you're debugging complicated networking stuff.
It uses eBPF to try to trace the path of the packet through the kernel. Haven't needed to use it yet, but it could have saved me a lot of trouble in the past.
Also: The recent trend of putting everything down web sockets is bad, as it effectively regresses to circuit-switched networking with undefined QoS guarantees / failure types and crap tooling. Hopefully we've already passed 'peak websocket'.
This is probably true, but elsewhere packet loss is often diffuse. If you're looking into packet loss, it's likely because something is overloaded on your machine resulting in a burst of loss that affects user experience or your stats. Surviving is great, but eliminating bottlenecks you can control is better.
One thing I’ve noticed is that introducing another function argument can alter tightly written loops and calls (also known as introducing instruction-cache busting).
I am quite sure Jen Axboe has something to say about this while he is busy pushing the Linux kernel toward multi-million IO and packet processing throughout.
We are running jvm (netty client and tomcat server) applications in K8s and are experiencing p99 delays for some requests. Server side, application metrics have a p99 of 8ms, but clients experience a p99 of 2000ms. In this same interval other requests continue happily. I do suspects either scheduling somehow, or something in the network.
Any suggestions on how to figure out how to detect where this happens? (Putting wireshark in between would be a last resort.)
Switching to QUIC or other user-space protocol would give you the best observability.
A more ordinary way to come at this would be to hook up a Prometheus node_exporter and just look at this stuff in Grafana.
Either way, tcpdump on the host or the client (sometimes you need dumps from both) should tell the tale. You probably don't need or want wireshark in between the peers, a capture from either can be loaded at your leasure. If you suspect a non-application issue, you can do -s 64 or so and not capture most of the application data, but still have all the TCP headers. pcaps aren't always exactly the truth about what's on the wire, but they're pretty close.
Personally, I get a lot of mileage out of Wireshark, so every problem report looks like a pcap. If the server is really busy, the pcaps get too big, and you have to do things like short bursts of capturing and hope you see the issue in the burst, or sampling, but if your server isn't very busy, you can do things like pcap all the packets, and ask for problem reports to include client ip and port number and then you can find it in the big pcap a lot easier.
Sometimes you even get lucky and can see what traffic was going on before the mysterious gap in packets, and make a good guess at what's blocking your rx queues or whatever.
Stats are nice too, of course.