Skip to content

Lesson 7 of 9 · 24m

Observability and Performance Without Guesswork

Use FreeBSD-native observability — systat, top, vmstat, dtrace, logs, and ZFS counters — to build evidence before tuning anything.

The worst performance advice sounds precise: raise this sysctl, disable that feature, copy this forum snippet. Senior operators work backward from evidence. FreeBSD gives you unusually good evidence if you learn the native tools instead of immediately installing a Linux-shaped dashboard and staring at averages.

Establish the symptom precisely

'The server is slow' is not a symptom; it is a feeling. Define the observable: request latency, packet loss, disk wait, CPU saturation, memory pressure, lock contention, or application queue depth. Then choose the tool:

top -S
vmstat 1
systat -vmstat 1
systat -iostat 1
sockstat -46l

top -S includes system processes that matter on storage-heavy hosts. vmstat exposes memory and paging behavior. systat views are crude but immediate, and immediate evidence beats a beautiful dashboard pointed at the wrong metric.

DTrace is powerful because it is specific

DTrace is not a general-purpose log pipeline. It is dynamic instrumentation: ask a narrow question, measure it, stop. Example questions include which process is generating disk I/O, which syscall dominates latency, or which functions are hot under load. Even a simple provider listing requires care:

dtrace -l | head

In production, DTrace scripts should be reviewed like any other privileged diagnostic. Overly broad probes can add overhead or expose sensitive data. The correct use is hypothesis-driven: measure the narrow transition where latency appears.

Storage evidence starts below the application

For ZFS hosts, combine pool and system views:

zpool iostat -v 1
zfs list -o name,used,avail,compressratio,mountpoint
gstat -p
sysctl kstat.zfs.misc.arcstats | less

A database latency incident may be disk saturation, pool fragmentation, sync write behavior, memory pressure, or application lock contention. Treating zpool iostat as a verdict rather than evidence leads to bad fixes.

Network service evidence

sockstat shows what is actually listening; netstat and pfctl show behavior through the network and firewall layers:

sockstat -46l
netstat -an | grep LISTEN
pfctl -si
pfctl -ss | head

If a jail cannot reach the internet, check routing, NAT state, resolver configuration inside the jail, PF state creation, and the host interface path. If the host can but the jail cannot, do not restart everything and call it analysis.

Logs are still operational truth

/var/log/messages, daemon logs, and application logs matter. FreeBSD does not force every log into a binary journal; use that simplicity. Correlate timestamps with metrics and change events. Most 'performance regressions' are release upgrades, package changes, ZFS dataset changes, or new traffic patterns wearing a latency costume.

Field notes

  • Record a baseline before there is an incident; otherwise every graph becomes storytelling.
  • Sysctls are compiler flags for production behavior: change one at a time, document why, and measure reversal.
  • DTrace answers questions; it does not replace monitoring or alerting.
  • ARC memory usage is normal until evidence shows memory pressure harming the workload.

Was this lesson helpful?

Sign in to rate