• [原创]MySql官方压力测试工具Mysqlslap


    [原创]MySql官方压力测试工具Mysqlslap

     一 Mysqlslap介绍

       Mysqlslap is a diagnostic program designed to emulate client load for a MySQL server and to report the timing of each stage. It works as if multiple clients are accessing the server. mysqlslap is available as of MySQL 5.1.4.

    二 Mysqlslap工具使用过程

    1. Create schema, table, and optionally any stored programs or data you want to using for the test. This stage uses a single client connection.
    2. Run the load test. This stage can use many client connections.
    3. Clean up (disconnect, drop table if specified). This stage uses a single client connection.

    三 Mysqlslap工具实例

    如下图所示:

    四  Mysqlslap常用参数介绍

    –auto-generate-sql, -a
    //自动生成测试表和数据
    –auto-generate-sql-load-type=type
    //测试语句的类型。取值包括:readkey,write,update和mixed(默认)。
    number-char-cols=N, -x N
    //自动生成的测试表中包含多少个字符类型的列,默认1
    number-int-cols=N, -y N
    //自动生成的测试表中包含多少个数字类型的列,默认1
    number-of-queries=N
    //总的测试查询次数(并发客户数×每客户查询次数)
    –query=name,-q
    //使用自定义脚本执行测试,例如可以调用自定义的一个存储过程或者sql语句来执行测试。
    create-schema
    //测试的schema,MySQL中schema也就是database
    –commint=N
    //多少条DML后提交一次
    –compress, -C
    //如果服务器和客户端支持都压缩,则压缩信息传递
    –concurrency=N, -c N
    //并发量,也就是模拟多少个客户端同时执行select。可指定多个值,以逗号或者–delimiter参数指定的值做为分隔符
    –engine=engine_name, -e engine_name
    //创建测试表所使用的存储引擎,可指定多个
    –iterations=N, -i N
    //测试执行的迭代次数
    –detach=N
    //执行N条语句后断开重连
    –debug-info, -T
    //打印内存和CPU的信息
    only-print
    //只打印测试语句而不实际执行

    如需更详细的学习,请访问Mysql官方网站:http://dev.mysql.com/doc/refman/5.1/en/mysqlslap.html



  • 相关阅读:
    2、变量
    1、基本的数据类型
    jenkins入门
    我的Python基础笔记
    jmeter测试手机app
    Python:字典
    Python:元组
    Python:列表
    Python:函数
    H3C-L2TP
  • 原文地址:https://www.cnblogs.com/mayingbao/p/631237.html
Copyright © 2020-2023  润新知