gethostlatency.bt(8)
β¨ gethostlatency.bt β the vibe π
okay so bestie, this page is about gethostlatency.bt, and it lives in section 8 of the System Manager's Manual. it's giving "show me how slow your DNS lookups are" energy. also it uses bpftrace/eBPF, iykyk π¦
πΈ NAME πΈ
gethostlatency.bt β no cap, this shows you the latency for getaddrinfo / gethostbyname[2] calls. and it runs on bpftrace/eBPF. periodt β¨
π SYNOPSIS π
gethostlatency.bt
π DESCRIPTION π
so what this does is trace and print every single time getaddrinfo(), gethostbyname(), and gethostbyname2() get called β system wide β and then it tells you:
- the responsible PID π
- the command name
- the latency of the call (the duration, in milliseconds)
- and the host string
literally the whole story. π«Ά
this tool is lowkey perfect for identifying DNS latency, by figuring out which remote host name lookups were slow, and by exactly how much. the way that it just... tells you. obsessed. π
π heads up bestie: this tool currently uses dynamic tracing of user-level functions and registers, so it may need modifications to match your software and processor architecture. not me warning you in advance π
and since it uses BPF, only the root user can use this tool. sorry babe, that's just the rules. π
π¦ REQUIREMENTS π¦
CONFIG_BPFbcc
β EXAMPLES β
trace host lookups (getaddrinfo / gethostbyname[2]) system wide:
# gethostlatency.bt
π FIELDS π
- TIME β Time of the command (
HH:MM:SS). β° - PID β Process ID of the client performing the call.
- COMM β Process (command) name of the client performing the call.
- LATms β Latency of the call, in milliseconds. π
- HOST β Host name string: the target of the lookup. π₯
πΈ OVERHEAD πΈ
the rate of lookups should be relatively low, so the overhead is not expected to be a problem. we love a chill tool. π§
π SOURCE π
this is from bpftrace.
https://github.com/iovisor/bpftrace
also bestie, look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. it's in there, promise. π
this is a bpftrace version of the bcc tool of the same name. the bcc tool provides command line options, so if that's your thing:
https://github.com/iovisor/bcc
π» OS π»
Linux π§
π STABILITY π
Unstable β in development. it's giving "we're still cooking" energy. π
π AUTHOR π
Brendan Gregg π
π SEE ALSO π
and that's the whole page, bestie! π this one came out of USER COMMANDS, dated 2018-09-08, and it's filed under gethostlatency.bt(8) in case you need to find it again. go trace some slow lookups, you got this π
β¨π¦
π¦ where this page comes from
- debian bookworm: bpftrace 0.17.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms