Linux System Performance Issues

Understanding the problem

If our Linux system is running slow, we should check the following parameters:

  • Processing.
  • Disk writing.
  • Networking(file transfer).
  • Hardware.
Troubleshooting Steps

The troubleshooting steps are the following :

  • Verify if the right system is reported or we are on the correct system with the command:
    hostname​

    linux-troubleshoot

  • Verify the disk space with the commands: df -h, du.
    linux-troubleshoot1
  • Verify the system processing with the commands: top, free, /proc/meminfo, vmstat, pmap <PID>, dmidecode, lscpu or /proc/cpuinfo.
    linux-troubleshoot3

linux-troubleshoot4

  • Verify the disk issues with the commands: iostat -y 5, lsof.
  • Verify networking issues with the commands: tcpdump -i enps03, lsof -i -P -n | grep -i listen, netstat -plntor ss -plnt, iftop.
    linux-troubleshoot5
The command iftop shall be available only after running the commands yum install epel-release and yum install iftop.
  • Verify the system uptime with the command uptime.
    linux-troubleshoot6
  • Verify the logs within /var/log.
    linux-troubleshoot7
  • Verify the hardware status by logging into the system console.
  • Install other tools like the htop, iotop, iptraf, psacct with the command yum.

IP Assigned but not Reachable

We can troubleshoot the issue of IP being assigned but not reachable with the following steps:

  • Verify if we are on the correct network with the command:
    ifconfig​

linux-troubleshootip

  • Verify if we have the correct subnet mask or gateway with the command:
    netstat -rnv​

linux-troubleshootip1

The gateway address is 192.168.1.1.

  • Ping the gateway with the command:
    ping 192.168.1.1​
  • Verify if the gateway is assigned with the command:
    netstat -rnv​​
  • Verify with the network team if the proper VLAN is assigned on the switch side.
  • Execute the ethtool or mii-tool to verify the NIC status with the command:
    ethtool enp0s3​

Or

mii-tool enp0s3
  • Restart the network service with the command:
    systemctl restart network​
  • Verify the status of the NIC with the commands ifconfig or ip addr. It should be UP and RUNNING.
    linux-troubleshootip2
  • Verify if the IP is assigned to another device. (IP conflict)
  • Turn off the firewall with the command:
    systemctl stop firewalld​

Remove Un-necessary or Orphan Packages

We should install only those packages that are really required. If there are unwanted packages, we should delete them. The lesser the number of packages, the less is the chance of unpatched code.

The guidelines to be followed on installing/uninstalling the packages are:

  • Do not install packages that we do not require at the time of initial installation.
  • Pay close attention to the add-on packages.

To get a list of all the packages, run the command(for CentOS):

rpm -qa

For Ubuntu:

apt list -installed

To count the total number of packages, run the command:

rpm -qa | wc -l

To remove packages, run the command rpm -e package_name or apt-get remove package_name.

The orphaned packages are those which do not serve the purpose of package dependencies. It is recommended to remove all the orphaned packages from the CentOS Linux.

For example, package 1 is dependent on package 2. To install package 1 we have to install package 2 as well. If package 1 is removed, package 2 may still be present. This state of package 2 is known as orphaned.

The built-in utility yum-utils is used to verify if there are orphaned packages.

To verify if that is present, run the command:

rpm -qa | grep yum-utils

If not present, install it with the command:

yum install yum-utils

To get the list of all orphaned packages, run the command:

package-cleanup --leaves

To remove a package run the command(for CentOS):

yum remove `package-cleanup --leaves`

For Ubuntu:

apt-get autoremove
About Author :

Myself Debomita Bhattacharjee, an IT employee with 6+ years of experience in Software industry. My area of interest is Automation testing and Front End Development.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions