Preface 1. Benchmarking is a type of performance testing that emphasizes quantitative, reproducible, and comparable testing of certain performance indicators of a class of test objects. To understand further, benchmarking is to establish a known performance level (called a baseline) through benchmarking at a certain time. When the system's hardware and software environment changes, benchmarking is performed again to determine the impact of those changes on performance. This is also the most common use of benchmarking. Other uses include determining performance limits at certain load levels, managing system or environmental changes, and identifying conditions that could lead to performance problems. 2. The role of benchmarking: For most Web applications, the system bottleneck often occurs easily on the database side. The reason is simple: other factors in Web applications, such as network bandwidth, load balancing nodes, application servers (including CPU, memory, hard disk light, number of connections, etc.), and cache, can easily achieve performance improvements through horizontal expansion (commonly known as adding machines). For databases such as MySQL, due to the requirement for data consistency, it is impossible to disperse the pressure of writing data to the database by adding machines; although the pressure can be reduced through front-end caching (Redis, etc.), read-write separation, and sharding of libraries and tables, it is subject to too many restrictions compared with the horizontal expansion of other components of the system. 3. The difference between benchmark test and stress test: Many times, benchmark testing and stress testing are easily confused in actual use. Benchmark testing can be understood as a stress test for the system. However, benchmark testing does not care about business logic and is simpler, more direct, and easier to test. Data can be generated by tools and is not required to be real. Stress testing generally considers business logic (such as shopping cart business) and requires real data. 4. Benchmarking Tools: SysBench is a modular, cross-platform, multi-threaded benchmark tool that is mainly used to evaluate database load under various system parameters. It mainly includes the following types of tests: 1. CPU performance 2. Disk IO performance 3. Scheduler Performance 4. Memory allocation and transmission speed 5. POSIX thread performance 6. Database performance (OLTP benchmark) Currently, sysbench mainly supports three databases: MySQL, pgsql, and oracle. Install
Friendly reminder: If there is a missing dependency package during installation, please see here Data preparation Prepare
2. Get Started find / -name oltp*.lua #Find the path of the sysbench built-in data writing script, which will be used to execute commands later
Execution prompt error reason: The imported data exceeds the default value of the database solve: You need to modify the data configuration on the server where MySQL is installed vim /etc/my.cnf Modify the value of max_allowed_packet. If it does not exist, add a line at the end. Execute successfully again, check the data on the mysql client Execute the test
The above command indicates that 10 concurrent threads are used, the execution time is 30 seconds, and the test information is output every 3 seconds. Among them, the more important information for us includes:
Cleaning the data Don't forget the final finishing touches after the test is completed. A large amount of test data stored in the database still has an impact.
Check the data The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Vue implements dynamic routing details
>>: Solve the problem of not being able to enter breakpoints when using GDB in Docker
Enable remote access Enable remote access rights ...
1. Introduction to docker-maven-plugin In our con...
Today, I want to write about a "low-tech&quo...
This article shares the specific code of js to ac...
nginx server nginx is an excellent web server tha...
I encountered several problems when installing My...
<meta http-equiv="x-ua-compatible" co...
This article shares the installation and configur...
Table of contents introduce Support Intel CPU Sup...
<br />Some web pages may not look large but ...
Table of contents 1. Get a random Boolean value (...
This article records the installation and configu...
See the effect first Implementation Code <div ...
1. Deploy nginx service in container The centos:7...
Table of contents Preface text 1. Install styleli...