Table of Contents
2.3.5 Run test analysis results
2.4 Benchmark Test Tool
Integration Test Tool: Entire Application
Single-component type: testing MySQL, system performance based on MySQL
2.5 Case
2.6 Summary
Home Database Mysql Tutorial [MySQL Database] Interpretation of Chapter 2: MySQL Benchmark Test

[MySQL Database] Interpretation of Chapter 2: MySQL Benchmark Test

Aug 07, 2018 am 11:50 AM
mysql

Preface:

## He can observe the behavior of the system under different pressures, evaluate the capacity of the system, understand what are the important changes, or observe how the system processes different data, and can create virtual scenarios outside the actual load of the system. Testing (mastering system behavior)

Text:

As mentioned in the preface, benchmark testing is very important! What can be done: In general: test hardware, estimate hardware, verify system, measure pressure, adjust configuration

1. Verify assumptions based on the system and confirm whether the assumptions are consistent with the actual situation; 2. Reproduce Some abnormal behaviors in the system to solve; 3. Test the current operation of the system and use historical results to analyze and diagnose unpredictable problems; 4. Simulate higher loads to find out the scalability bottlenecks that the system may encounter as the pressure increases. ; 5. Plan for future business growth, hardware, network capacity, and related resources; 6. Test the application's ability to adapt to variable environments; 7. Test different hardware, software, and operating system configurations to prove whether the equipment is configured correctly;

The role of database benchmark testing is to analyze the performance of the database under the current configuration (including hardware configuration, OS, database settings, etc.), so as to find out the performance threshold of MySQL and adjust it according to the actual system requirements. configuration. [Source]

Different from real pressure: real complexity and change; benchmark testing requires execution as quickly as possible, simple and direct, easy to compare results, low cost and easy to implement

2.2 Strategy

For the entire system: integrated full-stack

Test MySQL individually: single-component

Recommended overall test: correct settings

1. Users are concerned about the overall performance; 2. MySQL is not always a bottleneck; 3. It can better reveal the true performance of the application

Recommended separate testing: data required

1. Need to compare different schemas or Query performance; 2. Testing for a specific problem; 3. Avoid lengthy, short-term, fast cycle cycles

2.2.1 Indicators

Objective: refine it into a series of questions, Detailed analysis of specific issues

Throughput:

Number of transactions per unit time, TPC-C, multi-user interactive applications, number of transactions per second, number of transactions per minute

Response time or delay

The overall time required for the test task, average response time, minimum response time, maximum response time and percentage; with the help of the chart

Concurrency:

Test the performance of the application under different concurrency, pay attention to the concurrent operations at work, the number of threads and connections working at the same time;

Web server concurrency! = database, only table session storage mechanism data processing capabilities; test web concurrency at any time how much concurrency;

Scalability

Scalability: double the work of the system, rational situation The results of both parts can be obtained at the same time; doubling the resources of the system or doubling the throughput

System business pressure may change: it is necessary to measure scalability; this indicator is useful for capacity specifications: providing information to Discover application bottlenecks

Collect test requirements as much as possible, design tests based on requirements, avoid focusing on only some indicators and ignoring other indicators

2.3 Method

Be as close to the real application as possible Situation:

Use the complete set, data distribution characteristics, real distribution parameters, whether there are multiple users, match user behavior, multiple types, check error logs, system warm-up: how long does it take to reach normal performance capacity after restarting, Last for a certain period of time;

2.3.1 Design and specification

Raise questions and clear goals

Standard benchmark test:Suitable solution TPC-H OLTP

Dedicated testing: Complex, iterative, easy-to-restore snapshots of production data sets

Planning: Documentation of parameters, results, testing Detailed records

2.3.2 Time

The benchmark test should

run for a long enough time. If the time cannot be confirmed, it can be run continuously. Continue to observe until the system is confirmed to be stable

A simple test rule: wait for the system to look stable at least = the time for the system to warm up

2.3.3 Obtain system performance and status

Collect as much of the system under test as possible Information

bestCreate a directory, create a separate subdirectory for each round of testing, and save the results, configuration files, test indicators, scripts and other related instructions

The data that needs to be recorded:

System status, performance indicators: CPU usage, disk I/O, network traffic statistics, SHOWGLOBAL STATUS counter

Reasonable intervals, record start time, utilization timestamp, just collect

2.3.4 Get accurate results

Answer some questions:

Did you choose the right benchmark? Was data collected for the question? Is the warm-up time long enough?

