top or htop to check the health of SQL Server on Linux

Being a Windows user, your first place to check the health of SQL Server is Windows task manager. Since Microsoft has launched SQL Server on Linux operating system, you might be wondering how to check the health of SQL Server on Linux machine now.

You can use classical Linux task manager by running the “top” command. It is available in many Linux operating systems. It displays essential system information like CPU load, memory usage, swap usage, buffer size, process id, and much more.

In this blog, we will talk about not only “top” command but also “htop” command which is very similar to “top” command. We will also discuss;

  • Syntax of “top” and htop” commands
  • What information the commands show as an output
  • What are the differences between “top” and “htop”

let’s connect to your Linux machine and follow the below steps;

“top” command:

  • Run the “top” command on your Linux machine

Syntaxtop

01top_2

“htop” command:

  • By default, it is not installed. You need to install the “htop” package on the Linux machine. You can follow the below syntax to install on a respective operating system.

Syntax: sudo yum install htop (CentOS/REHL)

Syntax: sudo apt install htop (Ubuntu)

02installhtop

  • Once you installed successfully, run the “htop” command

Syntax: htop

03htop

Information the commands provide

Both the commands provide nearly same information, and they display following details of the system;

1) The first line of the output shows mix information that includes;

– How long the system has been up and running
– Total number of users
– The load average shows the system load time for the last 1, 5 and 15 mins.

2) Tasks – It provides tasks details

– Total number of tasks
– Number of running tasks
– Number of sleeping tasks
– Number of stopped tasks
– Number of zombie tasks

3) CPU – It gives CPU utilization details

– CPU used percentage by the user
– CPU used percentage by system
– CPU used percentage by low priority processes
– CPU used percentage by idle processes
– CPU used percentage by io wait
– CPU used percentage by hardware interrupts
– CPU used percentage by software interrupts
– CPU used percentage by steal time

4) Memory – It gives memory details

–  Total system memory
–  Free or available memory 
–  Memory used
–  Buffer cache

5) Swap – It provides Swap space (also known as paging) details

–  Total swap available
–  Total swap free
–  Total swap used
–  Available memory

6) Main Table

– Process ID (PID)
– User
– Priority (PR)
– Nice level (NI)
– Virtual memory utilized by process (VIRT)
– Resident memory utilized by a process (RES)
– Shareable memory (SHR)
– CPU used by process as a percentage (%CPU)
– Memory used by process as a percentage (%MEM)
– Time process has been running (TIME+)
– Command

Differences between “top” and “htop”

Here are some fundamental differences;

  • You can scroll vertically and horizontally to see all processes and complete command lines in “htop”, but you can’t do with “top”.
  • The “htop” is an improved version of “top” showing more stats and in a more colorful way, “top” doesn’t.
  • You don’t need to type the process number to kill a process in “htop”, but in “top” you do.
  • The “htop” starts very quickly as compared top command.
  • The “htop” command supports mouse operation, but “top” doesn’t.

Hope, you enjoyed classical Linux task manager to check the health of SQL Server on Linux system.

Leave a comment

Your email address will not be published. Required fields are marked *