Tech

10 Ubuntu Power Tips for More Performance


Ubuntu, Mint & Co. are quickly set up. But as with any system, there are options that speed up the system and make it more efficient to use. This is about system-related performance tips.

If

Ubuntu
and

Mint
meet up-to-date hardware, these Linux distributions are convincingly fast even after the standard installation. With the following tips you can optionally add a noticeable piece of performance.

A note in advance:

Some interventions in the “sysctl.conf”, system services, autostarts or file system functions described here always mean a certain risk. Therefore, you should only carry out one measure here and test sufficient time. If there are any problems, you can specifically undo the system change if necessary.

Set up fast mirror servers

All system updates and software installations use the preset mirror server, which provides the Ubuntu package sources. The faster your internet connection is, the more you benefit from a really fast mirror server. Ubuntu & Co. can determine the most suitable German server itself: To do this, go to “Applications & Updates” (Ubuntu) or “Application Package Sources” (Mint). You can click on the server in front of it, after which the search for a German server starts automatically, which also sorts according to download performance. Choose the fastest server (first in the list). But be aware that the performance test is a snapshot that deserves occasional control.

Find optimal drivers

Especially with graphics cards and WLAN chips, the supplied open source drivers cannot keep up with manufacturer drivers. Ubuntu & Co. make it easy to find and install drivers. In the system settings you will find an item “Driver” or “Driver management”. When you start this applet, a driver search starts automatically. If a suitable driver is found, you can reinstall it. A restart is usually necessary afterwards so that the new driver can be used.

Faster desktop alternatives

Surfaces like Gnome or Budgie are a considerable burden for older hardware. You can achieve the greatest memory savings if you subsequently install a more economical desktop. XFCE offers a good compromise between user comfort and resource economy. You can install the interface via the software center or in the console:

Note that this metapackage is only the surface, while the larger metapackage “xubuntu-desktop” also installs the typical accessories. This difference must also be observed for other desktops: “lxqt” only installs the surface, “lubuntuqt-core”, on the other hand, the complete LXQT environment with accessories. After a successful download, log out of the familiar environment. On the login screen, click the icon next to your username and select “Xfce session”.

Compiz configuration: A few mouse clicks in this additional tool are enough to switch off the effects of the desktop and thus relieve the graphics card and CPU.

Enlarge

Compiz configuration: A few mouse clicks in this additional tool are enough to switch off the effects of the desktop and thus relieve the graphics card and CPU.

Reduce graphic effects:

If the replacement of the familiar interface goes too far, the effects of your desktop can be reduced. Most desktops support this: For example, Cinnamon (Mint) shows the item “Effects” in the system settings, KDE (Kubuntu) under “Display and Monitor” the item “Composer”. Effects can be deactivated here in whole or in part. The main Ubuntu edition with Gnome, on the other hand, can only be reduced with the additional tool Gnome-Tweaks (“General -› Animations “), and only as a flat rate. If you want more targeted effects adjustment, you have to install the additional tool CCSM (Compiz-Config-Settings-Manager).

See also:

The 30 best tips for Ubuntu and Linux Mint

Switch off or adjust swapping

Swapping, i.e. the relocation of longer unused pages from the main memory to the hard disk, is a process that dates back to the 1990s when memory was notoriously scarce. This approach makes sense as long as RAM is valuable: the fast working memory freed up is then available again for programs and for the hard disk cache.

Today, the observation of swap activity in the task manager or with command line tools (top, htop, free) mostly shows that no outsourcing takes place. This is practically permanent for computers with eight and 16 GB. As a result, you can completely switch off the swap file there. This can be done in a few simple steps: the terminal commands end in the running system

the swap and delete the swap file. Finally, deactivate the line in the “/ etc / fstab” file

with the comment character “#”. Note that the Suspend to Ram hibernation continues to work. “Hibernation” (Suspend to Disk) is currently no longer provided for in the current Ubuntu versions since Ubuntu switched from the swap partition to the swap file.

Your system swaps? If the task manager occasionally or even frequently displays the swap file on older hardware, you should continue to allow the kernel to swap. Even then there are opportunities for optimization. The parameter “Swappiness” controls how active the kernel is outsourced

cat /proc/sys/vm/swappiness

determine. The default value for Ubuntu & Co. is “60”, but the value can be between 0 and 100. The higher the value, the faster the kernel writes memory pages from RAM to the swap file. If the value is low, the kernel only reacts when there is a serious shortage of memory.

The parameter

Enlarge

