Iotop parameters of the Linux system IO analysis tool (view IO occupancy)

Source: Internet
Author: User
Tags percona python script git clone

Objective:

In general operations work often encounter such a scenario, the server's IO load is very high (util in iostat), but unable to quickly locate the IO load source process and source files resulting in the inability to make the appropriate policy to solve the problem.

This phenomenon is more common on MySQL, and before 5.6 (Performance_schema provides IO instrument), we can usually only guess the high IO caused by MySQL, but we can't pinpoint which file is the load.

For example, is Ibdata's brush-writing? or random reading of an unpopular IBD?

This article will introduce a relatively simple process of positioning IO high load.

Tool Preparation:

iotop:http://guichaz.free.fr/iotop/

Pt-ioprofile:http://www.percona.com/downloads/percona-toolkit/2.2.1/

Step1:iostat Viewing IO conditions

Iostat-x 1 Look at the IO situation, you can see that the DFA disk has a higher IO load, and then we'll locate the specific load source.

Step2:iotop locating the load source process

The essence of Iotop is a Python script that gets the IO information of thread from the proc and summarizes it.

It can be seen that most of the IO sources come from the mysqld process. It is therefore possible to determine the load source of the DFA as a database

STEP3 pt-ioprofile Locating the load source file

The principle of pt-ioprofile is to attach an strace process to a certain PID for IO analysis.

Here is an excerpt from the official website:

However, it works by attaching Strace to the process using ptrace (), which would make it run very slowly Until strace detaches. In addition to freezing the server, there was also some risk of the process crashing or performing badly after strace detaches from it, or indeed of strace not detaching cleanly and leaving the process in a sleeping state. As a result, this should is considered an intrusive tool, and should not being used on production servers unless is COMF Ortable with that.

The process number of the MYSQLD process is found through the PS Aux|grep mysqld, which is viewed by pt-ioprofile to see which file has the most IO time.

The tool shows the time that the IO occupies by default parameters.

More useful for locating problems is locating through IO throughput. Using the parameter--cell=sizes, this parameter shows the result in B/s way

The main source of Io load can be seen as sbtest (Sysbench io bound OLTP test).

And the pressure is mainly concentrated on the reading.

The iotop command is a command that displays hard disk IO specifically, and the interface style is similar to the top command. This command is only available in kernelv2.6.20 and later versions. Python version requires python2.7 and above

Official notes:

Linux have always been able to show how much I/O is going on (the bi and Bo columns of the Vmstat 1 command).
Iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on. It requires python≥2.7 and a Linux kernel≥2.6.20 with the Task_delay_acct config_taskstats, task_io_accounting and CON Fig_vm_event_counters options on.

Iotop Installation:

Direct Yum installation.

Yum Install Iotop

The install command in Ubuntu is: sudo apt-get install Iotop
After installation, enter the terminal: Iotop.
Or:

git clone git://repo.or.cz/iotop.git





Iotop Instructions for use:

Can be operated with left and right arrows, press R is the opposite direction, press O is dynamic switch

Usage Iotop-parameters

–version Viewing the version information
-h,–help View Help information for
-o,–only only show the program on the drive
-b,–batch Batch processing for logging
-N NUM set loop several times
-D sec,–delay=sec setting display time interval

Iotop parameters of the Linux system IO analysis tool (view IO occupancy)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.