Two Tips For Performance of Linux Desktop

Two Tips For Performance of Linux Desktop

Two tips for performance Linux desktop – Swappiness kernel parameter and noatime mount option.

Swappiness

See https://en.wikipedia.org/wiki/Swappiness.

In short:

  • Lower value prevents processes to be swapped out of memory = Improves interactivity (latency) of system but affects I/O performance (because there is less space for disk cache in memory as a result).
    • Ideal for interactive systems and database servers (as they usually handle caching themselves)
  • Higher value causes that less active processes are aggressively swapped out of memory which improves I/O performance.
    • Ideal for I/O intensive systems – File storage servers
# Temporary until reboot
$ sysctl vm.swappiness=10

# Permanenty
$ echo "vm.swappiness = 10" >> /etc/sysctl.conf

Value of 10 is fair enough for regular desktop systems with sufficient amount of physical memory. And definitely better then 60 if your system has SSD disk and frequent write operations aren’t desirable.

Relatime and noatime mount options

Atime is time of last access to a file on file system. Formerly, every read access to a file caused update of its atime value. This meant performance penalty because of huge number of write operations and troubles for lifespan of SSD discs. The relatime and noatime are mount options which significantly reduce the number of writes because of atime and improve system performance.

The relatime option, which is now default in most Linux distros, causes that atime value is not updated during every read access but only when it’s necessary (there is a logic in kernel that decides if update should be done or not).

With noatime the atime value is not updated at all that is great for performance but may be problematic for software who relies on it but if you don’t need atime, then go with the noatime option:

$ vim /etc/fstab
/dev/sda1  /  ext4  defaults,noatime  1  1
...

Note: To check what options are used for currently mounted file systems use the mount command.

 

 

Comments are closed.