The parameter “vm.swappiness” controls the swapping activity. With a lot of RAM, a low value is appropriate, with a fast SSD, a high value can bring performance advantages.

However, the swappiness adjustment is only worthwhile in extreme hardware situations: A lot of RAM with a slow mechanical hard disk suggests reducing swapping – for example to “10”. If there is little RAM but a fast SSD, a high value is recommended – approximately “90”. To temporarily increase and test the value in the current session, use this terminal command:

sudo sysctl vm.swappiness=90 

The swappiness value applies permanently if you edit the configuration file “sysctl.conf” with root privileges:

sudo nano /etc/sysctl.conf 

The entry “vm.swappiness” is probably still missing – then just add the following line at the end:

The system behavior can be reset at any time in the same way.

Compressed outsourcing with Zram

Zram reserves significant amounts of memory depending on the RAM and CPU. As you can see in the picture (0 bytes of 3.9 GB), no RAM is branched off as long as this is not requested.

Enlarge

Zram reserves significant amounts of memory depending on the RAM and CPU. As you can see in the picture (0 bytes of 3.9 GB), no RAM is branched off as long as this is not requested.

If you don’t want to switch swapping off completely with good RAM, Zram is an interesting alternative to swapping. The kernel module reserves part of the working memory in order to create several RAM disks there, which serve as compressed swap space in the event of bottlenecks. By default, Zram reserves half of the RAM, divides it by the number of CPU cores and sets up a block device per core. With a CPU with four cores, four swap devices “/ dev / zram0”, / “dev / zram1” et cetera are created. The memory is allocated dynamically: As long as there is nothing to be outsourced, Zram does not use anything. Only when it becomes necessary to outsource does RAM go away from the physically available RAM as required. Zram can be set up with minimal effort:

sudo apt install zram-config 

This means that the module is immediately active, just like you

can easily control. We recommend Zram as a replacement for the swap file on computers with good RAM equipment. Zram should also bring advantages on computers with low memory (Raspberry & Co.). Zram can be switched off by uninstalling the “zram-config” package.

Ramdisk as an intermediate depot

Intermediate depot: The space of a ramdisk is dynamically branched off as required. The memory history shows the allocation after deleting and copying large ISO files.

Enlarge

Intermediate depot: The space of a ramdisk is dynamically branched off as required. The memory history shows the allocation after deleting and copying large ISO files.

16 GB RAM is no exception on today’s computers. For typical use with office, media player, image editing, this is pure luxury, but with which useful things can be started. If you move a central folder, via which you handle the data exchange including downloads, into a fast ramdisk, there are several advantages: more performance, disposal during shutdown, protection of the SSD / hard disk, use of the unused storage. A ramdisk can be created in no time at all. Ideally, this storage is located centrally, for example in the home directory or directly on the desktop:

sudo mount -t tmpfs -o size=2000M ramdisk ~/Schreibtisch/Ramdisk 

This command is sufficient to make space for a maximum of two GB of data in the “Ramdisk” folder (which must exist). The specified capacity is branched off dynamically – as required up to the specified maximum. The ramdisk therefore only uses the memory that the contained files actually cause. A ramdisk must be permanently set up using the “fstab” file:

Add the next line here (example)

tmpfs /home/ha/Schreibtisch/Ramdisk tmpfs defaults,size=40%,mode=1777 0 0 

added (the mount path must not contain any variables). After saving, restart Linux.

Danger:

Handling Ramdisk data requires competent and disciplined users because the data is deleted when the shutdown occurs.

Tip:

Increase WiFi speed – how it works

Reduce disk activity to Ext4

Reduce hard disk checks: The tune2fs tool can influence the standard behavior of Ext4 data carriers with numerous options.

Enlarge

Reduce hard disk checks: The tune2fs tool can influence the standard behavior of Ext4 data carriers with numerous options.

The Ext4 file system (similar to Ext3) offers many detailed options for partitions and hard disks via the tune2fs command, some of which work with mounted, some only with unmounted media. You can get an overview for a hard disk with this command (example):

sudo tune2fs -l /dev/sda 

Root rights are generally required for tune2fs.

Reduce checks: A first example, which controls the automatisms of Ext4, reduces the volume checks:

sudo tune2fs -i60 -c100 /dev/sda 

A hard disk check will then only take place every 60 days (“-i60”) or after 100 eboots (“-c100”) – depending on which event is fulfilled earlier.

Disable journaling:

Another example is the deactivation of the journaling function. Journaling is used to restore files after crashes or power failures and is desirable on the system partition. This function is not ideal on external USB data carriers or pure data partitions, since it causes considerable writing effort:

sudo tune2fs -O ^has_journal /dev/sdd

The first step is “umount” because the file system must not be mounted when making this change. The second command turns off journaling for the device “/ dev / sdd”, which you are using

sudo tune2fs -l /dev/sdd 

convince in the line “Filesystem features”. Conversely, journaling can be done with this command

sudo tune2fs -O has_journal /dev/sdd 

activate.

Change journaling mode:

Even when using the Ext journaling function, there are several gradations with high to low hard disk activity: Journal mode not only writes the metadata, but also the file contents. This most complex variant is not standard, but with (example)

sudo tune2fs -o journal_data /dev/sda 

to force. The standard is “journal_data_ ordered”, which only records metadata in the journal. The fastest mode “journal_data_writeback” does not wait for a journal backup beforehand, but writes files to the file system immediately. This mode can be used with (example)

sudo tune2fs -o journal_data_writeback /dev/sda 

force. Such changes apply from the next restart.

File system option “noatime”:

Ext4 formatted partitions save several times for each file. Creation and modification dates are always entered (ctime and mtime: Creation and Modification). On the other hand, recording the last file access (atime: Access) is optional. This information is only relevant if you use “find -atime” to search for access times of file objects. If you never do this, disk activity can be reduced. Only the “relatime” or “noatime” option needs to be set in the “/ etc / fstab” for the respective hard disk:

UUID=[…] / ext4 noatime 0 2 

In current Ubuntu versions, the “relatime” option is standard. “Relatime” only saves the last access time if this access took place before the last change to the file (mtime). With “noatime” the file system generally no longer saves the access time (atime).

For the sake of completeness:

There is also the “nodiratime” option, which does not record the access time for directories. If you want to reduce the activity of the hard disk, “noatime” is the more far-reaching measure.

Turn off system services

Disable system services: Under Ubuntu and Mint (with systemd) the tool systemctl is the relevant tool for service management.

Enlarge

Disable system services: Under Ubuntu and Mint (with systemd) the tool systemctl is the relevant tool for service management.

Every Linux loads numerous system services that not everyone needs. However, switching off system services is a science in itself. You can get an insight into the active services on a system with systemd daemon (Ubuntu, Mint) as follows:

The overview shows – among other things – the active and inactive services. On Ubuntu and Mint, you can use the command that system services generally do not represent a large boot brake

check, which lists the loading times in descending order (longest to shortest). You can still turn off services to save memory:

sudo systemctl stop avahi-daemon.service 
sudo systemctl disable avahidaemon.service 

These commands stop and permanently disable the specified service. If necessary, it can be reactivated with the parameters “enable” and “start”.

Muck out auto starts

Desktops such as Gnome, KDE or Cinnamon load numerous programs when they log in to their desktop. Switching off such autostarts saves memory and speeds up the desktop start. You can reduce existing autostarts using the “Start programs” tool. The functionality is particularly extensive under KDE, which provides a number of special options in the “System Settings” in the “Start and End” area: The standard under “Desktop session”, which automatically restores all programs from the last use of KDE, usually redundant and replaced by the option “Start with empty session”.

If you want to muck out rigorously, you have to know that the “Start programs” tool hides most system-related components. This is ensured by the instruction line “NoDisplay = true” in the respective desktop file. Means

sudo sed --in-place 's/ NoDisplay=true/ NoDisplay=false/g' *.desktop 

you can switch off the instruction in all starters. This means that all autostarts are visible under “Start programs” and can be deactivated or completely removed (the programs themselves remain on the system). In theory you can switch off everything except D-Bus, X-Settings-Plugin, Automount and the security service.

Switch off the IPv6 protocol

The IPv6 protocol generally plays no role in the home network. Since older routers and other network hardware for IPv6 packets often offer poorer data throughput, you can also switch off IPv6. With Ubuntu & Co., IPv6 can be controlled via kernel parameters, i.e. interactively using the sysctl tool

sudo sysctl net.ipv6.conf.all.disable_ipv6=1

or permanently via the configuration file “/etc/sysctl.conf” by using the additional line with sudo right

net.ipv6.conf.all.disable_ipv6=1 

enter. The change is active after a restart.

Another tip for system builders:

The command lists numerous parameters that can be manipulated with the sysctl tool or in the system file “/etc/sysctl.conf”. Our tips give two examples – ipv6 at this point and the swappiness value at an earlier point.

Tags

Related Articles

Back to top button
Close
Close