SysBench系统性能基准测试工具

网友投稿 785 2023-02-15

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

SysBench系统性能基准测试工具

一. 简介SysBench是一个模块化的、跨平台、多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况。当前功能允许测试的系统参数有:file I/O performance (文件I / O性能)scheduler performance (调度性能)memory allocation and transfer speed (内存分配和传输速度)POSIX threads implementation performance (POSIX线程执行绩效)database server performance (OLTP benchmark) (数据库服务器性能)SysBench运行指定数目的线程,他们都是并行的执行请求。实际工作量的请求产生依赖于指定的测试模式(在编译中添加测试模块)。可以限制请求总数或总时间为基准,或两者。

问题二:./sysbench: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory解决办法:# ln -s /usr/local/mysql-5.5.8/lib/libmysqlclient.so.16 /lib64/libmysqlclient.so.16

通用选项:--num-threads=N 创建测试线程的数目。默认为1.--max-requests=N 请求的最大数目。默认为10000,0代表不限制。--max-time=N 最大执行时间,单位是s。默认是0,不限制。--forced-shutdown=STRING 超过max-time强制中断。默认是off。]--thread-stack-size=SIZE 每个线程的堆栈大小。默认是32K。--init-rng=[on|off] 在测试开始时是否初始化随机数发生器。默认是off。--test=STRING 指定测试项目名称。--debug=[on|off] 是否显示更多的调试信息。默认是off。--validate=[on|off] 在可能情况下执行验证检查。默认是off。

测试项目:fileio - File I/O testcpu - CPU performance testmemory - Memory functions speed testthreads - Threads subsystem performance testmutex - Mutex performance test(互斥性能测试)oltp - OLTP test

指令: prepare(测试前准备工作) run(正式测试) cleanup(测试后删掉测试数据) help version

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

[root@localhost bin]# ./sysbench --test=fileio help--file-num=N 创建测试文件的数量。默认是128--file-block-size=N 测试时文件块的大小。默认是16384(16K)--file-total-size=SIZE 测试文件的总大小。默认是2G--file-test-mode=STRING 文件测试模式{seqwr(顺序写), seqrewr(顺序读写), seqrd(顺序读), rndrd(随机读), rndwr(随机写), rndrw(随机读写)}--file-io-mode=STRING 文件操作模式{sync(同步),async(异步),fastmmap(快速map映射),slowmmap(慢map映射)}。默认是sync--file-extra-flags=STRING 使用额外的标志来打开文件{sync,dsync,direct} 。默认为空--file-fsync-freq=N 执行fsync()的频率。(0 – 不使用fsync())。默认是100--file-fsync-all=[on|off] 每执行完一次写操作就执行一次fsync。默认是off--file-fsync-end=[on|off] 在测试结束时才执行fsync。默认是on--file-fsync-mode=STRING 使用哪种方法进行同步{fsync, fdatasync}。默认是fsync--file-merged-requests=N 如果可以,合并最多的IO请求数(0 – 表示不合并)。默认是0--file-rw-ratio=N 测试时的读写比例。默认是1.5

[root@localhost bin]# ./sysbench --test=cpu help--cpu-max-prime=N 最大质数发生器数量。默认是10000

[root@localhost bin]# ./sysbench --test=memory help--memory-block-size=SIZE 测试时内存块大小。默认是1K--memory-total-size=SIZE 传输数据的总大小。默认是100G--memory-scope=STRING 内存访问范围{global,local}。默认是global--memory-hugetlb=[on|off] 从HugeTLB池内存分配。默认是off--memory-oper=STRING 内存操作类型。{read, write, none} 默认是write--memory-access-mode=STRING存储器存取方式{seq,rnd} 默认是seq

[root@localhost bin]# ./sysbench --test=threads help--thread-yields=N 每个请求产生多少个线程。默认是1000--thread-locks=N 每个线程的锁的数量。默认是8

[root@localhost bin]# ./sysbench --test=mutex help--mutex-num=N 数组互斥的总大小。默认是4096--mutex-locks=N 每个线程互斥锁的数量。默认是50000--mutex-loops=N 内部互斥锁的空循环数量。默认是10000

