当前位置:网站首页>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.
边栏推荐
- Establishment of smart dialogue platform for wechat official account
- 【LeetCode】59. Spiral matrix II
- [sans titre]
- Detailed explanation of winsorflow quantum installation process
- MySQL第四章总结
- 创建对象的时候堆内存的分配
- Hcia-dhcp experiment
- 量化投资学习——经典书籍介绍
- Based on Zeng Shen's explanation, the line segment tree is studied again one
- Développeur, quelle est l'architecture des microservices?
猜你喜欢

Jar version conflict resolution

Use of exec series functions (EXECL, execlp, execle, execv, execvp)

方法区里面有什么——class文件、class文件常量池、运行时常量池

How to start the learning journey of webrtc native cross platform development?

Linux下安装Mysql【详细】

基础-MySQL

量化投资学习——经典书籍介绍

Allocation of heap memory when creating objects

MySQL 11th job - view application

MySQL第六次作业-查询数据-多条件
随机推荐
利用foreach循环二维数组
字符串常量池、class常量池和运行时常量池
904. 水果成篮
The fourteenth MySQL operation - e-mall project
Write data to local file
DBSCAN
MySQL 8th job
全渠道、多场景、跨平台,App如何借助数据分析渠道流量
[depth first search] 312 Poke balloon
Renesas electronics launched a complete intelligent sensor solution for Internet of things applications
2. merge two ordered arrays
AIX基本操作记录
Appium自动化测试基础 — 移动端测试环境搭建(二)
1. 两数之和(LeetCode题目)
[binary search] 4 Find the median of two positive arrays
2. 合并两个有序数组
Développeur, quelle est l'architecture des microservices?
[untitled]
Jar version conflict resolution
LSP 是什么