当前位置:网站首页>Introduction to sysbench Basics
Introduction to sysbench Basics
2022-06-26 10:36:00 【NYTWTYN】
List of articles
sysbench It's an open source 、 Modular 、 Cross platform multithreading performance testing tool , It can be used for CPU、 Memory 、 disk I/O、 Threads 、 Database performance test .
sysbench It can be used for the following benchmarks :
CPU performance
disk IO performance
Mobilize program performance
Memory allocation and transmission speed
POSIX Thread performance
Database performance
At present, there are MySQL、Oracle and PostgreSQL. With MySQL Database, for example .
Installation instructions
https://link.zhihu.com/?target=https%3A//www.cnblogs.com/pdlife/p/6698957.html
Instructions
test fileio
sysbench --test=fileio help
Parameters, :
--file-num=N Represents the number of test files generated , The default is 128.
--file-block-size=N The size of the file block used in the test , If you want a disk for innodb Storage engine for testing , You can set it to 16384, namely innodb Storage engine page size . The default is 16384.
--file-total-size=SIZE Create the total size of the test file , The default is 2G size .
--file-test-mode=STRING File test mode , contain :seqwr( Sequential writing ), seqrewr( Sequential reading and writing ), seqrd( Sequential reading ), rndrd( random block read ), rndwr( Write at random ), rndrw( Random, speaking, reading and writing ).
--file-io-mode=STRING The mode of file operation ,sync( Sync ),async( asynchronous ),fastmmap( Fast mmap),slowmmap( Slow down mmap), The default is sync Synchronous mode .
--file-async-backlog=N The number of asynchronous operations per thread queue , The default is 128.
--file-extra-flags=STRING Options for opening a file , This is the API Related parameters .
--file-fsync-freq=N perform fsync() The frequency of the function .fsync It's mainly about synchronizing disk files , Because there may be a relationship between the system and the disk buffer . 0 Does not use fsync function . The default value is 100.
--file-fsync-all=[on|off] After each write operation , Just do it once fsync. The default is off.
--file-fsync-end=[on|off] Execute... At the end of the test fsync function . The default is on.
--file-fsync-mode=STRING Selection of file synchronization function , The same is and API Related parameters , Due to multiple operating systems for fdatasync Support for different , Therefore, it is not recommended to use fdatasync. The default is fsync.
--file-merged-requests=N Most of the time , It's possible to merge IO Number of requests for , The default is 0.
--file-rw-ratio=N Read / write ratio at test time , The default is 1.5, that will do 3:2
test CPU
sysbench --test=cpu help
Parameters, :
--cpu-max-prime=N Used to specify the maximum number of primes , The specific parameters can be determined according to CPU Performance to set , The default is 10000
test memory
sysbench --test=memory help
Parameters, :
--memory-block-size=SIZE Test the size of the memory block , The default is 1K
--memory-total-size=SIZE The total size of the data transfer , The default is 100G
--memory-scope=STRING The scope of memory access , Including global and local scope , The default is global
--memory-hugetlb=[on|off] Whether from HugeTLB Switch for pool allocation memory , The default is off
--memory-oper=STRING The type of memory operation , Include read, write, none, The default is write
--memory-access-mode=STRING Memory access mode , Include seq,rnd Two modes , The default is seq
test threads
sysbench --test-threads help
Parameters, :
--thread-yields=N Specify the pressure for each request , The default is 1000
--thread-locks=N Specify the number of locks per thread , The default is 8
test mutex
sysbench --test=mutex help
Parameters, :
--mutex-num=N The total size of array mutexes . The default is 4096
--mutex-locks=N Number of mutexes per thread . The default is 50000
--mutex-loops=N The number of empty loops of the internal mutex . The default is 10000
test otlp
sysbench --test=otlp help
Parameters, :
--oltp-test-mode=STRING Execution mode {simple,complex(advanced transactional),nontrx(non-transactional),sp}. The default is complex
--oltp-reconnect-mode=STRING Reconnect mode {session( Do not use reconnection . Each thread is disconnected only at the end of the test ),transaction( Reconnect after each transaction ),query( At every SQL Reconnect after statement execution ),random( For each transaction, select the above reconnection mode randomly )}. The default is session
--oltp-sp-name=STRING The name of the stored procedure . The default is empty.
--oltp-read-only=[on|off] read only mode .Update,delete,insert Statement is not executable . The default is off
--oltp-skip-trx=[on|off] Omit begin/commit sentence . The default is off
--oltp-range-size=N Query range . The default is 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 Query type for non transactional execution mode {select, update_key, update_nokey, insert, delete} [select]
--oltp-auto-inc=[on|off] AUTO_INCREMENT Open or not . The default is on
--oltp-connect-delay=N How many microseconds to connect to the database . The default is 10000
--oltp-user-delay-min=N Minimum waiting time per request . The unit is ms. The default is 0
--oltp-user-delay-max=N Maximum waiting time per request . The unit is ms. The default is 0
--oltp-table-name=STRING The table name used in the test . The default is sbtest
--oltp-table-size=N The number of records in the test table . The default is 10000
--oltp-dist-type=STRING Random number of distribution {uniform( Uniform distribution ),Gaussian( Gaussian distribution ),special( The spatial distribution )}. The default is special
--oltp-dist-iter=N The number of iterations of the production number . The default is 12
--oltp-dist-pct=N The percentage of the value is treated as 'special' (for special distribution). The default is 1
--oltp-dist-res=N ‘special’ The percentage of . The default is 75
Yes MySQL transactional OLTP Test of :
about MySQL Of OLTP test , and File equally , Also need to experience prepare,run,cleanup Three stages .
- prepare Preparation stage
prepare Stage will generate a table with a specified number of rows in the database , Default table in sbtest Under the architecture , Table, sbtest(sysbench The default storage engine for generating tables is innodb), For example, create a 8000 Ten thousand records :
[[email protected] sysbench]# sysbench --test=oltp --oltp-table-size=80000000 --db-driver=mysql --mysql-socket=/data/mysqlsoft3307/mysql.sock --mysql-user=dba_manager --mysql-password='111111' --mysql-db=test prepare
sysbench 0.4.12: multi-threaded system evaluation benchmark
Creating table 'sbtest'...
Creating 10 records in table 'sbtest'...
- run Run the test
Next, the table generated above is oltp Test of :
[[email protected] sysbench]# sysbench --test=oltp --oltp-table-size=80000000 --oltp-read-only=off --init-rng=on --num-threads=16
--max-requests=0 --oltp-dist-type=uniform --max-time=3600 --mysql-user=dba_manager --mysql-password='111111' --db-driver=mysql
--mysql-socket=/data/mysqlsoft3307/mysql.sock run > result.log
Parameter description :
--max-time=3600 The specified test duration is 1 Hours
--mysql-db=test Specify the database name of the test
[[email protected] sysbench]# cat result.log
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 16
Initializing random number generator from timer.
Doing OLTP test.
Running mixed OLTP test
Using Uniform distribution
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Threads started!
Time limit exceeded, exiting...
(last message repeated 15 times)
Done.
OLTP test statistics:
queries performed:
read: 137346874
write: 49052449
other: 19620980
total: 206020303
transactions: 9810489 (2725.13 per sec.)
deadlocks: 2 (0.00 per sec.)
read/write requests: 186399323 (51777.50 per sec.)
other operations: 19620980 (5450.26 per sec.)
Test execution summary:
total time: 3600.0060s
total number of events: 9810489
total time taken by event execution: 57542.1464
per-request statistics:
min: 3.00ms
avg: 5.87ms
max: 212.09ms
approx. 95 percentile: 8.44ms
Threads fairness:
events (avg/stddev): 613155.5625/1486.47
execution time (avg/stddev): 3596.3842/0.01
transactions The criteria representing the test results are TPS.
The above test result is 2725.13 per sec.
边栏推荐
猜你喜欢

What is in the method area - class file, class file constant pool, runtime constant pool

904. fruit baskets

开发者,微服务架构到底是什么?

Développeur, quelle est l'architecture des microservices?

MySQL 8th job

字符串常量池、class常量池和运行时常量池

3行3列整形二维数组,求对角之和

Using foreach to loop two-dimensional array

MySQL 10th job - View

【Leetcode】76. Minimum covering substring
随机推荐
MySQL第六章总结
String class intern() method and string constant pool
Flutter与原生通信(上)
看我在Map<String, String>集合中,存入Integer类型数据
Redis中执行Lua脚本
Problems encountered in the application and development of Hongmeng and some roast
MySQL job 11 - application de la vue
Blog article index summary -- Software Engineering
MySQL seventh job - update data
Flutter and native communication (Part 1)
Win10安装tensorflow-quantum过程详解
Enter a positive integer with no more than 5 digits, and output the last digit in reverse order
What are the symbolic and direct references of the JVM
Detailed explanation of winsorflow quantum installation process
[binary search] 4 Find the median of two positive arrays
挖财商学院证券开户安全嘛?
[untitled]
String constant pool, class constant pool, and runtime constant pool
C中字符串基本操作
【无标题】