zoukankan      html  css  js  c++  java
  • sysbench 测试mysql性能

    =====

    #1
    sysbench --test=oltp --oltp-table-size=10000 --mysql-db=test --mysql-user=root --mysql-password=123456
    --mysql-socket=/data/mysql/3306/mysql.sock --db-driver=mysql prepare

    #2
    sysbench --test=oltp --oltp-table-size=10000 --mysql-db=test --mysql-user=root --mysql-password=123456
    --mysql-socket=/data/mysql/3306/mysql.sock --db-driver=mysql
    --max-time=720 --max-requests=0 --num-threads=16 --oltp-test-mode=complex run

    #3
    sysbench --test=oltp --oltp-table-size=10000 --mysql-db=test --mysql-user=root --mysql-password=123456
    --mysql-socket=/data/mysql/3306/mysql.sock --db-driver=mysql
    --max-time=720 --max-requests=0 --num-threads=16 --oltp-test-mode=complex cleanup

    ===========

    1.安装sysbench

    yum install sysbench

    2.测试前准备

    sysbench --test=oltp --oltp-table-size=80000000

    --db-driver=mysql

    --mysql-socket=/var/lib/mysql/mysql.sock

    --mysql-user=root  

    --mysql-password='root'

    --mysql-db=test

    prepare

    在test数据库中创建sbtest表,并插入80000000数据,表引擎为InnoDB

    3.测试

    把上面的语句最后一行改为run即可

    sysbench --test=oltp --oltp-table-size=80000000

    --db-driver=mysql

    --mysql-socket=/var/lib/mysql/mysql.sock

    --mysql-user=root  

    --mysql-password='root'

    --mysql-db=test

    run

    4.结果

    sysbench 0.4.12: multi-threaded system evaluation benchmark

    Running the test with following options:
    Number of threads: 1

    Doing OLTP test.
    Running mixed OLTP test
    Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
    Using "BEGIN" for starting transactions
    Using auto_inc on the id column
    Maximum number of requests for OLTP test is limited to 10000
    Threads started!
    Done.

    OLTP test statistics:
    queries performed:
    read: 140000
    write: 50000
    other: 20000
    total: 210000
    transactions: 10000 (27.14 per sec.) #每秒处理的事务数
    deadlocks: 0 (0.00 per sec.)
    read/write requests: 190000 (515.69 per sec.) #每秒处理的读写请求
    other operations: 20000 (54.28 per sec.)

    Test execution summary:
    total time: 368.4417s
    total number of events: 10000
    total time taken by event execution: 368.3644
    per-request statistics:
    min: 3.72ms
    avg: 36.84ms
    max: 326.52ms
    approx. 95 percentile: 76.04ms

    Threads fairness:
    events (avg/stddev): 10000.0000/0.00
    execution time (avg/stddev): 368.3644/0.00

    5.清理数据

    sysbench --test=oltp --oltp-table-size=80000000

    --db-driver=mysql

    --mysql-socket=/var/lib/mysql/mysql.sock

    --mysql-user=root  

    --mysql-password='root'

    --mysql-db=test

    cleanup

  • 相关阅读:
    centos 编程环境
    git 安装 使用
    nodejs 笔记
    微信开发
    composer 使用笔记
    一:安装centos 7最小编程环境 xfce桌面
    二: 安装centos服务环境软件mysql httpd php
    我的通用程序规范及说明
    常用js代码集
    三 , lnmp 一键包安装使用
  • 原文地址:https://www.cnblogs.com/moss_tan_jun/p/6594769.html
Copyright © 2011-2022 走看看