• PerconaToolkit 之 ptpmp


    pt-pmp 有两个方便的作用:一是获取进程的堆栈信息,二是对堆栈信息进行汇总。

    进程的堆栈信息是通过gdb获取的,所以在获取过程中,会对mysql服务端的性能有一定的影响

    pt-pmp脚本本身是用shell写的,用法也比较简单,唯一的要求是服务器上已安装gdb包。

    pt-pmp 参数:

    [root@hankyoon ~ ]# pt-pmp --help
    Usage: pt-pmp [OPTIONS] [FILES]
    
    For more information, 'man pt-pmp' or 'perldoc /usr/bin/pt-pmp'.
    
    Command line options:
    
      --binary          Which binary to trace.    指定分析的进程名,如果不指定,默认就是mysqld
      --help            Show help and exit.       帮助
      --interval        Number of seconds to sleep between L<"--iterations">.       迭代时间之间的时间间隔
      --iterations      How many traces to gather and aggregate.                    执行gdb命令的次数
      --lines           Aggregate only first specified number of many functions;    指定打印汇总后每一个分类中的头几个函数
                        0=infinity.
      --pid             Process ID of the process to trace; overrides L<"--binary">.指定进程的pid 
      --save-samples    Keep the raw traces in this file after aggregation.         是否将gdb获取的堆栈信息保存在文件中(注意,没有汇总)
      --version         Show version and exit.
    
    Options and values after processing arguments:
    
      --binary                         mysqld
      --help                           TRUE
      --interval                       0
      --iterations                     1
      --lines                          0
      --pid                            (No value)
      --save-samples                   (No value)
      --version                        FALSE

    用法:

    1. 汇总pstack获取的结果
    
     # ps -ef | grep mysqld
    
     # pstack 7777 > 7777.info
    
     # pt-pmp 7777.info 
    
    2. 直接根据进程名汇总堆栈信息
    
    # pt-pmp --binary mysqld
    
    3. 上述命令只是一次迭代的结果,如果要迭代多次,且每次相隔1s,可指定如下:
    
    # pt-pmp --binary mysqld --iterations 2 --interval 1
    
    4. 如果要同时保留汇总前的堆栈信息,可指定--save-samples参数
    
    # pt-pmp --binary sshd --save-samples sshd.txt
  • 相关阅读:
    Git 数据是怎么存储的
    技术管理规划-路径跟资源
    技术管理规划-如何规划团队的架构
    技术管理规划-如何设定团队的目标
    技术管理规划-设定团队的职能
    springboot实践1
    spring的事件机制实战
    Apollo的基本概念和集成实战
    spring的事件
    ELK的简单安装使用
  • 原文地址:https://www.cnblogs.com/hankyoon/p/15896998.html
Copyright © 2020-2023  润新知