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

  • 相关阅读:
    MapXtreme 2005
    QQ在线源码
    Oralce rowid
    MOSS2007 安装与部署(下)
    MapXtreme 2005新增内容
    MOSS 2007安装与部署(上)
    PL/SQL中的where子句比较
    Oracle中插入日期型数据
    在HTML语言网页中加载视频的代码
    HTTP 错误 500.24 Internal Server Error 检测到在集成的托管管道模式下不适用的 ASP.NET 设置。
  • 原文地址:https://www.cnblogs.com/binliubiao/p/12566646.html
Copyright © 2011-2022 走看看