设为首页 加入收藏

TOP

mysql压力测试之sysbench 安装、使用和测试(一)
2017-11-15 09:15:27 】 浏览:457
Tags:mysql 压力 测试 sysbench 安装 使用

sysbench 安装、使用和测试

摘要:
sysbench是一个开源的、模块化的、跨平台的多线程性能测试工具,可以用来进行CPU、内存、磁盘I/O、线程、数据库的性能测试。目前支持的数据库有MySQL、Oracle和PostgreSQL。当前功能允许测试的系统参数有:

file I/O performance (文件I / O性能)
scheduler performance (调度性能)
memory allocation and transfer speed (内存分配和传输速度)
POSIX threads implementation performance (POSIX线程执行绩效)
database server performance (OLTP benchmark) (数据库服务器性能)

安装:
1):Ubuntu系统可以直接apt,如:

apt-get install sysbench

2):其他系统的则可以编译安装[在/home/zhoujy/目录下]:(安装前先装automake,libtool)

wget https://nchc.dl.sourceforge.net/project/sysbench/sysbench/0.4.12/sysbench-0.4.12.tar.gz
tar zxvf sysbench-0.4.12.tar.gz
进入解压目录,并且创建安装目录:
root@m2:/home/zhoujy# cd sysbench-0.4.12/
root@m2:/home/zhoujy/sysbench-0.4.12# mkdir /usr/sysbench/
准备编译
root@m2:/home/zhoujy/sysbench-0.4.12# apt-get install automake
root@m2:/home/zhoujy/sysbench-0.4.12#apt-get install libtool
root@m2:/home/zhoujy/sysbench-0.4.12# ./autogen.sh

要是出现:perl: warning: Falling back to the standard locale ("C")。则需要设置locale:

echo "export LC_ALL=C" >> /root/.bashrc
source /root/.bashrc

要是没有安装开发包,即/usr/include/ 目录下面没有mysql文件夹。则需要执行安装(版本为12.04):

sudo apt-get install libmysqlclient-dev
sudo apt-get install libmysqld-dev
sudo apt-get install libmysqld-pic

执行configure操作:

./configure --prefix=/usr/sysbench/ --with-mysql-includes=/usr/include/mysql/ --with-mysql-libs=/usr/lib/mysql/ --with-mysql
说明:
--prefix=/usr/sysbench/                    :指定sysbench的安装目录。
--with-mysql-includes=/usr/include/mysql/  :指定安装mysql时候的includes目录。
--with-mysql-libs=/usr/lib/mysql/          :指定装mysql时候的lib目录。
--with-mysql                               :sysbench默认支持mysql,如果需要测试oracle或者pgsql则需要制定–with-oracle或者–with-pgsql。

在这里需要先执行:

cp /usr/bin/libtool /home/zhoujy/sysbench-0.4.12/libtool

再make和make install。否者会出现 libtool 报出的 Xsysbench: command not found 错误,则表示编译文件包的libtool版本太低,需要替换。

选项说明(通用):

root@db2:~# sysbench 
Missing required command argument.
Usage: #使用方法
  sysbench [general-options]... --test=
  
    [test-options]... command

General options: #通用选项
  --num-threads=N            number of threads to use [1] #创建测试线程的数目。默认为1.
  --max-requests=N           limit for total number of requests [10000] #请求的最大数目。默认为10000,0代表不限制。
  --max-time=N               limit for total execution time in seconds [0] #最大执行时间,单位是s。默认是0,不限制。
  --forced-shutdown=STRING   amount of time to wait after --max-time before forcing shutdown [off] #超过max-time强制中断。默认是off。
  --thread-stack-size=SIZE   size of stack per thread [32K] #每个线程的堆栈大小。默认是32K。
  --init-rng=[on|off]        initialize random number generator [off] #在测试开始时是否初始化随机数发生器。默认是off。
  --test=STRING              test to run #指定测试项目名称。
  --debug=[on|off]           print more debugging info [off] #是否显示更多的调试信息。默认是off。
  --validate=[on|off]        perform validation checks where possible [off] #在可能情况下执行验证检查。默认是off。
  --help=[on|off]            print help and exit #帮助信息。
  --version=[on|off]         print version and exit #版本信息。

Compiled-in tests: #测试项目
  fileio - File I/O test #IO
  cpu - CPU performance test #CPU
  memory - Memory functions speed test #内存
  threads - Threads subsystem performance test #线程
  mutex - Mutex performance test #互斥性能测试
  oltp - OLTP test # 数据库,事务处理

Commands: prepare:测试前准备工作; run:正式测试 cleanup:测试后删掉测试数据 help version

See 'sysbench --test=
   
     help' for a list of options for each test. #查看每个测试项目的更多选项列表
   
  

更多选项:
1):sys

首页 上一页 1 2 3 4 5 6 7 下一页 尾页 1/7/7
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇DML与DDL查询语言介绍 下一篇Docker 容器的常规用法详情

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目