A A
RSS

Three Apps For Monitoring Performance In Linux

Wed, Jul 21, 2010

Tweet this!

Most Linux users are familiar with the top command. Top shows you a list of processes on your system and provides a ton of useful information such as their CPU usage and owner. Unfortunately, this isn’t always enough data and many people don’t know where to turn next. This article covers three performance monitoring applications that show information top doesn’t tell you, and can greatly help in troubleshooting bottlenecks or just finding out more about your system. These utilities are iftop, iotop, and pv.

  1. iftop
  2. As you might be able to deduce from the name, iftop is a top-like application for network interfaces. You need to be root to run it, and it can be installed using the command:

    Ubuntu: sudo apt-get install iftop
    Fedora: sudo yum install iftop

    Run it in a terminal by specificying the interface you want to use, and optionally a -B (make sure you use a capital B) to display values in bytes rather than bits:

    # iftop -i eth3 -B

    The result is a screen showing you all the current connections on that port, as well as the throughput for each connection. Like top, iftop is full of features; press the h key to get an online help showing the options.

    Here you can see my network throughput as I run a speed test on dslreports.com. You’ll notice that there are separate indicators for incoming and outgoing traffic, and that three values are given on the right-hand side; these are the 2, 10, and 40 second averages.

    If you find iftop useful, you might want to read more about monitoring network traffic.

  3. iotop
  4. While iftop is great for monitoring network throughput, iotop is the utility you want if you need to measure disk access. It’s easily installable from the commandline:

    Ubuntu: sudo apt-get install iotop
    Fedora: sudo yum install iotop

    And you can run it with a simple sudo iotop command. What you’ll get is a listing of processes, like in top, but with their disk access information:

    In the above screenshot, I’m running a simple dd test to write to my local hard disk, which you can see as the first item in the window.

    iotop will tell you how much data each process is reading and writing, as well as if a process is using swap (which can be really helpful if you need to determine which process is thrashing your disk).

  5. pv
  6. The pv command isn’t a top-like application at all, but I’ve found it incredibly useful and I wanted to share it with you here. The pv utility is used between pipes on a command line and measures the speed of data throwing through that pipe. For example, here I am using pv to measure how quickly data is flowing between two dd commands:

    Installing pv is a simple one-liner:

    Ubuntu: sudo apt-get install pv
    Fedora: sudo yum install pv

    This is a great way to see how quickly one command is passing data to another command, when neither command is giving any output to report on its progress. If you’ve ever setup a pipe on the command line and wondered if it was actually doing anything, pv is the command you’ve been looking for. You can use it not only when you need to know the speed of data moving through a pipe, but whether there is any data moving at all.

  7. latencytop
  8. I wanted to give a quick mention to latencytop since I’m sure someone will ask about it if I don’t mention it. latencytop is a tool that shows you what resources a given process (or processes) are waiting for on your system. For example, it can tell you that a program is waiting on disk I/O or waiting to get a file lock. latencytop is a great tool, but on the whole it’s more useful for developers than end-users. If you’re interested, this is what it looks like:

    And this is how to install it:

    Ubuntu: sudo apt-get install latencytop
    Fedora: sudo yum install latencytop

Sound off: what are your tools?

Did I miss your favorite tool? What are your go-to commands when your system performance isn’t what it should be? Leave your helpful tips in the comment section below!

Like this post?

16 Responses to “Three Apps For Monitoring Performance In Linux”

  1. neuntoeter says:

    iptraf is a nice alternative to iftop.

    iostat is very useful to search for i/o bottlenecks

  2. Aurelio says:

    I like nmon. Ported from AIX to Linux by IBM.

  3. Vitaly says:

    there are 4, not three :-)

  4. Mozzi says:

    What about sar with sag and sadf?
    A real all-in-one tool

  5. Iain says:

    htop is a colorful, more usable replacement for top.

  6. dasen says:

    You should try nethogs because it shows the network traffic of each process. You have to run it with administrator privileges and append the interface you’ll scan, for example ‘sudo nethogs wlan0′.

    Good article

    • Jonathan DePrizio says:

      Thanks for that tip, Dasen! I’ve never heard of nethogs before, but it looks very useful. Appreciate it!

  7. I haven’t tried any of these, but I use nettop for a quick overview of a machine’s network traffic.

  8. Mark Seger says:

    I guess we all have our biases and I have a very strong bias against point tools like these. They’re great for solving a specific problem but pretty useless if you have a misbehaving system and no clue where to look. Further, even if you do know where to look, looking at any one type of data in isolation usually doesn’t help track down the problem, it only shows you the behavior of a single component. Furthermore all the outputs are in a totally inconsistent format.

    Enter collectl – it can report most of what many of these tools report but like sar it can run in the background at very low overheard. But unlike sar it can collect a whole lot more and let you look at it in multiple formats depending on where your investigation takes you. It can also produce output in a delimited format making it real easy to import into a spreadsheet or even pass to a tool like gnuplot.

    Try it, you’ll like it.

    -mark

  9. Anton says:

    Hi, nice post. I translate it to russian and published on my website, but I do not know how to send trackback to You?
    Help me please!

  10. Mark Seger says:

    Bumped into this article a second time, a year later. Since then I’ve released a new version of colmux, part of collectl-utils, which given your like for top-like tools thought you might like this one. Rather than repeat myself, here’s a post I had recently made to the highscalability blog – http://highscalability.com/blog/2011/8/25/colmux-finding-memory-leaks-high-io-wait-times-and-hotness-o.html

    Think ‘top anything’ across a cluster of potentially thousands of nodes.

    -mark

Trackbacks/Pingbacks

  1. How to Monitor Network Traffic in Linux | Techthrob.com - 26. Jul, 2010

    [...] recently covered three utilities you can use to monitor your system resources in Linux. One of those programs, iftop gives you information about the network traffic of your machine. In [...]

  2. Monitoring delle Performance In Linux - iLinux.it - 27. Sep, 2011

    [...] Three Apps For Monitoring Performance In Linux | Techthrob.com. Senza categoria device, kernel, network, tcp [...]

  3. Three Apps For Monitoring Performance In Linux | Techthrob.com - iLinux.it - 05. Dec, 2013

    [...] L’articolo completo su: Three Apps For Monitoring Performance In Linux | Techthrob.com. [...]

Leave a Reply

Weekly Poll

What's the best Linux distribution for desktops?

View Results

Loading ... Loading ...

Search TechThrob

Advertisement