首页 > 其他分享 >v7.1 LTS Resource Control 试用

v7.1 LTS Resource Control 试用

时间:2023-07-28 22:06:34浏览次数:31  
标签:LTS Control Resource read mysql write only sec tidb

作者: weixiaobing 

1、集群信息

[tidb@vm116 ~]$ tiup cluster display tidb-prd
tiup is checking updates for component cluster ...
Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.12.2/tiup-cluster display tidb-prd
Cluster type:       tidb
Cluster name:       tidb-prd
Cluster version:    v7.1.0
Deploy user:        tidb
SSH type:           builtin
Dashboard URL:      http://10.2.103.116:32379/dashboard
Grafana URL:        http://10.2.103.116:5000
ID                  Role          Host          Ports                            OS/Arch       Status   Data Dir                            Deploy Dir
--                  ----          ----          -----                            -------       ------   --------                            ----------
10.2.103.116:9793   alertmanager  10.2.103.116  9793/9794                        linux/x86_64  Up       /data1/tidb-data/alertmanager-9793  /data1/tidb-deploy/alertmanager-9793
10.2.103.116:5000   grafana       10.2.103.116  5000                             linux/x86_64  Up       -                                   /data1/tidb-deploy/grafana-5000
10.2.103.116:32379  pd            10.2.103.116  32379/3380                       linux/x86_64  Up|L|UI  /data1/tidb-data/pd-32379           /data1/tidb-deploy/pd-32379
10.2.103.116:9390   prometheus    10.2.103.116  9390/32020                       linux/x86_64  Up       /data1/tidb-data/prometheus-9390    /data1/tidb-deploy/prometheus-9390
10.2.103.116:43000  tidb          10.2.103.116  43000/20080                      linux/x86_64  Up       -                                   /data1/tidb-deploy/tidb-34000
10.2.103.116:9300   tiflash       10.2.103.116  9300/9123/4930/30170/30292/8234  linux/x86_64  Up       /data1/tidb-data/tiflash-9300       /data1/tidb-deploy/tiflash-9300
10.2.103.116:30160  tikv          10.2.103.116  30160/30180                      linux/x86_64  Up       /data1/tidb-data/tikv-30160         /data1/tidb-deploy/tikv-30160
Total nodes: 7
[tidb@vm116 ~]$



相关参数

mysql> show variables like '%tidb_enable_resource_control%';
+------------------------------+-------+
| Variable_name                | Value |
+------------------------------+-------+
| tidb_enable_resource_control | ON    |
+------------------------------+-------+
1 row in set (0.00 sec)

mysql> show config where name like '%resource-control%';
+---------+--------------------+------------------------------------------+-------+
| Type    | Instance           | Name                                     | Value |
+---------+--------------------+------------------------------------------+-------+
| tikv    | 10.2.103.116:30160 | resource-control.enabled                 | true  |
| tiflash | 10.2.103.116:4930  | raftstore-proxy.resource-control.enabled | true  |
+---------+--------------------+------------------------------------------+-------+
2 rows in set (0.01 sec)

mysql>



预估集群容量

mysql> CALIBRATE RESOURCE;
+-------+
| QUOTA |
+-------+
| 23256 |
+-------+
1 row in set (0.01 sec)

mysql> CALIBRATE RESOURCE WORKLOAD OLTP_WRITE_ONLY;
+-------+
| QUOTA |
+-------+
| 36592 |
+-------+
1 row in set (0.00 sec)

mysql> CALIBRATE RESOURCE WORKLOAD OLTP_READ_ONLY;
+-------+
| QUOTA |
+-------+
|  6985 |
+-------+
1 row in set (0.00 sec)

mysql> CALIBRATE RESOURCE WORKLOAD OLTP_READ_WRITE;
+-------+
| QUOTA |
+-------+
| 14886 |
+-------+
1 row in set (0.00 sec)

mysql>

