Chinaunix首页 | 论坛 | 博客
  • 博客访问: 25775
  • 博文数量: 10
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 0
  • 用 户 组: 普通用户
  • 注册时间: 2013-12-25 19:23
文章分类
文章存档

2014年(5)

2013年(5)

我的朋友

分类: Mysql/postgreSQL

2014-02-23 19:25:16

关于sysbench测试步骤
关于sysbench调试和安装请参考:
http://blog.chinaunix.net/uid-20682026-id-3138466.html
下载地址:
[root@mysql tmp]#wget
[root@mysql sysbench-0.4.12]# ./configure && make && make install
1,关于sysbench可选项
[root@mysql tmp]# sysbench
Missing required command argument.
Usage:
  sysbench [general-options]... --test= [test-options]... command

General options:
  --num-threads=N            number of threads to use [1]
  --max-requests=N           limit for total number of requests [10000]
  --max-time=N               limit for total execution time in seconds [0]
  --forced-shutdown=STRING   amount of time to wait after --max-time before forcing shutdown [off]
  --thread-stack-size=SIZE   size of stack per thread [32K]
  --init-rng=[on|off]        initialize random number generator [off]
  --test=STRING              test to run
  --debug=[on|off]           print more debugging info [off]
  --validate=[on|off]        perform validation checks where possible [off]
  --help=[on|off]            print help and exit
  --version=[on|off]         print version and exit

Compiled-in tests:
  fileio - File I/O test
  cpu - CPU performance test
  memory - Memory functions speed test
  threads - Threads subsystem performance test
  mutex - Mutex performance test
  oltp - OLTP test

//文件IO选项
[root@mysql tmp]# sysbench --test=fileio help
sysbench 0.4.12:  multi-threaded system evaluation benchmark