General database options:--db-driver=STRING 指定数据库驱动程序('help' to get list of available drivers)--db-ps-mode=STRING编制报表使用模式{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 []

四. 测试实例1.测试cpu[root@localhost bin]# ./sysbench --test=cpu --cpu-max-prime=20000 runNumber of threads: 1

Doing CPU performance benchmark

Threads started!Done.

Maximum prime number checked in CPU test: 20000Test execution summary:total time: 31.9364stotal number of events: 10000total time taken by event execution: 31.9334per-request statistics:min: 3.18msavg: 3.19msmax: 3.60msapprox. 95 percentile: 3.20ms

Threads fairness:events (avg/stddev): 10000.0000/0.00execution time (avg/stddev): 31.9334/0.00

2.测试线程[root@localhost bin]# ./sysbench --num-threads=64 --test=threads --thread-yields=100 --thread-locks=2 runNumber of threads: 64

Doing thread subsystem performance testThread yields per test: 100 Locks used: 2Threads started!Done.Test execution summary:total time: 2.2507stotal number of events: 10000total time taken by event execution: 143.8405per-request statistics:min: 0.03msavg: 14.38msmax: 411.39msapprox. 95 percentile: 63.49ms

Threads fairness:events (avg/stddev): 156.2500/45.17execution time (avg/stddev): 2.2475/0.00

Running the test with following options:Number of threads: 1500

Doing mutex performance testThreads started!Done.Test execution summary:total time: 74.0710stotal number of events: 1500total time taken by event execution: 5410.6925per-request statistics:min: 485.77msavg: 3607.13msmax: 13770.44msapprox. 95 percentile: 12489.67ms

Threads fairness:events (avg/stddev): 1.0000/0.00execution time (avg/stddev): 3.6071/3.97

4.测试fileio[root@localhost bin]# ./sysbench --num-threads=16 --test=fileio --file-total-size=3G --file-test-mode=rndrw preparesysbench 0.4.12: multi-threaded system evaluation benchmark

128 files, 24576Kb each, 3072Mb totalCreating files for the test...

[root@localhost bin]# ./sysbench --num-threads=16 --test=fileio --file-total-size=3G --file-test-mode=rndrw runsysbench 0.4.12: multi-threaded system evaluation benchmark

Running the test with following options:Number of threads: 16

Operations performed: 6011 Read, 3997 Write, 12692 Other = 22700 TotalRead 93.922Mb Written 62.453Mb Total transferred 156.38Mb (9.9885Mb/sec)639.27 Requests/sec executed

Test execution summary:total time: 15.6555stotal number of events: 10008total time taken by event execution: 34.5359per-request statistics:min: 0.01msavg: 3.45msmax: 828.73msapprox. 95 percentile: 0.07ms

Threads fairness:events (avg/stddev): 625.5000/137.06execution time (avg/stddev): 2.1585/0.49

[root@localhost bin]# ./sysbench --num-threads=16 --test=fileio --file-total-size=3G --file-test-mode=rndrw cleanupsysbench 0.4.12: multi-threaded system evaluation benchmark

Removing test files...

5.OLTP测试[root@localhost bin]# ./sysbench --test=oltp --mysql-table-engine=innodb --mysql-port=3307 --mysql-db=test --oltp-table-size=10000000 --mysql-socket=/tmp/mysql-5.5.8.sock preparesysbench 0.4.12: multi-threaded system evaluation benchmark

No DB drivers specified, using mysqlCreating table 'sbtest'...Creating 10000000 records in table 'sbtest'...

[root@localhost bin]# ./sysbench --num-threads=100 --max-requests=100000 --test=oltp --oltp-table-size=1000000 --mysql-port=3307 --mysql-db=test --mysql-socket=/tmp/mysql-5.5.8.sock runsysbench 0.4.12: multi-threaded system evaluation benchmark

No DB drivers specified, using mysqlRunning the test with following options:Number of threads: 100

Doing OLTP test.Running mixed OLTP testUsing Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)Using "BEGIN" for starting transactionsUsing auto_inc on the id columnMaximum number of requests for OLTP test is limited to 100000Threads started!Done.

OLTP test statistics:queries performed:read: 1400154write: 500055other: 200022total: 2100231transactions: 100011 (740.18 per sec.)deadlocks: 0 (0.00 per sec.)read/write requests: 1900209 (14063.46 per sec.)other operations: 200022 (1480.36 per sec.)

Test execution summary:total time: 135.1168stotal number of events: 100011total time taken by event execution: 13504.7609per-request statistics:min: 2.70msavg: 135.03msmax: 2319.30msapprox. 95 percentile: 224.40ms

Threads fairness:events (avg/stddev): 1000.1100/12.06execution time (avg/stddev): 135.0476/0.04

[root@localhost bin]# ./sysbench --test=oltp --mysql-table-engine=innodb --mysql-port=3307 --mysql-db=test --oltp-table-size=10000000 --mysql-socket=/tmp/mysql-5.5.8.sock cleanupsysbench 0.4.12: multi-threaded system evaluation benchmark

No DB drivers specified, using mysqlDropping table 'sbtest'...Done.

上一篇:微波告警怎么处理(微波感应报警器)
下一篇:运维工程师悲惨事件(运维工程师悲惨事件)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~