Linux Administration for SQL Server DBA’s: Checking Network I/O

By:   |   Comments   |   Related: > SQL Server on Linux


Problem

You are a SQL Server DBA and you are new to Linux. You know that Microsoft has decided to expand SQL Server to Linux servers and you need to know how to check for network latency and I/O. In this tip I will show you some tools that will help you.

Solution

When it comes to networking, Linux had an historical advantage over Windows until the release of Windows XP. For this reason Windows has more tools and more advanced features to monitor network usage, so in this tip we will show you commands you can use on Linux.

netstat

This command is well known for all Windows users. Its name is a short for network statistics and that is what this command does. The usage is almost identical to Windows, but on Linux this command gives more information. Now I will show you a few netstat invocations that you may probably use more.

netstat –i
   

The –i argument lists the network interfaces. With this command you can see the interface name and the packets sent and received correctly (TX-OK, RX-OK), the number of packets rejected by checksum error (TX-ERR, RX-ERR), the packets dropped due to a full buffer (TX-DRP, RX-DRP) and the packets dropped because the system was too busy (TX-OVR, RX-OVR).

netstat -i - Description: Screen capture of the execution of netstat -i.

netstat -ltu
   

The parameters –ltu displays the listening (l) ports, both TCP (t) and UDP (u). If you only use the –l argument it will also show the list of active UNIX domain sockets which is the way Linux uses to communicate between processes.

netstat -ltu - Description: Use netstat -ltu to view the listening ports.

Additionally, if you add the –p argument (netstat -ltup) it will show which program is listening.

slurm

Slurm is a terminal based network monitoring tool. This utility doesn’t come with the standard distribution, so you will have to install it from the repositories with the following command. Remember to use sudo if you are not running as root.

apt-get install slurm
   

The usage of this tool is very easy; you just need to pass as an argument the interface name you want to monitor. For example, if you want to monitor the eth0 interface you have to execute the following.

slurm –i eth0
   

Slurm - Description: This is how slurm looks like.

As you can see on the above image, this utility consists of an upper panel with a graph displaying network activity and a lower panel with the information as text.

speedometer

This is a graphic network monitoring tool whose graphics are much easier to understand than those of slurm. In order to install this tool you must execute the following sentence.

apt-get install speedometer
   

When you use speedometer you have to pass as arguments the network interface you want to monitor as usual with any network monitoring tool, but this utility allows you to monitor multiple interfaces at the same time. Here is how it works: for example, if you want to monitor transmission and reception speed on the interface eth0 you should execute the following command.

speedometer –tx eth0 –rx eth0
   

Additionally, if you want to monitor transmission and reception speed on the interfaces eth0 and eth1 the command to execute is the one below.

Speedometer –tx eth0 –rx eth0 –tx eth1 –rx eth1
   

On the following screen capture you can appreciate that the utility draws one histogram for every –tx or –rx argument adjusting its scale independently of each other.

Speedometer - Description: Screen capture of speedometer showing reception and transmission speed graphs.

ifstat

This is a network monitoring tool with a very basic interface, what makes it a good choice if you need to process or format the raw data in other application. To install this tool just execute the following code in your shell as root, or add sudo at the start of the command.

apt-get install ifstat
   

On the next screen capture you can see the execution of ifstat.

ifstat - Description: This is how ifstat looks like.

nethogs

Whenever you need to see the network usage by application the nethogs utility will do the job. This program resembles to the Linux top utility, but instead of showing CPU usage by application it shows the network usage.

nethogs - Description: Screen capture of nethogs execution.

As you can see on the previous image, this utility shows a grid sorted by network usage. It shows the process identifier, the user running the program that is using the network, the program path, the network interface being used by that program and the send and receive speed expressed in kilobytes per second.

Something to note is that this utility requires to be executed as root. To install this program just execute the following code on a shell.

apt-get install nethogs
   
Next Steps


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Daniel Farina Daniel Farina was born in Buenos Aires, Argentina. Self-educated, since childhood he showed a passion for learning.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips



Comments For This Article

















get free sql tips
agree to terms