Home Ubuntu 10 advanced strategies for speeding up your Ubuntu system

10 advanced strategies for speeding up your Ubuntu system

Elevate your Ubuntu system's performance with these advanced tips. This guide delves into deeper system optimizations, including kernel adjustments, resource management, and fine-tuning system settings, to significantly improve speed and efficiency for power users and enthusiasts.

by John Horan
improve ubuntu performance tips for advanced users

In today’s constantly evolving world of technology, it is essential to optimize the performance of your operating system for a smooth and efficient computing experience. Ubuntu, a popular choice among many users, offers plenty of options for enhancement and customization.

In this blog, we explore some advanced tips and tricks that can help you speed up your Ubuntu system. These tips are designed for users who are already proficient in navigating the Linux environment and are keen to take their systems to the next level. We’ll cover everything from kernel tuning to experimenting with alternative filesystems.

Advanced strategies for speeding up your Ubuntu system

For beginners looking to optimize Ubuntu, refer: Top 10 tips to speed up your Ubuntu system for beginners

1. Kernel tuning with sysctl

Fine-tune performance at the kernel level

The sysctl utility allows for the fine-tuning of the Linux kernel. You can adjust various parameters that affect system performance. For instance, to optimize the TCP stack, you could:

sudo sysctl -w net.ipv4.tcp_tw_reuse=1
sudo sysctl -w net.ipv4.tcp_fin_timeout=15

This helps in faster recycling of sockets and reducing the delay.

My perspective

Tweaking kernel parameters can be quite powerful, but remember, with great power comes great responsibility. We have published a detailed article if you want to know more. How to use sysctl for effective kernel tuning in Ubuntu

2. Using cron jobs for regular maintenance

Automate system maintenance

You can set up cron jobs to automate tasks like clearing the cache or optimizing databases. For instance, to clear the apt cache every week.

0 0 * * 0 sudo apt clean

Add this to your crontab using crontab -e.

My experience

Automating these tasks has saved me a lot of time and kept my system running smoothly. For more ways to use cronjobs on a Ubuntu server, refer: 10 essential cronjobs for your Ubuntu server

3. Advanced file system tuning

Optimize your filesystem

File system parameters can be tuned for better performance. For example, if you’re using ext4, consider adjusting the commit interval:

sudo tune2fs -o journal_data_writeback /dev/sda1

Remember to replace /dev/sda1 with your actual partition.

Personal note

Filesystem tuning is complex, and I recommend this only if you understand the filesystems and their options deeply. Refer to our article for details on Linux file systems:  Linux File Systems: Everything You Need to Know

4. Adjusting the I/O scheduler

The I/O scheduler determines how the system reads and writes data to disks. Adjusting it can enhance performance, especially on SSDs.

When you’re adjusting the I/O scheduler in Ubuntu, it’s helpful to know what to expect in terms of terminal output. Here’s a step-by-step guide with the expected output for each command.

Checking the current I/O scheduler

First, let’s check the current I/O scheduler for your primary disk (usually sda). The command is:

cat /sys/block/sda/queue/scheduler

Expected output:

[noop] deadline cfq

In this output, the scheduler in use is indicated by the brackets. In this case, noop is the current I/O scheduler. Other options, like deadline and cfq, are available but not active.

Changing the I/O scheduler

To change the I/O scheduler, let’s say to deadline, use the following command:

echo deadline | sudo tee /sys/block/sda/queue/scheduler

Expected output:

deadline

This output confirms that the deadline scheduler has been set. It’s straightforward and simply echoes back the scheduler you set.

Verifying the change

To verify that the change has taken effect, rerun the check command:

cat /sys/block/sda/queue/scheduler

Expected output:

noop [deadline] cfq

Now, the output shows that deadline is the active I/O scheduler, as indicated by the brackets.

Important note

The change made with the echo command is temporary and will revert after a system reboot. To make it permanent, you would need to add the echo command to your /etc/rc.local file or an equivalent startup script, depending on your system’s setup.

Also, the best I/O scheduler can vary depending on your specific hardware configuration and workload. noop is often recommended for SSDs due to their low-latency nature, while deadline or cfq might be better for traditional spinning hard drives. Always consider your specific use case and hardware when making such changes.

Change the I/O scheduler (for instance, to ‘noop’ for SSDs):

echo noop | sudo tee /sys/block/sda/queue/scheduler

I switched to ‘noop’ on my SSD and noticed faster boot times.

5. Using preload to speed up application launch

Preload is an ingenious utility in Ubuntu that can significantly improve the launch time of frequently used applications. It works by analyzing the user’s behavior and preloading into memory the binaries and dependencies of frequently used applications. Essentially, Preload 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.

The advantage of this approach is that when you decide to launch an application that Preload has already loaded into memory, the loading time is drastically reduced, as reading from RAM is significantly faster than reading from a disk, even an SSD. For instance, if you regularly use a program like LibreOffice, Preload will ensure that much of LibreOffice’s code is already in RAM when you launch it, resulting in a quicker startup time.

However, it’s important to note that Preload might not be beneficial for systems with very limited RAM, as it could end up occupying valuable memory that is needed for other processes. For most users, especially those with ample RAM, Preload offers a simple and effective way to speed up application launch times with minimal downside.

Install preload:

sudo apt install preload

The service starts automatically and requires no configuration.

foss_linux@fosslinux-ubuntu:~$ sudo apt install preload
[sudo] password for foss_linux: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
preload
0 upgraded, 1 newly installed, 0 to remove and 39 not upgraded.
Need to get 29.5 kB of archives.
After this operation, 94.2 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 preload amd64 0.6.4-5 [29.5 kB]
Fetched 29.5 kB in 0s (134 kB/s) 
Selecting previously unselected package preload.
(Reading database ... 244396 files and directories currently installed.)
Preparing to unpack .../preload_0.6.4-5_amd64.deb ...
Unpacking preload (0.6.4-5) ...
Setting up preload (0.6.4-5) ...
Processing triggers for man-db (2.10.2-1) ...

To know more about the effective usage of preload to speedup Ubuntu apps, please refer to our detailed article: How to use preload to speedup app launches in Ubuntu

6. Customizing or disabling system logging

Customizing or disabling system logging in Ubuntu, primarily managed by rsyslog, can enhance performance by reducing disk space and I/O usage. Adjusting settings to limit log verbosity or disabling non-essential logs conserves resources. However, caution is advised as logs are crucial for troubleshooting, and excessive reduction may hinder problem diagnosis.

Configure rsyslog:

sudo nano /etc/rsyslog.conf

Adjust logging levels as needed. Refer to our detailed article to know more: Customizing or disabling system logging in Ubuntu

7. Overclocking CPU and GPU

If your hardware supports it, overclocking can give you a significant performance boost. Tools like cpupower can be used for CPU overclocking.

My take

Be cautious with overclocking, as it can lead to overheating and hardware failure. Refer to our guide: Step-by-step CPU overclocking in Ubuntu using cpupower

8. Network performance tuning

Tweaking network parameters, like the receive window size and buffer limits, can improve network performance:

sudo sysctl -w net.core.rmem_max=16777216
sudo sysctl -w net.core.wmem_max=16777216

Personal note

This is particularly useful for high-speed networks or if you do a lot of streaming or file transfers. Refer to our guide for other techniques to optimize network performance on Ubuntu: How to enhance network speed and reliability in Ubuntu

9. Using alternative filesystems

Exploring filesystems beyond the commonly used Ext4 can provide unique advantages in certain scenarios. Filesystems like Btrfs and XFS are popular alternatives, each with its own set of features and performance characteristics.

Btrfs: The feature-rich filesystem

Btrfs, short for B-tree File System, is known for its rich feature set, including:

  • Snapshots and Rollbacks: Btrfs allows you to create snapshots of the filesystem, which are quick and consume minimal space. This feature is incredibly useful for system backups and restoring your system to a previous state.
  • Data Duplication and Mirroring: It supports data deduplication and has built-in RAID support, allowing for data mirroring and redundancy. This ensures data integrity and can be crucial for systems where data safety is paramount.
  • Dynamic Volume Management: Unlike traditional filesystems, Btrfs allows for dynamic resizing of partitions and combining multiple physical disks into one logical volume.
  • Copy-on-Write (CoW): This feature ensures that when you copy files, they are not physically duplicated until you make changes. This saves space and reduces write operations.

XFS: High-performance under heavy loads

XFS is known for its high performance, particularly in situations involving large files and parallel I/O operations. It’s a great choice for large-scale data centers and databases. Key features include:

  • Scalability: XFS excels in handling large files and large filesystems, making it an excellent choice for media servers and storage-heavy applications.
  • Journaling: Like Ext4, XFS is a journaling filesystem, which improves reliability and speeds up crash recovery.
  • Efficient Allocation Management: XFS manages disk space efficiently, reducing fragmentation and maintaining consistent performance even with very large volumes.

Switching to a different filesystem

Switching to Btrfs or XFS involves formatting a partition with the chosen filesystem. For example, to format a partition with Btrfs:

sudo mkfs.btrfs /dev/sdxN

Replace /dev/sdxN with your target partition. After formatting, you can mount the filesystem and start using it. Keep in mind that changing filesystems is a significant operation and should be done with a complete backup of your data.

My perspective

I’ve experimented with both Btrfs and XFS for different use cases. Btrfs’s snapshot feature has saved me several times, allowing me to roll back to a previous state after a failed experiment. XFS, on the other hand, has been my go-to for media servers where I deal with large video files.

10. Advanced power management

Tools like TLP or powertop can help fine-tune power management, offering a good balance between performance and energy consumption.

Effective power management has helped me improve battery life while maintaining good performance. Refer to my detailed guide on how to use TLP to improve Ubuntu power efficiency: How to fine-tune power management in Ubuntu using TLP

Conclusion

As we’ve explored, enhancing Ubuntu’s performance goes beyond the basic tweaks and adjustments. By delving into advanced methods like kernel tuning, automating system maintenance through cron jobs, optimizing file systems, and even exploring alternative filesystems like Btrfs and XFS, users can significantly improve their system’s efficiency and performance.

Each of these advanced tips comes with its own set of benefits and challenges. Whether it’s fine-tuning your system at the kernel level, adjusting I/O schedulers for better disk performance, or choosing a filesystem that matches your specific needs, these techniques require a careful approach and a good understanding of Linux internals.

You may also like

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.