Is the wrong test standard used: IO-intensive references use CPU-intensive test standards to evaluate performance?

Are the test results repeatable? Ensure that the system status is consistent before retesting; symptomatic testing

Influencing factors:

External pressure, performance analysis, monitoring system, detailed logs, periodic operations

Note:

The resources required in the process are specially used for testing; modify the parameters as little as possible during the test, and gradually modify the parameters of the benchmark test through iteration; carefully study the abnormal situations in the process and find the reasons

2.3.5 Run test analysis results

Automation: Reduce human errors. Makefile files and scripts

The test results meet the current needs. Simply run a few rounds of tests and see the results. If the results change greatly, , you can run it several times or for a longer time

Result:

Analysis, turning numbers into knowledge, the ultimate goal is to answer Problems during design

How to abstract meaningful results depends on how to collect data, write scripts to analyze data, reduce human errors, workload, repeatability, and documentation

2.3.6 DrawingImportance

A picture is worth a thousand words. There are some knowledge points that the baby originally wanted to draw a guide map, but there are no drawings

in the book Share this statement: SHOW FULL PROCESSLIST SHOW PROCESSLIST shows which threads are running. You can also use the mysqladmin processlist statement to get this information. If you have SUPER permissions, you can see all threads. Otherwise, you can only see you. In its own thread, if the FULL keyword is not used, only the first 100 characters of each query will be displayed [Source]

2.4 Benchmark Test Tool

Integration Test Tool: Entire Application

1. ab is Apache HTTP, how many requests can be processed per second [Reference] [2]

2. http_load: ab is similar to more flexible and is designed to test web servers and is provided through an input file Multiple URLs can be randomly selected for testing, or can be customized to test according to time ratio [Reference]

3. JMeter, a java program, can load other applications and test their performance. This sounds good. I have not come into contact with the above two, so I will not comment.

Single-component type: testing MySQL, system performance based on MySQL

1. mysqlslap: comes with mysql5.1, simulates the load of the server, and outputs Timing information, you can execute the number of concurrent connections and specify the sql statement, otherwise the select statement will be automatically generated [Reference]

2. MySQL Benchmark Suite (sql-bench): Comes with it, removed from 5.7, benchmark test suite, use Comparison testing on different database servers, single-threaded serial execution, measuring the speed of query execution; Contains a large number of predefined tests, easy to use, easily compare performance tests of different engines or configurations, CPU-intensive , the results will show which types of operations are performed faster on the server. Disadvantages: the test data set is small and cannot use the specified data, and requires perl BDB support; [Reference]

3. Super Smack: MySQL, PostgreSQL provides stress testing and load balancing, complex and powerful tools that can simulate multi-user access, load test data into the database, and fill test tables with random data [Reference]

4. Database Test Suite: A tool set similar to some industrial standard tests, Free TPC-C OLTP test tool

5. sysbench: Multi-threaded system stress test , evaluate the performance of the system based on the factors that affect the performance of the database server, all-in-one testing tool, supports hardware testing of MySQL, operating system, and hardware [Reference] [2]

MySQL BENCHMARK() function: Tests the execution speed of a specific operation. The parameter can be the number of times to be executed or an expression (any scalar expression)

2.5 Case

The n word is omitted here

2.6 Summary

It’s finally waiting for you~ Music starts; it is recommended to at least be familiar with sysbench, how to use oltp (comparing different system performance) and fileio testing; it is necessary to perform benchmark tests frequently and formulate some principles to choose the appropriate one Test tools, build script libraries, collect information analysis results, and be proficient in a drawing tool;

The bosses have said so, so do you know what my next article is?

Related articles:

[MySQL Database] Chapter 1 Interpretation: MySQL Architecture and History

[MySQL Database] Interpretation of Chapter 3: Server Performance Analysis (Part 2)

The above is the detailed content of [MySQL Database] Interpretation of Chapter 2: MySQL Benchmark Test. For more information, please follow other related articles on the PHP Chinese website!

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)

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

How to open phpmyadmin How to open phpmyadmin Apr 10, 2025 pm 10:51 PM

You can open phpMyAdmin through the following steps: 1. Log in to the website control panel; 2. Find and click the phpMyAdmin icon; 3. Enter MySQL credentials; 4. Click "Login".

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

MySQL's Place: Databases and Programming MySQL's Place: Databases and Programming Apr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

How to start mysql by docker How to start mysql by docker Apr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

How to install mysql in centos7 How to install mysql in centos7 Apr 14, 2025 pm 08:30 PM

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting

See all articles