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

How to realize the shell script of sysbench stress Test MyCAT

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

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to achieve sysbench stress test MyCAT shell script, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The middleware MyCAT itself has been tested and summarized before. Recently, when I did distributed testing, I divided it into three phases:

one。 Environment deployment, integration of MHA and MyCAT, separation of read and write

II. Stress testing of sharding strategy and sub-database and sub-table.

three。 Do the simulation test of sub-database and sub-table combined with business.

Especially in the testing of sub-library and sub-table, there are still some points that need to be confirmed.

What was the point of doing this distributed test that I thought before testing? It is to demonstrate what through testing, what goals you want to achieve, whether it is stable, and whether the functions meet the requirements. These are all areas that need to be clarified repeatedly.

Of course, I did not leave too much time down, I hope it is a quick decision, but the quality of the test still needs to be basically guaranteed, that is, the test scenario is basically more comprehensive.

As for the choice of testing tools, I first choose sysbench, which is natively supported, which is relatively easy to control, especially the rich scenarios supported. In some pipelined data business, if I focus on testing intensive insertion scenarios, I can easily use insert templates to test.

The deployment of MyCAT itself is very simple, nothing more than some basic environment configuration. If you are a novice, from the installation of Java to the deployment of MyCAT, if you follow up the whole process, you can take it down in two hours. For deployment and installation, see the previous article Mycat read-write separation configuration practice

However, it will take some time to configure the sharding policy. First of all, you have to understand its sharding logic. After a general understanding, the matter is very simple.

The test scenario, I planned like this, first deployed the MySQL service on three physical machines, each server is a sharding node, and then another server deployed MyCAT, which is a simple distributed sharding environment.

To test the basic performance, there are several testing methods, assuming that the table of the test is sharding_table and the existing database is db1,db2,db3,db4

The scene of the test will be very rich.

Scenario 1:

Scenario 2:

On the basis of the previous expansion, according to this progress, it is basically the way of 3N, so there will be some distribution ways such as 3Magne6, 9 and 12, which has the advantage of planning in the early stage, and if there is a bottleneck in the later stage, it can be easily split.

To complete this work, each scene test Jerry test for a few minutes is not good, each scene at least 1 hour, according to this requirement, at least 20 hours, people are iron rice is steel, I can not stay there all the time. So I wrote a script before I got off work, let it run slowly, and collect money at work tomorrow.

I did a quick iteration in the previous stage, roughly ran each scene, got a basic data distribution, and then refined it to an hour for each scene to receive a relatively complete data situation.

The script is as follows. I configured 10 sbtest [N] tables. If the 3 server nodes are sliced and divided into 12 sharding shards, that's 120 tables. The test scenario I divided into different sharding fragments, different number of threads. Need to configure rules.xml and schema.xml in advance. I have prepared several configuration files and just replace them at that time.

#! / bin/bash

Time= 3600

Sleep_time= 60

Function clean_data

{

Echo $time

Echo ${sleep_time}

Mysql-umycat_user-pmycat_user-P8066-h227.0.0.1 / dev/null

/ usr/local/mycat/bin/mycat restart > / dev/null

Sleep ${sleep_time}

}

Change_sharding 12

Sysbench_test 12 16

Sysbench_test 12 32

Sysbench_test 12 64

Sysbench_test 12 98

Sysbench_test 12 128

Change_sharding 9

Sysbench_test 9 16

Sysbench_test 9 32

Sysbench_test 9 64

Sysbench_test 9 98

Sysbench_test 9 128

Change_sharding 6

Sysbench_test 6 16

Sysbench_test 6 32

Sysbench_test 6 64

Sysbench_test 6 98

Sysbench_test 6 128

Change_sharding 3

Sysbench_test 3 16

Sysbench_test 3 32

Sysbench_test 3 64

Sysbench_test 3 98

Sysbench_test 3 128

The above is all the contents of this article "how to implement the shell script of sysbench stress Test MyCAT". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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