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 as HH: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 πŸ’…βœ¨