Day 0: The lab grounds – two VMs, the tools and a first baseline
Goal: set up access to two VMs, install all measurement tools of the course, prepare an extra disk, check what the VM can do and record first reference values · Duration: about 105 min · Prerequisite: two fresh VMs with Ubuntu 24.04, a computer with SSH
Where we start
You need two VMs with Ubuntu 24.04 that you can log in to via SSH with a user name and password, and your own computer with a terminal. The first VM (perf1) has a second, empty virtual disk of 20 GB. Nothing more – you set up everything else today.
Introduction
If you want to measure performance, you first need a place where nothing else interferes. Today you set up this lab: two VMs that can reach each other, all the tools you will work with over the next sixteen days, and a disk of your own on which you can run benchmarks and create faults without endangering the system.
Then you check what your VM can measure at all. Not every virtual machine passes on the processor’s hardware counters, and not every kernel ships the type information that modern eBPF tools need. Better to know that today than on Day 5, in the middle of a measurement.
Finally you record a baseline: how fast the network between the VMs is and how many reads the extra disk manages. These numbers are your yardstick. When you later build in a fault and say “it is slow”, you can say how much slower.
Today you learn:
- to create an SSH key of your own for the lab and to set up short names for the VMs,
- to get to know a VM with
lscpu,freeandlsblk, - to install the measurement tools of the course and to know which package each one comes from,
- to format a disk and mount it permanently,
- to configure
sysstatso that a data point is recorded every minute, - to check whether hardware counters, BTF and eBPF work in your VM,
- to measure a first baseline for network and disk.
This is how every chapter is structured: first it says in words what you do and why, then comes exactly one command, then every option explained, then the real output from the lab and what it means. At the end of each drill a Remember box sums up the core in one sentence, and before the Interview Note you test yourself with a few questions.
Background
The picture for today: setting up a doctor’s practice
This course treats Linux servers the way a family doctor treats patients: measure first, then judge. Today you set up the practice before the first patient arrives.
- perf1 is the treatment room. The patient lies here, and this is where you measure.
- last1 is the treadmill for the stress ECG. It generates load from outside. If the patients put strain on themselves, you would not know whether you are measuring their heart or their effort.
- The extra disk is a separate examination room. There you may create stress without paralyzing the rest of the practice.
- The tools are the instruments: thermometer
(
uptime), blood pressure (vmstat), X-ray (perf), real-time ultrasound (eBPF). Some instruments only work partly in a VM – you check that today. - sar is the long-term ECG. It records every minute, even when you are not looking.
- The baseline is the set of normal values. Without it you do not know whether 25,000 IOPS are healthy or sick.
The terms
| Term | Meaning | In the picture |
|---|---|---|
| perf1 | VM on which you measure | treatment room |
| last1 | VM that generates load and is the remote end | treadmill |
extra disk /daten |
a disk of its own for benchmarks and faults | separate examination room |
| PMC, BTF, eBPF | hardware counters, type information of the kernel, programs in the kernel | special instruments not every practice has |
| sar | long-term recording of the system counters | long-term ECG |
| baseline | values in a quiet state, for comparison | normal values |
Remember: First set up the practice and know the normal values, then treat. If you measure without a baseline, you cannot turn “slow” into a number.
Why two VMs
You measure almost everything in this course on perf1. For some questions, however, you need a second machine: network throughput is measured between two endpoints, an overloaded web server needs someone to flood it with requests, and a load generator must not run on the same machine as the thing it loads – otherwise you measure how the two fight over the CPU. last1 takes on this role.
Why an extra disk
On Days 8 to 10 you deliberately create a lot of load on a disk, fill file systems and make processes wait for I/O. Doing that on the system disk would slow down the operating system at the same time and, in the worst case, make the machine unusable. A separate disk is also yours alone: no system journaling, no log writer and no package manager interferes with the measurement.
What a VM cannot do
A VM is a computer that shares the real hardware with others. That has consequences for measuring, and this course names them where they occur. You should know three of them from the start:
- Hardware counters (PMCs). Modern processors count
cycles, executed instructions, cache misses and much more in dedicated
registers, the Performance Monitoring Counters.
perfcan read them – but only if the hypervisor passes them through to the VM. With KVM this happens when the CPU type of the VM is set tohost; many cloud and default settings lack them. Drill 6 checks this. - CPU steal. When the hypervisor is giving the real CPU to another VM, your VM waits although it wants to run. The VM’s kernel notices and counts this as steal time. It only becomes visible when the host is overcommitted – on Day 4 you create exactly that.
- Frequency, power-saving states and NUMA. How fast the real CPU is clocked, whether it falls into a sleep state and which memory is closer to which core is decided by the hypervisor. Inside the VM you can hardly observe this and cannot influence it at all. The course explains these topics but does not measure them.
The tools and their packages
The tools of the course come from a few packages. If you know which package provides which tool, you will find it on an unfamiliar system too:
| Package | Tools (selection) | What for |
|---|---|---|
procps |
top, vmstat, free,
uptime, pmap |
basic equipment, always present |
sysstat |
mpstat, pidstat, iostat,
sar |
counters per CPU, process, disk; recording |
linux-tools-… |
perf, bpftool |
profiling, hardware counters, tracing; matching the kernel |
bpfcc-tools |
runqlat-bpfcc, biolatency-bpfcc and many
more |
over 100 ready-made eBPF tools (bcc) |
bpftrace |
bpftrace |
your own eBPF one-liners and scripts |
trace-cmd |
trace-cmd |
front end for ftrace |
fio, stress-ng |
fio, stress-ng |
load and benchmarks for disk, CPU, memory |
iperf3, wrk |
iperf3, wrk |
network throughput, HTTP load |
smem, htop, conntrack,
ethtool |
same name | memory per process, overview, connection table, network card |
Ubuntu appends the suffix -bpfcc to the bcc tools so
that they do not clash with programs of the same name from other
packages. On other distributions they have no suffix, for example
runqlat, and live under
/usr/share/bcc/tools/.
Measuring needs comparison
A single number says almost nothing. “The disk manages 25,000 reads
per second” is neither good nor bad as long as you do not know what it
managed yesterday or what an identical disk manages. That is why this
course starts with a baseline: values that you measure
in a quiet state and write down. Later you compare against them. In
operations, long-term recording does this job – sar on a
single host, a monitoring system at scale.
The lab grounds
| VM | IP in the lab | Role | Size |
|---|---|---|---|
| perf1 | 172.16.0.126 | target, this is where you measure | 4 vCPU, 8 GB, + 20 GB extra disk |
| last1 | 172.16.0.228 | load and remote end | 2 vCPU, 4 GB |
Your addresses are different. Wherever the course says
172.16.0.…, put in your own. If a command block starts with
# on perf1, you run it on perf1;
# on your computer means the computer you are sitting at.
The author’s VMs have a little more memory than required; where that
changes an output, the text says so.
Drill 1: Access to the two VMs
Where you are: on your own computer, in a terminal.
What you have afterwards: an SSH key of your own and short names with which
ssh perf1works without a password, and VMs called perf1 and last1.
You work on the VMs via SSH throughout the course. A key just for this lab keeps it separate from your other accounts; you can simply delete it at the end.
Step 1 – Create a key.
# on your computer
ssh-keygen -t ed25519 -f ~/.ssh/perf -C perf-laborssh-keygen creates a key pair consisting of a private
and a public key.
-t ed25519selects the key type Ed25519 – short, fast and today’s standard.-f ~/.ssh/perfsets the file name: the private key ends up in~/.ssh/perf, the public one in~/.ssh/perf.pub. The private key stays on your computer, the public one goes onto the VMs.-C perf-laboris a comment. It later appears in theauthorized_keysfile on the VMs so that you recognize the key there.
The program asks for a passphrase. For a lab you may leave it empty with Enter.
Expected (shortened):
Generating public/private ed25519 key pair.
Your identification has been saved in /home/du/.ssh/perf
Your public key has been saved in /home/du/.ssh/perf.pub
The key fingerprint is:
Step 2 – Copy the public key to the VMs.
# on your computer
ssh-copy-id -i ~/.ssh/perf.pub [email protected]Then the same for last1:
# on your computer
ssh-copy-id -i ~/.ssh/perf.pub [email protected]ssh-copy-id logs in once with the password and appends
the public key to the file ~/.ssh/authorized_keys of the
user on the VM.
-i ~/.ssh/perf.pubsays which public key is transferred.[email protected]is the user and address of the VM. If your user has a different name, replaceubuntu.
Each call asks for the password once and ends with
Number of key(s) added: 1.
Step 3 – Set up short names. So that you do not have
to type key, user and address every time, you add the VMs to the SSH
configuration. Open the file ~/.ssh/config in the editor
nano:
# on your computer
nano ~/.ssh/confignano <file> opens the file in the terminal. If it
does not exist yet, nano creates it when you save. nano is a simple
editor that you use throughout the course:
- You move the cursor with the arrow keys and simply type text.
- You paste text from the clipboard in the terminal with a right click, on a Mac with Cmd+V, on Linux with Ctrl+Shift+V.
- Ctrl+O saves (write Out); nano asks for the file name, Enter confirms it.
- Ctrl+X quits nano. If you have not saved yet, nano
asks:
Ysaves,Ndiscards the changes. - Files under
/etcbelong to root. You open them withsudo nano <file>, otherwise you cannot save them.
Move to the end of the file with the arrow keys and add these lines. Anything already in the file stays unchanged; what you add is highlighted in green:
Host perf1
HostName 172.16.0.126
Host last1
HostName 172.16.0.228
Host perf1 last1
User ubuntu
IdentityFile ~/.ssh/perfEach Host section applies to the short names it lists.
HostName is the real address, User the user on
the VM and IdentityFile the private key. The last section
names both hosts at once so that you only have to write user and key
once.
Step 4 – Give the VMs their names. Many tools write the host name into their output. So that your output matches the course, the VMs are called perf1 and last1:
# on your computer
ssh perf1 sudo hostnamectl set-hostname perf1# on your computer
ssh last1 sudo hostnamectl set-hostname last1ssh perf1 <command> logs in, runs the command and
logs out again. hostnamectl set-hostname perf1 sets the
host name permanently; sudo is needed because it is a
system setting.
Ubuntu cloud images sometimes reset the name at boot to the value from the hypervisor configuration. A small file for cloud-init, the program that sets up these images at boot, prevents that. Log in to perf1 for this:
# on your computer
ssh perf1Create the file there with nano. sudo is needed because
/etc belongs to root:
# on perf1
sudo nano /etc/cloud/cloud.cfg.d/99-hostname.cfgContent:
preserve_hostname: truecloud-init reads all files in /etc/cloud/cloud.cfg.d/ at
boot. preserve_hostname: true tells it: do not touch the
host name, it stays the way you set it. Save with Ctrl+O and Enter and
quit nano with Ctrl+X. If your VM has no /etc/cloud
directory, no cloud-init runs there and you can skip this step (nano
then reports an error when saving because the directory is missing).
Stay logged in to perf1; Step 5 continues there. Afterwards you do both on last1 the same way.
Step 5 – Introduce the VMs to each other. perf1 and
last1 should reach each other by name. To do so, you add both addresses
to /etc/hosts on both VMs:
# on perf1
sudo nano /etc/hostsThe file already contains lines, for example for
localhost. Leave them as they are and add these two lines
at the end of the file:
172.16.0.126 perf1
172.16.0.228 last1Each line in /etc/hosts maps a name to an address: first
the IP address, then, separated by a space, the name. If there is a
comment at the top of the file such as
Your system has configured 'manage_etc_hosts' as True, read
the next paragraph particularly carefully.
On VMs set up by cloud-init this is often not enough: if the
hypervisor’s user data contains manage_etc_hosts: true
(Proxmox sets this, for example), cloud-init rewrites
/etc/hosts from a template at every boot –
your lines are gone after the first reboot. In this course’s lab this
only showed up on Day 11. So also add the lines to the template if it
exists. ls shows whether it exists:
# on perf1
ls /etc/cloud/templates/hosts.debian.tmplIf ls reports No such file or directory,
there is no template and you are done with Step 5. Otherwise open the
template:
# on perf1
sudo nano /etc/cloud/templates/hosts.debian.tmplAdd the same two lines at the end of the file:
172.16.0.126 perf1
172.16.0.228 last1Whether cloud-init really manages /etc/hosts is shown by
sudo cloud-init query merged_cfg.manage_etc_hosts (the
output True means yes).
Now log out of perf1 with exit, log in to last1
(ssh last1) and create
/etc/cloud/cloud.cfg.d/99-hostname.cfg there in the same
way and add the same two lines to /etc/hosts and the
template. Then exit.
Check:
# on your computer
ssh perf1 hostname
ssh last1 hostnamehostname prints the name of the VM. Both lines only
read, which is why they are in one block.
Expected:
perf1
last1
# on your computer
ssh perf1 ping -c 3 last1ping -c 3 last1 sends three echo requests from perf1 to
last1 (-c 3 = three of them, then stop) and measures how
long the reply takes.
Expected:
PING last1 (172.16.0.228) 56(84) bytes of data.
64 bytes from last1 (172.16.0.228): icmp_seq=1 ttl=64 time=1.34 ms
64 bytes from last1 (172.16.0.228): icmp_seq=2 ttl=64 time=0.638 ms
64 bytes from last1 (172.16.0.228): icmp_seq=3 ttl=64 time=0.612 ms
--- last1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2066ms
rtt min/avg/max/mdev = 0.612/0.863/1.340/0.337 ms
If no password prompt appears, both names show up and all three packets get through, access is in place. The last line is already your first measurement: the round trip time (RTT) – the way of a packet there and back – is a little over half a millisecond in the lab because both VMs run on the same host. The first packet is often slower than the following ones: before it, perf1 has to ask for last1’s hardware address via ARP. Between two real servers in the same data center 0.1 to 0.5 ms are usual, over the internet rather 10 to 100 ms.
Remember: A key of your own and short names in
~/.ssh/config– after that every login is justssh perf1. The RTT of a little over 0.6 ms is your first normal value.
If it doesn’t work
Permission denied (publickey)in Step 2: the VM does not allow password logins. Copy the content of~/.ssh/perf.pubby hand into~/.ssh/authorized_keyson the VM via your hypervisor’s console, or add it as a cloud-init key when creating the VM.ping: last1: Temporary failure in name resolution: the entry in/etc/hostsis missing or mistyped. Check withssh perf1 grep last1 /etc/hosts.- After a reboot
ping last1reportsTemporary failure in name resolutionagain: cloud-init has rewritten/etc/hosts. Add the lines to the template (see Step 5). pingshowsfrom worker1or another old name:/etc/hostsstill contains the same address with an earlier name. Reverse resolution takes the first match. Delete the old line with an editor (sudo nano /etc/hosts).
Save your progress? Sign up for free
Drill 2: Getting to know the VM
Where you are: on perf1 (
ssh perf1).What you have afterwards: a profile of perf1 – CPU, memory, disks, kernel – and you know whether the VM’s CPU offers hardware counters.
Before you measure anything, you need to know what you are measuring on. Four CPUs at 2 GHz behave differently from two at 4 GHz, and a disk that the kernel reports as a hard disk is treated differently from an SSD.
Step 1 – Processor.
# on perf1
lscpu | head -20lscpu collects everything the kernel knows about the
processors from /proc/cpuinfo and /sys.
| head -20 shows only the first 20 lines.
Expected (your values differ depending on the hardware):
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
CPU family: 6
Model: 79
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Stepping: 1
BogoMIPS: 4195.14
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca ...
Virtualization: VT-x
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 128 KiB (4 instances)
The most important lines:
CPU(s): 4– the number of CPUs the kernel sees. Each can run one thread at a time. You need this number constantly: a load average of 4 is full load on this VM, idle on a 64-core server.Model name– the host’s real processor, here a Xeon from 2016. It determines which hardware counters exist.Thread(s) per core: 1– no hyper-threading in the VM. On real hardware this often says 2; two threads then share one core, which makes utilization harder to interpret.Hypervisor vendor: KVM– you are in a VM. On real hardware this line is missing.Flags– capabilities of the CPU. What counts for this course isarch_perfmon: the CPU offers the VM an interface for hardware counters. If the flag is missing, the counters are missing.
You check for the flag specifically:
# on perf1
grep -o -w arch_perfmon /proc/cpuinfo | sort -ugrep -o prints only the match instead of the whole line,
-w requires a whole word. /proc/cpuinfo
contains the flags once per CPU, which is why sort -u
(sort, remove duplicates) merges the four matches into one.
Expected:
arch_perfmon
If there is no output, the hypervisor does not pass the counters through. That does not stop you from doing the course – Drill 6 shows what still works.
Step 2 – Memory, disks, kernel.
# on perf1
free -hfree shows how much main memory and swap there are and
how they are used; -h (human) writes the sizes in
readable units such as Gi.
Expected:
total used free shared buff/cache available
Mem: 11Gi 607Mi 5.8Gi 2.3Mi 5.6Gi 11Gi
Swap: 0B 0B 0B
# on perf1
lsblk -d -o NAME,SIZE,ROTA,MODELlsblk lists the block devices, that is, disks.
-d shows only the devices themselves without partitions,
-o NAME,SIZE,ROTA,MODEL selects the columns name, size,
“rotational” and model. Expected:
NAME SIZE ROTA MODEL
sda 80G 1 QEMU HARDDISK
sdb 20G 1 QEMU HARDDISK
sr0 4M 1 QEMU DVD-ROM
# on perf1
uname -runame -r prints the version of the running kernel.
Expected:
6.8.0-151-generic
What you can read here – Day 6 explains the columns of
free in detail:
- The author’s VM has 11 GiB instead of the required 8; yours shows
about
7.7Gihere. Swap: 0B– Ubuntu cloud images do not create swap. That is good for the first days, because without swap there is no swap storm. On Day 7 you create one on purpose.sdb 20Gis the empty extra disk. It has no file system yet – that comes in Drill 4.ROTA 1means: the kernel thinks the disk is a rotating hard disk. QEMU reports this by default, even if there is an SSD underneath. Among other things, the kernel uses it to decide how much to read ahead. Keep in mind: what the VM believes about its disk need not be true. Day 9 comes back to this.6.8.0-151-genericis the kernel. The packageslinux-toolsandlinux-headersmust match exactly this version.
Remember: First know what you are measuring on: number of CPUs, memory, disks, kernel. And what the VM believes about its hardware (
ROTA 1) need not be true.
Save your progress? Sign up for free
Drill 3: Installing the tools
Where you are: first on perf1, then on last1.
What you have afterwards: all measurement tools of the course on perf1 and last1.
Step 1 – See what is already there. Ubuntu Server 24.04 already ships some of the tools. Whether that applies to you depends on how the VM was installed:
# on perf1
dpkg-query -W -f='${Package} ${Version}\n' sysstat bpfcc-tools bpftrace linux-tools-common fiodpkg-query -W asks the package database for the named
packages and prints them sorted alphabetically; the message for a
missing package comes first because it goes to the error channel.
-f sets the output format: ${Package} is the
name, ${Version} the version, \n the line
break. The single quotes prevent the shell from trying to evaluate the
${…} expressions itself.
Expected (on an Ubuntu cloud image):
dpkg-query: no packages found matching fio
bpfcc-tools 0.29.1+ds-1ubuntu7
bpftrace 0.20.2-1ubuntu4.3
linux-tools-common 6.8.0-151.151
sysstat 12.6.1-2
sysstat, bpfcc-tools, bpftrace
and perf are already installed – with 24.04 Ubuntu added
them to the server’s standard equipment so that you do not have to
install packages first when there is a problem (often exactly when the
system has the least room to breathe). fio is missing.
Step 2 – Refresh the package lists.
# on perf1
sudo apt-get updateapt-get update downloads the current package lists;
without it apt does not find new versions.
Step 3 – Install everything. apt simply
skips packages that are already there:
# on perf1
sudo apt-get install -y sysstat linux-tools-common linux-tools-$(uname -r) bpfcc-tools \
bpftrace trace-cmd fio stress-ng iperf3 wrk smem htop conntrack ethtool gitapt-get install -yinstalls the packages;-yanswers the question “Continue?” with yes.linux-tools-$(uname -r)–$(…)inserts the output ofuname -r, herelinux-tools-6.8.0-151-generic.perfmust match the running kernel exactly; the general packagelinux-tools-commononly contains a launcher that looks for the matching version.- The backslash
\at the end of a line continues the command on the next line. - The other names are the packages from the table in the Background section.
Step 4 – The same on last1. Log out of perf1 with
exit and log in with ssh last1. Then the same
two commands:
# on last1
sudo apt-get update# on last1
sudo apt-get install -y sysstat linux-tools-common linux-tools-$(uname -r) bpfcc-tools \
bpftrace trace-cmd fio stress-ng iperf3 wrk smem htop conntrack ethtool gitExpected (end of the output, on last1):
Setting up fio (3.36-1ubuntu0.1) ...
Setting up gcc (4:13.2.0-7ubuntu1) ...
Setting up g++ (4:13.2.0-7ubuntu1) ...
Setting up python3-matplotlib (3.6.3-1ubuntu5) ...
fio and stress-ng pull in some
dependencies, among them a C compiler and Python libraries for charts.
You need the compiler from Day 5 anyway for small test programs.
Check:
# on perf1
perf --version
bpftrace --version
fio --version
stress-ng --version
iperf3 --version | head -1
wrk -v 2>&1 | head -1
trace-cmd --version 2>&1 | head -2Seven pure queries, one line each. | head -1 shows only
the first line of the output. wrk and
trace-cmd write their version to the error channel instead
of standard output; 2>&1 redirects the error channel
(2) to standard output (1) so that head sees it.
Expected:
perf version 6.8.12
bpftrace v0.20.2
fio-3.36
stress-ng, version 0.17.06 (gcc 13.2.0, x86_64 Linux 6.8.0-151-generic)
iperf 3.16 (cJSON 1.7.15)
wrk debian/4.1.0-4build2 [epoll] Copyright (C) 2012 Will Glozer
trace-cmd version 3.2.0 (not-a-git-repo)
Remember: The instruments come from a few packages.
perfmust match the running kernel exactly – hencelinux-tools-$(uname -r).
If it doesn’t work
E: Unable to locate package linux-tools-6.8.0-…: there is no longer a matching package for the running kernel – usually because a new kernel was installed but the VM has not been rebooted yet. Reboot it (sudo reboot) and repeat the step.Could not get lock /var/lib/dpkg/lock-frontend: shortly after the first boot Ubuntu installs security updates in the background. Wait a minute or two and try again.
Save your progress? Sign up for free
Drill 4: Preparing the extra disk
Where you are: on perf1.
What you have afterwards: the extra disk as an ext4 file system under
/datenthat stays mounted after a reboot and belongs to you.
Step 1 – Find the right disk. Formatting erases
everything on the disk. So first check that sdb really is
the empty extra disk:
# on perf1
lsblk /dev/sdblsblk /dev/sdb shows only this device.
Expected:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sdb 8:16 0 20G 0 disk
sdb has 20 GB, no partitions and no mount point.
# on perf1
sudo wipefs /dev/sdbwipefs lists signatures of file systems and partition
tables on a device – without further options it only reads and deletes
nothing.
Expected: no output – no signature, so empty. If
your extra disk has a different name (for virtio disks, for example,
vdb), use that name in all following commands. If
wipefs shows a line, there is already something on the
disk: stop and check whether it really is the right one.
Step 2 – Create a file system.
# on perf1
sudo mkfs.ext4 -L daten /dev/sdbmkfs.ext4 creates an ext4 file system. You use the whole
disk without a partition table – for a data disk that carries only one
file system, this is simpler and perfectly fine. -L daten
gives the file system the label daten, by which you mount
it in a moment.
Expected:
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done
Creating filesystem with 5242880 4k blocks and 1310720 inodes
Filesystem UUID: 789cfd03-3269-45a4-b985-0ad37922baee
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
The line 5242880 4k blocks means: the file system
manages the 20 GB in blocks of 4 KiB. You will meet this block size
again – 4 KiB is also the page size of memory and the usual size in
which disks are read in benchmarks. 1310720 inodes is the
maximum number of files.
Step 3 – Mount permanently.
# on perf1
sudo mkdir -p /datenmkdir -p /daten creates the mount point; -p
reports no error if it already exists.
Then you add the file system to /etc/fstab, the list of
file systems that are mounted at boot:
# on perf1
sudo nano /etc/fstabThe file already contains lines, at least the one for the root file
system /. Leave them as they are and add this line at the
end of the file:
LABEL=daten /daten ext4 defaults,noatime 0 2Save with Ctrl+O and Enter, quit with Ctrl+X.
- The new line in
/etc/fstabsays at boot: mount the file system labeleddatenunder/datenas ext4. The fields:defaults,noatimeare the mount options.noatimeswitches off recording the last read time. Without the option, every read of a file also causes a small write – that would distort your measurements on Day 8.0means: do not back up with the old programdump.2means: check at boot after the root file system.
Step 4 – Tell systemd about the change.
# on perf1
sudo systemctl daemon-reloadsystemctl daemon-reload rereads /etc/fstab;
systemd generates its mount units from it.
Step 5 – Mount.
# on perf1
sudo mount /datenmount /daten mounts it, using the details from
/etc/fstab.
Step 6 – Make the disk yours.
# on perf1
sudo chown ubuntu:ubuntu /datenchown ubuntu:ubuntu /daten makes you (user and group
ubuntu) the owner, so that you can create files there
without sudo.
Check:
# on perf1
findmnt /datenfindmnt shows what is mounted at a path and with which
options.
Expected:
TARGET SOURCE FSTYPE OPTIONS
/daten /dev/sdb ext4 rw,noatime
# on perf1
df -h /datendf -h shows size and usage.
Expected:
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 20G 24K 19G 1% /daten
rw,noatime confirms the option. That only 19 GB of 20 GB
are available is correct: ext4 reserves 5 % for the user root so that a
full file system does not paralyze the system.
Remember: Look twice before formatting (
lsblk,wipefs). A disk of your own withnoatimeis your examination room – there you measure alone.
If it doesn’t work
mount: /daten: can't find LABEL="daten".: the label was not set or mistyped when formatting.sudo blkid /dev/sdbshows the actual label; correct the line in/etc/fstabwithsudo nano /etc/fstab.- After a reboot the VM no longer starts, emergency
console: a typo in
/etc/fstabstops the boot. Log in on the console, correct the line and reboot. If you want to be completely safe, add the optionnofail– then the system also starts without the disk.
Save your progress? Sign up for free
Drill 5: Letting sar record every minute
Where you are: on perf1.
What you have afterwards: a long-term recording that saves all important counters every minute – so you can later look at what was going on before a problem.
sar (System Activity Reporter) from the
sysstat package writes all important system counters at
fixed intervals into one file per day. It is the server’s flight
recorder: if something was slow tomorrow at 3 a.m., you can look at 9
a.m. at what was going on at 3 a.m. Day 3 explains sar in detail; today
you only make sure it is running.
Step 1 – See whether it is running.
# on perf1
systemctl list-timers 'sysstat*' --no-pagersystemctl list-timers shows systemd timers, that is,
scheduled tasks – the modern form of cron. 'sysstat*'
filters by name; the quotes prevent the shell from expanding the
asterisk itself. --no-pager prints everything directly
instead of opening it in less.
Expected:
NEXT LEFT LAST PASSED UNIT ACTIVATES
Mon 2026-11-30 11:50:00 UTC 22s Mon 2026-11-30 11:40:08 UTC 9min ago sysstat-collect.timer sysstat-collect.service
Tue 2026-12-01 00:07:00 UTC 12h Mon 2026-11-30 00:07:08 UTC 11h ago sysstat-summary.timer sysstat-summary.service
2 timers listed.
sysstat-collect.timer collects a data point every ten
minutes (the columns NEXT and LAST are ten
minutes apart), sysstat-summary.timer writes a summary once
a day.
You may come across the file /etc/default/sysstat with
the line ENABLED="false" in guides and the advice to set it
to true. This setting only applies to the old way via cron.
On a system with systemd, the timer calls the collector directly, and it
collects even with false – you can see that in the
LAST column.
Step 2 – Every minute instead of every ten. Ten minutes are a good compromise for operations. In the lab, however, you create faults that last only a minute or two; they would disappear between two data points. You therefore override the timer’s schedule with a drop-in file – a small addition that systemd reads in addition to the shipped file without you having to change it:
# on perf1
sudo mkdir -p /etc/systemd/system/sysstat-collect.timer.dThe directory <unit>.d next to a unit holds
drop-ins; every .conf file in it is read.
mkdir -p creates it.
# on perf1
sudo nano /etc/systemd/system/sysstat-collect.timer.d/jede-minute.confContent:
[Timer]
OnCalendar=
OnCalendar=*:*:00[Timer]is the section you add to.- The line
OnCalendar=without a value deletes the previous schedule. Without it, the new one would only be added, and the timer would run according to both schedules. OnCalendar=*:*:00means: every hour (*), every minute (*), at second00.
Save, quit nano, then tell systemd about the change:
# on perf1
sudo systemctl daemon-reloaddaemon-reload rereads the files.
# on perf1
sudo systemctl restart sysstat-collect.timerrestart starts the timer with the new schedule.
Check:
# on perf1
systemctl list-timers sysstat-collect.timer --no-pagerExpected:
NEXT LEFT LAST PASSED UNIT ACTIVATES
Mon 2026-11-30 11:50:00 UTC 2s Mon 2026-11-30 11:49:57 UTC 59ms ago sysstat-collect.timer sysstat-collect.service
1 timers listed.
NEXT is now at most one minute in the future. A few
minutes later sar -u shows the first data points at
one-minute intervals. One minute is harmless for a single server: the
daily file under /var/log/sysstat/ grows to a few megabytes
and is deleted after 28 days.
Remember: sar is the long-term ECG: it measures even when you are not looking. In the lab every minute, so that short faults do not disappear between two data points.
Save your progress? Sign up for free
Drill 6: Checking what the VM can measure
Where you are: on perf1.
What you have afterwards: the certainty that hardware counters, BTF, bpftrace, the bcc tools, PSI and cgroups v2 work – or a clear list of what is missing on your system.
Step 1 – perf and the hardware counters. First
without sudo:
# on perf1
perf stat -e cycles -- sleep 1perf stat runs a command and counts events while doing
so. -e cycles selects the event CPU cycles, a
hardware counter. The -- separates perf’s options from the
command being measured; here sleep 1, which waits for one
second.
Expected:
Error:
Access to performance monitoring and observability operations is limited.
Consider adjusting /proc/sys/kernel/perf_event_paranoid setting to open
access to performance monitoring and observability operations for processes
without CAP_PERFMON, CAP_SYS_PTRACE or CAP_SYS_ADMIN Linux capability.
...
perf_event_paranoid setting is 4:
This is not a fault in your installation but intended. The setting
perf_event_paranoid controls what normal users may do with
perf. The Linux default is 2 (measure your own processes, but not the
kernel); Ubuntu sets it to 4, which means: without
special rights nothing works. The reason: performance counters can
reveal information about other processes. Throughout the course you
therefore call perf with sudo.
# on perf1
sudo perf stat -e cycles,instructions,cache-misses -- sleep 1-e takes several events, separated by commas: cycles,
executed instructions and cache misses (accesses that the processor
could not serve from its fast cache).
Expected:
Performance counter stats for 'sleep 1':
4102045 cycles
1443311 instructions # 0.35 insn per cycle
14663 cache-misses
1.011657199 seconds time elapsed
0.002035000 seconds user
0.009470000 seconds sys
If you see numbers here, your hypervisor passes the counters through.
sleep hardly computes, which is why it is only about 4
million cycles – at 2.1 GHz that is two thousandths of a second of
compute time. The line insn per cycle (IPC, instructions
per cycle) is one of the most important metrics on Day 5: a value well
below 1 means the CPU waits a lot – usually for memory.
If you see <not supported> instead of a number,
the hypervisor does not pass the counters on. With Proxmox and KVM you
set the VM’s CPU type to host and restart it. If that is
not possible (for example on a rented server), you work with software
events and timer-based profiling on Day 5; the course shows both
ways.
Step 2 – BTF, the kernel’s type information. Modern eBPF tools need to know what the data structures of the running kernel look like – where in a structure each field lies. In the past this required the complete kernel headers and a compiler on every server. Today the kernel stores this information itself as BTF (BPF Type Format) in a file:
# on perf1
ls -l /sys/kernel/btf/vmlinuxExpected:
-r--r--r-- 1 root root 6119306 Nov 30 11:15 /sys/kernel/btf/vmlinux
# on perf1
sudo bpftool btf dump file /sys/kernel/btf/vmlinux format raw | head -2bpftool is the eBPF management tool from the kernel
project (package linux-tools).
btf dump file … format raw prints the type information from
the file in raw form; head -2 shows only the first two
entries, the file has tens of thousands.
Expected:
[1] INT 'long unsigned int' size=8 bits_offset=0 nr_bits=64 encoding=(none)
[2] PTR '(anon)' type_id=5
The file is about 6 MB in size and describes every type of the kernel – the first one is simply a 64-bit integer. Ubuntu builds its kernels with BTF; if the file is missing, the kernel is too old (before 5.4) or built without BTF, and some bpftrace features do not work.
Step 3 – bpftrace and bcc.
# on perf1
sudo bpftrace -e 'BEGIN { printf("bpftrace läuft\n"); exit(); }'bpftrace -e runs a program written directly on the
command line. BEGIN is a special probe that fires exactly
once at startup; printf prints text, exit()
ends the program. You learn the bpftrace language on Day 14.
sudo is needed because eBPF programs are loaded into the
kernel.
Expected:
Attaching 1 probe...
bpftrace läuft
# on perf1
sudo runqlat-bpfcc 1 1runqlat measures how long threads wait after they become
runnable until a CPU actually runs them – the waiting time in the
run queue. The first 1 is the interval in seconds,
the second the number of outputs.
Expected (the last lines):
32 -> 63 : 18 |****************************************|
64 -> 127 : 5 |*********** |
128 -> 255 : 1 |** |
256 -> 511 : 1 |** |
This is a histogram: each line is a range in microseconds, the number next to it how often a waiting time fell into this range. In the quiet VM almost all threads wait less than 64 µs – no sign of saturation. On Day 4 you see how this picture tips over under load. That the tool starts at all proves: eBPF works, and the bcc tools find everything they need.
Step 4 – PSI and cgroups v2.
# on perf1
cat /proc/pressure/cpu/proc/pressure/cpu is a file of the Pressure
Stall Information (PSI): it says what share of the time tasks
had to wait for a CPU. Day 3 explains the values.
Expected:
some avg10=0.02 avg60=0.11 avg300=0.11 total=1609120254
full avg10=0.00 avg60=0.00 avg300=0.00 total=0
# on perf1
stat -fc %T /sys/fs/cgroupstat -fc %T prints the type of the file system mounted
at a path (-f = file system instead of file,
-c %T = only the type name).
Expected:
cgroup2fs
# on perf1
cat /sys/fs/cgroup/cgroup.controllerscgroup.controllers lists which resources the system’s
cgroups can limit.
Expected:
cpuset cpu io memory hugetlb pids rdma misc
PSI is switched on, and cgroup2fs sits under
/sys/fs/cgroup – the system uses cgroups
v2 exclusively, today’s form of resource control. You need the
controllers cpu, io and memory on
Days 7 and 15.
Remember: Check on the first day which special instruments your practice has: hardware counters, BTF, eBPF, PSI, cgroups v2. Better now than in the middle of a measurement.
If it doesn’t work
<not supported> cycleswithsudo perf stat: the hypervisor does not pass the hardware counters through. Set the VM’s CPU type tohost(Proxmox: Hardware → Processors → Type; libvirt:<cpu mode='host-passthrough'/>) and restart the VM. Without access to the hypervisor: carry on with the course, Day 5 shows the alternative.- perf without
sudo:Access to performance monitoring and observability operations is limited.– that is the settingperf_event_paranoid = 4, not an error. Call it withsudo. /sys/kernel/btf/vmlinuxis missing: the kernel is built without BTF. This does not happen with the standard kernel of Ubuntu 24.04; if you have your own kernel, switch tolinux-genericfor the course.
Save your progress? Sign up for free
Drill 7: A first baseline
Where you are: in two terminals – one on last1, one on perf1.
What you have afterwards: two reference values in a file: the network throughput between the VMs and the reads per second of the extra disk.
Step 1 – Network throughput. iperf3
measures how much data per second fits through a TCP connection. It
needs two sides: a server that waits and a client that sends.
In the terminal on last1 you start the server:
# on last1
iperf3 -s -1-s starts server mode, which waits on port 5201.
-1 (one-off) ends the server after exactly one
measurement – so no open port is left behind.
Expected:
-----------------------------------------------------------
Server listening on 5201 (test #1)
-----------------------------------------------------------
The terminal stays put and waits. As soon as the client connects,
Accepted connection from 172.16.0.126 appears here,
followed by the same measurement from the receiver’s point of view.
In the terminal on perf1 you start the client:
# on perf1
iperf3 -c last1 -t 10-c last1 connects as a client to last1,
-t 10 sends for ten seconds.
Expected (shortened):
Connecting to host last1, port 5201
[ 5] local 172.16.0.126 port 40052 connected to 172.16.0.228 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 880 MBytes 7.37 Gbits/sec 1 2.98 MBytes
[ 5] 1.00-2.00 sec 808 MBytes 6.78 Gbits/sec 0 3.23 MBytes
...
[ 5] 9.00-10.00 sec 877 MBytes 7.33 Gbits/sec 0 4.01 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 8.87 GBytes 7.62 Gbits/sec 1 sender
[ 5] 0.00-10.01 sec 8.87 GBytes 7.62 Gbits/sec receiver
iperf Done.
The columns:
Bitrate– the throughput in that second. In the lab it varies between 6.8 and 9.2 Gbit/s; the average is at the bottom: 7.62 Gbit/s.Retr– retransmits, packets that TCP had to send again because no acknowledgment came. One in ten seconds is nothing; hundreds per second would be a warning sign (Day 11).Cwnd– the congestion window: how much data TCP may have in flight without waiting for an acknowledgment. It grows as long as all goes well.
Almost 8 Gbit/s is more than most real network cards manage. That is because both VMs run on the same host: the packets never leave the machine, the hypervisor only copies them from one memory area to another. Between two VMs on different hosts you measure the real network card – at 1 Gbit/s about 940 Mbit/s, at 10 Gbit/s about 9.4 Gbit/s. If your VMs are on different hosts, that is just as correct; all that matters is that you write down your number.
Step 2 – Reads of the extra disk. fio
(flexible I/O tester) creates precisely described load on a
disk. Here you measure random reads of 4 KiB each – the pattern of a
database fetching individual records:
# on perf1
fio --name=basis --filename=/daten/fio-basis --size=1G --rw=randread --bs=4k \
--direct=1 --ioengine=libaio --iodepth=16 --runtime=20 --time_based --group_reportingEvery parameter:
--name=basis– name of the job, appears in the output.--filename=/daten/fio-basis– the test file on the extra disk.--size=1G– it is 1 GiB in size; fio creates it on the first run.--rw=randread– random reads.--bs=4k– block size of 4 KiB per access.--direct=1– read past the page cache. Without this option the data would come from main memory after the first read, and you would measure memory instead of the disk. Exactly this mistake is the diagnosis task on Day 10.--ioengine=libaio– Linux asynchronous I/O: fio sends off several requests without waiting for the first one.--iodepth=16– up to 16 requests in flight at the same time.--runtime=20 --time_based– exactly 20 seconds, no matter how much data that is.--group_reporting– one combined report instead of one per job.
Expected (shortened):
basis: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=16
fio-3.36
Starting 1 process
basis: Laying out IO file (1 file / 1024MiB)
basis: (groupid=0, jobs=1): err= 0: pid=171575: Mon Nov 30 11:51:51 2026
read: IOPS=24.9k, BW=97.2MiB/s (102MB/s)(1944MiB/20001msec)
slat (usec): min=4, max=7820, avg=21.63, stdev=30.13
clat (usec): min=150, max=12078, avg=617.91, stdev=315.78
lat (usec): min=160, max=12103, avg=639.54, stdev=316.32
clat percentiles (usec):
| 1.00th=[ 293], 5.00th=[ 363], 10.00th=[ 400], 20.00th=[ 445],
| 30.00th=[ 482], 40.00th=[ 515], 50.00th=[ 553], 60.00th=[ 594],
| 70.00th=[ 644], 80.00th=[ 717], 90.00th=[ 865], 95.00th=[ 1090],
| 99.00th=[ 1713], 99.50th=[ 2089], 99.90th=[ 3982], 99.95th=[ 5080],
| 99.99th=[ 8455]
...
Disk stats (read/write):
sdb: ios=497094/6, sectors=3976752/120, merge=0/9, ticks=218919/7, in_queue=218925, util=98.66%
What counts:
IOPS=24.9k– almost 25,000 reads per second.BW=97.2MiB/sis the same as an amount of data: 25,000 × 4 KiB.clat(completion latency) – how long a request took from being sent to the device until the answer: 618 µs on average.slatis the time that sending itself cost,latthe sum.clat percentiles– the distribution.50.00th=[553]means: half of all accesses were done in 553 µs.99.00th=[1713]: 99 % were under 1.7 ms, but every hundredth took longer.99.99th=[8455]: a very few took over 8 ms. Remember this pattern: the average hides the outliers, and in practice users complain about the outliers.util=98.66%– the disk was busy almost all the time. That it is still not “full” but could do more if you gave it more parallel requests is the “%utiltrap” of Day 9.
Your numbers depend entirely on what lies under the VM: an NVMe SSD manages many times as much, a real hard disk only a few hundred IOPS. Here too, all that matters is that you know your number.
Step 3 – Clean up and write it down.
# on perf1
rm -f /daten/fio-basisrm -f deletes the test file; -f reports no
error if it is already gone.
# on perf1
nano ~/basislinie.txtnano ~/basislinie.txt creates the note in your home
directory. Content:
Basislinie perf1, Tag 0
Netz perf1 -> last1 (iperf3, 10 s): 7.62 Gbit/s, 1 Retransmit
Zusatzplatte sdb (fio randread 4k, QD16): 24.9k IOPS, clat Mittel 618 us, p99 1.7 ms
Ping perf1 -> last1: RTT ca. 0.6 msEnter your numbers, not the ones from the course. Save, quit nano, then print it as a check:
# on perf1
cat ~/basislinie.txtcat prints the content of a file.
Expected:
Basislinie perf1, Tag 0
Netz perf1 -> last1 (iperf3, 10 s): 7.62 Gbit/s, 1 Retransmit
Zusatzplatte sdb (fio randread 4k, QD16): 24.9k IOPS, clat Mittel 618 us, p99 1.7 ms
Ping perf1 -> last1: RTT ca. 0.6 ms
Remember: The baseline is your set of normal values. Write down your numbers – and with latencies always look at the percentiles, not just the average.
If it doesn’t work
iperf3: error - unable to connect to server - server may have stopped running or use a different port, firewall issue, etc.: Connection refused: the server on last1 is not running (any more) –-1ends it after each measurement. Start it again. If it is running, a firewall blocks port 5201:sudo ufw statuson last1 shows it,sudo ufw allow 5201/tcpopens it.fio: pid=0, err=13/file:filesetup.c:174, func=open, error=Permission denied:/datenstill belongs to root. Catch up on thechownfrom Drill 4.- IOPS far above 100,000 and
clatunder 50 µs on a hard disk: you forgot--direct=1– you measured the page cache.
Save your progress? Sign up for free
Diagnosis task
There is none today – the lab grounds are still free of faults, and that is how it should stay. From Day 1 on, every chapter builds in a fault that you find with the tools of the day.
Challenge
Measure the baseline for the system disk
sda with the same fio command, but with
--filename=/home/ubuntu/fio-basis, and compare. Is it
faster or slower than the extra disk? Why could that be, even though
both come from the same hypervisor?
Solution path: in the author’s lab both disks sit on
the same storage; the values differ by a few percent. Larger differences
arise when the disks sit on different storage, have different cache
settings in the hypervisor – or when something else writes to the system
disk at the same time, such as the journal or an update. That is exactly
the reason for the separate disk: on sda you never measure
alone. Delete the test file afterwards
(rm -f ~/fio-basis).
Save your progress? Sign up for free
Checkpoint
# on your computer
ssh perf1 hostname
ssh last1 hostnameExpected: perf1 and last1, without a
password prompt.
# on perf1
findmnt -no SOURCE,OPTIONS /datenExpected: /dev/sdb rw,noatime (-n without
header, -o only these columns).
# on perf1
systemctl list-timers sysstat-collect.timer --no-pager | grep -c sysstatExpected: 1 – the timer exists. In the long form you see
that NEXT is at most one minute away.
# on perf1
sudo perf stat -e cycles -- true 2>&1 | grep cyclesExpected: a line with a number in front of cycles (or
<not supported> if your hypervisor does not pass
counters through – then you know it now).
# on perf1
sudo bpftrace -e 'BEGIN { printf("ok\n"); exit(); }' | tail -1Expected: ok.
# on perf1
head -1 ~/basislinie.txtExpected: Basislinie perf1, Tag 0.
Test yourself
- Why does last1 generate the load and not perf1 itself?
- What is the extra disk for when perf1 already has a system disk?
sudo perf stat -e cyclesshows<not supported>. What does that mean, and what can you do?- Why do you set sar to every minute in the lab instead of every ten minutes?
- fio reports 120,000 IOPS and
clatunder 50 µs on a hard disk. What probably went wrong?
Answers:
- A load generator on the same machine fights with the measured program over the CPU – you would measure the fight, not the program.
- On the separate disk you measure alone: no journal, no package manager, no log writer interferes, and fault experiments do not endanger the system.
- The hypervisor does not pass the hardware counters through. With
KVM/Proxmox set the CPU type to
host; otherwise carry on with software events (Day 5). - Faults in the lab often last only a minute or two and would disappear between two data points.
--direct=1is missing – the page cache was measured, not the disk.
Interview Note
“How do you proceed when a server is slow?” is one of the most common questions in interviews for operations and SRE. A good answer does not start with a tool but with a question: slower than what? If you have a baseline, you can answer. Mention that before any troubleshooting you know what the system delivers in its normal state – and that on new systems you first check whether recording (sar or monitoring) is running. If you also know that VMs do not always pass on hardware counters, you show that you have really measured before.
Enterprise Note
In many companies production servers may not receive additional
packages, and sudo is restricted. So clarify
before an emergency which tools may be on the servers,
and put them into the standard image – Ubuntu did exactly that with
24.04 for this reason. For eBPF and perf, admins need the capabilities
CAP_PERFMON and CAP_BPF or root; some security
policies forbid that. Then the approval belongs in the emergency
process, not in a discussion during an outage. Long-term recording with
sar costs almost nothing and should run on every server – even if there
is central monitoring, because that usually only sees one-minute
averages of a few metrics.
Summary
- The lab consists of perf1 (target, with extra disk
/daten) and last1 (load, remote end), reachable withssh perf1andssh last1. - The tools come from a few packages:
procps,sysstat,linux-tools,bpfcc-tools,bpftrace,trace-cmd,fio,stress-ng,iperf3,wrk. Ubuntu 24.04 already ships many of them; bcc tools are called…-bpfccthere. perfmust match the running kernel and needssudoon Ubuntu (perf_event_paranoid = 4).- A VM only passes hardware counters through if the hypervisor allows
it (KVM: CPU type
host). BTF under/sys/kernel/btf/vmlinuxmakes modern eBPF tools possible without kernel headers. - sar now records every minute – the flight recorder for all the following days.
- The baseline is in
~/basislinie.txt: network, disk IOPS, latency. Averages hide outliers; always look at the percentiles too.
Commands at a glance
| Command | What it does | Parameters |
|---|---|---|
ssh-keygen -t ed25519 -f ~/.ssh/perf -C perf-labor |
create a key pair | -t type, -f file, -C
comment |
ssh-copy-id -i ~/.ssh/perf.pub ubuntu@IP |
copy the public key to a VM | -i key file |
nano FILE / sudo nano FILE |
open or create a file in the editor (sudo for files
under /etc) |
Ctrl+O save, Ctrl+X quit |
sudo hostnamectl set-hostname perf1 |
set the host name permanently | name |
ping -c 3 last1 |
measure reachability and round trip time | -c number of packets |
lscpu |
show processor, cores, hypervisor, flags | – |
free -h |
show memory and swap | -h readable units |
lsblk -d -o NAME,SIZE,ROTA,MODEL |
list disks | -d without partitions, -o columns |
uname -r |
kernel version | -r only the version |
dpkg-query -W -f='${Package} ${Version}\n' PACKAGE |
query installed packages | -W show, -f format |
apt-get install -y PACKAGES |
install packages | -y without asking |
wipefs /dev/sdb |
show signatures on a disk | without options read only |
mkfs.ext4 -L daten /dev/sdb |
create an ext4 file system | -L label |
mount /daten |
mount a file system according to /etc/fstab |
mount point |
findmnt /daten |
show what is mounted where with which options | -n without header, -o columns |
df -h /daten |
size and usage of a file system | -h readable units |
systemctl list-timers 'sysstat*' |
show systemd timers | pattern, --no-pager |
perf stat -e cycles,instructions -- COMMAND |
count events during a command | -e events, -- separator |
bpftool btf dump file /sys/kernel/btf/vmlinux format raw |
print BTF type information | file source, format raw raw form |
bpftrace -e 'PROGRAM' |
run a bpftrace program | -e program on the command line |
runqlat-bpfcc 1 1 |
run queue waiting time as a histogram | interval, count |
cat /proc/pressure/cpu |
Pressure Stall Information for the CPU | – |
iperf3 -s -1 / iperf3 -c last1 -t 10 |
measure network throughput (server/client) | -s server, -1 one measurement,
-c client, -t duration |
fio --rw=randread --bs=4k --direct=1 … |
create and measure disk load | see Drill 7 |