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

  • 相关阅读:
    pathon学习总结(二)pathon的基础语法
    python学习总结(一),第一个python程序的编写
    数组中查找最大值和最小值 (两种方法)
    websocket----聊天室,推送等服务
    django-celery 应用方法
    vue-resource
    Vue-router
    vue 属性绑定
    Vue的生命周期以及钩子函数
    安装 vue 及 组件
  • 原文地址:https://www.cnblogs.com/binliubiao/p/12566646.html
Copyright © 2011-2022 走看看