zoukankan      html  css  js  c++  java
  • sysbench对oracle进行压力测试

    Sysbench压测Oracle

    1.安装

    1.1.下载sysbench安装包

    mysql官网:sysbench下载

    github下载:sysbench下载

    digoal收藏:sysbench下载

    sysbench 0.5以上版本不再支持Oracle,因此如果需要压测Oracle,需要下载sysbench 0.5版本

    1.2.安装Oracle客户端

    1.3.解压安装sysbench

    1.3.1.sysbench 0.4版本安装

    tar vxf sysbench-0.4.12.16.tar.gz
    echo "/oracle/11204/lib/" > /etc/ld.so.conf.d/oracle-client-11.2.conf
    ldconfig
    cd sysbench-0.4.12.16/
    ./configure --prefix=/usr/local/sysbench --with-oracle="/oracle/11204" --without-mysql 
    make
    make install
    vi ~/.bash_profile
    export PATH=$PATH:/usr/local/sysbench/bin
    source .bash_profile
    

    1.3.2.sysbench 0.5版本安装

    yum -y install automake libtool 
    unzip sysbench-0.5.zip
    echo "/oracle/11204/lib/" > /etc/ld.so.conf.d/oracle-client-11.2.conf
    ldconfig
    cd sysbench-0.5/
    ./autogen.sh
    ./configure --prefix=/usr/local/sysbench --with-oracle="/oracle/11204" --without-mysql
    make
    make install
    vi ~/.bash_profile
    export PATH=$PATH:/usr/local/sysbench/bin
    source .bash_profile
    

    2.进行压力测试

    2.1.查看帮助

    本次使用的是0.5版本

    sysbench

    可以看到使用oracle驱动被编译进sysbench中了

    2.2.准备数据

    需要进去oracle用户,并且数据库TNS配置在tnsnames.ora中

    su - oracle
    vi .bash_profile
    export PATH=$PATH:/oracle/11204/bin:/usr/local/sysbench/bin
    source ~/.bash_profile
    sysbench --test=oltp --db-driver=oracle --oltp_tables_count=8 --oltp-table-size=100000 --oracle-db=racdb --oracle-user=monkey --oracle-password=xxxxx prepare
    

    执行上面的语句后,报错

    解决方法:

    下载.lua文件,替换原本的.lua文件

    github:lua文件下载

    cd /usr/local/sysbench/share/sysbench/
    mkdir backup
    mv *.lua backup/
    unzip sysbench_lua-master.zip
    cd sysbench_lua-master/lua/
    mv *.lua /usr/local/sysbench/share/sysbench/
    su - oracle
    cd /usr/local/sysbench/share/sysbench/
    sysbench --test=oltp --db-driver=oracle  --oltp_tables_count=8 --oltp-table-size=100000 --oracle-db=racdb --oracle-user=monkey --oracle-password=xxxxx prepare
    

    2.3.压力测试

    2.3.1.数据准备

    su - oracle
    cd /usr/local/sysbench/share/sysbench/
    sysbench --test=oltp --db-driver=oracle --oltp_tables_count=8 --oltp-table-size=100000 --oracle-db=racdb --oracle-user=monkey --oracle-password=xxxxx prepare
    

    2.3.2.压力测试

    sysbench --test=oltp --db-driver=oracle  --oltp-tables-count=8 --oltp-table-size=100000 --oracle-db=racdb --oracle-user=monkey --oracle-password=xxxxx --max-time=900 --max-requests=10000000 --num-threads=40 --report-interval=10 run
    

    max_time:压力测试时间,单位秒

    num-threads:打开多少个连接(并发数)

    report-interval:多久显示一次压测结果,单位秒

    test:oltp是混合的压测,包括增删改查。在/usr/local/sysbench/share/sysbench/下面的脚本都可以使用

    2.3.3.清理压测数据

    sysbench --test=oltp --db-driver=oracle --oltp_tables_count=8 --oracle-db=racdb --oracle-user=monkey --oracle-password=xxxxx cleanup
    
  • 相关阅读:
    Ajax
    Linux安装SmartSVN及破解
    JQuery异步提交
    动画效果
    事件
    表单选择器
    DOM操作
    JQuery基础
    PHP环境配置
    DP--钢条切割
  • 原文地址:https://www.cnblogs.com/monkey6/p/14341083.html
Copyright © 2011-2022 走看看