Blog - comments

Hi Perry, The spare CPU power is of course available for other processes ( i.e non-caged database)! ...
When I studied Oracle New Feature Guide "Media Failure: PDB SYSTEM Data File" , I was surprised tha...
Hayat Khan

Really a nice article to study.

Thanks,

Amol Bhoite

Bonjour,

Tout d'abord merci pour cet article. J'aimerai savoir si ACFS est gratuit ?

Chris

Chris
Hi Jerome.. I have a question. Suppose if we have 8 CPUs on server and we assign 2 CPUs to a databas...
Perry Kahlon
Blog David Hueber Linux: easing the process and performance monitoring with htop

dbi services Blog

Welcome to the dbi services Blog! This blog focuses on IT infrastructure - featuring news, troubleshooting, and tips & tricks. It covers database, middleware, and OS technologies such as Oracle, Microsoft SQL Server, Documentum, MySQL, PostgreSQL, Sybase, Unix/Linux, etc. The dbi services blog represents the view of our consultants, not necessarily that of dbi services. Feel free to comment on the postings!

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that have been used in the blog.
  • Bloggers
    Bloggers Search for your favorite blogger from this site.

Linux: easing the process and performance monitoring with htop

I'm pretty sure that most of you already struggled with some low performance systems. In order to analyse such cases several tools and utilities, like top, nmon, fuser or lsof are available under Linux. However trying to dig in processes analysis and looking for files and processes relations may be quite painful.

To get started with performance checks and analysis, a interesting utility is available: htop

What is htop

htop is an interactive process viewer developed by Hisham Muhammad. It can be seen as an "enhancement" of the traditional top tool that is better known. In my point of view it is a pretty handy entry point for performance analysis on Linux. It integrates most of the top functionnalities and add some new one. Here is a brief summary of its main functions:

  • Scroll the process list horizontally and vertically using the arrow keys
  • Kill or renice processes (already in top)
  • Actions on multiple processes through tagging using the space bar
  • Pretty good visual representation of CPU, Memory and Swap usage
  • Process tree view
  • List files used by a process
  • Search function

 

How to install htop

htop is available on most of the Linux distribution and even already included in several repositories such the canonical or the EPEL one. However if like me you do not have it in a repo, you can easily find the binaries and sources on the project web site http://htop.sourceforge.net/index.php?page=downloads

 

For my tests, I installed it on Oracle Enterprise Linux 5.7 using the RHEL binaries

 

 

 

Note that if you want to be able to display the files used by a process within htop, then lsof must be installed too.

 

Getting started

htop supports 2 options when started:

  • -d --> to specify a refresh delay
  • -u --> to specify a user to filter on

In my examples below, I have started htop by filtering on the oracle user to get an eye on my databases processes.

 

The first point I found nice once I started htop was the visual representation of the server load. It provides a pretty good overview using colors, which is close from the principle used in nmon and really easy and fast to read.

 

 

In addition this part can be fully customized through the Setup (F2 or shift + s)

 

Then an other good idea in the tool is that unlike top the main functions are displayed at the bottom. This seems to be trivial but is quite useful while starting to use the tool or for people not using it often.

 

 

As htop is based on the same principle than top, it also integrates almost the same shortcuts. This means that if now F9 is designed to kill a process the shortcut k is still available. This should ease the switch for top users to htop.

 

 

Beside these "cosmetic" enhancement, the coolest features in htop are:

  • Tree View
  • Tag
  • Kill
  • File trace
  • Syscall trace

 

Tree View

The Tree View can be activated using F5 or the t shortcut. Then processes having child processes can be expended using the + or - key, which allows also to collapse the tree.

 

 

Tag - Multiple Actions

If you need to run the same action such kill or renice on several processes, htop offers the Tag function for this purpose. Using the space bar, you will be able to tag processes and then run an action on all of them. Tagged processes are highlighted.

 

 

You untag a process by pressing the space bar again or easily untag all processes using the shortcut U (shift + u)

 

Kill - select the signal

 

The kill function has been made much more handy. Instead entering a PID, now you just need to tag the process(es) you want to kill. In addition the nich thing is that you can select the signal you want to send to the process.

 

 

 

File trace

During your analysis if you have identified some processes using htop, you may want to check the files accessed by them. If lsof is installed, you even don't need to switch from one utility to another anymore. It is integrated within htop. Simply select the process and use the shortcut l.

 

 

SysCall trace

In the same idea than the file trace, htop allows you to trace all system call made and signals received by a process. This feature requires strace to be installed too.

 

 

So I hope that you find some interessting stuff in this overview of htop. If you want to look at it a bit deeper have a look on the project web site, http://htop.sourceforge.net/index.php?page=screenshots, or simple install it Wink

 

Enjoy! Cool

Rate this blog entry:
1

David Hueber is Head of Service Management and Consultant at dbi Services. He has ten years of experience in infrastructure operation & management, engineering, and optimization. He is specialized in Oracle technologies (engineering, backup and recovery, high availability, etc.), Service Management standards and Oracle infrastructure operation processes (Service Desk, Change Management, Capacity Planning, etc.). David Hueber is ITILv3 Service Operation Lifecycle certified and Linux LPIC-1 certified. He received a university degree in Informatics and Networks at the IUT Mulhouse, France. He also studied Information Systems at the Conservatoire National des Arts et Métiers in Mulhouse, France. His branch-related experience covers Financial Services / Banking, Chemicals & Pharmaceuticals, Transport & Logistics, Retail, Food, etc.

Comments

  • No comments made yet. Be the first to submit a comment

Leave your comment

Guest Wednesday, 23 April 2014
AddThis Social Bookmark Button
Deutsch (DE-CH-AT)   French (Fr)
NewsOfficesContact

Contact

Contact us now!

Send us your request!

Our workshops

dbi FlexService SLA - ISO 20000 certified.

dbi FlexService SLA ISO 20000

Expert insight from insiders!

Fixed Price Services

dbi FlexService SLA - ISO 20000 certified.

dbi FlexService SLA ISO 20000

A safe investment: our IT services at fixed prices!

Your flexible SLA

dbi FlexService SLA - ISO 20000 certified.

dbi FlexService SLA ISO 20000

ISO 20000 certified & freely customizable!

dbi services Newsletter