How to Optimize System Performance in Debian 12 Bookworm

How to Optimize System Performance in Debian 12 Bookworm

Debian 12 “Bookworm” is a stable and efficient Linux distribution, but like any operating system, it can benefit from optimization to improve performance. Whether you’re running Debian on a server, desktop, or low-resource machine, optimizing various aspects of the system can lead to better responsiveness and efficiency. In this guide, we will explore different ways to enhance the performance of Debian 12.

1. Keep Your System Updated

Regular updates provide security patches, bug fixes, and performance improvements. Use the following commands to update and upgrade your system:

sudo apt update && sudo apt upgrade -y

For kernel and distribution upgrades, use:

sudo apt dist-upgrade -y

2. Optimize Boot Time

Reducing boot time can enhance overall performance. You can achieve this by:

a. Disabling Unnecessary Services

List services that are running at startup:

systemctl list-unit-files --type=service --state=enabled

Disable unnecessary services using:

sudo systemctl disable SERVICE_NAME

For example, if you don’t need Bluetooth, disable it:

sudo systemctl disable bluetooth

b. Enable Parallel Boot Processing

Ensure systemd is using parallel booting:

sudo systemctl enable systemd-bootchart

This helps diagnose and reduce boot delays.

3. Improve Memory Management

Efficient memory usage can lead to a faster system.

a. Adjust Swappiness Value

By default, Linux uses swap space aggressively, which may slow down performance. Reduce swap usage with:

echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

b. Enable ZRAM (for Low RAM Systems)

ZRAM compresses RAM to allow more efficient usage. Install and enable ZRAM:

sudo apt install zram-tools -y
sudo systemctl enable --now zramswap.service

4. Optimize Disk Performance

Optimizing disk usage speeds up read/write operations.

a. Enable TRIM for SSDs

If you’re using an SSD, enable TRIM to prolong its lifespan:

sudo systemctl enable fstrim.timer

b. Use a More Efficient Filesystem

For better performance, consider using ext4 or XFS instead of ext3. Check your current filesystem with:

lsblk -f

Convert older partitions if necessary (backup first):

sudo tune2fs -O extents,uninit_bg,dir_index /dev/sdX

5. Reduce CPU Load

Optimizing CPU usage helps maintain system responsiveness.

a. Enable CPU Frequency Scaling

Use cpufreq utilities to adjust CPU scaling:

sudo apt install cpufrequtils -y
sudo cpufreq-set -g performance

b. Disable Unused Daemons

Check background processes with:

top

Kill or disable unnecessary daemons.

sudo systemctl stop SERVICE_NAME
sudo systemctl disable SERVICE_NAME

6. Improve Network Performance

a. Adjust TCP/IP Settings

Optimize TCP window scaling for better network performance:

echo 'net.core.default_qdisc=fq' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

b. Disable IPv6 (If Not Used)

If you don’t use IPv6, disable it for better performance:

echo 'net.ipv6.conf.all.disable_ipv6 = 1' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

7. Optimize Graphics Performance

a. Enable Hardware Acceleration

If using an Intel or AMD GPU, enable hardware acceleration:

sudo apt install mesa-utils -y
glxinfo | grep "direct rendering"

For NVIDIA users, install proprietary drivers:

sudo apt install nvidia-driver -y

b. Reduce Display Effects

If using GNOME, disable unnecessary animations:

gsettings set org.gnome.desktop.interface enable-animations false

8. Use Lighter Applications

Using resource-efficient applications can improve system responsiveness. Consider:

  • Use XFCE or LXQt instead of GNOME/KDE for a lightweight desktop.
  • Use Featherpad instead of LibreOffice for simple text editing.
  • Use MPV instead of VLC for media playback.
  • Use Midori or Brave instead of Firefox for browsing.

9. Clean Up Your System

a. Remove Unused Packages

Free up space and reduce clutter:

sudo apt autoremove -y
sudo apt autoclean -y

b. Find and Delete Large Unused Files

Find large files:

du -ah / | sort -rh | head -20

Manually delete unnecessary files.

c. Clear Journal Logs

Journal logs can consume disk space over time:

sudo journalctl --vacuum-size=100M

10. Enable Preloading for Faster Application Startup

Preloading helps frequently used applications start faster:

sudo apt install preload -y
sudo systemctl enable --now preload

Conclusion

By implementing these optimizations, you can significantly improve the performance of your Debian 12 Bookworm system. Whether you’re running a high-performance server or an older machine, these tweaks ensure a smoother and more efficient experience.