This episode optimizes Alpine's performance: leveraging the small footprint of musl and BusyBox, kernel tuning with sysctl, memory management, and resource monitoring with top, htop, free, and df to keep servers responsive.

Alpine is resource-efficient from the start, but there's always room to optimize further. Episode 19 turns optimization habits into a systematic procedure: leveraging the small footprint of musl and BusyBox, tuning kernel parameters with sysctl, managing memory, and monitoring resources regularly.
The goal isn't extreme benchmarks, but servers that stay responsive under real load. You'll learn to read the system's signals and tailor Alpine to your workloads.
Alpine is small by design, and you can keep it small through discipline:
apk del.Check the system's size and processes:
du -sh /usr /var /etc 2>/dev/null
ps aux --sort=-rss | head -10ps aux --sort=-rss | head -10 shows the processes with the highest memory usage — the starting point for spotting waste.
Kernel parameters are managed with sysctl. View and change runtime values:
sysctl -a | grep -E "net.core|vm.swappiness"
sysctl vm.swappiness=10
sysctl -w net.core.rmem_max=16777216For persistence, write them in /etc/sysctl.conf:
vm.swappiness=10
net.ipv4.ip_forward=1
net.core.somaxconn=4096Apply and verify:
sysctl -p
sysctl vm.swappinesssysctl -p loads all lines from /etc/sysctl.conf. The vm.swappiness=10 value reduces swap usage on systems with plenty of RAM.
Understanding the memory output helps diagnose problems:
free -h
cat /proc/meminfo | head -5
swapoff -a && swapon -afree -h shows memory and swap usage.swapoff -a && swapon -a reloads swap (useful after tuning swappiness).To see per-process consumption in real time, install htop:
apk add htop
htophtop interactively shows CPU, memory, and swap per process. When RAM runs low, check whether any daemon can be turned off:
ps aux --sort=-%mem | head -5Monitoring isn't a one-time event, but a routine. The four core commands:
top -b -n 1 | head -15
free -h
df -h
uptimetop -b -n 1 takes a CPU and process snapshot.free -h checks memory.df -h checks disk usage.uptime shows the system load for the last 1, 5, and 15 minutes.To monitor OpenRC services, combine this with rc-status:
rc-status
rc-service nginx statusThe combination of rc-status and df -h gives you a picture of service and disk health at a glance.
Automate with cron so problems are caught early:
*/5 * * * * df -h > /var/log/disk-usage.log
0 3 * * * top -b -n 1 > /var/log/top-snapshot.logThe */5 * * * * df -h line records disk usage every five minutes — the basis for full-disk detection.
Info
The most impactful optimization on Alpine is often not exotic tweaks, but removing unnecessary processes. A system that only runs the services it needs is almost always faster than one with many tunables.
Episode 19 optimized Alpine's performance: leveraging the small footprint of musl and BusyBox, kernel tuning with sysctl, memory management, and monitoring with top, htop, free, df, and rc-status.
Key takeaways:
In the next episode, episode 20, we'll cover cloud, SBC, and embedded — using Alpine cloud images on AWS, Azure, GCP, and OpenStack, installing on VMs with VirtIO and UEFI, and running Alpine on Raspberry Pi, the aarch64 architecture, and RISC-V.