MySQL Basic test

Source: Internet
Author: User
Tags benchmark sha1 cpu usage

Test Reason  Why do I need to do performance testing
    • Simulate a higher load than the current system to identify performance bottlenecks
    • Reproduce an on-line exception
    • Testing different hardware software configurations
    • Plan for future business growth
Test Classification  Classification of performance tests
    • Test of the equipment layer
    • Test of the business layer
    • Testing the database tier
  test of the equipment layer
    • Focus on which metrics
      • Server, disk Performance
      • Disk bad block rate
      • Server Life
Business Layer Testing
    • Testing for the business
Testing the database tier
    • What happens when you do a MySQL test
      • Testing different versions of MySQL
      • Testing different versions of MySQL
      • Test for different MySQL parameter combinations
MySQL test categories
    • CPU Bound--full memory test, the test data is much smaller than the configured memory, so you can not because of the performance of disk IO different, and affect the test results.
    • IO bound--test The amount of data much larger than memory, which has a large amount of data read from disk IO write;
4 Small Categories:
    • Write test
    • Update test
    • Purity Testing
    • Mixed mode (varies by business)
Common testing tools
    • Open-source MySQL performance testing tool
      • Sysbench
      • Tpcc-mysql
      • Mysqlslap
    • Writing performance testing tools for business
      • blogbench--according to NetEase blog, the specific business to do the test tools
Performance Test metrics:
    • Service throughput
      • tps--the total number of transactions performed per second
      • qps--the total number of requests executed per second
    • Service Response Time
    • The concurrency of the service---the concurrent operation in the work, or the number of threads or connections working concurrently. For example, a Web site "has 50,000 users" access, but may only 10--15 a concurrent request to the MySQL database, at this time the number of concurrent only 10--15.
    • Scalability---------------simply to increase the number of resources (such as twice times the CPU) for the system, which can achieve twice times the throughput. Of course, performance (response time) must also be within an acceptable range. Most systems are unable to achieve such an ideal linear extension.
test Method Common errors in designing benchmark tests:
    • Use a subset of real data rather than a complete collection.
    • Does not match the real user behavior.
    • There are no check errors. You should check the error log for the basic requirements when encountering unexpected results-----------the test.
    • ignoring the system preheating Process ----The system restarts, the cache is no data, then the test is inconsistent with the actual situation, it is likely that the cache has a lot of data.
    • Test time is too short
1 Test Planning:
    • Record test data
    • Steps for System Configuration
    • Steps for how to test
    • Analysis results
    • Pre-heating scheme
 The specification should be established to document parameters and results, and each round of tests must be documented in detail 2 how long a benchmark should run a simple test rule, that is, when the system seems to be stable at least the time equals system preheatingThe time. The benchmark should run for a long enough time. If you do not actually complete the exact benchmark, all the time that has been spent is a waste. Sometimes it's better to trust someone else's test results than to do a uncompleted test to get a wrong conclusion. 3 Get system performance and status the data that needs to be logged includes system status and performance metrics:
    • CPU Usage
    • Disk I/O
    • Network traffic statistics
    • Show global status counters, etc.
Use a script to collect this data. The default configuration based on MySQL is meaningless, because the default configuration is based on very small applications that consume very little memory. 4 It is a good idea to run benchmarks and analyze the results of automated benchmarking tests. Can be a makefile or a set of scripts. Use all test procedures to automate as much as possible, including data loading, system preheating, performing tests, and documenting results. such as Multiple measurements 5 The importance of drawing can be immediately identified by graphs, and these problems are difficult to notice in the original data. When performing benchmarks, collect as much detail data as possible and then plot the data to help you quickly identify problems. Gnuplot or R plotting; Test Tools Sysbench
    • Industry's more famous performance testing tools
    • Can test disk, CPU, database
    • Supports multiple databases: Oracle,db2,mysql
    • Need to download the compilation installation yourself
    • Suggested version: sysbench0.5
Sysbench, not only to test the performance of the database, but also to test the performance of the server running the database. It is highly recommended to familiarize yourself with the sysbench test, which should be one of the most useful tools in the MySQL user's toolkit.
    • Sysbench CPU Benchmark Test
    • Sysbench file I/O benchmarks
    • Sysbench's OLTP benchmark test
Sysbench other benchmark tests, but not directly related to database performance.
    • Memory-----Test memory for continuous read and write performance
    • The thread-----test the performance of the thread scheduler.
    • Mutex---test mutex performance.
    • Sequential Write---Test the performance of sequential writes.
Tpcc-mysql
    • TPC-C is a specification specifically for online transaction processing systems (OLTP systems)
    • Tpcc-mysql is implemented by Percona according to specifications
TPCC process to simulate online businessUse this test tool: you need to create data and table structures, load data, and perform three steps of testing. Benchmark () MySQL benchmark (): You can test the execution speed of some specific operations.
Mysql> Set @input:= 'Hello World'; Query OK,0Rows Affected (0.00sec) MySQL> SelectBenchmark1000000, MD5 (@input));+--------------------------------+|Benchmark1000000, MD5 (@input))|+--------------------------------+|                              0 |+--------------------------------+1Rowinch Set(1.45sec) MySQL> SelectBenchmark1000000, SHA1 (@input));+---------------------------------+|Benchmark1000000, SHA1 (@input))|+---------------------------------+|                               0 |+---------------------------------+1Rowinch Set(1.40Sec

Although the benchmark () function is convenient to use, it is not suitable for a real benchmark, because the function simply returns the time that the server executes the expression and does not involve analysis and overhead, among other factors. And the expression must contain a user-defined variable (input) as in this example, otherwise the same expression will be executed more than once because the system cache hit will affect the result. Specific test practice, see Sysbench Practice, Tpcc-mysql practice; Summary
  • Four small categories: Write test, update test, purity test, Mixed mode
  • Performance Test metrics:
    • Service throughput
      • tps--the total number of transactions performed per second
      • qps--the total number of requests executed per second
    • Service Response Time
    • Concurrency of services
  • Design Test Common errors:
    • Using a subset of data rather than a complete collection,
    • Does not match the real user behavior,
    • No check errors,
    • Ignoring the system preheating process , the test time is too short;
  • Test method
    • Test planning:
      • Record test data,
      • System configuration steps,
      • Test steps,
      • Analysis results,
      • Preheating scheme;
    • Test time: The test should run long enough, at least equal to the time the system warms up.
    • Get system performance and Status: Cpu,io, network traffic, MySQL status counter;
    • Run Tests: Automated tests include: Data loading, System preheating, performing tests, recording results.
    • Mapping analysis: intuitive discovery problems;
    • Test tool: Sysbench,tpcc-mysql,benchmark ()
  • Test Summary:
    • IO bound test data is much larger than memory, CPU bound test data is less than the amount of memory
    • The test time is recommended to be more than 60 minutes, reduce the error, the system warm-up time;
    • Sysbench more inclined to test MySQL performance, TPCC closer to the business
    • Running the test program requires simultaneous monitoring of the machine load, MySQL monitoring metrics

MySQL Basic test

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.