• sysbench 测试mysql的学习过程


    1.测试mysql前的准备工作

    //创建一张测试的数据表
    sysbench --test=oltp#指定测试模式 --mysql-table-engine=myisam#指定测试引擎 --oltp-table-size=8000000#建表时候插入800W数据
    --db-driver=mysql#设置驱动为mysql --mysql-user=root --mysql-password='123456' --mysql-db=test#登陆数据库,并使用test数据库 prepare#开启测试前的准备工作;

    2.开始测试 在prepare操作上增加几个参数,就可以运行测试了

    sysbench --test=oltp --oltp-table-size=8000000 --oltp-read-only=off# 是否开启只读模式,默认就是off,表示不要进行只读测试,也就是会采用读写混合模式测试

    (只读模式表示仅仅做select查询) --init-rng=on#分布的随机数设置为均匀分布  --num-threads=16#开启8个并发线程 --max-requests=0#表示总请求数为 0,因为上面已经定义了总执行时长,所以总请求数可以设定为 0;也可以只设定总请求数,不设定最大执行时长
    --oltp-dist-type=uniform#表示随机类型为固定模式,其他几个可选随机模式:uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托) --max-time=600#测试时间 --mysql-user=root --mysql-password='123456' --mysql-db=test --db-driver=mysql run > result.log#把信息输出到result.log文件中

    3.收尾工作 (会把测试表删除)

    sysbench --test=oltp --oltp-table-size=8000000 --mysql-db=test --mysql-user=root --db-driver=mysql --mysql-password='123456' cleanup

    result.log文件信息如下:

    /**测试运行的信息**/
    sysbench 0.4.12: multi-threaded system evaluation benchmark

    Running the test with following options:
    Number of threads: 8
    Initializing random number generator from timer.


    Doing OLTP test.
    Running mixed OLTP test
    Using Uniform distribution
    Using "LOCK TABLES WRITE" for starting transactions
    Using auto_inc on the id column
    Threads started!
    Time limit exceeded, exiting...
    (last message repeated 7 times)
    Done.
    /**结束**/
    OLTP test statistics:
    queries performed:
    read: 3983322 #读总数
    write: 1422615 #写总数
    other: 569046 #增删改查之外的操作数,比如commit
    total: 5974983 #全部总数
    transactions: 284523 (158.05 per sec.)#总事务数(每秒事务数)
    deadlocks: 0 (0.00 per sec.) #发生死锁总数
    read/write requests: 5405937 (3003.03 per sec.)# 读写总数(每秒读写次数)
    other operations: 569046 (316.11 per sec.) #其他操作总数(每秒其他操作次数)

    //测试统计数据
    Test execution summary:
    total time: 1800.1609s #总耗时
    total number of events: 284523 #总发生事务数
    total time taken by event execution: 14399.6619 #所有事务耗时相加(不考虑并行因素)
    per-request statistics:#响应时长统计
    min: 14.04ms #最小耗时
    avg: 50.61ms #平均耗时
    max: 7566.70ms #最高耗时
    approx. 95 percentile: 47.30ms #超过95%平均耗时
    //线程公平性统计信息
    Threads fairness:
    events (avg/stddev): 35565.3750/2.23
    execution time (avg/stddev): 1799.9577/0.05

  • 相关阅读:
    武汉招项目经理,高级软件工程师,客户端程序员,网页制作,2D美工[代发]
    学习WPF: 创建数据绑定目录树
    How do you translage CS2008 hardcode strings quickly?
    Windows Media Services 流媒体服务器架设教程 .
    流媒体服务器搭建实例——可实现录音,录像功能
    (转)A General Fast Method Invoker
    iphone property(转)
    C# 运算法 “??” “:: ” “int?”
    Crosby质量箴言(转)
    iphone程序的生命周期(执行过程) (转)
  • 原文地址:https://www.cnblogs.com/tudou1223/p/4441603.html
Copyright © 2020-2023  润新知