WO2023103349A1 - 负载调节方法、管理节点以及存储介质 - Google Patents

负载调节方法、管理节点以及存储介质 Download PDF

Info

Publication number
WO2023103349A1
WO2023103349A1 PCT/CN2022/101385 CN2022101385W WO2023103349A1 WO 2023103349 A1 WO2023103349 A1 WO 2023103349A1 CN 2022101385 W CN2022101385 W CN 2022101385W WO 2023103349 A1 WO2023103349 A1 WO 2023103349A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
node
load
load value
transfer
Prior art date
Application number
PCT/CN2022/101385
Other languages
English (en)
French (fr)
Inventor
黄蔚
龚俊楷
胡盼盼
卢道和
Original Assignee
深圳前海微众银行股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2023103349A1 publication Critical patent/WO2023103349A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Definitions

  • the present application relates to the technical field of financial technology (Fintech), and in particular to a load adjustment method, a management node and a storage medium.
  • the distributed data system provides data services for financial services, and the distributed data system usually has multiple data nodes.
  • the load of each data node is usually monitored, and the capacity is expanded and reduced in time according to the load.
  • the purpose of the present application is to provide a load adjustment solution to adjust the load of each data node in a distributed data system, so as to maintain the load balance of each data node.
  • the present application provides a load adjustment method, a management node and a storage medium, aiming at adjusting the load of a distributed system, especially when the load of the system is unbalanced.
  • the present application provides a load adjustment method, which is applied to a management node, and the method includes:
  • each data node When the load imbalance of each data node is determined according to the load value of each data node in the future, select at least one data node whose load value satisfies the high-load operation condition from each data node as the transfer node, and select at least one data node from each data node A data node whose load value satisfies the low-load operation condition or select a new node as the target node;
  • the method further includes:
  • the method also includes:
  • For any transfer node calculate the load difference between the transfer node and any target node according to the load value of the transfer node, the data slice size of the transfer node, the load value of the target node, and the data slice size of the target node;
  • the load difference exceeds the preset threshold, determine the size of the sub-data slice according to the load value of the transfer node, the size of the data slice of the transfer node, the load value of the target node, and the size of the data slice of the target node;
  • the data slice in the node is re-sharded to obtain multiple sub-data slices.
  • the load difference between the transfer node and any target node is calculated according to the load value of the transfer node, the data slice size of the transfer node, the load value of the target node, and the data slice size of the target node, specifically including:
  • ⁇ Q ij represents the load difference between the transfer node i and any target node j
  • Q i represents the load value of the transfer node i
  • R i represents the data slice size of the transfer node
  • Q j represents the load value of the target node
  • R j represents the data slice size of the target node.
  • the sub-data slice size is determined according to the load value of the transfer node, the data slice size of the transfer node, the load value of the target node, and the data slice size of the target node, specifically including:
  • the size of the sub-data slice is calculated according to a second formula, wherein the second formula specifically includes:
  • ⁇ R ij represents the size of the sub-data slice.
  • obtaining the load value of each data node in the distributed data system at a future moment specifically includes:
  • the capacity of each resource of the data node and the usage amount of each resource at a future moment are acquired, specifically including:
  • the data node When the data node provides OLTP service, obtain the rate and CPU frequency of the disk IO port in the data node, and obtain the usage rate of the disk IO port in the data node and the usage rate of the CPU in the future time;
  • the present application provides a management node, including: a processor, and a memory communicatively connected to the processor;
  • the processor executes the computer-executed instructions stored in the memory, so as to implement the load adjustment method provided in the above embodiments.
  • the present application provides a computer-readable storage medium, wherein computer-executable instructions are stored in the computer-readable storage medium, and when executed by a processor, the computer-readable instructions are used to implement the load adjustment method provided in the foregoing embodiments.
  • the embodiment of the present application provides a load adjustment method, a management node, and a storage medium, monitor the load value of each data node in a distributed data system, and select a high-load operation from the data nodes when the load of each data node is determined to be unbalanced
  • the data node is used as the transfer node, and the data node with low load operation or the newly added node is selected as the target node, and the data slice in the transfer node is divided again and then transferred to the target node to realize the real-time dispersal of hot data slices to adjust the data node load within.
  • the distributed data system should be expanded. If it is monitored that most of the data nodes are running at low load, the distributed data system will be scaled down.
  • FIG. 2 is a flow chart of a load adjustment method for each data node provided by an embodiment of the present application
  • FIG. 3 is a flow chart of a load adjustment method for each data node provided in another embodiment of the present application.
  • FIG. 4 is a flow chart of data fragmentation operation when the load is unbalanced according to an embodiment of the present application
  • Fig. 5 is a schematic structural diagram of a load regulating device provided by an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a management node provided by an embodiment of the present application.
  • the load adjustment method for the distributed data system may be elastic scaling based on CPU usage.
  • the method is run in the management node, and a CPU utilization threshold is preset, and S101 is executed first.
  • S101 includes judging whether the current CPU utilization of a data node exceeds the first CPU threshold. If the current CPU utilization of a data node If the utilization rate exceeds the first CPU threshold, S102 will be executed, and S102 includes triggering an automatic expansion operation. Then execute S103.
  • S103 includes continuing to judge whether the current CPU utilization of the data node is lower than the second CPU threshold. If it is determined that the current CPU utilization of the data node is lower than the second CPU threshold, execute S104.
  • S104 includes triggering automatic scaling operate.
  • stateful services such as distributed data systems are usually very sensitive to the expansion and contraction of data instances.
  • S105 can be continued. S105 includes judging whether the time since the last expansion operation exceeds the time interval threshold. When the time interval between secondary scaling exceeds the time interval threshold, the automatic scaling operation is triggered, thereby avoiding the normal jitter of the system caused by frequent automatic scaling.
  • FIG. 2 other embodiments of the present application provide a load adjustment method aimed at adjusting the load of each data node in a distributed data system, especially load adjustment when load imbalance occurs.
  • This load adjustment method runs in the management node.
  • When monitoring the load value of each data node in the distributed system first monitor whether the load of each data node is balanced, and then re-shard the data in the high-load data node when there is an imbalance
  • the load difference between two data nodes is calculated, and a re-sharding operation based on the load difference and the capacity value of each resource is proposed, which can make full use of each Data node resources to achieve load balancing of each data node.
  • an embodiment of the present application provides a load adjustment method, the load adjustment method is applied to a management node, and the load adjustment method includes:
  • the load value of the data node can be expressed by the usage of each resource in the data node, or can be expressed by the ratio of the usage of each resource in the data node to the capacity value of each resource.
  • the load value of the future time can be predicted according to the load value of the current time and the load value of the historical time, for example: using a machine learning model for predictive analysis.
  • the difference threshold when the number of data node pairs whose difference is greater than or equal to the difference threshold is greater than or equal to the first number threshold, it indicates that the load is unbalanced, and when the difference is greater than or equal to the number of data node pairs When the number is less than the first number threshold, it indicates load balancing.
  • the difference threshold For example: set the difference threshold to 20%, the quantity threshold to 2 groups, the difference between load values between two data nodes is 30%, and the difference between load values between certain two data nodes is 25% , if the difference between the load values of two groups of data nodes is greater than 20%, it means that the load of the data nodes in the distributed data system is unbalanced.
  • the transfer node and the target node are determined according to the load value of each data.
  • a data node whose load value satisfies a high-load operating condition is a transfer node
  • the high-load operating condition includes a node whose load value is greater than or equal to a first load threshold.
  • the data node whose load value satisfies the low-load operation condition is used as the target node.
  • the low load operating condition includes nodes with a load value less than a second load threshold. Wherein, the first load threshold is greater than or equal to the second load threshold.
  • the load difference of each data node is relatively small.
  • Counting the number of data nodes whose load value satisfies the high-load operating condition that is, counting the number of data nodes whose load value is greater than or equal to the first load threshold, and judging whether the number of data nodes obtained by statistics is greater than or equal to the first preset number, To determine whether most of the data nodes in the distributed data system are running under high load, that is, to determine whether the load of each data node in the distributed data system meets the first condition.
  • the number of additional data nodes can be determined according to the load of the data nodes, and the data slices to be migrated from the original 4 data nodes can be determined according to the capacity of the newly added data nodes.
  • this step if it is judged that a small number of data nodes in the distributed system are running under high load, that is, when it is judged that the load distribution of each data node in the distributed system does not meet the first situation, continue to judge the load distribution of each data node Whether it meets the third condition, that is, count the number of data nodes whose load value meets the low-load operating condition, and judge whether the number of data nodes obtained by statistics is greater than or equal to the second preset number, so as to determine most of the distributed data systems Whether the data node is running under low load.
  • the scaling-down node is selected from the data nodes whose load value satisfies the low-load operation condition.
  • An embodiment of the present application provides a load adjustment method, the load adjustment method is applied to a management node, and the load adjustment method includes:
  • the load value of the data node is represented by the ratio of the usage amount of each resource in the data node to the capacity value of each resource.
  • the training data is filtered from the historical data.
  • the main indicators that reflect the load of the distributed data system are CPU, disk IO port, and memory, and the CPU usage, disk IO port usage, and memory usage of each data node in the distributed data system can be collected periodically.
  • the model is trained using CPU usage, disk IO port usage, and memory usage.
  • a large-scale parallel XGBoost algorithm is selected.
  • the historical data of each resource utilization rate is used as the input of XGBoost, that is, the load conditions of the data nodes in the previous 1 day and the previous 7 days at the same time are used as input.
  • the resource usage rate of the data node after 1 minute is used as the output, and the best XGBoost model is obtained after continuous tuning.
  • c i represents the number of CPUs of data node i
  • p(f i ) represents the CPU frequency of data node i
  • p(v i ) represents the speed of the disk IO port of data node i
  • p(m i ) represents the data node i memory capacity.
  • k 1 , k 2 and k 3 indicate that the weight values reflect the degree of influence of different types of access services on each index.
  • OLTP services mainly affect the IO and CPU of the distributed data system
  • OLAP services mainly affect memory usage.
  • the weight parameter can be adjusted according to different systems and operating conditions of the system in order to achieve the best effect.
  • the ratio of k 1 , k 2 and k 3 is 5:5:1.
  • the ratio of k 1 , k 2 and k 3 is 1:1:5.
  • the load value of a data node is defined as the ratio of the actual utilization rate of the node to the node load capacity value:
  • the value of the threshold ⁇ can be determined according to the requirements. The larger the threshold ⁇ , the greater the load difference of different nodes can be tolerated, and the smaller the threshold ⁇ , the smaller the load difference of different nodes can be tolerated, and more hot spots will be triggered The nodes are broken up. Usually selected as 20%, more moderate.
  • each data node When the load imbalance of each data node is determined according to the load value of each data node in the future, select at least one data node whose load value satisfies the high-load operation condition from each data node as a transfer node, and select from each data node Select at least one data node whose load value satisfies the low-load operation condition or select a newly added node as the target node.
  • the data in the data node is composed of multiple data slices, and usually the data slice is used as the smallest data scheduling unit.
  • the data slice is used as the smallest data scheduling unit.
  • Qi and Qj are the load weights of transfer node i and target node j respectively
  • Ri and Rj are the size of the data slice on data node i and the size of data slice on data node j respectively.
  • the data slices are divided according to the size of the migrated data slices to obtain multiple sub-data slices, and the target sub-data slices are selected so that the size of the target sub-data slices is ⁇ R ij or ⁇ R ij /N.
  • this step when determining the load balance of each data node, it is judged whether most of the data nodes in the distributed data system are in high-load operation, that is, whether the number of data nodes whose load value satisfies the high-load operation condition is greater than or equal to The first preset quantity.
  • an embodiment of the present application provides a load regulating device 500, which includes:
  • the processing module 502 is configured to select at least one data node whose load value satisfies the high-load operating condition from each data node as a transfer node when the load imbalance of each data node is determined according to the load value of each data node at a future moment, and from Select at least one data node whose load value satisfies the low-load operation condition from each data node or select a newly added node as the target node;
  • the processing module 502 is further configured to re-shard the multiple data slices in at least one transfer node to obtain multiple sub-data slices, and transfer the multiple sub-data slices to at least one target node.
  • the size of the sub-data slice is determined according to the load value of the transfer node, the size of the data slice of the transfer node, the load value of the target node, and the size of the data slice of the target node;
  • the data slices in the transfer node are re-sharded to obtain multiple sub-data slices.
  • the processing module 502 is specifically configured to: calculate the load difference between the transfer node and any target node according to a first formula, where the first formula includes:
  • ⁇ Q ij represents the load difference between the transfer node i and any target node j
  • Q i represents the load value of the transfer node i
  • R i represents the data slice size of the transfer node
  • Q j represents the load value of the target node
  • R j represents the data slice size of the target node.
  • the processing module 502 is specifically configured to: calculate the sub-data slice size according to a second formula, where the second formula specifically includes:
  • ⁇ R ij represents the size of the sub-data slice.
  • the processing module 502 is specifically configured to: for each data node, obtain the capacity of each resource of the data node and the usage amount of each resource at a future moment;
  • the processing module 502 is specifically configured to: when the data node provides OLTP services, obtain the rate and CPU frequency of the disk IO port in the data node, and obtain the usage rate and CPU frequency of the disk IO port in the data node in the future utilization rate at a future moment;
  • an embodiment of the present application provides a management node 600 , and the management node 600 includes a memory 601 and a processor 602 .
  • the memory 601 is used to store computer instructions executable by the processor
  • the processor 602 implements various steps in the methods in the above-mentioned embodiments when executing computer instructions. For details, refer to the related descriptions in the foregoing method embodiments.
  • the above-mentioned memory 601 may be independent or integrated with the processor 602 .
  • the management node further includes a bus for connecting the memory 601 and the processor 602 .
  • the embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored, and when the processor executes the computer instructions, each step in the method in the foregoing embodiments is implemented.
  • An embodiment of the present application further provides a computer program product, including computer instructions, and when the computer instructions are executed by a processor, each step in the method in the foregoing embodiments is implemented.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Multi Processors (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请提供一种负载调节方法、管理节点以及存储介质。该方法包括获取分布式数据系统中各个数据节点在未来时刻的负载值;当根据各个数据节点未来时刻的负载值确定各个数据节点的负载不均衡时,从各个数据节点中选择至少一个负载值满足高负载运行条件的数据节点为转移节点,并从各个数据节点中选择至少一个负载值满足低负载运行条件的数据节点或者选择新增节点为目标节点;对至少一个转移节点内多个数据片进行再分片处理获得多个子数据片,并将所述多个子数据片转移到至少一个目标节点内。本方案在进行负载监控时若确定数据节点负载不均衡时,进行数据片再次分割后再转移,可以消除负载不平衡问题。

Description

负载调节方法、管理节点以及存储介质
本申请要求于2021年12月8日提交中国专利局、申请号为202111494350.4、申请名称为“负载调节方法、管理节点以及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及金融科技(Fintech)技术领域,尤其涉及负载调节方法、管理节点以及存储介质。
背景技术
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技转变。
分布式数据系统为金融业务提供数据服务,分布式数据系统通常设有多个数据节点。为了保证分布式数据系统正常运行,通常会监控各数据节点的负载情况,并根据负载情况及时进行扩容和缩容。
本申请旨在提供一种负载调节方案,以调节分布式数据系统中各个数据节点的负载,以保持各个数据节点的负载均衡。
发明内容
本申请提供一种负载调节方法、管理节点以及存储介质,旨在调节分布式系统的负载,尤其是在系统出现负载不均衡时的调节。
第一方面,本申请提供一种负载调节方法,方法应用于管理节点,方法包括:
获取分布式数据系统中各个数据节点在未来时刻的负载值;
当根据各个数据节点未来时刻的负载值确定各个数据节点的负载不均衡时,从各个数据节点中选择至少一个负载值满足高负载运行条件的数据节点为转移节点,并从各个数据节点中选择至少一个负载值满足低负载运行条件的数据节点或者选择新增节点为目标节点;
对至少一个转移节点内多个数据片进行再分片处理获得多个子数据片,并将所述多个子数据片转移到至少一个目标节点内。
在一实施例中,在获取分布式数据系统中各个数据节点在未来时刻的负载值之后,方法还包括:
当根据各个数据节点在未来时刻的负载值确定各个数据节点的负载均衡时,继续判断负载值满足高负载运行条件的数据节点的数量是否大于或等于第一预设数量;若是,则将所有数据节点上的部分数据片转移到新增节点上。
在一实施例中,方法还包括:
若负载值满足高负载运行条件的数据节点的数量小于第一预设数量,则继续判断负载值满足低负载运行条件的数据节点的数量是否大于或等于第二预设数量;若是,从负载值满足低负载运行条件的数据节点中选择缩容节点,并将缩容节点内数据片转移到其他负载值满足低负载运行条件的数据节点内。
在一实施例中,对至少一个转移节点内数据片进行再分片处理获得多个子数据片,具体包括:
针对任意转移节点,根据转移节点的负载值、转移节点的数据片大小、目标节点的负载值以及目标节点的数据片大小计算转移节点与任意目标节点之间的负载差值;
当负载差值超过预设阈值时,根据转移节点的负载值、转移节点的数据片大小、目标节点的负载值以及目标节点的数据片大小确定子数据片大小;并根据子数据片大小对转移节点内数据片进行再分片处理获得多个子数据片。
在一实施例中,根据转移节点的负载值、转移节点的数据片大小、目标节点的负载值以及目标节点的数据片大小计算转移节点与任意目标节点之间的负载差值,具体包括:
根据第一公式计算转移节点与任意目标节点之间的负载差值,其中,第一公式包括:
Figure PCTCN2022101385-appb-000001
其中,ΔQ ij表示转移节点i与任意目标节点j之间的负载差值,Q i表示转移节点i的负载值,R i表示转移节点的数据片大小,Q j表示目标节点的负载值,R j表示目标节点的数据片大小。
在一实施例中,根据转移节点的负载值、转移节点的数据片大小、目标节点的负载值以及目标节点的数据片大小确定子数据片大小,具体包括:
根据第二公式计算子数据片大小,其中,第二公式具体包括:
Figure PCTCN2022101385-appb-000002
其中,ΔR ij表示子数据片大小。
在一实施例中,获取分布式数据系统中各个数据节点在未来时刻的负载值,具体包括:
针对每个数据节点,获取数据节点的各资源的容量和各资源在未来时刻的使用量;
对数据节点的各资源的容量进行加权求和后,获得数据节点的负载能力值;
对数据节点的各资源在未来时刻的使用量进行加权求和后,获得数据节点在未来时刻的实际使用量;
根据数据节点在未来时刻的实际使用量和负载能力值,计算获得负载值。
在一实施例中,获取数据节点的各资源的容量和各资源在未来时刻的使用量,具体包括:
当数据节点提供OLTP服务时,获取数据节点内磁盘IO端口的速率和CPU频率,并获取数据节点内磁盘IO端口在未来时刻的使用率以及CPU在未来时刻的使用率;
当数据节点提供OLAP服务时,获取数据节点的内存容量和内存在未来时刻的使用率。
第二方面,本申请提供一种管理节点,包括:处理器,以及与处理器通信连接的存储器;
存储器存储计算机执行指令;
处理器执行存储器存储的计算机执行指令,以实现上述实施例提供的负载调节方法。
第三方面,本申请提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,计算机执行指令被处理器执行时用于实现上述实施例提供的负载调节方法。
第四方面,本申请提供一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述实施例提供的负载调节方法。
本申请实施例提供一种负载调节方法、管理节点以及存储介质,监控分布式数据系统中各个数据节点的负载值,并确定各个数据节点的负载不均衡时,从数据节点中选择高负载运行的数据节点作为转移节点,选择低负载运行的数据节点或者新增节点作为目标节点,将转移节点内数据片再次分片后转移到目标节点中,实现热点数据片的实时打散,以调节数据节点内的负载。此外,若排除负载不均衡导致的负载升高的情况后,仍有大部分数据节点高负载运行,则对分布式数据系统进行扩容。若监控到大部分数据节点低负载运行,则对分布式数据系统进行缩容。通过上述设置,在有效调节数据系统负载的同时,可以有效调节由于热点数据片导致数据节点负载上升的问题。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。
图1为本申请一实施例提供的分布式数据系统的结构示意图;
图2为本申请一实施例提供的各个数据节点的负载调节方法的流程图;
图3为本申请另一实施例提供的各个数据节点的负载调节方法的流程图;
图4为本申请一实施例提供的负载不均衡时采用数据分片操作的流程图;
图5为本申请一实施例提供的负载调节装置的结构示意图;
图6为本申请一实施例提供的管理节点的结构示意图。
通过上述附图,已示出本申请明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本申请构思的范围,而是通过参考特定实施例为本领域技术人员说明本申请的概念。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附 图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。
如图1所示,分布式数据系统包括多个数据节点200,各数据节点200之间通信连接。每个数据节点200内存储若个数据片(Range)和索引片。通常数据分片是根据数据的主键或者索引值来进行的,数据片是分布式数据库中最小的数据调度单位。数据节点200用于存储数据,还用于对存储的进行分析处理,并基于分析处理结果向外部提供相应地分析服务。
如图2所示,对于分布式数据系统的负载调节方法可以为基于CPU使用率的弹性扩缩容。该方法运行于管理节点中,预先设置一个CPU使用率利用率的阈值,先执行S101,S101包括判断某一数据节点的当前CPU利用率是否超过第一CPU阈值,如果某一数据节点的当前CPU利用率超过第一CPU阈值,则会执行S102,S102包括触发自动扩容操作。再执行S103,S103包括继续判断数据节点的当前CPU利用率是否低于第二CPU阈值,若确定数据节点的当前CPU利用率低于第二CPU阈值,则执行S104,S104包括会触发自动缩容操作。由于与无状态的服务不同,分布式数据系统等有状态的服务对于数据实例的扩缩容通常是非常敏感的。为了避免在扩容完成后,在检测到当前CPU使用率低于第二CPU阈值时触发自动缩容操作,可以继续执行S105,S105包括判断距离上一次扩容操作的时间是否超过时间间隔阈值,在两次扩缩容之间的时间间隔超过时间间隔阈值时触发自动缩容操作,从而避免因为频繁自动扩缩容引起系统的常态性抖动。
然而,当某一个数据节点接收大量访问流量时,数据节点的当前CPU利用率也会超过阈值,也就是该数据节点的负载也会增加。同时,数据节点的负载值也会高于其他数据节点的负载值时,也会出现同时负载不均衡的情况,负载不均衡会导致系统整体响应效率低。因为负载不均衡时,系统访问流量低的节点负载比较低,已经存在资源浪费的情况,若以负载高而采用自动扩容操作反而会更浪费资源。并且自动扩容并不能降低负载不均衡的问题,通常情况下,数据片作为数据最小调度单元存储于数据节点中,扩容操作只能将数据片整体转移到新增节点上,无法实现将高流量的数据节点的访问流量分散的目的。
为克服图2所示实施例中问题,本申请其他实施例提供一种负载调节方法,旨在对分布式数据系统的各个数据节点的负载进行调节,尤其是出现负载不均衡时的负载调节。该负载调节方法运行于管理节点中,监控分布式系统内各个数据节点的负载值时,先监控各个数据节点负载是否平衡,在出现不平衡时则对高负载的数据节点内数据进行再分片操作,在平衡时则根据负载高低进行扩容或缩容处理,以实现负载调节。相较于直接根据负载高低进行扩缩容方式而言,可以有效调节由于高流量节点引起的负载高的情况。此外,为实现数据节点内数据片的再分片操作,计算两个数据节点之间负载差值,并提出一种基于负载差值和各资源的容量值进行再分片操作,可以充分利用各个数据节点的资源,以实现各个数据节点的负载均衡。
如图3所示,本申请一实施例提供一种负载调节方法,该负载调节方法应用于管理节点, 该负载调节方法包括:
S201、获取分布式数据系统中各个数据节点在未来时刻的负载值。
在该步骤,数据节点的负载值可以用数据节点内各资源的使用量表示,也可以用数据节点内各资源的使用量和各资源的容量值的比值来表示。
在获取各个数据节点在未来时刻的负载值时,可以根据当前时刻的负载值和历史时刻的负载值预测未来时刻的负载值,例如:利用机器学习模型进行预测分析。
S202、根据各个数据节点未来时刻的负载值确定各个数据节点的负载是否均衡,若否,进入S203,若是,则进入S205。
在该步骤,通过计算任意两两数据节点之间的负载值之间差值,通过差值大小判断各个数据节点的负载是否均衡。
在一实施例中,当差值大于或者等于差值阈值的数据节点对的数量大于或者等于第一数量阈值时,则表示负载不均衡,当差值大于或者等于差值阈值的数据节点对的数量小于第一数量阈值时,则表示负载均衡。
例如:设定差值阈值为20%,数量阈值为2组,某两个数据节点之间负载值之间差值为30%,某两个数据节点之间负载值之间差值为25%,有2组数据节点的负载值的差值大于20%,则表示该分布式数据系统内数据节点的负载存在不均衡的情况。
S203、当根据各个数据节点未来时刻的负载值确定各个数据节点的负载不均衡时,从各个数据节点中选择至少一个负载值满足高负载运行条件的数据节点为转移节点,并从各个数据节点中选择至少一个负载值满足低负载运行条件的数据节点或者选择新增节点为目标节点。
在该步骤,在确定各个数据节点的负载不均衡时,则根据各个数据的负载值确定转移节点和目标节点。
作为其中一种实现方式,将负载值满足高负载运行条件的数据节点为转移节点,高负载运行条件包括负载值大于或等于第一负载阈值的节点。将负载值满足低负载运行条件的数据节点作为目标节点。低负载运行条件包括负载值小于第二负载阈值的节点。其中,第一负载阈值大于或等于第二负载阈值。
作为另一种实现方式,将负载值满足高负载运行条件的数据节点为转移节点,将分布式数据系统中新增节点作为目标节点。
S204、对至少一个转移节点内数据片进行再分片处理获得多个子数据片,并将子数据片转移到多个目标节点内。
在该步骤,在确定至少一个转移节点后,对每个转移节点内的数据片进行再分片处理,以获得数据量更小的子数据片。在将各个转移节点内数据片进行再分片后将子数据片转移到目标节点中。可以一个转移节点向多个目标节点转移子数据片,也可以一个转移节点向一个目标节点转移子数据片,转移节点和目标节点的对应关系此处不做限定。
S205、当根据各个数据节点在未来时刻的负载值确定各个数据节点的负载均衡时,继续判断负载值满足高负载运行条件的数据节点的数量是否大于或等于第一预设数量。
在该步骤,在判断各个数据节点的负载均衡时,各个数据节点的负载差值比较小。各个数据节点的负载值分布情况仅有三种情况,第一种情况是大部分数据节点的负载值比较大,第二种情况是大部分数据节点的负载值比较小,第三种情况是大部分数据节点的负载值居中。
统计负载值满足高负载运行条件的数据节点的数量,也就是统计负载值大于或者等于第一负载阈值的数据节点数量,并判断统计获得的数据节点的数量是否大于或者等于第一预设数量,以确定分布式数据系统中大部分数据节点是否处于高负载运行,也就是判断分布式数据系统中各个数据节点的负载是否符合第一种情况。
S206、若负载值满足高负载运行条件的数据节点的数量大于或者等于第一预设数量,则将所有数据节点上的部分数据片转移到新增节点上,并进入S207。
在该步骤,若判断分布式系统中大部分数据节点处于高负载运行,则将所有数据节点上的部分数据片转移到新增节点上,以对分布式系统进行扩容。
例如:分布式数据系统内设有4个数据节点,判断3个数据节点的高负载运行条件,则对分布式数据系统进行扩容。
在扩容时,可根据数据节点的负载情况确定增加的数据节点的数量,并根据新增数据节点的容量确定原来4个数据节点需要迁移的数据片。
S207、若负载值满足高负载运行条件的数据节点的数量小于第一预设数量,则继续判断负载值满足低负载运行条件的数据节点的数量是否大于或等于第二预设数量,若是,则进入S208,若否,则结束方法。
在该步骤中,若判断分布式系统中少部分数据节点处于高负载运行,也就是判断分布式系统中各个数据节点的负载分布不符合第一种情况时,则继续判断各个数据节点的负载分布是否符合第三情况,也就是统计负载值满足低负载运行条件的数据节点的数量,并判断统计获得的数据节点的数量是否大于或者等于第二预设数量,以确定分布式数据系统中大部分数据节点是否处于低负载运行。
S208、在确定负载值满足低负载运行条件的数据节点的数量大于或等于第二预设数量时,从负载值满足低负载运行条件的数据节点中选择缩容节点,并将缩容节点内数据片转移到其他负载值满足低负载运行条件的数据节点内。
在该步骤,若判断分布式系统中大部分数据节点处于低负载运行,则选从负载值满足低负载运行条件的数据节点中选择缩容节点。在选择缩容节点时,可以按照负载值从小到大的顺序选择缩容节点和转入节点,并根据缩容节点内数据片的大小、转入节点的数据片大小以及转入节点的各资源的容量确定向各个转入节点转入的数据片数量。
在上述技术方案中,在获得各个数据节点的负载值后,先判断各个数据节点的负载是否均衡,在不均衡时则对数据片进行再分片操作,降低不均衡节点中可调度的最小数据单元的大小,并将子数据片转移到其他节点内,以实现将热点数据片进一步打散分散化,以消除各个数据节点的负载不均衡的问题。在确定各个数据节点负载均衡时,再根据各数据节点的负载高低确定进行缩容或者扩容处理,以实现调节各个数据节点的负载。 通过上述步骤,可以调节由于高流量节点的负载增加而引起系统效率低的问题,也可以调节分布式数据系统所有数据节点的负载增加而引起系统效率低的问题。
本申请一实施例提供一种负载调节方法,该负载调节方法应用于管理节点,该负载调节方法包括:
S301、获取分布式数据系统中各个数据节点在未来时刻的负载值。
在该步骤,数据节点的负载值用数据节点内各资源的使用量和各资源的容量值的比值来表示。
更具体地,采用如下步骤计算各个数据节点的负载值:
S3001、获取数据节点的各资源的容量和各资源在未来时刻的使用量。
其中,数据节点的资源包括CPU、磁盘IO端口以及内存,根据数据节点内CPU、磁盘IO端口以及内存的配置情况获得CPU频率、磁盘IO端口的速率以及内存容量。
在获取CPU在未来时刻的使用率、磁盘IO端口在未来时刻的使用率以及内存在未来时刻的使用率时,可以根据当前时刻和历史时刻的CPU、磁盘IO端口以及内存的使用率进行预测,例如:使用机器学习模型进行预测。
在一实施例中,当数据节点提供联机事务处理过程(On-Line Transaction Processing,简称:OLTP)服务时,数据节点的资源包括磁盘IO端口和CPU,则获取数据节点内磁盘IO端口的速率和CPU频率,并获取数据节点内磁盘IO端口在未来时刻的使用率以及CPU在未来时刻的使用率。
在一实施例中,当数据节点提供联机分析处理(On-Line Analytical Processing,简称:OLAP)服务时,数据节点的资源包括内存,获取数据节点的内存容量和内存在未来时刻的使用率。
S3002、对数据节点的各资源的容量进行加权求和后获得数据节点的负载能力值。
其中,在获得CPU频率、磁盘IO端口的速率以及内存容量后,对CPU频率、磁盘IO端口的速率以及内存容量进行加权求和,以获得数据节点的整体负载能力值。
在一实施例中,对CPU频率、磁盘IO端口的速率以及内存容量进行加权求和之前,可以对CPU频率、磁盘IO端口的速率以及内存容量进行数量级调整处理,以将其数值调整到同一数量级,再进行加权求和。
S3003、对数据节点的各资源在未来时刻的使用量进行加权求和后获得数据节点在未来时刻的实际使用量。
其中,在获得在未来时刻的CPU、磁盘IO端口以及内存的使用率后,对在未来时刻的CPU、磁盘IO端口以及内存的使用率进行加权求和,以获得数据节点在未来时刻的实际使用量。
S3004、根据数据节点在未来时刻的实际使用量和负载能力值计算获得负载值。
其中,在获得数据节点在未来时刻的实际使用量和负载能力值时,计算实际使用量和负载能力值之间的比值,并将计算得到的比值作为数据节点的负载值。
在一实施例中,在计算实际使用量和负载能力值之间比值时,可以对实际使用量和 负载能力值进行数量级调整处理,以将其数值调整到同一数量级,再计算比值。S302、根据各个数据节点未来时刻的负载值确定各个数据节点的负载是否均衡,若否,进入S303,若是,则进入S305。
该步骤已经在上述实施例中详细说明,此处不再赘述。
S303、当根据各个数据节点未来时刻的负载值确定各个数据节点的负载不均衡时,从各个数据节点中选择至少一个负载值满足高负载运行条件的数据节点为转移节点,并从各个数据节点中选择至少一个负载值满足低负载运行条件的数据节点或者选择新增节点为目标节点。
该步骤已经在上述实施例中详细说明,此处不再赘述。
S304、对至少一个转移节点内数据片进行再分片处理获得多个子数据片,并将子数据片转移到多个目标节点内。
在该步骤中,若分布式数据系统中各个数据节点中负载出现不平衡时,需要将转移节点内数据片再分片,以获得更小的数据调度单元,并以更小的数据调度单元进行调度。
在一实施例中,如图4所示,为了保证在数据调度后各个数据节点的负载保持平衡,针对任意转移节点,采用如下的分片方案:
S4001、根据转移节点的负载值、转移节点的数据片大小、目标节点的负载值以及目标节点的数据片大小计算转移节点与任意目标节点之间的负载差值。
在该步骤中,使用目标节点的数据片大小和转移节点的数据片大小对目标节点的负载值进行调整,以获得调整后的目标节点的负载值。再基于调整后的目标节点的负载值和转移节点的负载值计算获得转移节点与目标节点之间的负载差值。
其中,根据第一公式计算转移节点与任意目标节点之间的负载差值,第一公式包括:
Figure PCTCN2022101385-appb-000003
其中,ΔQ ij表示转移节点i与任意目标节点j之间的负载差值,Q i表示转移节点i的负载值,R i表示转移节点的数据片大小,Q j表示目标节点的负载值,R j表示目标节点的数据片大小。
S4002、判断负载差值是否超过预设阈值α,若是则进入S4002,若否,则选择下一个目标节点。
其中,若转移节点i和目标节点j之间的负载差值ΔQ ij大于预设阈值α,则表示两个数据节点的负载不平衡,则可以将转移节点i内的数据片转移到目标节点j内。
若转移节点i和目标节点j之间的负载差值ΔQ ij小于或等于预设阈值,则表示两个数据节点的负载相平衡,则不考虑将转移节点i内的数据片转移到目标节点j内。
S4003、负载差值超过预设阈值α时,根据转移节点的负载值、转移节点的数据片大小、目标节点的负载值以及目标节点的数据片大小确定子数据片大小。
更具体地,再基于调整后的目标节点的负载值和转移节点的负载值计算获得转移节 点与目标节点之间的负载差值之后,再计算负载差值与目标节点和转移节点的总负载值之间的比值,并基于该比值和目标节点内数据片的大小对转移节点内数据片进行再分片处理。
其中,根据第二公式计算子数据片大小,其中,第二公式具体包括:
Figure PCTCN2022101385-appb-000004
其中,ΔR ij表示子数据片大小。
在计算子数据片大小和负载差值的公式中,利用转移节点i与目标节点j之间的数据片的比值调整目标节点j的负载值,可以减少由于两个节点内部存储数据片大小不同而造成的负载值不同的影响,再计算两个节点之间的负载差值,可以保证基于负载差值进行数据再分片处理和数据转移后,各个节点的负载均衡。
S4004、根据子数据片大小对转移节点内数据片进行再分片处理获得多个子数据片。
其中,在获得子数据片大小后,根据子数据片大小对转移节点i内数据片进行再分片,获得多个子数据片,并从中选择目标子数据片。目标子数据片的大小为ΔR ij,或者,目标子数据片的大小为ΔR ij/N,并将目标子数据片转移到目标节点j中。
S305、当根据各个数据节点在未来时刻的负载值确定各个数据节点的负载均衡时,继续判断负载值满足高负载运行条件的数据节点的数量是否大于或等于第一预设数量,若是,进入S306。
在该步骤,在确定各个数据节点的负载均衡时,则判断分布式数据系统中大部分数据节点是否处于高负载运行,也就是判断负载值满足高负载运行条件的数据节点的数量是否大于或等于第一预设数量。
S306、若负载值满足高负载运行条件的数据节点的数量大于或者等于第一预设数量,则将所有数据节点上的部分数据片转移到新增节点上,并进入S307。
在该步骤,若判断分布式数据系统中大部分数据节点在高负载运行时,则对分布式数据系统进行扩容,也就是计算各个数据节点需要转移的数据片大小,按照计算结果将各个数据节点上数据片转移到新增节点上。
S307、若负载值满足高负载运行条件的数据节点的数量小于第一预设数量,则继续判断负载值满足低负载运行条件的数据节点的数量是否大于或等于第二预设数量,若是,则进入S308,若否,则结束方法。
在该步骤中,若判断分布式数据系统中少部分数据节点在高负载运行,则继续判断分布式数据系统中大部分数据节点是否在低负载运行,若是,则对分布式数据系统进行缩容处理。
S308、在确定负载值满足低负载运行条件的数据节点的数量大于或等于第二预设数量时,从负载值满足低负载运行条件的数据节点中选择缩容节点,并将缩容节点内数据片转移到其他负载值满足低负载运行条件的数据节点内。
在该步骤中,在确定需要对分布式数据系统进行缩容处理,从负载值满足低负载运 行条件的数据节点中选择缩容节点和转入节点,并将缩容节点中数据片转移到转入节点。缩容节点和转入节点的数据转移关系可以根据节点内数据片大小确定。
在上述技术方案中,通过当前时刻和历史时刻的资源使用量预测未来时刻的资源使用量,再计算数据节点内各资源使用量和资源能力值之间的比值作为数据节点的负载值,由于各数据节点的资源能力不同,通过计算比值可以更加准确反应各个数据节点的负载情况。在此基础上,再基于转移数据节点和目标节点的负载值,以及转移数据节点和目标节点内数据片大小确定转移节点内数据片的切分策略,可以保证在将切分后的子数据片转移到目标节点后,数据节点之间负载保持均衡。
本申请一实施例提供一种负载调节方法,该负载调节方法应用于管理节点,该负载调节方法包括:
S401、获取分布式数据系统中各个数据节点在未来时刻的负载值。
其中,先用训练数据对预测模型进行训练,以获得已训练的预测模型。将数据节点的各资源在历史日中与未来时刻对应的历史时刻的使用量输入到已训练的预测模型中,以获取各个数据节点的各资源在未来时刻的使用量。
其中,例如:当前时刻是12月9日12点整,未来时刻是12月9日13点整到14点整之间的60个时刻,以分钟为最小单位,历史日中与未来时刻对应的历史时刻是指在12月8日13点整到14点整之间的60个时刻,12月9日13点整到14点整之间的60个时刻,依此类推。
反映各数据节点负载情况的指标的时间粒度越小,越能表征数据系统负载随时间变化的局部特征,预测越准确。由于受到数据采集窗口以及数据存储容量大小等客观条件的限制,一般从数据采集节点上提取到数据节点的各资源的使用量的最小时间粒度为1min,因此,本实施例中获取各数据节点的各资源在每分钟的使用量数据。
又分布式数据系统负载变化规律性较强,为了预测未来时刻的各资源的使用量,数据节点的各资源的使用量的变化较依赖于前几日对应时刻的各资源的使用量,还依赖于前几个时刻的各资源的使用量。
因此,需要使用前1天和前7天该分布式数据系统同时刻的资源使用量来预测今天对应时刻的资源使用量。
假设分布式数据系统中某一数据节点的资源使用率的非线性模型为:
y(k)=f(X(k))
其中,f(*)是非线性映射函数。y(k)表示当前时刻的数据节点的资源使用率,X(k)是由多个历史时刻的资源使用率构成向量,可以表示为(y1(k),y2(k),…,yn(k)),其中,n表示时间。
模型训练的任务是根据X(k)和y(k)确定非线性映射f(*),从而根据非线性映射f(*)对当前时刻和历史时刻的资源使用率进行预测,获得未来时刻资源使用率情况。
在对预测模型进行训练之前,先从历史数据中筛选出训练数据。反应分布式数据系统负载的主要指标值为CPU、磁盘IO端和内存,则可以周期性采集分布式数据系统中各个数据节点的CPU使用率、磁盘IO端口的使用率和内存使用率。在使用CPU使用率、磁盘IO端 口的使用率和内存使用率对模型进行训练。
例如:在确定非线性映射f(*)时,采集到某个节点前1天的CPU使用率是3600个值,前6天的CPU使用率是7*3600个值,前期会给定一个初始函数,来预测当前的CPU使用率,再与真实的CPU使用率进行对比,若有差异,再对初始函数的参数进行微调,如此反复,用大量的数据和大量反复,最后训练出一个函数,该函数也可以相对比较精准的预测CPU使用率。
目前有多种成熟的方法可以达到以上目的,本实施例选取了大规模可并行的XGBoost算法。将各资源使用率的历史数据作为XGBoost的输入,即用前1天和前7天数据节点在同时刻的负载情况作为输入。将数据节点在1分钟后的资源使用率作为输出,并且不断调优后得到最佳的XGBoost模型。将当前分布式数据系统各数据节点的实时资源使用率输入到训练好的XGBoost模型,以得到各节点的资源使用量的预测值。
在获得各数据节点的资源使用量的预测值后,计算数据节点的实际使用量。下面以数据节点的资源包括CPU、磁盘IO端口以及内存容量为例说明:
使用以下方法计算得到数据节点实际使用量q(i):
q(i)=k 1×q(f i)+k 2×q(v i)+k 3×q(m i)
其中,q(f i)表示数据节点i的CPU使用率、q(v i)表示数据节点i的磁盘IO端口的使用率、q(m i)表示数据节点i的内存使用,k 1、k 2和k 3表示权重值。
使用以下方法计算得到数据节点负载能力值p(i):
p(i)=k 1×c i×p(f i)+k 2×p(v i)+k 3×p(m i)
其中,c i表示数据节点i的CPU数量、p(f i)表示数据节点i的CPU频率、p(v i)表示数据节点i的磁盘IO端口的速率、p(m i)表示数据节点i的内存容量。
k 1、k 2和k 3表示权重值反映不同类型的接入业务对各个指标的影响程度。例如:OLTP业务主要影响分布式数据系统的IO和CPU,而OLAP业务则主要影响内存使用。在实际应用过程中,该权重参数可以不同的系统以及系统的运行情况进行调节,以期达到最佳的效果。
例如:在分布式系统处理OLTP业务时,k 1、k 2和k 3的比值是5:5:1。在分布式系统处理OLAP业务时,k 1、k 2和k 3的比值是1:1:5。
由于不同的数据节点具有不同的负载能力值,将数据节点的负载值定义为节点实际使用率与节点负载能力值的比值:
Figure PCTCN2022101385-appb-000005
其中,负载值Q(i)越大,说明数据节点负载越重。
在上述技术方案中,由于数据节点的各资源的使用量的变化较依赖于前几日对应时刻的各资源的使用量,使用与未来时刻对应的历史日中历史时刻和当前日中各个时刻的使用量预测未来时刻的使用量,可以提高预测准确性。从而可以根据预测得到的使用量准确预测未来时刻的负载值,并基于负载值确定负载调度策略,以维持各个数据节点的负载均衡。
S402、根据各个数据节点未来时刻的负载值确定各个数据节点的负载是否均衡,若 否,进入S403,若是,则进入S405。
其中,分布式数据系统是一个由多个组件构成的集群,即系统有多个节点。分布式数据库内建负载均衡机制,尽可能将业务负载均匀地分布到不同数据节点上,更好地利用上整体系统资源。然而,机制不是万能的,在一些场景下仍会有部分业务负载不能被很好地分散,影响性能,形成单点的过高负载,也称为热点节点。所以当发现集群的负载情况加剧时,不能简单的进行扩容操作来解决问题,先判断负载是否均衡,再基于判断结果确定进行热点打散还是扩容,否则就会造成资源浪费的情况。
在判断负载是否均衡时,先设定一个阈值ε,并依次轮询分布式数据系统中所有数据节点,确定节点候选集J。
更具体地,首先选取负载值最大的节点k,也就是节点k满足如下条件:
Q k=min(Q i),i=1,2,3…
依次轮询节点j,j=1,2,3…,将节点j的负载值与最大负载值进行比较,若节点j满足不等式Q j<Q k+ε,则表示两个节点负载均衡,将节点j加入到候选集J中,候选集J中节点用于进行扩容或者缩容处理。如果节点j满足不等式Q j>Q k+ε,则表示两个节点负载不均衡,需要对节点j进行热点打散。
在上述技术方案中,通过选择出最小负载值对应节点,将其他节点与最小负载值进行比较,若二者之间差值大于阈值时,则表示两个节点之间负载不均衡,则需要对该节点进行热点打散,若二者之间差值小于阈值时,则表示两个节点之间负载均衡,则需要进行扩容或缩容处理,通过如此设置,可以确定是否存在热点节点。
阈值ε的值可以根据需求确定,阈值ε越大,表示能容忍不同节点的负载差异越大,而阈值ε越小,则表示能容忍不同节点的负载差异越小,则会触发更多的热点节点打散。通常选取为20%,比较适中。
S403、当根据各个数据节点未来时刻的负载值确定各个数据节点的负载不均衡时,从各个数据节点中选择至少一个负载值满足高负载运行条件的数据节点为转移节点,并从各个数据节点中选择至少一个负载值满足低负载运行条件的数据节点或者选择新增节点为目标节点。
其中,在确定各数据节点的负载不均衡时,从各个数据节点中选择负载值超过第一负载阈值的数据节点作为转移节点,从各个数据节点中选择负载值小于第二负载阈值的数据节点作为目标节点。
S404、对至少一个转移节点内数据片进行再分片处理获得多个子数据片,并将子数据片转移到多个目标节点内。
其中,数据节点中数据是由多个数据片组成的,通常情况下数据片作为最小数据调度单元。在判断数据节点的负载不均衡时,需要对数据片进行切分,减少最少数据调度单元的大小,也就是从数据片切分为子数据片,子数据片的数据量小于数据片的数据量,再通过数据迁移操作将子数据片从转移节点迁移到一个或多个目标节点。
在确定需要将数据片进行切分时,需要设计一个热点打散的具体算法,用来确定把负载 过高的节点承担的计算任务分配到哪个负载较低的节点,也就是把热点节点上的数据片进行切分操作后,如何将切分后的数据片均衡地迁移到另外负载较低的数据节点上。
针对任意转移节点i,选择任意节点j,根据如下公式计算得到转移节点i的负载值和目标节点j的负载值之间的差值ΔQ ij
Figure PCTCN2022101385-appb-000006
其中,Qi和Qj分别是转移节点i和目标节点j的负载权值,Ri和Rj分别是数据节点i上的数据片的大小和数据节点j上的数据片的大小。
设置差值阈值为10%,若负载差值ΔQ ij大于差值阈值,则说明节点i的数据片可以往节点j迁移。
具体迁移的数据片的大小由以下方法计算得到:
Figure PCTCN2022101385-appb-000007
并根据迁移的数据片的大小对数据片进行切分,以获得多个子数据片,并从中选择目标子数据片,以使目标子数片的大小为ΔR ij或者ΔR ij/N。
S405、当根据各个数据节点在未来时刻的负载值确定各个数据节点的负载均衡时,继续判断负载值满足高负载运行条件的数据节点的数量是否大于或等于第一预设数量。
在该步骤,在确定各个数据节点的负载均衡时,则判断分布式数据系统中大部分数据节点是否处于高负载运行,也就是判断负载值满足高负载运行条件的数据节点的数量是否大于或等于第一预设数量。
S406、若负载值满足高负载运行条件的数据节点的数量大于或者等于第一预设数量,则将所有数据节点上的部分数据片转移到新增节点上,并进入S407。
在该步骤,若判断分布式数据系统中大部分数据节点在高负载运行时,则对分布式数据系统进行扩容。
S407、若负载值满足高负载运行条件的数据节点的数量小于第一预设数量,则继续判断负载值满足低负载运行条件的数据节点的数量是否大于或等于第二预设数量,若是,则进入S408,若否,则结束方法。
在该步骤中,若判断分布式数据系统中少部分数据节点在高负载运行,则继续判断分布式数据系统中大部分数据节点是否在低负载运行,若是,则对分布式数据系统进行缩容处理。
S408、在确定负载值满足低负载运行条件的数据节点的数量大于或等于第二预设数量时,从负载值满足低负载运行条件的数据节点中选择缩容节点,并将缩容节点内数据片转移到其他负载值满足低负载运行条件的数据节点内。
在该步骤中,从负载值满足低负载运行条件的数据节点中选择缩容节点和转入节点,并将缩容节点中数据片转移到转入节点。
在上述技术方案中,根据数据节点的各个资源的使用量和各资源的配置情况计算数 据节点的负载值,并基于负载值判断整体分布式数据系统的负载均衡情况。如果有某个数据节点的负载值大于其他数据节点,则需要对这个数据节点进行热点打散。如果负载是均衡的,但是系统各个数据节点的负载值都比较大,则需要对系统进行扩容操作。如果系统各个节点的负载值都比较小,则需要对系统进行缩容操作。通过如此设置,实现对分布式数据系统的负载调节。
如图5所示,本申请一实施例提供一种负载调节装置500,装置包括:
获取模块501,用于获取分布式数据系统中各个数据节点在未来时刻的负载值;
处理模块502,用于当根据各个数据节点未来时刻的负载值确定各个数据节点的负载不均衡时,从各个数据节点中选择至少一个负载值满足高负载运行条件的数据节点为转移节点,并从各个数据节点中选择至少一个负载值满足低负载运行条件的数据节点或者选择新增节点为目标节点;
处理模块502还用于对至少一个转移节点内多个数据片进行再分片处理获得多个子数据片,并将所述多个子数据片转移到至少一个目标节点内。
在一实施例中,处理模块502还用于:当根据各个数据节点在未来时刻的负载值确定各个数据节点的负载均衡时,继续判断负载值满足高负载运行条件的数据节点的数量是否大于或等于第一预设数量;若是,则将所有数据节点上的部分数据片转移到新增节点上。
在一实施例中,处理模块502还用于:若负载值满足高负载运行条件的数据节点的数量小于预设数量,则继续判断负载值满足低负载运行条件的数据节点的数量是否大于或等于第二预设数量;若是,从负载值满足低负载运行条件的数据节点中选择缩容节点,并将缩容节点内数据片转移到其他负载值满足低负载运行条件的数据节点内。
在一实施例中,处理模块502具体用于:针对任意转移节点,根据转移节点的负载值、转移节点的数据片大小、目标节点的负载值以及目标节点的数据片大小计算转移节点与任意目标节点之间的负载差值;
当负载差值超过预设阈值时,根据转移节点的负载值、转移节点的数据片大小、目标节点的负载值以及目标节点的数据片大小确定子数据片大小;
并根据子数据片大小对转移节点内数据片进行再分片处理获得多个子数据片。
在一实施例中,处理模块502具体用于:根据第一公式计算转移节点与任意目标节点之间的负载差值,其中,第一公式包括:
Figure PCTCN2022101385-appb-000008
其中,ΔQ ij表示转移节点i与任意目标节点j之间的负载差值,Q i表示转移节点i的负载值,R i表示转移节点的数据片大小,Q j表示目标节点的负载值,R j表示目标节点的数据片大小。
在一实施例中,处理模块502具体用于:根据第二公式计算子数据片大小,其中, 第二公式具体包括:
Figure PCTCN2022101385-appb-000009
其中,ΔR ij表示子数据片大小。
在一实施例中,处理模块502具体用于:针对每个数据节点,获取数据节点的各资源的容量和各资源在未来时刻的使用量;
对数据节点的各资源的容量进行加权求和后,获得数据节点的负载能力值;
对数据节点的各资源在未来时刻的使用量进行加权求和后,获得数据节点在未来时刻的实际使用量;
根据数据节点在未来时刻的实际使用量和负载能力值,计算获得负载值。
在一实施例中,处理模块502具体用于:当数据节点提供OLTP服务时,获取数据节点内磁盘IO端口的速率和CPU频率,并获取数据节点内磁盘IO端口在未来时刻的使用率以及CPU在未来时刻的使用率;
当数据节点提供OLAP服务时,获取数据节点的内存容量和内存在未来时刻的使用率。
如图6所示,本申请一实施例提供一种管理节点600,管理节点600包括存储器601和处理器602。
其中,存储器601用于存储处理器可执行的计算机指令;
处理器602在执行计算机指令时实现上述实施例中方法中的各个步骤。具体可以参见前述方法实施例中的相关描述。
可选地,上述存储器601既可以是独立的,也可以跟处理器602集成在一起。当存储器601独立设置时,该管理节点还包括总线,用于连接存储器601和处理器602。
本申请实施例还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机指令,当处理器执行计算机指令时,实现上述实施例中方法中的各个步骤。
本申请实施例还提供一种计算机程序产品,包括计算机指令,该计算机指令被处理器执行时实现上述实施例中方法中的各个步骤。
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求书指出。
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求书来限制。

Claims (10)

  1. 一种负载调节方法,其特征在于,所述方法应用于管理节点,所述方法包括:
    获取分布式数据系统中各个数据节点在未来时刻的负载值;
    当根据所述各个数据节点未来时刻的负载值确定所述各个数据节点的负载不均衡时,从所述各个数据节点中选择至少一个负载值满足高负载运行条件的数据节点为转移节点,并从所述各个数据节点中选择至少一个负载值满足低负载运行条件的数据节点或者选择新增节点为目标节点;
    对至少一个所述转移节点内多个数据片进行再分片处理获得多个子数据片,并将所述多个子数据片转移到至少一个所述目标节点内。
  2. 根据权利要求1所述的方法,其特征在于,在所述获取分布式数据系统中各个数据节点在未来时刻的负载值之后,方法还包括:
    当确定所述各个数据节点的负载均衡时,继续判断负载值满足所述高负载运行条件的数据节点的数量是否大于或等于第一预设数量;若是,则将所有所述数据节点上的部分数据片转移到所述新增节点上。
  3. 根据权利要求2所述的方法,其特征在于,方法还包括:
    若所述负载值满足所述高负载运行条件的数据节点的数量小于第一预设数量,则继续判断所述负载值满足所述低负载运行条件的数据节点的数量是否大于或等于第二预设数量;
    若是,从所述负载值满足所述低负载运行条件的数据节点中选择缩容节点,并将所述缩容节点内数据片转移到其他负载值满足所述低负载运行条件的数据节点内。
  4. 根据权利要求1至3中任意一项所述的方法,其特征在于,对至少一个所述转移节点内数据片进行再分片处理获得多个子数据片,具体包括:
    针对任意所述转移节点,根据所述转移节点的负载值、所述转移节点的数据片大小、所述目标节点的负载值以及所述目标节点的数据片大小计算所述转移节点与任意所述目标节点之间的负载差值;
    当所述负载差值超过预设阈值时,根据所述转移节点的负载值、所述转移节点的数据片大小、所述目标节点的负载值以及所述目标节点的数据片大小确定子数据片大小;并根据所述子数据片大小对转移节点内数据片进行再分片处理获得多个子数据片。
  5. 根据权利要求4所述的方法,其特征在于,根据所述转移节点的负载值、所述转移节点的数据片大小、所述目标节点的负载值以及所述目标节点的数据片大小计算所述转移节点与任意所述目标节点之间的负载差值,具体包括:
    根据第一公式计算所述转移节点与任意所述目标节点之间的负载差值,其中,所述第一公式包括:
    Figure PCTCN2022101385-appb-100001
    其中,ΔQ ij表示所述转移节点i与所述目标节点j之间的负载差值,Q i表示所述转移节点i的负载值,R i表示所述转移节点的数据片大小,Q j表示所述目标节点的负载值,R j表示所述目标节点的数据片大小。
  6. 根据权利要求4所述的方法,其特征在于,根据所述转移节点的负载值、所述转移节点的数据片大小、所述目标节点的负载值以及所述目标节点的数据片大小确定子数据片大小,具体包括:
    根据第二公式计算子数据片大小,其中,所述第二公式具体包括:
    Figure PCTCN2022101385-appb-100002
    其中,ΔR ij表示所述子数据片大小,Q i表示所述转移节点i的负载值,R i表示所述转移节点的数据片大小,Q j表示所述目标节点的负载值,R j表示所述目标节点的数据片大小。
  7. 根据权利要求1至3中任意一项所述的方法,其特征在于,所述获取分布式数据系统中各个数据节点在未来时刻的负载值,具体包括:
    针对每个所述数据节点,获取所述数据节点的各资源的容量和所述各资源在未来时刻的使用量;
    对所述数据节点的各资源的容量进行加权求和后,获得所述数据节点的负载能力值;
    对所述数据节点的各资源在未来时刻的使用量进行加权求和后,获得所述数据节点在未来时刻的实际使用量;
    根据所述数据节点在未来时刻的实际使用量和负载能力值,计算获得所述负载值。
  8. 根据权利要求7所述的方法,其特征在于,获取所述数据节点的各资源的容量和所述各资源在未来时刻的使用量,具体包括:
    当所述数据节点提供OLTP服务时,获取所述数据节点内磁盘IO端口的速率和CPU频率,并获取所述数据节点内磁盘IO端口在未来时刻的使用率以及CPU在未来时刻的使用率;
    当所述数据节点提供OLAP服务时,获取所述数据节点的内存容量和内存在未来时刻的使用率。
  9. 一种管理节点,其特征在于,包括:处理器,以及与所述处理器通信连接的存储器;
    所述存储器存储计算机执行指令;
    所述处理器执行所述存储器存储的所述计算机执行指令,以实现如权利要求1至8中任一项所述的负载调节方法。
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,所述计算机执行指令被处理器执行时用于实现如权利要求1至8任一项所述的负载调节方法。
PCT/CN2022/101385 2021-12-08 2022-06-27 负载调节方法、管理节点以及存储介质 WO2023103349A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111494350.4A CN114143326A (zh) 2021-12-08 2021-12-08 负载调节方法、管理节点以及存储介质
CN202111494350.4 2021-12-08

Publications (1)

Publication Number Publication Date
WO2023103349A1 true WO2023103349A1 (zh) 2023-06-15

Family

ID=80385718

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/101385 WO2023103349A1 (zh) 2021-12-08 2022-06-27 负载调节方法、管理节点以及存储介质

Country Status (2)

Country Link
CN (1) CN114143326A (zh)
WO (1) WO2023103349A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991580A (zh) * 2023-07-27 2023-11-03 上海沄熹科技有限公司 一种分布式数据库系统负载均衡的方法及装置

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114143326A (zh) * 2021-12-08 2022-03-04 深圳前海微众银行股份有限公司 负载调节方法、管理节点以及存储介质
CN114661247B (zh) * 2022-05-23 2022-09-20 武汉四通信息服务有限公司 自动扩容方法、装置、电子设备及存储介质
CN115629879B (zh) * 2022-10-25 2023-10-10 北京百度网讯科技有限公司 分布式模型训练的负载均衡方法和装置
CN115587222B (zh) * 2022-12-12 2023-03-17 阿里巴巴(中国)有限公司 分布式图计算方法、系统及设备
CN116600015B (zh) * 2023-07-18 2023-10-10 湖南快乐阳光互动娱乐传媒有限公司 一种资源节点调整方法、系统、电子设备及可读存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145393A (zh) * 2017-04-27 2017-09-08 努比亚技术有限公司 一种负载调整方法、设备及计算机可读存储介质
CN108829494A (zh) * 2018-06-25 2018-11-16 杭州谐云科技有限公司 基于负载预测的容器云平台智能资源优化方法
CN110377430A (zh) * 2019-07-24 2019-10-25 中南民族大学 数据迁移方法、设备、存储介质及装置
CN111581174A (zh) * 2019-02-18 2020-08-25 北京搜狗科技发展有限公司 基于分布式集群系统的资源管理方法及装置
US20200344290A1 (en) * 2019-03-18 2020-10-29 Reliance Jio Infocomm Limited Systems and methods for microservice execution load balancing in virtual distributed ledger networks
CN112738272A (zh) * 2021-01-12 2021-04-30 浙江工业大学 一种最小化网络时延的边缘节点负载均衡方法
CN114143326A (zh) * 2021-12-08 2022-03-04 深圳前海微众银行股份有限公司 负载调节方法、管理节点以及存储介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101201904B1 (ko) * 2010-11-18 2012-11-16 와이즈토드 피티이. 엘티디. 클라우드 컴퓨팅에서의 리소스 분배 장치 및 그 방법
CN102480502B (zh) * 2010-11-26 2014-10-01 联想(北京)有限公司 一种i/o负载均衡方法及i/o服务器
CN109669758A (zh) * 2018-09-11 2019-04-23 深圳平安财富宝投资咨询有限公司 服务器资源的调配方法、装置、设备及存储介质
CN110389813B (zh) * 2019-06-17 2023-07-28 东南大学 一种面向网络靶场的虚拟机动态迁移方法
CN112433858A (zh) * 2020-12-17 2021-03-02 济南浪潮数据技术有限公司 一种负载分配方法、装置、设备及可读存储介质
CN112817694A (zh) * 2021-02-02 2021-05-18 中国工商银行股份有限公司 分布式系统的自动负载均衡方法及装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145393A (zh) * 2017-04-27 2017-09-08 努比亚技术有限公司 一种负载调整方法、设备及计算机可读存储介质
CN108829494A (zh) * 2018-06-25 2018-11-16 杭州谐云科技有限公司 基于负载预测的容器云平台智能资源优化方法
CN111581174A (zh) * 2019-02-18 2020-08-25 北京搜狗科技发展有限公司 基于分布式集群系统的资源管理方法及装置
US20200344290A1 (en) * 2019-03-18 2020-10-29 Reliance Jio Infocomm Limited Systems and methods for microservice execution load balancing in virtual distributed ledger networks
CN110377430A (zh) * 2019-07-24 2019-10-25 中南民族大学 数据迁移方法、设备、存储介质及装置
CN112738272A (zh) * 2021-01-12 2021-04-30 浙江工业大学 一种最小化网络时延的边缘节点负载均衡方法
CN114143326A (zh) * 2021-12-08 2022-03-04 深圳前海微众银行股份有限公司 负载调节方法、管理节点以及存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991580A (zh) * 2023-07-27 2023-11-03 上海沄熹科技有限公司 一种分布式数据库系统负载均衡的方法及装置

Also Published As

Publication number Publication date
CN114143326A (zh) 2022-03-04

Similar Documents

Publication Publication Date Title
WO2023103349A1 (zh) 负载调节方法、管理节点以及存储介质
CN108829494B (zh) 基于负载预测的容器云平台智能资源优化方法
CN102694868B (zh) 一种集群系统实现及任务动态分配方法
CN104102543B (zh) 一种云计算环境中负载调整的方法和装置
CN106899660B (zh) 基于滚动灰色预测模型的云数据中心节能调度实现方法
CN110704542A (zh) 一种基于节点负载的数据动态分区系统
Fu et al. Layered virtual machine migration algorithm for network resource balancing in cloud computing
CN103595780B (zh) 基于消重的云计算资源调度方法
CN108196935B (zh) 一种面向云计算的虚拟机节能迁移方法
CN110347498B (zh) 一种容器和虚拟机混合云环境下的负载动态迁移方法
CN103023801B (zh) 一种基于流量特征分析的网络中间节点缓存优化方法
CN103294546A (zh) 多维度资源性能干扰感知的虚拟机在线迁移方法及系统
CN106775944A (zh) 云平台下基于文化‑多蚁群算法虚拟机整合的方法
CN115718644A (zh) 一种面向云数据中心的计算任务跨区迁移方法及系统
Jiang et al. Resource-utilization-aware task scheduling in cloud platform using three-way clustering
CN110597598B (zh) 一种云环境中的虚拟机迁移的控制方法
Jiang et al. An energy-aware virtual machine migration strategy based on three-way decisions
CN109976879B (zh) 一种基于资源使用曲线互补的云计算虚拟机放置方法
CN106598693B (zh) 一种基于延时策略的能耗及负载敏感的虚拟机整合方法
Ma et al. SE-PSO: resource scheduling strategy for multimedia cloud platform based on security enhanced virtual migration
CN110865871A (zh) 基于资源合理化应用的虚拟化集群资源调度方法
US20210004675A1 (en) Predictive apparatus and method for predicting workload group metrics of a workload management system of a database system
CN115941696A (zh) 异构大数据分布式集群存储优化方法
Fu et al. Imrp: a predictive partition method for data skew alleviation in spark streaming environment
CN115604269A (zh) 一种服务器的负载均衡方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22902785

Country of ref document: EP

Kind code of ref document: A1