gethostlatency(8)
π gethostlatency(8) β¨ System Manager's Manual β¨
πΈ NAME
okay so gethostlatency is the tool that shows latency for getaddrinfo/gethostbyname[2] calls. it's built on Linux eBPF/bcc π¦
π SYNOPSIS
gethostlatency
β¨ DESCRIPTION
bestie, this one traces and prints every time getaddrinfo(), gethostbyname(), and gethostbyname2() get called, system wide π for each call it shows you the responsible PID and command name, the latency of the call (duration) in milliseconds, and the host string.
this is lowkey perfect for spotting DNS latency π you can see which remote host name lookups were slow, and by how much. no cap, it's giving detective energy π΅οΈββοΈ
this makes use of a Linux 4.4 feature (bpf_perf_event_output()). for kernels older than 4.4, check out the version under tools/old, which uses an older mechanism π
also, heads up π¨ this tool currently uses dynamic tracing of user-level functions and registers, so it may need modifications to match your software and processor architecture π
since this uses BPF, only the root user can use this tool. β οΈ no root, no gethostlatency, periodt π
π§ REQUIREMENTS
you'll need CONFIG_BPF and bcc π
π OPTIONS
-p PIDβ trace this process ID only π―
π¦ EXAMPLES
trace host lookups (getaddrinfo/gethostbyname[2]) system wide:
# gethostlatency
π FIELDS
TIMEβ time of the command, formatted asHH:MM:SSβ°PIDβ process ID of the client performing the call πͺͺCOMMβ process (command) name of the client performing the call π§βπ»HOSTβ host name string, aka the target of the lookup π―
π«Ά OVERHEAD
the rate of lookups should be relatively low, so the overhead is not expected to be a problem. literally no stress πβ¨
π SOURCE
this is from bcc π the source lives at https://github.com/iovisor/bcc
also, look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool π
π OS
Linux π§
π STABILITY
Unstable - still in development π§
π AUTHOR
Brendan Gregg π«‘
π₯ SEE ALSO
tcpdump(8) π
bestie, that's the whole page π«Ά it's from the USER COMMANDS section, dated 2016-01-28, and it's still gethostlatency(8) πΈ stay curious, stay caffeinated, and go trace some slow lookups, you got this π β¨
π¦ where this page comes from
- debian bookworm: bpfcc-tools 0.26.0+ds-1 Β· Apache-2.0
- debian trixie: bpfcc-tools 0.31.0+ds-7 Β· Apache-2.0
- ubuntu jammy: bpfcc-tools 0.18.0+ds-2 Β· Apache-2.0
- ubuntu noble: bpfcc-tools 0.29.1+ds-1ubuntu7 Β· Apache-2.0
- ubuntu questing: bpfcc-tools 0.31.0+ds-7ubuntu2 Β· Apache-2.0
- ubuntu resolute: bpfcc-tools 0.35.0+ds-1ubuntu2 Β· Apache-2.0
- ubuntu stonking: bpfcc-tools 0.35.0+ds-1ubuntu4 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms