Luca Canali on 28 Jul 2015

Topic: this post is about some simple tools and techniques that can be used to drill down high-latency I/O events using SystemTap probes.

The problem: Operations with high latency on a filesystem and/or a storage volume can sometimes be attributed to just a few disks 'misbehaving', possibly because they are suffering mechanical failures and/or are going to break completely in the near future.

I/Os of high latency on just a few disks can then appear as latency outliers when accessing volumes build on a large number of disks and overall affect the performance of the entire storage. I write this having in mind the example of a storage system built with (SATA) JBODs using Oracle ASM as volume manager/DB filesystem. However the main ideas and tools described in this post apply to many other volume managers and file systems, including HDFS.

The standard tools: One way to find that one or more disks are serving I/O requests with high latency is with the use of standard Linux tools such as iostatsar orcollectl. Typically you would use those tools to spot anomalous values of average service time, average wait time and also of queue size.

A structured approach on how to do this is described in Brendan Gregg(link is external)'s USE method(link is external) and thetools that can be used in Linux(link is external) to implement it.

SystemTap scripts: In this post we focus on a technique and a couple of simple scripts that can be used to identify disks serving I/O with high latency using SystemTap(link is external) probes to investigate I/O latency of the block devices.

The script blockio_latency_outliers_per_device.stp(link is external) provides a measurement of some basics latency statistics for block device, including number of I/Os, average andmaximum latency. The script also provides details of all the I/O where the latency is above a certain programmable threshold (the default threshold is set at 500 microseconds).

An example of its use (edited output for clarity) is here below. Note the latency warning message and overall the very large maximum value measured for the latency of the /dev/sdy block device:

[root@myhost(link sends e-mail)] # stap -v blockio_latency_outliers_per_device.stp 10

Measuring block I/O latency and statistics

A warning will be printed for I/Os with latency higher than 500000 microseconds

Statistics will be printed every 10 seconds. Press CTRL-C to stop

...

latency warning, >500000 microsec: device=sdy, sector=166891231, latency=714984

latency warning, >500000 microsec: device=sdy, sector=165679327, latency=582708

latency warning, >500000 microsec: device=sdy, sector=167102975, latency=1162550

....

I/O latency basic statistics per device, measurement time: 10 seconds

Latency measured in microseconds

Disk name          Num I/Os    Min latency    Avg latency    Max latency

....

sdu                     219            106           6217          27117

sdz                     200            123           5995          27205

sdq                     211             71           6553          31120

sdh                     256            103           6643          22663

sds                     224            101           6610          29743

sdm                     238             92           7550          35571

sde                     243             90           8652          52029

sdt                     200            105           5997          25180

sdk                     200             94           5696          35057

sdi                     206             99           7849          30636

sdg                     269             74           6746          36746

sdy                     197            102          98298        1167977

sdr                     200             89           6559          27873

sdl                     200            140           8789          31996

sdw                     210             99           7009          37118

sdd                     217             94           7440          56071

sdn                     205             99           6628          41339

....

When candidate disks for high latency have been identified, the second step is to further drill down using the script blockio_rq_issue_filter_latencyhistogram.stp(link is external). This script gathers and displays I/O latency histograms for a subset of block devices that can be specified using filters in the script header. The default filters are:

# SystemTap variables used to define filters, edit as needed

global IO_size = 8192    # this will be used as a filter for the I/O request size

# the value 8192 targets 8KB operations for Oracle

# single-block I/O

# use the value -1 to disable this filter

global IO_operation = 0  # this will be used as a filter: only read operations

# a value of 0 considers only read operations

# (1 is for write), use -1 to disable this filter

global IO_devmaj = -1    # this will be used as a filter:

# device major number (-1 means no filter)

# ex: use the value 253 for device mapper block devices

global IO_devmin = -1    # device minor number (or -1 if no filter)

You can use  blockio_rq_issue_filter_latencyhistogram.stp(link is external) to drill down on the latency histogram for those disks that have shown high latency I/O and also compare them with "good" disks. In the example above the candidate "trouble disk" is /dev/sdy with major number 65 and minor 128 (you can major and minor device numbers for "sdy" simply using ls -l /dev/sdy).

Example:

stap -v blockio_rq_issue_filter_latencyhistogram.stp 10

Block I/O latency histograms from kernel trace points

Filters:

    IO_size = 8192

    IO_operation = 0 (0=read, 1=write, -1=disable filter)

    IO_devmaj = 65 (-1=disable filter)

    IO_devmin = 128 (-1=disable filter)

