当前位置:网站首页>MySQL's built-in performance testing tool, mysqlslap, performs stress testing
MySQL's built-in performance testing tool, mysqlslap, performs stress testing
2022-06-26 04:03:00 【Procedural ape (siege lion)】
For databases configured by , You need to have a basic understanding of its basic performance , When the overall performance of the system declines or cannot be improved , You need to think about , Whether the result is caused by the performance limitation of the database , At this time, it is better to have the performance test results of the database as a reference .
mysqlslap [options]
-?, --help Display this help and exit.
-a, --auto-generate-sql # Automatically generate test tables and data
--auto-generate-sql-add-autoincrement # Automatically add to generated tables auto_increment Column
--auto-generate-sql-execute-number=#
Set this number to generate a set number of queries to
run.
--auto-generate-sql-guid-primary
Add GUID based primary keys to auto-generated tables.
--auto-generate-sql-load-type=name # Type of test statement : mixed, update, write, key, or
read; default is mixed.
--auto-generate-sql-secondary-indexes=#
Number of secondary indexes to add to auto-generated
tables.
--auto-generate-sql-unique-query-number=#
Number of unique queries to generate for automatic tests.
--auto-generate-sql-unique-write-number=#
Number of unique queries to generate for
auto-generate-sql-write-number.
--auto-generate-sql-write-number=#
Number of row inserts to perform for each thread (default
is 100).
--commit=# Commit records every X number of statements.
-C, --compress Use compression in server/client protocol.
-c, --concurrency=name
Number of clients to simulate for query to run.
--create=name File or string to use create tables.
--create-schema=name
Schema to run tests in.
--csv[=name] Generate CSV output to named file or to stdout if no file
is named.
-#, --debug[=#] This is a non-debug version. Catch this and exit.
--debug-check This is a non-debug version. Catch this and exit.
-T, --debug-info This is a non-debug version. Catch this and exit.
--default-auth=name Default authentication client-side plugin to use.
-F, --delimiter=name
Delimiter to use in SQL statements supplied in file or
command line.
--detach=# Detach (close and reopen) connections after X number of
requests.
--enable-cleartext-plugin
Enable/disable the clear text authentication plugin.
-e, --engine=name Storage engine to use for creating the table.
-h, --host=name Connect to host.
-i, --iterations=# Number of times to run the tests.
--no-drop Do not drop the schema after the test.
-x, --number-char-cols=name
Number of VARCHAR columns to create in table if
specifying --auto-generate-sql.
-y, --number-int-cols=name
Number of INT columns to create in table if specifying
--auto-generate-sql.
--number-of-queries=#
Limit each client to this number of queries (this is not
exact).
--only-print Do not connect to the databases, but instead print out
what would have been done.
-p, --password[=name]
Password to use when connecting to server. If password is
not given it's asked from the tty.
--plugin-dir=name Directory for client-side plugins.
-P, --port=# Port number to use for connection.
--post-query=name Query to run or file containing query to execute after
tests have completed.
--post-system=name system() string to execute after tests have completed.
--pre-query=name Query to run or file containing query to execute before
running tests.
--pre-system=name system() string to execute before running tests.
--protocol=name The protocol to use for connection (tcp, socket, pipe,
memory).
-q, --query=name Query to run or file containing query to run.
--secure-auth Refuse client connecting to server if it uses old
(pre-4.1.1) protocol. Deprecated. Always TRUE
-s, --silent Run program in silent mode - no output.
-S, --socket=name The socket file to use for connection.
--sql-mode=name Specify sql-mode to run mysqlslap tool.
--ssl-mode=name SSL connection mode.
--ssl Deprecated. Use --ssl-mode instead.
(Defaults to on; use --skip-ssl to disable.)
--ssl-verify-server-cert
Deprecated. Use --ssl-mode=VERIFY_IDENTITY instead.
--ssl-ca=name CA file in PEM format.
--ssl-capath=name CA directory.
--ssl-cert=name X509 cert in PEM format.
--ssl-cipher=name SSL cipher to use.
--ssl-key=name X509 key in PEM format.
--ssl-crl=name Certificate revocation list.
--ssl-crlpath=name Certificate revocation list path.
--tls-version=name TLS version to use, permitted values are: TLSv1, TLSv1.1,
TLSv1.2
--server-public-key-path=name
File path to the server public RSA key in PEM format.
--get-server-public-key
Get server public key
-u, --user=name User for login if not current user.
-v, --verbose More verbose output; you can use this multiple times to
get even more verbose output.
-V, --version Output version information and exit.1. Single thread test
# ./mysqlslap -a -uroot -p
Enter password:
Benchmark
Average number of seconds to run all queries: 0.012 seconds
Minimum number of seconds to run all queries: 0.012 seconds
Maximum number of seconds to run all queries: 0.012 seconds
Number of clients running queries: 1
Average number of queries per client: 02. Multithreaded testing
# ./mysqlslap -a -c 100 -uroot -p
Enter password:
Benchmark
Average number of seconds to run all queries: 1.608 seconds
Minimum number of seconds to run all queries: 1.608 seconds
Maximum number of seconds to run all queries: 1.608 seconds
Number of clients running queries: 100
Average number of queries per client: 0It can be seen that 100 Concurrent tests , The response time is significantly longer than that of a single thread test .
3. Iterative testing
# ./mysqlslap -a -i 10 -uroot -p
Enter password:
Benchmark
Average number of seconds to run all queries: 0.012 seconds
Minimum number of seconds to run all queries: 0.012 seconds
Maximum number of seconds to run all queries: 0.013 seconds
Number of clients running queries: 1
Average number of queries per client: 04. Multithreaded iterative testing
# ./mysqlslap -a -c 100 -i 10 -uroot -p
Enter password: 5. Test of different concurrent users
# ./mysqlslap -a --concurrency=50,100 --number-of-queries 1000 -uroot -p
Enter password:
Benchmark
Average number of seconds to run all queries: 1.312 seconds
Minimum number of seconds to run all queries: 1.312 seconds
Maximum number of seconds to run all queries: 1.312 seconds
Number of clients running queries: 50
Average number of queries per client: 20
Benchmark
Average number of seconds to run all queries: 1.581 seconds
Minimum number of seconds to run all queries: 1.581 seconds
Maximum number of seconds to run all queries: 1.581 seconds
Number of clients running queries: 100
Average number of queries per client: 106. Test comparison of different engines
# ./mysqlslap -a --concurrency=50,100 --number-of-queries 1000 --iterations=5 --engine=myisam,innodb,ndbcluster -uroot -p
Enter password:
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.065 seconds
Minimum number of seconds to run all queries: 0.063 seconds
Maximum number of seconds to run all queries: 0.074 seconds
Number of clients running queries: 50
Average number of queries per client: 20
Benchmark
Running for engine myisam
Average number of seconds to run all queries: 0.072 seconds
Minimum number of seconds to run all queries: 0.071 seconds
Maximum number of seconds to run all queries: 0.073 seconds
Number of clients running queries: 100
Average number of queries per client: 10
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.744 seconds
Minimum number of seconds to run all queries: 0.641 seconds
Maximum number of seconds to run all queries: 0.849 seconds
Number of clients running queries: 50
Average number of queries per client: 20
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.389 seconds
Minimum number of seconds to run all queries: 0.318 seconds
Maximum number of seconds to run all queries: 0.473 seconds
Number of clients running queries: 100
Average number of queries per client: 10
Benchmark
Running for engine ndbcluster
Average number of seconds to run all queries: 1.314 seconds
Minimum number of seconds to run all queries: 1.313 seconds
Maximum number of seconds to run all queries: 1.318 seconds
Number of clients running queries: 50
Average number of queries per client: 20
Benchmark
Running for engine ndbcluster
Average number of seconds to run all queries: 1.581 seconds
Minimum number of seconds to run all queries: 1.564 seconds
Maximum number of seconds to run all queries: 1.615 seconds
Number of clients running queries: 100
Average number of queries per client: 10It can be seen that , The fastest average response is myisam engine , The second is innodb, The slowest is ndbcluster.ndbcluster The engine is cluster Environment , It is greatly influenced by the network environment .
7. Query performance test (select)
ndbcluster Engine testing :
./mysqlslap --engine=ndbcluster -uroot -p --auto-generate-sql-guid-primary --concurrency=50,100 --number-of-queries=10000 --iterations=2 --number-char-cols=10 --number-int-cols=10 --auto-generate-sql --create-schema=rdb10 --auto-generate-sql-load-type=read
Enter password:
Benchmark
Running for engine ndbcluster
Average number of seconds to run all queries: 54.835 seconds
Minimum number of seconds to run all queries: 47.827 seconds
Maximum number of seconds to run all queries: 61.844 seconds
Number of clients running queries: 50
Average number of queries per client: 200
Benchmark
Running for engine ndbcluster
Average number of seconds to run all queries: 59.451 seconds
Minimum number of seconds to run all queries: 57.080 seconds
Maximum number of seconds to run all queries: 61.822 seconds
Number of clients running queries: 100
Average number of queries per client: 100innodb Engine testing :
# ./mysqlslap --engine=innodb -uroot -p --auto-generate-sql-guid-primary --concurrency=50,100 --number-of-queries=10000 --iterations=2 --number-char-cols=10 --number-int-cols=10 --auto-generate-sql --create-schema=rdb10 --auto-generate-sql-load-type=read
Enter password:
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 1.886 seconds
Minimum number of seconds to run all queries: 1.877 seconds
Maximum number of seconds to run all queries: 1.895 seconds
Number of clients running queries: 50
Average number of queries per client: 200
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 2.022 seconds
Minimum number of seconds to run all queries: 1.878 seconds
Maximum number of seconds to run all queries: 2.167 seconds
Number of clients running queries: 100
Average number of queries per client: 100It can be seen that ,innodb The query efficiency of the engine is higher .
8. Write library test (insert)
ndbcluster Engine testing :
# ./mysqlslap --engine=ndbcluster -uroot -p --auto-generate-sql-guid-primary --concurrency=50,100 --number-of-queries=10000 --iterations=2 --number-char-cols=10 --number-int-cols=10 --auto-generate-sql --create-schema=rdb10 --auto-generate-sql-load-type=write
Enter password:
Benchmark
Running for engine ndbcluster
Average number of seconds to run all queries: 1.529 seconds
Minimum number of seconds to run all queries: 1.528 seconds
Maximum number of seconds to run all queries: 1.531 seconds
Number of clients running queries: 50
Average number of queries per client: 200
Benchmark
Running for engine ndbcluster
Average number of seconds to run all queries: 1.475 seconds
Minimum number of seconds to run all queries: 1.469 seconds
Maximum number of seconds to run all queries: 1.482 seconds
Number of clients running queries: 100
Average number of queries per client: 100innodb Write test :
# ./mysqlslap --engine=innodb -uroot -p --auto-generate-sql-guid-primary --concurrency=50,100 --number-of-queries=10000 --iterations=2 --number-char-cols=10 --number-int-cols=10 --auto-generate-sql --create-schema=rdb10 --auto-generate-sql-load-type=write
Enter password:
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 17.523 seconds
Minimum number of seconds to run all queries: 17.409 seconds
Maximum number of seconds to run all queries: 17.637 seconds
Number of clients running queries: 50
Average number of queries per client: 200
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 15.521 seconds
Minimum number of seconds to run all queries: 15.106 seconds
Maximum number of seconds to run all queries: 15.937 seconds
Number of clients running queries: 100
Average number of queries per client: 100It can be seen that ndbcluster The engine is more write efficient .
9. Update performance test (update)
ndbcluster Engine testing :
# ./mysqlslap --engine=ndbcluster -uroot -p --auto-generate-sql-guid-primary --concurrency=50,100 --number-of-queries=10000 --iterations=2 --number-char-cols=10 --number-int-cols=10 --auto-generate-sql --create-schema=rdb10 --auto-generate-sql-load-type=update
Enter password:
Benchmark
Running for engine ndbcluster
Average number of seconds to run all queries: 1.474 seconds
Minimum number of seconds to run all queries: 1.474 seconds
Maximum number of seconds to run all queries: 1.475 seconds
Number of clients running queries: 50
Average number of queries per client: 200
Benchmark
Running for engine ndbcluster
Average number of seconds to run all queries: 1.426 seconds
Minimum number of seconds to run all queries: 1.424 seconds
Maximum number of seconds to run all queries: 1.428 seconds
Number of clients running queries: 100
Average number of queries per client: 100innodb Engine testing :
# ./mysqlslap --engine=innodb -uroot -p --auto-generate-sql-guid-primary --concurrency=50,100 --number-of-queries=10000 --iterations=2 --number-char-cols=10 --number-int-cols=10 --auto-generate-sql --create-schema=rdb10 --auto-generate-sql-load-type=update
Enter password:
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 17.469 seconds
Minimum number of seconds to run all queries: 17.227 seconds
Maximum number of seconds to run all queries: 17.712 seconds
Number of clients running queries: 50
Average number of queries per client: 200
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 15.241 seconds
Minimum number of seconds to run all queries: 15.137 seconds
Maximum number of seconds to run all queries: 15.346 seconds
Number of clients running queries: 100
Average number of queries per client: 100It can be seen that ndbcluster Engine performance ratio innodb Better .
边栏推荐
- Use soapUI to access the corresponding ESB project
- Machine learning notes - trend components of time series
- Analysis of camera memory memory leakage (II)
- Three level menu applet
- ASP. Net startup and running mechanism
- Restful API interface design standards and specifications
- [Nuggets' operation routine disclosure] the routine of being truly Nuggets
- ABP framework Practice Series (II) - Introduction to domain layer
- What preparation should I make before learning SCM?
- Spark - 一文搞懂 parquet
猜你喜欢

chrome页面录制,重放功能

软件调试测试的十大重要基本准则

After four years of outsourcing, people are directly abandoned...

Kotlin uses viewpager2+fragment+bottomnavigationview to implement the style of the switching module of the bottom menu bar.

Machine learning notes - trend components of time series

Detailed explanation of globalkey of flutter

MapReduce execution principle record

钉钉开放平台-小程序开发实战(钉钉小程序客户端)

Ten important basic principles of software debugging and testing
![[Flink] a brief analysis of the writing process of Flink sort shuffle](/img/27/01e95b44df46d8bfcb36ab1d746cc2.jpg)
[Flink] a brief analysis of the writing process of Flink sort shuffle
随机推荐
【QT】对话框dialog
1. foundation closing
Spark - 一文搞懂 parquet
Oracle technology sharing Oracle 19.14 upgrade 19.15
而是互联网开始有了新的进化,开始以一种全新的状态出现
[Flink] Flink batch mode map side data aggregation normalizedkeysorter
Question brushing record day01
[QT] dialog box
Link monitoring pinpoint
Mybatis的引入问题invalid
IEDA 突然找不到了compact middle packages
1.基础关
Kotlin uses viewpager2+fragment+bottomnavigationview to implement the style of the switching module of the bottom menu bar.
Camera-memory内存泄漏分析(二)
Camera-CreateCaptureSession
ASP. Net core introduction
The stc-isp burning program for 51 single chip microcomputer always shows that "the target single chip microcomputer is being detected..." the cold start board does not respond
Conditional variables for thread synchronization
VHDL design
User control custom DependencyProperty