v7.1 LTS Resource Control 试用_mysql

mysql> CALIBRATE RESOURCE START_TIME '2023-06-07 10:40:00' DURATION '20m';
ERROR 1105 (HY000): There are too few metrics points available in selected time window
mysql>

v7.1 LTS Resource Control 试用_mysql_02

v7.1 LTS Resource Control 试用_压测_03

当负载太小时,可能不能正确的估算出容量

v7.1 LTS Resource Control 试用_mysql_04

调整负载后,可以正常估算容量

v7.1 LTS Resource Control 试用_linux_05



管理资源组



创建资源组

mysql> CREATE RESOURCE GROUP IF NOT EXISTS read_write RU_PER_SEC = 5000 BURSTABLE;
Query OK, 0 rows affected (0.21 sec)

mysql> CREATE RESOURCE GROUP IF NOT EXISTS read_write_no RU_PER_SEC = 5000 ;
Query OK, 0 rows affected (0.14 sec)

mysql> CREATE RESOURCE GROUP IF NOT EXISTS read RU_PER_SEC = 2000 ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 40 near "read RU_PER_SEC = 2000"  

mysql> CREATE RESOURCE GROUP IF NOT EXISTS read_only RU_PER_SEC = 2000;
Query OK, 0 rows affected (0.17 sec)

mysql> CREATE RESOURCE GROUP IF NOT EXISTS write_only RU_PER_SEC = 12000;
Query OK, 0 rows affected (0.18 sec)

mysql> CREATE RESOURCE GROUP IF NOT EXISTS write RU_PER_SEC = 12000;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 41 near "write RU_PER_SEC = 12000" 
mysql>
mysql> select * from information_schema.RESOURCE_GROUPS;
+---------------+------------+----------+-----------+
| NAME          | RU_PER_SEC | PRIORITY | BURSTABLE |
+---------------+------------+----------+-----------+
| default       | UNLIMITED  | MEDIUM   | YES       |
| read_only     | 2000       | MEDIUM   | NO        |
| read_write    | 5000       | MEDIUM   | YES       |
| read_write_no | 5000       | MEDIUM   | NO        |
| write_only    | 12000      | MEDIUM   | NO        |
+---------------+------------+----------+-----------+
5 rows in set (0.01 sec)

mysql>



绑定资源组

mysql> create user read_only identified by 'tidb';
Query OK, 0 rows affected (0.08 sec)

mysql> create user read_write identified by 'tidb';
Query OK, 0 rows affected (0.03 sec)

mysql> create user read_write_no identified by 'tidb';
Query OK, 0 rows affected (0.04 sec)

mysql> create user write_only identified by 'tidb';
Query OK, 0 rows affected (0.03 sec)

mysql> alter user read_only resource group read_only;
Query OK, 0 rows affected (0.05 sec)

mysql> alter user write_only resource group write_only;
Query OK, 0 rows affected (0.04 sec)

mysql> alter user read_write resource group read_write;
Query OK, 0 rows affected (0.03 sec)

mysql> alter user read_write_no resource group read_write_no;
Query OK, 0 rows affected (0.04 sec)

mysql>



将用户绑定到资源组

mysql> select user,host,User_attributes from mysql.user;
+---------------+------+-------------------------------------+
| user          | host | User_attributes                     |
+---------------+------+-------------------------------------+
| root          | %    | NULL                                |
| read_only     | %    | {"resource_group": "read_only"}     |
| read_write    | %    | {"resource_group": "read_write"}    |
| write_only    | %    | {"resource_group": "write_only"}    |
| read_write_no | %    | {"resource_group": "read_write_no"} |
+---------------+------+-------------------------------------+
5 rows in set (0.00 sec)

mysql>

v7.1 LTS Resource Control 试用_linux_06



性能测试



read_only



压测脚本

