In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
How to conduct sysbench stress testing, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
For many online businesses, if there is a new server, new environment, new business, whether the resources match the expected load-bearing pressure, this has to be explained by data or through rigorous argumentation.
For example, a new server generally needs to undergo stress testing, which is also called machine testing. Generally, it will be pressurized from multiple dimensions (such as CPU, memory, IO, etc.) to see if the server is still strong. Although laziness or laziness at this point will still be despised, some problems will be tested from the examples around me, and if problems are found, a lot of subsequent passivity will be avoided.
Sysbench is such a tool with very comprehensive functions. Is a standard modular, multi-threaded benchmark testing tool.
The installation process is relatively simple. After downloading, you can refer to the README documentation. I just skipped it.
What aspects can this tool test? we use commands to explain.
Sysbench-help
Compiled-in tests:
Fileio- File I/O test
Cpu- CPU performance test
Memory- Memory functions speed test
Threads- Threads subsystem performance test
Mutex- Mutex performance test
Oltp- OLTP test simply refers to some of the following aspects.
1. Disk IO performance
2. CPU operation performance
3. Scheduler performance
4. Memory allocation and transmission speed
5. POSIX thread performance
6. Database performance (OLTP benchmark)
For example, to test CPU, if there is really no good idea for us to test, and see how sysbench is done, you can use the command sysbench-- test=cpu help to get the following results:
Cpu options:
-- cpu-max-prime=N upper limit for primes generator [10000] you can see the important keyword prime, that is, prime numbers, such as finding the largest prime number less than 10 million. This problem is quite brain-burning, so let CPU burn it and run it this way. Ten concurrent threads are enabled, and the maximum number of requests is 100
/ usr/local/bin/sysbench-num-threads=10-max-requests=100-test=cpu-debug-cpu-max-prime=10000000 run
With the basic concept of CPU stress testing, the following explanations are relatively easy.
For example, test memory, you can specify the test range, such as 32G par 64g according to your own needs.
For example, when we test 32 GB of memory, the number of concurrent threads is 10 and the maximum number of requests is 100, which is done from both read and write tests.
Memory read test
/ usr/local/bin/sysbench-num-threads=10-max-requests=100
-test=memory-memory-block-size=8k-memory-total-size=32G
-- memory-oper=readrun memory write test
/ usr/local/bin/sysbench-- num-threads=10-- max-requests=100-- test=memory-- memory-block-size=8k-- memory-total-size=32G--memory-oper=writerun but for IO testing, there is some difference, because there will be preparation data (such as writing a temporary file), so it will be divided into several phases, preparation phase, run phase, clean-up phase.
The following is a relatively simple scenario, 20 files, each 10GB, random read and write, with a total file size of 200G.
/ usr/local/bin/sysbench-file-num=20-num-threads=20-test=fileio
-- file-total-size=
200G--max-requests=1000000-file-test-mode=rndrwprepare
/ usr/local/bin/sysbench-file-num=20-num-threads=20
-test=fileio-file-total-size=
200G--max-requests=1000000-file-test-mode=rndrwrun
/ usr/local/bin/sysbench-- file-num=20
-num-threads=20-test=fileio-file-total-size=
200G--max-requests=1000000-file-test-mode=rndrwcleanup hardware class testing, basically a test can get a baseline data, there is no need to test again and again. For DBA or developer students, pay more attention to the business level, we will analyze the trade-off from many possible angles and scenarios, these sysbench are also supported, that is, the oltp option.
Of course, sysben's support for mysql is native, while other data, such as oracle,PostgreSQL, need to be configured separately.
Because application testing produces basic data, it is also divided into multi-stages.
Such as preparing basic data, conducting stress tests, final statistical results and later cleaning up. It is worth saying that for the lower version of sysbench, the multi-table parameter-oltp_tables_count is not supported yet. If the basic data is ready, the multi-threaded mode will be turned on to simulate the stress test. For example, the following command, test mode complex, the number of concurrent threads is 30, the maximum number of requests is 5000000, and the data volume of the table is 100 million. First create a test library sysbenchtest, and delete it after the test is complete.
Mysql-uroot-e "create database if not exists sysbenchtest"
/ usr/local/bin/sysbench-mysql-user=root-test=oltp
-mysql-host=localhost-oltp-test-mode=complex
-mysql-table-engine=innodb-oltp-table-size=100000000
-mysql-db=sysbenchtest-oltp-table-name=innodb_test-num-threads=30
-- max-requests=5000000
Prepare
/ usr/local/bin/sysbench
-mysql-user=root-test=oltp-mysql-host=localhost
-oltp-test-mode=complex-mysql-table-engine=innodb
-oltp-table-size=100000000-mysql-db=sysbenchtest
-oltp-table-name=innodb_test-num-threads=30-max-requests=5000000
Run
Mysql-uroot-e "drop table if exists sysbenchtest.innodb_test; drop database if exists sysbenchtest"
I tested on a server and found that about 100 million data and data files were about 24 gigabytes.
-rw-r- 1 mysql mysql 61 Mar 10 11:20 db.opt
-rw-r- 1 mysql mysql 8632 Mar 10 11:20 innodb_test.frm
-rw-r- 1 mysql mysql 24419237888 Mar 10 13:29 innodb_test.ibd
The report is as follows, we can see that the whole process lasted nearly 3 hours, TPS is about 455, in fact, it is not high.
Actually, a pretty good idea for stress testing is that I specify the stress testing strategy and let it run in the background. The MGR test script has been written and will be shared with everyone after the test, so that I can create multiple nodes in an instant and test a lot of complex stress scenarios. At that time, I will directly look at the data and get a report, which is very interesting to think about.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.