Home Database Mysql Tutorial Details of the code for mysqlslap to execute benchmark tests

Details of the code for mysqlslap to execute benchmark tests

Mar 04, 2017 pm 02:43 PM

View the main parameter configuration and description supported by mysqlslap as follows


<span style="color: #000000">-a, --auto-generate-sql 由系统自动生成SQL脚本进行测试<br/>                      Generate SQL where not supplied by file or command line.<br/>  --auto-generate-sql-add-autoincrement 生成的表中增加自增的ID<br/>                      Add an AUTO_INCREMENT column to auto-generated tables.--auto-generate-sql-load-type=name 制定测试过程中使用的查询类型<br/>                      Specify test load type: mixed, update, write, key, or<br/>                      read; default is mixed.--auto-generate-sql-write-number=# 制定所生成的初始化数据的条数<br/>                      Number of row inserts to perform for each thread (default<br/>                      is 100).-c, --concurrency=name 制定并发线程的数量<br/>                      Number of clients to simulate for query to run.<br/>  --create=name       File or string to use create tables.<br/>  --create-schema=name 创建一个测试数据库的schema名称<br/>                      Schema to run tests in.-T, --debug-info    This is a non-debug version. Catch this and exit.指定输出额外的内存及CPU统计信息-e,<br/>                       --engine=name   Storage engine to use for creating the table. 指定所测试的存储引擎,用逗号可以分割以便测试多个引擎<br/>  -h, --host=name     Connect to host. 链接远程主机的IP<br/>  -i, --iterations=#  Number of times to run the tests. 指定本次测试需要运行的次数<br/>  --no-drop           Do not drop the schema after the test. 指定测试完成后,不清理过程数据<br/>  -x, --number-char-cols=name 指定测试表中生成的varchar类型的数据数量<br/>                      Number of VARCHAR columns to create in table if<br/>                      specifying --auto-generate-sql.<br/>  -y, --number-int-cols=name 指定测试表中生成的int类型的数据数量<br/>                      Number of INT columns to create in table if specifying<br/>                      --auto-generate-sql.<br/>  --number-of-queries=# 指定每一个线程所执行的查询数量<br/>                      Limit each client to this number of queries (this is not<br/>                      exact).<br/>  --only-print        Do not connect to the databases, but instead print out 并不运行测试脚本,而是把生成的脚本打印出来<br/>                      what would have been done.<br/>  -p, --password[=name] 指定测试所用的链接数据库的密码<br/>                      Password to use when connecting to server. If password is<br/>                      not given it&#39;s asked from the tty.-q, --query=name    Query to run or file containing query to run.自定义测试用的sql<br/>  -u, --user=name     User for login if not current user. 指定测试所用的链接数据库的用户名<br/></span>
Copy after login


The complete running script is as follows

mysqlslap -S /tmp/mysql3306.sock --concurrency=1,50,100,200 --iterations=3 --number-int-cols=5 --number-char-cols=5 
--auto-generate-sql --auto-generate-sql-add-autoincrement --engine=innodb --number-of-queries=10
 --create-schema=test -uroot -p
Copy after login

After entering the password, the test information is as follows

Enter password: 
Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 0.097 seconds
        Minimum number of seconds to run all queries: 0.093 seconds
        Maximum number of seconds to run all queries: 0.107 seconds
        Number of clients running queries: 1
        Average number of queries per client: 10Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 0.506 seconds
        Minimum number of seconds to run all queries: 0.447 seconds
        Maximum number of seconds to run all queries: 0.570 seconds
        Number of clients running queries: 50
        Average number of queries per client: 0Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 2.204 seconds
        Minimum number of seconds to run all queries: 1.595 seconds
        Maximum number of seconds to run all queries: 3.257 seconds
        Number of clients running queries: 100
        Average number of queries per client: 0mysqlslap: Error when connecting to server: 1040 Too many connections
mysqlslap: Error when connecting to server: 1040 Too many connections
mysqlslap: Error when connecting to server: 1040 Too many connections
mysqlslap: Error when connecting to server: 1040 Too many connections
Copy after login

It can be seen at this time that when the concurrency reaches 200, a Too many connections exception occurs. This is because the maximum number of connections configured by mysql is default. is 100, so you need to make the following modifications to my.cnf

Add max_connections=1024, and then run normally

Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 0.093 seconds
        Minimum number of seconds to run all queries: 0.087 seconds
        Maximum number of seconds to run all queries: 0.098 seconds
        Number of clients running queries: 1
        Average number of queries per client: 10Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 0.514 seconds
        Minimum number of seconds to run all queries: 0.462 seconds
        Maximum number of seconds to run all queries: 0.545 seconds
        Number of clients running queries: 50
        Average number of queries per client: 0Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 1.209 seconds
        Minimum number of seconds to run all queries: 1.173 seconds
        Maximum number of seconds to run all queries: 1.241 seconds
        Number of clients running queries: 100
        Average number of queries per client: 0Benchmark
        Running for engine innodb
        Average number of seconds to run all queries: 2.174 seconds
        Minimum number of seconds to run all queries: 1.978 seconds
        Maximum number of seconds to run all queries: 2.402 seconds
        Number of clients running queries: 200
        Average number of queries per client: 0
Copy after login

The above is the detailed introduction of the code for mysqlslap to execute the benchmark test, more related Please pay attention to the PHP Chinese website (www.php.cn) for content!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

iPad Air 5 benchmarks show same performance as 11-inch iPad Pro iPad Air 5 benchmarks show same performance as 11-inch iPad Pro May 18, 2023 am 10:34 AM

