Support > About cloud server > Is your Ubuntu system getting sluggish over time? These 8 optimization steps will restore its smooth performance.
Is your Ubuntu system getting sluggish over time? These 8 optimization steps will restore its smooth performance.
Time : 2026-11-18 11:12:13
Edit : Jtti

Whether running on a cloud server or in a local environment, Ubuntu systems often develop a "chronic ailment" over time: even when CPU and memory usage are well below capacity, the system becomes sluggish—SSH commands lag, and web page loading times deteriorate.

This slowdown is rarely caused by a single catastrophic failure; rather, it stems from the cumulative effect of accumulated cache, redundant background services, inefficient swap policies, and bottlenecks in underlying disk I/O or network links. You don’t need to reinstall the OS to restore smooth performance—simply follow these eight logical optimization steps.

Clean Up System Junk and Old Kernels

Frequent updates in Ubuntu often leave behind useless APT cache, orphaned dependencies, and old kernel versions. These not only consume valuable disk space but also slow down the package manager’s search operations.

Clear APT cache and orphaned packages:

sudo apt autoremove --purge -y

sudo apt clean

Limit the size of Systemd logs: Unchecked log growth is a common culprit for filling up disk space.

sudo journalctl --vacuum-size=100M

Remove old kernels: If your `/boot` partition is nearing capacity, running `sudo apt --purge autoremove` will automatically remove kernels that are no longer in use.

Streamline Startup Services

Many software packages automatically add themselves to the system's startup sequence (e.g., Bluetooth, printing services, or Avahi network discovery). On a server, these services are typically unnecessary and only serve to waste CPU and memory resources.

List currently enabled services:

systemctl list-unit-files --state=enabled

Disable any services you don’t need (using Bluetooth, printing, and Avahi as examples):

sudo systemctl disable --now bluetooth cups avahi-daemon

Adjust Swap Policy to Prevent "Excessive Paging"

Swap (virtual memory) is intended as a buffer for when physical RAM is insufficient. However, if the system frequently shuttles data back and forth between RAM and Swap—a common issue on budget cloud servers—the resulting slow disk I/O can cause the entire system to become unresponsive. Edit `/etc/sysctl.conf` to reduce the system's tendency to use swap space:

ini

vm.swappiness = 10

Save the file and run `sudo sysctl -p` to apply the changes. This instructs the kernel to prioritize physical RAM and only resort to swap when absolutely necessary.

Enable BBR congestion control to boost network throughput

Ubuntu’s default TCP congestion control algorithm (Cubic) often performs poorly on high-latency, cross-border networks. Enabling Google’s BBR algorithm can significantly improve network throughput and resilience against packet loss.

Edit `/etc/sysctl.conf`:

ini

net.core.default_qdisc = fq

net.ipv4.tcp_congestion_control = bbr

After running `sudo sysctl -p`, verify the setting with `sysctl net.ipv4.tcp_congestion_control`. If it returns `bbr`, the configuration has been successfully applied.

Optimize the disk I/O scheduling algorithm

For NVMe or SSD drives—commonly used in cloud servers—the default I/O scheduler (typically `mq-deadline` or `cfq`) may introduce unnecessary disk-seeking overhead.

Check the current scheduler by running `cat /sys/block/nvme0n1/queue/scheduler`. For NVMe SSDs, it is recommended to set the scheduler to `none` or `noop` ​​(allowing the hardware to handle scheduling directly), which can significantly reduce latency. You can automate this by adding the setting to `/etc/rc.local` or a systemd service.

Switch to faster software repositories

Official Ubuntu repositories can be slow to access from within China. Replacing the entries in `/etc/apt/sources.list` with domestic mirrors (such as those provided by Alibaba Cloud or Tsinghua University), or using an efficient caching proxy, can drastically speed up `apt update` operations and software installations.

Remove unnecessary desktop environments (for desktop versions)

If you are running Ubuntu on a personal computer, the GNOME desktop environment can be quite resource-intensive. If you are using the machine solely for development, consider switching to a more lightweight desktop environment like XFCE or LXQt, or opt for the Ubuntu Server edition and perform development remotely via SSH. This frees up significant memory and CPU resources, allowing them to be used for compilers and containers instead.

The Underlying Bottleneck: The Limits of Software Optimization Are Defined by the Infrastructure

Once you have completed the seven steps mentioned above, your Ubuntu system will be optimized to its absolute limit at the software level. If you still experience lag, the bottleneck undoubtedly lies within the underlying infrastructure.

If the host machine is severely oversold, you may see high `%st` (Steal Time) values. If the disk is a cheap, shared SATA drive, your physical IOPS will likely be throttled by other users on the same host—even if you set the I/O scheduler to `none`. If your network path is inefficient or prone to packet loss, cross-border data transfers will continue to time out, regardless of whether BBR is enabled. Software can never fully compensate for the shortcomings of physical hardware.

Optimizing Ubuntu’s performance is essentially a systematic troubleshooting process that spans from the application layer down to the system and hardware layers. By mastering these system-level techniques—and pairing them with a robust, high-quality cloud server from Jtti—you can ensure your system remains responsive under any workload. Visit the official Jtti website to explore high-performance cloud server solutions featuring NVMe storage and premium CN2 GIA network connectivity.

Frequently Asked Questions (FAQ)

Q: Will clearing logs delete my important application logs?

A: The command `journalctl --vacuum-size=100M` only removes system logs managed by `systemd`. Logs you have configured independently under `/var/log` (such as Nginx access logs) will not be affected; it is recommended to manage those using `logrotate`.

Q: Do I need to restart the server after enabling BBR?

A: No, a restart is not required. Simply run `sysctl -p` to apply the configuration immediately. However, ensure that your system kernel version is 4.9 or higher (all modern Ubuntu versions meet this requirement).

Q: What should I do if the system becomes sluggish again a few days after optimization?

A: You can use the `top` command to identify which process (such as a Java or Python service) is experiencing a continuous increase in memory or CPU usage; this may indicate an application-level memory leak rather than a system-level issue. If disk I/O is consistently at maximum capacity, consider upgrading to an instance equipped with an NVMe SSD.

Relevant contents

How to Remove PPA Repositories in Ubuntu: A Complete Guide and Cleanup Instructions A Comprehensive Analysis of OpenClash and IPv6 Conflicts: A Complete Troubleshooting Guide—From Traffic Bypassing to DNS Leaks Did your D: drive "vanish" after a server migration? Here’s how to recover your missing data drive. Getting persistent "Internal Error" messages on your US-based cloud server? A guide to potential causes and troubleshooting steps. Does your personal website need a dedicated IP address? A comprehensive look at the pros and cons of a dedicated IP. How Do DE-CIX and AMS-IX Differ? An In-Depth Comparison of Scale, Architecture, and Ecosystem Migrating from Traditional Shared Hosting to Unmanaged VPS: Four Major Gaps to Bridge and an Upgrade Guide What Is a Data Processing Agreement (DPA)? A Compliance and Security Framework That Cloud Server Users Must Understand Comprehensive Guide to Common Default Ports and Port Configuration Strategies for Multi-IP Servers in Website Clusters Locked Out of Your Server? A Guide to Recovering Access After Losing SSH/RDP Connectivity—Including Out-of-Band Rescue via VNC
Go back

24/7/365 support.Here for you 24/7/365.

Support