Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sysbench conducts stress tests on the database

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Sysbench is a stress testing tool that can be used to test the hardware performance of the system and can also be used to benchmark databases.

Installation method: https://github.com/akopytov/sysbench/blob/master/README.md#general-command-line-options

What is installed here is version 1.0.6 of sysbench, which is different from most of the 0.4 and 0.5 commands on the Internet.

Sysbench supports three test scenarios:

1. Use your own test module, such as the test of cpu,I/O,memory, etc.

2. Use your own lua script for testing. If you use quick installation, the default script path is: / usr/share/sysbench.

3. Use a custom lua script.

Get help information:

If you are not clear about the parameters of the relevant module or script, you can use sysbench testname help to view it. Testname contains the module name and script name.

Sysbench Classic Test commands:

Prepare: create test data or related test files to prepare for testing. Such as database test data preparation and so on.

Run: start executing the test.

Cleanup: removing test data

Help: help command

Test the performance of CPU

Sysbench cpu--cpu-max-prime=10000 run# displays the test results General statistics: total time: 10.0003s total number of events: 8692Latency (ms): min: 1.12 avg: 1.15 max: 2.98 95th percentile: 1.25 sum: 9996.64Threads fairness: events (avg/stddev): 8692.00000.00 execution time (avg/stddev): 9.9966amp0.00

Ipaw O test

Prepare test data:

Sysbench fileio-file-total-size=40G prepare

Run the order write test:

Sysbench fileio-- file-total-size=40G-- file-test-mode=seqwr run# test results File operations: reads/s: 0.00 writes/s: 3916.87 fsyncs/s: 5001.01Throughput: read, MiB/s: 0.00 written MiB/s: 61.20General statistics: total time: 10.0055s total number of events: 89250Latency (ms): min: 0.01avg: 0.11max: 95th percentile: 0.12 sum: 9937.24Threads fairness: events (avg/stddev): 89250.00000.00 execution time (avg/stddev): 9.9372

Run the sequence rewrite test:

Sysbench fileio-- file-total-size=40G-- file-test-mode=seqrewr run# test results: File operations: reads/s: 0.00 writes/s: 4018.65 fsyncs/s: 5131.38Throughput: read, MiB/s: 0.00 written MiB/s: 62.79General statistics: total time: 10.0003s total number of events: 91531Latency (ms): min: 0.00 avg: 0.11 max: 31.45 95th percentile: 0.10 sum: 9933.80Threads fairness: events (avg/stddev): 91531.0000 execution time (avg/stddev): 9.9338 pound 0.00

Mixed random read / write: (re-prepare data is required if execution error occurs)

Sysbench fileio-- file-total-size=40G-- file-test-mode=rndrw-- max-time=100-- max-requests=0 run# test results: File operations: reads/s: 338.98 writes/s: 225.99 fsyncs/s: 722.23Throughput: read, MiB/s: 5.30 written MiB/s: 3.53General statistics: total time: 100.0007s total number of events: 128727Latency (ms): min: 0.00 avg: 0.78 max: 43.01 95th percentile: 2.97 sum: 99785.92Threads fairness: events (avg/stddev): 128727.0000 execution time (avg/stddev): 99.7859

Clear test data:

Sysbench fileio-file-total-size=40G cleanup

OLTP benchmark test

The OLTP benchmark simulates the workload of a simple transaction processing system. To test database performance, you need to use OLTP-related scripts.

There are related lua scripts in the / usr/share/sysbench/ directory:

Bulk_insert.luaoltp_common.luaoltp_delete.luaoltp_insert.luaoltp_point_select.luaoltp_read_only.luaoltp_read_write.luaoltp_update_index.luaoltp_update_non_index.luaoltp_write_only.luaselect_random_points.luaselect_random_ranges.lua

For unknown test parameters, you can view them through sysbench scripts-name help.

Create test data:

Sysbench oltp_common-- table-size=1000000-- db-driver=mysql\-- mysql-db=test-- mysql-user=root-- mysql-password=123456 prepareCreating table 'sbtest1'...Inserting 1000000 records into' sbtest1'Creating a secondary index on 'sbtest1'...

Execute the run command to test: (read-only)

Sysbench oltp_read_only-- table-size=1000000-- db-driver=mysql\-- mysql-db=test-- mysql-user=root-- mysql-password=123456-- time=60-- max-requests=0-- threads=8 run# test results Running the test with following options:Number of threads: 8Initializing random number generator from current timeInitializing worker threads...Threads startedSQL statistics: queries performed: read: 1679174 write: 0 other: 239882 total: 1919056 transactions: 119941 (1998.81 per sec.) Queries: 1919056 (31980.95 per sec.) Ignored errors: 0 (0.00 per sec.) Reconnects: 0 (0.00 per sec.) General statistics: total time: 60.0047s total number of events: 119941Latency (ms): min: 0.32 avg: 4. 00 max: 56.17 95th percentile: 8.13 sum: 479830.78Threads fairness: events (avg/stddev): 14992.6250 execution time 116.75 execution time (avg/stddev): 59.9788 Compact 0.00

In addition to using read_only tests, we can also test the write performance of the database:

Sysbench oltp_write_only-- table-size=1000000-- db-driver=mysql\-- mysql-db=test-- mysql-user=root-- mysql-password=123456-- time=60-- max-requests=0-- threads=8 run# test results SQL statistics: queries performed: read: 0 write: 83764 other: 41882 Total: 125646 transactions: 20941 (348.93 per sec.) Queries: 125646 (2093.56 per sec.) Ignored errors: 0 (0.00 per sec.) Reconnects: 0 (0.00 per sec.) General statistics: total time: 60.0120s total number of events: 20941Latency (ms): min: 4.92 avg: 22.92 Max: 5518.27 95th percentile: 69.29 sum: 479968.99Threads fairness: events (avg/stddev): 2617.6250 execution time (avg/stddev): 59.9961

The above results contain a lot of information, among which the key information we need to pay attention to is:

1. Total transactions (total number of events)

2. Transactions per second

3. Time statistics (minimum, average, maximum response time, and 95% response time)

4. Thread fairness statistics, indicating the fairness of the load. (thread-fairness)

Clean up the test data:

Sysbench oltp_read_only-table-size=1000000-db-driver=mysql\-mysql-db=test-mysql-user=root-mysql-password=123456 cleanup

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report