[tidb@vm116 ~]$ more sysbench_read_only.config 
mysql-host=10.2.103.116
mysql-port=43000
mysql-user=read_only
mysql-password=tidb
mysql-db=sbtest
time=600
threads=16
report-interval=1
db-driver=mysql
[tidb@vm116 ~]$ 

sysbench --config-file=sysbench_read_only.config oltp_read_only --tables=10 --table-size=10000 run



监控与图表

v7.1 LTS Resource Control 试用_压测_07



机器负载

v7.1 LTS Resource Control 试用_mysql_08



压测结果

SQL statistics:
    queries performed:
        read:                            4125548
        write:                           0
        other:                           589364
        total:                           4714912
    transactions:                        294682 (491.11 per sec.)
    queries:                             4714912 (7857.77 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          600.0306s
    total number of events:              294682

Latency (ms):
         min:                                    9.70
         avg:                                   32.57
         max:                                  204.13
         95th percentile:                       38.94
         sum:                              9599029.86

Threads fairness:
    events (avg/stddev):           18417.6250/23.24
    execution time (avg/stddev):   599.9394/0.01



read_only_no



压测脚本

[tidb@vm116 ~]$ more sysbench_read_only_no.config 
mysql-host=10.2.103.116
mysql-port=43000
mysql-user=read_only_no
mysql-password=tidb
mysql-db=sbtest
time=600
threads=16
report-interval=1
db-driver=mysql
[tidb@vm116 ~]$ sysbench --config-file=sysbench_read_only_no.config oltp_read_only --tables=10 --table-size=10000 run



监控与图表

v7.1 LTS Resource Control 试用_压测_09



机器负载

v7.1 LTS Resource Control 试用_压测_10



压测结果

SQL statistics:
    queries performed:
        read:                            7025844
        write:                           0
        other:                           1003692
        total:                           8029536
    transactions:                        501846 (836.38 per sec.)
    queries:                             8029536 (13382.01 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          600.0231s
    total number of events:              501846

Latency (ms):
         min:                                    7.99
         avg:                                   19.13
         max:                                  167.63
         95th percentile:                       28.67
         sum:                              9598335.88

Threads fairness:
    events (avg/stddev):           31365.3750/58.39
    execution time (avg/stddev):   599.8960/0.01

[tidb@vm116 ~]$



没有资源限制用户测试



压测脚本

[tidb@vm116 ~]$ more sysbench.config 
mysql-host=10.2.103.116
mysql-port=43000
mysql-user=root
mysql-password=
mysql-db=sbtest
time=600
threads=16
report-interval=1
db-driver=mysql
[tidb@vm116 ~]$



监控与图表

v7.1 LTS Resource Control 试用_mysql_11



机器负载

v7.1 LTS Resource Control 试用_mysql_12



压测结果

SQL statistics:
    queries performed:
        read:                            6938876
        write:                           0
        other:                           991268
        total:                           7930144
    transactions:                        495634 (826.02 per sec.)
    queries:                             7930144 (13216.36 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          600.0232s
    total number of events:              495634

Latency (ms):
         min:                                    7.88
         avg:                                   19.37
         max:                                  239.23
         95th percentile:                       29.19
         sum:                              9598338.50

Threads fairness:
    events (avg/stddev):           30977.1250/55.63
    execution time (avg/stddev):   599.8962/0.01

[tidb@vm116 ~]$



总结

Resource Contro 的确可以限制用户的资源使用,但是当资源组设置BURSTABLE 属性后,基本可以用到机器所有的资源,建议还是需要设置一个最大值,这样可以更好的保护集群。

由于测试资源有限,没有测试更大的集群,在有更多的tidb servre 和tikv 后,希望可以测试一下在资源管控后,是否会资源均衡,希望大家多多测试。

标签:LTS,Control,Resource,read,mysql,write,only,sec,tidb
From: https://blog.51cto.com/u_15550868/6887280

相关文章

  • EAS_在controllerBean中调用其他方法,发生异常后,事务没有回滚
    首先列出例子如下:在一个方法中,执行了多个逻辑,第一部分是调用退票逻辑,第二部分是执行其他业务,这里我们遇到问题,退票逻辑执行成功,但是后面的代码异常,这时我们需要的是退回所有执行,这时我们就需要认清facade中的事务属性: 就是EJB规范的6种事务属性:Required:要求有事务:如果已......
  • Zabbix Server 6.0 LTS 原生高可用HA集群部署 - On Debian11
    官方文档里面说明,ZabbixServerHA最少需要两个节点,多台Zabbixserver作为集群中的节点运行。当集群中的一个Zabbixserver处于active时,其他服务器处于standy,随时准备在必要时接管。无论集群的节点数量有多少,只有一个节点实例是出于Active状态,Standby节点不收集监控数据或者......
  • @PersistenceContext 和 @Resource
    @PersistenceContextprivate EntityManager em;注入的是实体管理器,执行持久化操作的,需要配置文件persistence.xml。注入一堆保存实体类状态的数据结构,针对实体类的不同状态(四种,managedh或detached等)可以做出不同的反应(merge,persist等等),其实就是把数据从数据库里提出,然......
  • rabbitmq告警Error: health check failed. Message: resource alarm(s) in effect:[{r
     这个错误信息表示RabbitMQ的内存使用量超出了预设的阈值,导致触发了RabbitMQ的内存警告阈值报警。RabbitMQ在运行过程中会不断地将消息存储在内存中,如果内存使用量超出了预设的阈值,就会触发内存警告阈值报警。这个阈值的默认值是40%的物理内存,可以通过修改Rabbi......
  • ltsql 增加语法兼容类型提示
    背景lightdb目前兼容mysql,oracle语法。为了提醒用户正在使用的是哪种类型的数据库,lightdb在ltsql端增加了连接提示。用户在初次连接数据库或在psql内切换数据库时,会打印一条消息提示。该功能出现在lightdb版本:LightDB1.0.V202303.00.000测试用例$#不带参数运行,......
  • APP - Appium-Inspector连接报错Failed to create session, The requested resource c
    APP-Appium-Inspector连接报错Failedtocreatesession,Therequestedresourcecouldnotbefoundappium版本:Appium-Server-GUI-windows-1.22.3-4Appium-Inspector版本:Appium-Inspector-windows-2022.5.4填写好参数连接时报错: 错误信息:错误Failedtocreatesess......
  • 办公套件Microsoft Office LTSC 2021最新中文Mac版
    MicrosoftOfficeLTSC2021(office全家桶)中文版是Microsoft为Mac用户推出的一款新iPadMac系列电脑、iPad桌面应用程序。OfficeLTSC2021是MicrosoftOffice系列电脑、iPad电脑和桌面应用程序的新一代操作系统和办公自动化产品。它采用了Mac和Linux操作系统的同步版......
  • SpringBoot中使用测试框架MockMvc来模拟HTTP请求测试Controller接口
    场景Java中进行单元测试junit.Assert断言、Mockito模拟对象、verify验证模拟结果、Java8中lambda的peek方法使用:https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/127492361上面讲了开发过程中一些测试方法。如果需要在代码中直接测试某个Controller接口,除了每次启......
  • cocos creator 资源加载函数 resources.load 注意该函数为异步
    constanimationComponent=i.addComponent(Animation);if(animationComponent){constcomponent=animationComponent.getComponent(Animation);if(component){resources.load("An......
  • PCH(Platform Controller Hub)
    PlatformContollerHub(PCH)平台PCH芯片具有原来ICH(I/OControllerHub)的全部功能,又具有原来MCH(MemoryControllerHub)的管理引擎功能。负责连接PCI总线,IDE设备,I/O设备等。 从Intel5系列芯片组开始,已经完全看不到北桥芯片的踪影,只剩下PCH的芯片用来支持外设......