As expected, since both devices use the M1 processor, early benchmarks show the iPad Air 5 scoring the same as the 11-inch iPad Pro. The reviewer ran the iPad Air 5 through Geekbench, and the scores weren't surprising. In fact, the numbers only differ due to rounding errors and variations from run to run. The iPad Air 5 is listed as "iPad 13,17" in Geekbench, showing a single-core score of 1,711 and a multi-core score of 7,233 in a CPU test. This is similar to the 11-inch iPad Pro, which has a single-core score of 1718 and a multi-core score of 7313. exist

Apple's Snapdragon 8 Gen 3 vs. A17 Pro: Both have ray tracing, but which one is better? Apple's Snapdragon 8 Gen 3 vs. A17 Pro: Both have ray tracing, but which one is better? Oct 25, 2023 am 11:17 AM

Still buzzing about Qualcomm’s exclusive scoop on the upcoming Snapdragon 8 Gen 3? Well, here's how the Snapdragon 8 Gen 3 vs A17 Pro compares: Both powerful chips come with ray tracing support, but which one will best suit your needs? Apple is proud that its latest chip will power games like Resident Evil 2 Remake and Resident Evil 7 once ported to iOS, but Qualcomm's new AI marvel does have its very own ray tracing support . "Advanced camera and audio technologies enable crystal-clear video and crystal-clear audio. Powerful AI-accelerated experiences and enterprise-grade security enable modern mobile PCs," the company said in an official statement ahead of today's Snapdragon Summit event

LLM ultra-long context query-practical performance evaluation LLM ultra-long context query-practical performance evaluation Apr 03, 2024 am 11:55 AM

In the application of large language models (LLM), there are several scenarios that require data to be presented in a structured manner, of which information extraction and query analysis are two typical examples. We recently emphasized the importance of information extraction with updated documentation and a dedicated code repository. For query analysis, we have also updated relevant documentation. In these scenarios, data fields may include strings, Boolean values, integers, etc. Among these types, dealing with high cardinality categorical values ​​(i.e. enumeration types) is the most challenging. The so-called "high cardinality grouping values" in the picture refer to those values ​​that must be selected from a limited number of options. These values ​​cannot be specified arbitrarily, but must come from a predefined set. In such a set, sometimes there will be a very large number of valid values

Go function performance optimization: benchmarking and performance analysis methods Go function performance optimization: benchmarking and performance analysis methods May 03, 2024 pm 06:42 PM

Understanding Go function performance optimization is crucial and can be achieved through the following methods: Benchmarking: Use Go’s testing package to measure execution time and resource consumption, such as benchmarking string concatenation strategies. Performance analysis: Use the runtime/pprof package to generate a function call graph, and use gotoolpprof to analyze the pprof.out file to gain an in-depth understanding of performance bottlenecks. Further optimization: Based on performance analysis results, reduce unnecessary function calls, avoid creating unnecessary variables, use appropriate data structures, and make full use of concurrency to improve application performance.

3DMark Steal Nomad graphics card benchmark test postponed to achieve fairer cross-platform comparison 3DMark Steal Nomad graphics card benchmark test postponed to achieve fairer cross-platform comparison Apr 02, 2024 am 08:58 AM

According to responses from 3DMark developers on the Steam discussion forum, the latest graphics card benchmark StealNomad and its lightweight version SteelNomadLight will be launched soon to achieve a fairer cross-platform comparison. ▲Screenshot of SteelNomad. Image source ULSolutions3DMark is a widely used benchmark software. ULSolutions released StealNomad in November last year. This test is designed to provide a general, non-ray tracing benchmark across multiple platforms representing launches in 2016. Among them, TimeSpy is a very important test, providing a common performance baseline test for many platforms. Unlike being limited to DirectX

Benchmarks and performance comparison in Go language Benchmarks and performance comparison in Go language May 08, 2024 am 09:27 AM

In the Go language, you can easily write benchmarks to measure code performance by using the BenchmarkXXX functions in the testing package. These functions follow the standard syntax and receive a pointer of type *testing.B as parameter, which is used to control the running of the benchmark. Running the benchmark (gotest-bench=BenchmarkName) can output a table of results showing various information such as the number of nanoseconds spent on each operation, the number of operations performed per second, the number of iterations run in the test and the number of times passed per second. Amount of memory, etc. By comparing the results of different benchmarks, you can identify inefficient code areas and thereby improve the overall performance of your application.

Benchmarking and performance analysis of concurrent programming in Go Benchmarking and performance analysis of concurrent programming in Go Jun 01, 2023 am 08:18 AM

With the continuous improvement of computer hardware technology, single-core CPUs can no longer meet the performance needs of computers. Therefore, how to fully utilize the performance of multi-core CPUs has become an important issue in the field of computer science. Concurrent programming is precisely to take advantage of the performance of multi-core CPUs and improve the efficiency and response speed of computer programs. As an efficient concurrent programming language, Go language's default concurrency model is widely accepted. However, in actual development, we need to evaluate and test the concurrency performance of the program in order to identify potential performance bottlenecks

How to benchmark pipelines using pipelines in Go? How to benchmark pipelines using pipelines in Go? Jun 04, 2024 pm 04:40 PM

To benchmark a pipeline, you can use the benchmark package in the Go language pipeline package: create a pipeline and include data reading, data processing, and data output steps. Pass benchmark.Run to the pipeline to benchmark the pipeline. Pipeline benchmarks provide insights into pipeline throughput and latency, helping to optimize its performance.

See all articles