Monitor Bandwidth Usage per Process – NetHogs

nethogs is a very helpful tool to find out which PID is taking high bandwidth and the trouble with your network traffic as it groups bandwidth by process instead of breaking the traffic down per protocol or per subnet, like most tools, do. Monitor Bandwidth Usage per Process using Nethogs depends on ncurses for the text-based interface and libpcap for user-level packet capture.

If there’s suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this. This is very helpful for a system administrator to troubleshoot.


  • Shows TCP download- and upload-speed per process
  • Supports both Ethernet and PPP
  • Supports both IPv4 and IPv6


Install Nethogs Tool on a RHEL or CentOS or Fedora Linux

First, update EPEL repo and type the following yum command to install nethogs package:

yum install epel-release -y

Install NetHogs

yum install nethogs -y
Loaded plugins: fastestmirror, remove-with-leaves
apporbit-base | 2.9 kB 00:00:00
apporbit-c3 | 2.9 kB 00:00:00
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 14 kB 00:00:00
epel | 4.7 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/3): apporbit-c3/primary_db | 112 kB 00:00:00
(2/3): epel/x86_64/updateinfo | 847 kB 00:00:00
(3/3): epel/x86_64/primary_db | 6.1 MB 00:00:00
Loading mirror speeds from cached hostfile
 * base:
 * epel:
 * updates:
Resolving Dependencies
--> Running transaction check
---> Package nethogs.x86_64 0:0.8.5-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package Arch Version Repository Size
 nethogs x86_64 0.8.5-1.el7 epel 38 k

Transaction Summary
Install 1 Package

Total download size: 38 k
Installed size: 71 k
Is this ok [y/d/N]: y
Downloading packages:
nethogs-0.8.5-1.el7.x86_64.rpm | 38 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : nethogs-0.8.5-1.el7.x86_64 1/1
 Verifying : nethogs-0.8.5-1.el7.x86_64 1/1

 nethogs.x86_64 0:0.8.5-1.el7


Install Nethogs Tool n a Debian or Ubuntu Linux

Type the following apt-get command/apt-get command

sudo apt-get install nethogs


Once you successfully installed, Run the following command to see the bandwidth results.

# nethogs

bandwidth usage checker

For more details.


[[email protected]]# nethogs -h

usage: nethogs [-V] [-h] [-b] [-d seconds] [-v mode] [-c count] [-t] [-p] [-s] [device [device [device …]]]
-V : prints version.
-h : prints this help.
-b : bughunt mode – implies tracemode.
-d : delay for update refresh rate in seconds. default is 1.
-v : view mode (0 = KB/s, 1 = total KB, 2 = total B, 3 = total MB). default is 0.
-c : number of updates. default is 0 (unlimited).
-t : tracemode.
-p : sniff in promiscious mode (not recommended).
-s : sort output by sent column.
-a : monitor all devices, even loopback/stopped ones.
device : device(s) to monitor. default is all interfaces up and running excluding loopback

nethogs running, press:
q: quit
s: sort by SENT traffic
r: sort by RECEIVE traffic
m: switch between total (KB, B, MB) and KB/s mode





SysBench- Benchmark CPU, File I/O and Memory in CentOS

SysBench is a modular, cross-platform and multi-threaded benchmark tool for evaluating OS parameters that are important for a system running a database under intensive load. Benchmark CPU, File I/O and Memory in CentOS Server.

Current features allow to test the following system parameters:

  • file I/O performance
  • scheduler performance
  • memory allocation and transfer speed
  • POSIX threads implementation performance
  • database server performance

Install SysBench on CentOS 7

# yum install epel-release -y
# yum install sysbench -y


General syntax
The general syntax for SysBench is as follows:

sysbench [common-options] --test=name [test-options] command

CPU workload

You can benchmark your CPU performance as follows, The benchmark can be configured with the number of simultaneous threads and the maximum number to verify if it is a prime.

# sysbench --test=cpu --cpu-max-prime=20000 run
sysbench 1.0.6 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Prime numbers limit: 20000

Initializing worker threads...

Threads started!

General statistics:
total time: 10.0018s
total number of events: 3652

Latency (ms):
min: 2.67
avg: 2.74
max: 13.85
95th percentile: 2.81
sum: 10000.00

Threads fairness:
events (avg/stddev): 3652.0000/0.00
execution time (avg/stddev): 10.0000/0.00

Verify the the Total time statistics.


File IO workload

Before you do the file IO benchmark, you should confirm your drive and mount it if it is additional drive. Here using fileio, you will need to create a set of test files to work on. It is recommended that the size is larger than the available memory to ensure that file caching does not influence the workload too much.

# time sysbench --test=fileio --file-total-size=48G --file-num=24 prepare
sysbench 1.0.6 (using system LuaJIT 2.0.4)

24 files, 2097152Kb each, 49152Mb total
Creating files for the test...
Extra file open flags: 0
Creating file test_file.0
Creating file test_file.1
Creating file test_file.2
Creating file test_file.3
Creating file test_file.4
Creating file test_file.5
Creating file test_file.6
Creating file test_file.7
Creating file test_file.8
Creating file test_file.9
Creating file test_file.10
Creating file test_file.11
Creating file test_file.12
Creating file test_file.13
Creating file test_file.14
Creating file test_file.15
Creating file test_file.16
Creating file test_file.17
Creating file test_file.18
Creating file test_file.19
Creating file test_file.20
Creating file test_file.21
Creating file test_file.22
Creating file test_file.23
51539607552 bytes written in 594.02 seconds (82.74 MiB/sec).

real 9m54.175s
user 0m0.162s
sys 0m51.073s


You can tell the sysbench which kind of workload you want to run: sequential reads, writes or random reads, writes, or a combination.

We are going to use random read/write is used (rndrw) for example testing. Once you generated the files using above command, try to run the following commands.

# sysbench fileio --file-total-size=48G --file-num=24 --file-test-mode=rndrw --time=1800 --file-rw-ratio=1 --threads=16 --max-requests=0 run
sysbench 1.0.6 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 16
Initializing random number generator from current time

Extra file open flags: 0
24 files, 2GiB each
48GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.00
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!

File operations:
reads/s: 233.63
writes/s: 233.63
fsyncs/s: 112.14

read, MiB/s: 3.65
written, MiB/s: 3.65

General statistics:
total time: 1800.0621s
total number of events: 1042957

Latency (ms):
min: 0.00
avg: 27.61
max: 300.08
95th percentile: 101.13
sum: 28798434.80

Threads fairness:
events (avg/stddev): 65184.8125/349.16
execution time (avg/stddev): 1799.9022/0.02


Once completed, you can check the “Throughput” and “File operations” result to get the details.

After the benchmark, you can delete the 50GB test file from the server using the below command.

#sysbench --test=fileio --file-total-size=50G cleanup

You can also do some workload using sysbench.

the memory workload
the mutex workload
the threads workload