Linux Running Too Slow? Here’s How to Find the Cause

cpu-power

Have you ever wondered why your Linux computer is running slow these days? Despite high transmission speed and powerful hardware, it still takes forever in executing or processing services or applications.

Your Linux computer seems to be slow because of some of the following reasons:

  • Many unnecessary services started or initialised at boot time by the init program
  • Many RAM consuming applications such as LibreOffice on your computer
  • Your (old) hard drive is malfunctioning, or its processing speed cannot keep up with the modern application

Before we find out how we can speed up a Linux computer, we need to know which methods can help us to find the services started at boot time, processes running with higher or lower priorities, CPU health status, and whether the RAM is filled with much more data than it requires and also check whether the swap memory area is full. Lastly, we also need to check check if the hard disk is working well.

The first step to take when you want to speed up a slow Linux computer is to check CPU information. Perhaps the main reason why your computer takes forever to run LibreOffice is because your CPU speed is considerably not enough to run heavyweight applications.

Open a terminal and run one of the following commands:

cpuinfo

cpuinfo-list

The above commands display detailed information about your CPU such as vendor_id, model name, CPU MHZ, cache size, microcode and bogomips.

Let’s go through some important details about CPU information.

  • bogomips: simply means Bogus Millions of instructions per second. It is a standalone program that displays your system performance.
  • model_name: The model_name indicates the manufacturer, model and speed of the CPU. In this case, we have an Intel(R) Celeron(R) CPU that has a speed of 1.73GHz.
  • cpu MHZ: cpu MHZ(MegaHertz) is used to measure the transmission speed of channels, buses and the computer’s internal clock. In this case the transmission speed is 1733.329GHz.

If you are not aware, the Intel Celeron 1.73GHz CPU is an old processor with little processing power. For this case, it is obvious that the CPU transmission speed is quite low for this computer as compared to others with multi-cores 2.8GHz CPU. This could be the reason why our Linux computer is slow when running a heavyweight application.

Solution

When you have an old and slow CPU, the only solution is to change to a newer one. Learn what you need to look out for when buying a new processor.

There are different methods to check for services started at boot-time. You can use any of the following commands.

This command lists services started at boot-time:

service

This command lists services started at boot-time. It is compatible with CentOS, Fedora, and Redhat:

chkconfig1

This command also lists services started at boot-time:

initctl is a daemon control tool that allows a system administrator to communicate and interact with Upstart daemon.

init-ctl

If your system is using systemd, you can use the following command to find the services that run at boot time:

Solution

For Linux distro that are using systemd, you can use the systemctl command to manage your services, so they will not run during boot time.

Apart from checking for services started at boot time, you can also check whether your processor/CPU is overloaded with processes. You can use the command top to check CPU load.

The top command sorts processes with the highest usage on top. As you can see from the screenshot below, you can clearly identify which process/application is abusing your CPU and kill it if necessary using the kill command.

topnew

Solution

If you are running too many applications (both in the foreground and background), and your CPU is not up to par, it is best to close the applications that you are not using. Also, disable any applications that you are not using from running in the background.

Alternatively, you can use preload to load commonly used applications. Preload is a daemon that runs in the background and analyzes frequently run applications.

Open a terminal and run the following command:

For Fedora and CentOS users, you can use the following command:

Preload works in the background. Thus, there is no need tweak it. Preload loads a section of commonly used applications into memory to ensure faster load of these applications.

RAM is where commonly used applications are usually stored. You can use the free command to check for memory information such as free space available for RAM and so on. Less memory space can also affect a computer’s performance.

free

Solution

Either you upgrade your RAM or replace your memory-intensive applications with lightweight alternatives. Applications such as Libreoffice are rather memory intensive. Instead of using LibreOffice, you can use Abiword.

Is your hard drive light constantly chugging along, yet you have no idea what it’s doing? Mysterious input/output can sure be a problem, so there is a top-like tool called iotop, specifically meant to help diagnose this kind of problem.

Open a terminal and enter the command:

For Fedora and CentOS users, you can use the following command:

A normal, idle system should be mostly zeros across the board, sometimes with a few small bursts while data is being written, as in the screenshot below.

linuxperformance-iotop1

If however, you run a disk-intensive utility like find, you’ll see its name and throughput listed clearly in iotop.

linuxperformance-iotop2

Now you can easily find out what program is using your I/O, who ran it, the speed the data is being read, and more.

While there are many things that can potentially cause system slowness, CPU, RAM, and disk I/O are behind the vast majority of performance problems. Using the methods described here will help you determine the cause of your performance problems, and how you can fix them.

This article was first published in September 2011 and was updated in June 2018.

6 comments

  1. Thanks a lot… It is really helpful!

    Just a quick question, my linux server is showing 95% of CPU usage in gzip command and I am amazed as I am not using it. How can I stop only this process in linux through command…..Any Idea?

    • “95% of CPU usage in gzip command”

      At a guess it is probably logrotate running gzip (the default compression program) on a very large log file.

      Two points to consider

      1) Do not let your logfiles grow so large — logrotate them more frequently if only weekly or monthly. If daily, then examine the log file and cure the problem that is causing lots of entries in the log file.

      2) Change the default compression from gzip to bzip2 or maybe even xz to compress your logfiles to a smaller size to save on disk space and do not keep more than your reasonably need.

      ps -efw | grep gzip

      will reveal the process and its parent id, then use ps -efw | grep parent_id to show what process was invoking gzip (probably logrotate launched fron cron.daily).

  2. “Check for Services Started at Boot-Time”
    You can run BootChart for Linux. It charts the entire boot process.

    • I just installed bootchart on my Linux Mint PC. When I run it I get a nasty looking error about a missing or empty file:
      Warning: path ‘/var/log/bootchart.tgz’ does not exist, ignoring

      It then follows up with:
      Parse error: empty state: ‘/var/log/bootchart.tgz’ does not contain a valid bootchart

      Scratch 1 solution. I have a comment about iotop as well but I’ll enter that as a separate comment.

  3. I have already commented on bootchart in reply to Dragonmouth. Now for iotop:

    I installed iotop on my Linux Mint PC. When I try to to run it (with sudo of course) I get a very verbose traceback of .py modules but the main message at the bottom is:
    /data.py, line 196, in parse_proc_pid_status
    key, value = line.split(‘:t’, 1)
    ValueError: need more than one value to unpack

    Clues? Was this released with a nasty program bug?

  4. Please, can we just forget about the free(1) command? It provides absolutely no useful information to diagnose performance issues. Newcomers to Linux are often alarmed when they see almost no free memory. You do not want *any* free memory because free memory is wasted memory. For details look at https://www.linuxatemyram.com/ for a glimpse of how Linux memory management actually works.

    Instead, use the vmstat(8) tool to monitor the paging file in-bound traffic (the SI column). Linux does implement paging but it just does not do paging (aka “swapping”) very well, so it is to be avoided. Out-bound paging traffic (the SO column) can be ignored: Linux will do anticipatory page evictions of stale memory content to make more room for the demands of the moment; SO is good, SI is bad.

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.

Sponsored Stories