lock I/O latency histogram, measurement time: 10 seconds, I/O count: 199

Value = latency bucket (microseconds), count=I/O operations in 10 seconds

value |-------------------------------------------------- count

16 |                                                    0

32 |                                                    0

64 |@                                                   2

128 |@@@@@@@                                            14

256 |@@                                                  4

512 |@                                                   2

1024 |@@@                                                 7

2048 |@@@@@@@@@                                          19

4096 |@@@@@@@@@@@@@@@@@@                                 37

8192 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                      59

16384 |@@@@@@@                                            14

32768 |                                                    0

65536 |@@@@@          HIGH                                10

131072 |@@@@@          LATENCY                             11

262144 |@@@@@          I/O                                 10

524288 |@@@            OPERATIONS                           6

1048576 |@@                                                  4

2097152 |                                                    0

 

Note the presence of several I/O operations at high latency together with more normal I/O latecy, for example I/Os served from SATA disks at around 8 ms and also I/O served from the controller cache at sub-millisecond latency.

For comparison here below is the latency histogram measured on another disk while the same workload was running. We can see that in this case high latency points found in the previous example are no more present. Most of the I/O operations are around 8 ms latency and some operations served from cache at sub-millisecond latency. The I/O reported for the /dev/sdy disks with latency of 64 ms and above are not present in this case.

stap -v blockio_rq_issue_filter_latencyhistogram.stp 10

Block I/O latency histograms from kernel trace points

Filters:

IO_size = 8192

IO_operation = 0 (0=read, 1=write, -1=disable filter)

IO_devmaj = 65 (-1=disable filter)

IO_devmin = 48 (-1=disable filter)

Block I/O latency histogram, measurement time: 10 seconds, I/O count: 196

Value = latency bucket (microseconds), count=I/O operations in 10 seconds

value |-------------------------------------------------- count

32 |                                                    0

64 |                                                    0

128 |@@@@@@@@@                                          19

256 |@@@@@@@@                                           16

512 |                                                    1

1024 |@@@@                                                9

2048 |@@@@@@@@@@@@@@                                     28

4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@                       56

8192 |@@@@@@@@@@@@@@@@@@@@@@@@                           49

16384 |@@@@@@@@@                                          18

32768 |                                                    0

65536 |                                                    0

The tests reported here have been performed on a old system running RHEL 5 (kernel 2.6.18-371)  and SystemTap v. 1.8, however the scripts have also been tested on OL and CentOS 7.1 (kernel 3.10.0-229) and SystemTap 2.8. If you are using SystemTap 2.6 or above you can use the scripts blockio_rq_issue_latencyhistogram_new.stp(link is external)and blockio_rq_issue_filter_latencyhistogram_new.stp(link is external) instead.

Conclusion: In this post we have shown a simple technique to troubleshoot I/O latency outliers and in particular on how to drill down on I/Os served at high latency because of one or more misbehaving disk in the storage volume/filesystem. The investigation has been done using SystemTap scripts used first to discover which disks were serving some of their I/O s with high latency and then drilling down on specific devices with the use of latency histograms. The fact of identifying and later replacing the badly performing disks can be beneficial for the performance of the entire storage systems.

Download: The tools discussed in this post can be downloaded from this webpage and from Github(link is external).

Acknowledgements and additional links: Brendan Gregg(link is external) has published an extensive set of articles and tools on performance tuning, including storage latency investigations.

For more information and examples on how to use SystemTap see the SystemTap wiki(link is external)

Additional tools for Oracle ASM I/O investigations also see Bertrand Drouvot's asm_metrics.pl(link is external)

Kevin Closson's SLOB(link is external) was used as workload generator for the examples discussed here.

Additional links on tools and techniques on Oracle I/O troubleshooting in this blog: Heat Map Visualization of I/O Latency with SystemTap and PyLatencyMap(link is external)Event Histogram Metric and Oracle 12c(link is external) and Life of an Oracle I/O: Tracing Logical and Physical I/O with Systemtap(link is external)

