Looking for ways to improve performance on an existing desktop machine, which is being unresponsive and laggy in basic use. One thing I notice is heavy use of swap.
Kubuntu 24.04 LTS w/ low latency kernel
- i5 CPU
- 12gb ram
- 512gb SSD
- GB ethernet.
Commonly running
- Firefox
- Thunderbird
- Element Desktop
- Nextcloud Desktop
Changes made
- Update all packages from PPA
- Lowered swappiness to 10 to reduce disk writing
- fstrim for improving SSD performance.
- Disabling all KDE animations
Settings / General Behavior and change "Animation speed" all the way to "Instant"
- Manually disabling individual animation behaviors
Workspace Behavior / Desktop Effects
System Monitoring
I really like Glances, but it is system intensive enough that I've stopped using it as a client/server on my machines.
iotop is simple and works well.
top works fine
Checking Journal Log Usage
journalctl --disk-usage
# journalctl --vacuum-time=7d
Preload - If you have the ram to spare
Quietly runs in the background, monitoring which applications you use most often. Over time, it builds a profile of these frequently used applications. When your system is idle, Preload automatically loads these resources into RAM.
Enabling Zram
ZRAM can significantly improve performance on low RAM machines by creating a compressed block device in memory that acts as additional swap space, reducing reliance on slower disk-based swap. This allows more data to be kept in fast memory, enhancing responsiveness, especially when running multiple applications.
zram and swap exist to prevent freezes
Both zram and swap compliment each other, but work differently:
zram = compressed RAM
- Fast
- Keeps the system responsive
- Used before disk swap
swapfile/partition = disk-based
- Slow
- Used only when zram is full
- Prevents crashes, but can cause lag
Because 12–16 GB is enough to run current applications, but not enough to absorb sudden spikes from:
- Browsers with many tabs
- Electron apps (Discord, VSCode, Slack)
- Games
- Memory leaks
- Virtual machines & Heavy Applications
When RAM fills, the system jumps straight to disk swap → Desktop freezes → the system becomes unresponsive.
What happens with zram?
You effectively get:
12–16 GB RAM
- 6–8 GB compressed zram
- 2–4 GB disk swap
This gives you 20–28 GB usable memory, and the system stays smooth because zram is fast.
Recommended setup for 12–16 GB:
zram = ½ of RAM (6–8 GB)
swapfile = 2–4 GB
swappiness = 20–30
earlyoom = enabled
On 32 GB RAM systems
Typical setup for 32 GB:
zram = 4–8 GB (not 16 GB)
swapfile = 2–4 GB
swappiness = 10–20
earlyoom = optional
Why smaller zram?
Because:
You don’t need as much compressed memory
You don’t want to waste CPU compressing RAM you’ll never use
The system rarely hits swap anyway
Preventing spikes, then smoother multitasking, then simple insurance for rare issues.