zoukankan      html  css  js  c++  java
  • MySQL-sysbench


    1. 源码编译安装

    RHEL/CentOS
        yum -y install make automake libtool pkgconfig libaio-devel
        # For MySQL support, replace with mysql-devel on RHEL/CentOS 5
        yum -y install mariadb-devel openssl-devel
        # For PostgreSQL support
        yum -y install postgresql-devel
    -----------------------------------------------------------------------------
        ./autogen.sh
        $(which mysql_config) && $(which pg_config) && ./configure --prefix=/ups/app/sysbench --with-mysql --with-pgsql
    
    ./configure --prefix=/ups/app/sysbench --with-mysql --with-pgsql --with-pgsql-includes=/ups/app/postgresql/pgsql-12/include  --with-pgsql-libs=/ups/app/postgresql/pgsql-12/lib
        
        make -j
        make install

    image


    2. 服务器硬件性能测试

    sysbench --threads=10  memory --memory-block-size=8k --memory-total-size=6G --memory-oper=read run

    image

    # IO测试
    sysbench --threads=10  fileio --file-num=20 --file-total-size=20G --file-test-mode=rndrw run

    3. mysql性能测试

    3.1 创建测试数据

    mycli -e "create database if not exists sysbentest"
    
    sysbench --db-driver=mysql --mysql-user=root --mysql-password=root 
      --mysql-socket=/ups/app/mysql/mysql3308/logs/mysql3308.sock 
      --mysql-db=sysbentest --range_size=100 --table_size=10000 
      --tables=2 --threads=1 --events=0 --time=60 
      --rand-type=uniform /ups/app/sysbench/share/sysbench/oltp_read_only.lua prepare


    image

    3.2 测试

    sysbench --db-driver=mysql --mysql-user=root --mysql-password=root 
      --mysql-socket=/ups/app/mysql/mysql3308/logs/mysql3308.sock 
      --mysql-db=sysbentest --range_size=100 --table_size=10000 
      --tables=2 --threads=1 --events=0 --time=60 
      --rand-type=uniform /ups/app/sysbench/share/sysbench/oltp_read_only.lua run


    image

    -- 每5秒钟输出一次指标

    sysbench /ups/app/sysbench/share/sysbench/oltp_read_only.lua --db-driver=mysql --mysql-user=root --mysql-password=root 
      --mysql-socket=/ups/app/mysql/mysql3308/logs/mysql3308.sock 
      --mysql-db=sysbentest --range_size=100 --table_size=10000 
      --tables=2 --threads=2 --events=0 --time=60 
      --rand-type=uniform --report-interval=5 run

    image


    3.3 sysbench自带lua脚本

    image


    3.4 定制lua脚本测试

    function thread_init ()
        drv = sysbench.sql.driver()
        con = drv:connect()
    end
    
    function event ()
        con:query ("SELECT 1"
    )
    end
    
    function therad_done ()
        con:disconnect()
    end


    sysbench test.lua --mysql-host=localhost --mysql-user=root --mysql-password=root 
    --mysql-socket=/ups/app/mysql/mysql3308/logs/mysql3308.sock 
    --mysql-db=sysbentest run

    image

  • 相关阅读:
    [bzoj1095] [ZJOI2007]Hide 捉迷藏
    [bzoj3730] 震波
    [bzoj3672] [Noi2014]购票
    [bzoj4129] Haruna’s Breakfast
    《CSS3知识点》
    《表单总结》
    <表格>
    《HTML总结》
    <java程序大集合>
    《字符串的概念》
  • 原文地址:https://www.cnblogs.com/binliubiao/p/12566646.html
Copyright © 2011-2022 走看看