Diagnose High-Latency I/O Operations Using SystemTap的更多相关文章

  1. SystemTap Beginners Guide

    SystemTap 3.0 SystemTap Beginners Guide Introduction to SystemTap Edition 3.0   Red Hat, Inc. Don Do ...

  2. Examining Huge Pages or Transparent Huge Pages performance

    Posted by William Cohen on March 10, 2014 All modern processors use page-based mechanisms to transla ...

  3. HazelCast 的内存管理原理

    As it is said in the recent article "Google: Taming the Long Latency Tail - When More Machines ...

  4. Windows常用性能计数器总结

    基础监控: Processor:% Processor Time CPU当前利用率,百分比 Memory:Available MBytes 当前可用内存,兆字节(虚拟内存不需要监控,只有当物理内存不够 ...

  5. 【RabbitMQ】 RabbitMQ安装

    MQ全称为Message Queue, 消息队列(MQ)是一种应用程序对应用程序的通信方法.应用程序通过读写出入队列的消息(针对应用程序的数据)来通信,而无需专用连接来链接它们.消息传递指的是程序之间 ...

  6. Extension of write anywhere file system layout

    A file system layout apportions an underlying physical volume into one or more virtual volumes (vvol ...

  7. Spark第一周

    Why Scala 在数据集不是很大的时候,开发人员可以使用python.R.MATLAB等语言在单机上处理数据集.但是在大数据时代,数据集少说都是TB.PB级别,此时便需要分布式地处理.相较于上述语 ...

  8. Linux安装RabbitMQ教程(文件下载地址+安装命令+ 端口开放 + 用户创建 +配置文件模板+端口修改)

    前言 1.安装RabbitMQ前需先安装erlang, 且两者需要版本对应, 否则无法正常启动RabbitMQ (本教程使用22.0.7版本的erlang和3.8.6版本的Rabbitmq) 版本对应 ...

  9. 用systemtap对sysbench IO测试结果的分析1

    http://www.actionsky.com/docs/archives/171  2016年5月6日  黄炎 近期在一些简单的sysbench IO测试中, 遇到了一些不合常识的测试结果. 从结 ...

随机推荐

  1. win10下spark+Python开发环境配置

    Step0:安装好Java ,jdk Step1:下载好: Step2: 将解压后的hadoop和spark设置好环境变量: 在系统path变量里面+: Step3: 使用pip安装 py4j : p ...

  2. 378 Kth Smallest Element in a Sorted Matrix 有序矩阵中第K小的元素

    给定一个 n x n 矩阵,其中每行和每列元素均按升序排序,找到矩阵中第k小的元素.请注意,它是排序后的第k小元素,而不是第k个元素.示例:matrix = [   [ 1,  5,  9],   [ ...

  3. String field contains invalid UTF-8 data when serializing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes.

    [libprotobuf ERROR google/protobuf/wire_format.cc:1053] String field contains invalid UTF-8 data whe ...

  4. python的机器学习之路

    2018-04-1712:22:40 这是python依靠计算机视觉进行的ocr手写字的识别. 通过KNN训练数据 kNN 可以说是最简单的监督学习分类器了.想法也很简单,就是找出测试数据在特征空间中 ...

  5. python语言真正的奥义所在--对接32单片机

    2018-02-2720:51:24 今天晚上注定我要玩一夜这个东西,太爽了,给力! 烧写固件成功, http://blog.csdn.net/Lingdongtianxia/article/deta ...

  6. Java_大数值_16.5.12

    如果基本的整数和浮点数精度不能满足要求,那么可以使用java.math包中的BigInteger和BigDecimal这两个类.这两个类可以处理包含任意长度数字序列的数值.BigInteger类实现了 ...

  7. blog笔录1

    (1)虚拟主机 (2)部署 部署完成后刷新页面会看到笑脸,在Home分组下控制器Application/Home/Controller/IndexController.class.php下定义显示 ( ...

  8. Leetcode加一 (java、python3)

    加一 给定一个由整数组成的非空数组所表示的非负整数,在该数的基础上加一. 最高位数字存放在数组的首位, 数组中每个元素只存储一个数字. 你可以假设除了整数 0 之外,这个整数不会以零开头. Given ...

  9. 关于Extjs的窗口拖拽,改变大小,背景淡化问题

    大部分Extjs的Windows问题:在Extjs4代码中,只要加几句话: frame:true, //这个窗口的边边是圆的 border : false , //窗口没有边框 draggable: ...

  10. Vue.js 模板语法

    本章节将详细介绍 Vue.js 模板语法,如果对 HTML +Css +JavaScript 有一定的了解,学习起来将信手拈来. Vue.js 使用了基于 HTML 的模版语法,允许开发者声明式地将 ...