fileio options:
  --file-num=N                  number of files to create [128]
  --file-block-size=N           block size to use in all IO operations [16384]
  --file-total-size=SIZE        total size of files to create [2G]
  --file-test-mode=STRING       test mode {seqwr(顺序写), seqrewr(顺序读写), seqrd(顺序读), rndrd(随机读), rndwr(随机写), rndrw(随机读写)}
  --file-io-mode=STRING         file operations mode {sync,async,fastmmap,slowmmap} 默认为[sync]
  --file-extra-flags=STRING     additional flags to use on opening files {sync,dsync,direct} []
  --file-fsync-freq=N           do fsync() after this number of requests (0 - don't use fsync()) [100]
  --file-fsync-all=[on|off]     do fsync() after each write operation [off]
  --file-fsync-end=[on|off]     do fsync() at the end of test [on]
  --file-fsync-mode=STRING      which method to use for synchronization {fsync, fdatasync} [fsync]
  --file-merged-requests=N      merge at most this number of IO requests if possible (0 - don't merge) [0]
  --file-rw-ratio=N             reads/writes ratio for combined test [1.5]
 
//文件IP测试三部曲
[root@mysql tmp]# sysbench --test=fileio --file-num=16 --file-total-size=2G  prepare
 
[root@mysql tmp]# sysbench --test=fileio --file-total-size=2G --file-test-mode=rndrd --max-time=180 --max-requests=100000000 --num-threads=16 --init-rng=on --file-num=16 --file-extra-flags=direct --file-fsync-freq=0 --file-block-size=16384 run

[root@mysql tmp]# sysbench --test=fileio --file-num=16 --file-total-size=2G cleanup
 
自动测试脚本:
#!/bin/sh
set -u
set -x
set -e
for size in 2G 8G;do
    for mode in seqrd seqrw rndrd rndwr rndrw;do
        for blksize in 4096 16384;do
            sysbench --test=fileio --file-num=64 --file-total-size=$size prepare
            for threads in 1 4 8 16 32;do
                echo "====== testing $blksize in $threads threads"
                echo PARAMS $size $mode $threads $blksize > sysbench-size-$size-mode-$mode-threads-$threads-blksz-$blksize
                for i in 1 2 3;do
                    sysbench --test=fileio --file-total-size=$size --file-test-mode=$mode --max-time=180 --max-requests=100000000\
                    --num-threads=$threads --init-rng=on --file-num=64 --file-extra-flags=direct --file-fsync-freq=0\
                    --file-block-size=$blksize run | tee -a sysbench-size-$size-mode-$mode-threads-$threads-blksz-$blksize 2>&1
                done
            done
            sysbench --test=fileio --file-total-size=$size cleanup
        done
    done
done

======

 
 
 
 
[root@mysql tmp]# sysbench --test=cpu help
sysbench 0.4.12:  multi-threaded system evaluation benchmark

cpu options:
  --cpu-max-prime=N      upper limit for primes generator [10000]
 
 
[root@mysql tmp]# sysbench --test=memory help
sysbench 0.4.12:  multi-threaded system evaluation benchmark

memory options:
  --memory-block-size=SIZE    size of memory block for test [1K]
  --memory-total-size=SIZE    total size of data to transfer [100G]
  --memory-scope=STRING       memory access scope {global,local} [global]
  --memory-hugetlb=[on|off]   allocate memory from HugeTLB pool [off]
  --memory-oper=STRING        type of memory operations {read, write, none} [write]
  --memory-access-mode=STRING memory access mode {seq,rnd} [seq]

[root@mysql tmp]# sysbench --test=threads help
sysbench 0.4.12:  multi-threaded system evaluation benchmark

threads options:
  --thread-yields=N      number of yields to do per request [1000]
  --thread-locks=N       number of locks per thread [8]

[root@mysql tmp]# sysbench --test=mutex help  
sysbench 0.4.12:  multi-threaded system evaluation benchmark

mutex options:
  --mutex-num=N        total size of mutex array [4096]
  --mutex-locks=N      number of mutex locks to do per thread [50000]
  --mutex-loops=N      number of empty loops to do inside mutex lock [10000]
 

[root@mysql tmp]# sysbench --test=oltp help
sysbench 0.4.12:  multi-threaded system evaluation benchmark

oltp options:
  --oltp-test-mode=STRING         test type to use {simple,complex,nontrx,sp} [complex]
  --oltp-reconnect-mode=STRING    reconnect mode {session,transaction,query,random} [session]
  --oltp-sp-name=STRING           name of store procedure to call in SP test mode []
  --oltp-read-only=[on|off]       generate only 'read' queries (do not modify database) [off]
  --oltp-skip-trx=[on|off]        skip BEGIN/COMMIT statements [off]
  --oltp-range-size=N             range size for range queries [100]
  --oltp-point-selects=N          number of point selects [10]
  --oltp-simple-ranges=N          number of simple ranges [1]
  --oltp-sum-ranges=N             number of sum ranges [1]
  --oltp-order-ranges=N           number of ordered ranges [1]
  --oltp-distinct-ranges=N        number of distinct ranges [1]
  --oltp-index-updates=N          number of index update [1]
  --oltp-non-index-updates=N      number of non-index updates [1]
  --oltp-nontrx-mode=STRING       mode for non-transactional test {select, update_key, update_nokey, insert, delete} [select]
  --oltp-auto-inc=[on|off]        whether AUTO_INCREMENT (or equivalent) should be used on id column [on]
  --oltp-connect-delay=N          time in microseconds to sleep after connection to database [10000]
  --oltp-user-delay-min=N         minimum time in microseconds to sleep after each request [0]
  --oltp-user-delay-max=N         maximum time in microseconds to sleep after each request [0]
  --oltp-table-name=STRING        name of test table [sbtest]
  --oltp-table-size=N             number of records in test table [10000]
  --oltp-dist-type=STRING         random numbers distribution {uniform,gaussian,special} [special]
  --oltp-dist-iter=N              number of iterations used for numbers generation [12]
  --oltp-dist-pct=N               percentage of values to be treated as 'special' (for special distribution) [1]
  --oltp-dist-res=N               percentage of 'special' values to use (for special distribution) [75]

General database options:

  --db-driver=STRING  specifies database driver to use ('help' to get list of available drivers)
  --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]


Compiled-in database drivers:
  mysql - MySQL driver

mysql options:
  --mysql-host=[LIST,...]       MySQL server host [localhost]
  --mysql-port=N                MySQL server port [3306]
  --mysql-socket=STRING         MySQL socket
  --mysql-user=STRING           MySQL user [sbtest]
  --mysql-password=STRING       MySQL password []
  --mysql-db=STRING             MySQL database name [sbtest]
  --mysql-table-engine=STRING   storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated},默认存储引擎为[innodb]
  --mysql-engine-trx=STRING     whether storage engine used is transactional or not {yes,no,auto} [auto]
  --mysql-ssl=[on|off]          use SSL connections, if available in the client library [off]
  --myisam-max-rows=N           max-rows parameter for MyISAM tables [1000000]
  --mysql-create-options=STRING additional options passed to CREATE TABLE []
//oltp测试需要经历prepare,run,cleanup的阶段,默认表在sbtest,创建一张8000万的表;
[root@mysql tmp]# sysbench --test=oltp --oltp-table-size=80000000 --db-driver=mysql --mysql-socket=/usr/local/mysql/tmp/mysql.sock --mysql-user=root --mysql-password=user_password prepare

[root@mysql tmp]# sysbench --test=oltp --oltp-table-size=800000 --oltp-read-only=off --init-rng=on --num-threads=16 --max-requests=0 --oltp-dist-type=uniform --max-time=3600 --mysql-user=root --mysql-password=cluster123 --mysql-socket=/usr/local/mysql/tmp/mysql.sock --db-driver=mysql run



tpcc-mysql下载地址
[root@mysql mysql_test]# wget

编译方式:
[root@mysql mysql_test]#cd scr
[root@mysql src]# make

创建测试数据库
[root@mysql src]# mysqladmin -uroot -p create tpcc100
Enter password:
导入表结构
[root@mysql src]# mysql -uroot -p --database tpcc1000 < create_table.sql
[root@mysql src]# mysql -uroot -p --database tpcc1000 < add_fkey_idx.sql
创建100个数据仓库数据
[root@mysql src]#./tpcc_load localhost tpcc1000 root "" 1000
                 |hostname| |dbname| |user| |password| |WAREHOUSES|

开始测试
[root@mysql src]#./tpcc_start localhost tpcc1000 root "" 1000 32 10 10800
                |hostname| |dbname| |user| |password| |WAREHOUSES| |CONNECTIONS| |WARMUP TIME| |BENCHMARK TIME|


阅读(1797) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~