gethostlatency.bt(8)

πŸ“¦ version 0.17.0, in debian bookworm

✨ 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_BPF
  • bcc

⭐ 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