CN112416888A - Dynamic load balancing method and system for distributed file system - Google Patents

Dynamic load balancing method and system for distributed file system Download PDF

Info

Publication number
CN112416888A
CN112416888A CN202011107475.2A CN202011107475A CN112416888A CN 112416888 A CN112416888 A CN 112416888A CN 202011107475 A CN202011107475 A CN 202011107475A CN 112416888 A CN112416888 A CN 112416888A
Authority
CN
China
Prior art keywords
data
node
data node
nodes
racks
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202011107475.2A
Other languages
Chinese (zh)
Other versions
CN112416888B (en
Inventor
陈世云
岑玉海
毛剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology Co Ltd
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 Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN202011107475.2A priority Critical patent/CN112416888B/en
Publication of CN112416888A publication Critical patent/CN112416888A/en
Application granted granted Critical
Publication of CN112416888B publication Critical patent/CN112416888B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • 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/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • 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

Abstract

The application discloses a dynamic load balancing method for a distributed file system, which comprises the following steps: acquiring a plurality of heartbeat packets provided by a plurality of data nodes, wherein the data nodes are nodes for data storage in the distributed file system; acquiring node load information of each data node at least based on the plurality of heartbeat packets; receiving a write request of a client; and in response to the write request: and selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, so as to interface the write-in task of the client through the plurality of target data nodes. In this embodiment, the heartbeat packet provides load-related information to select a suitable data node for writing, thereby ensuring the writing speed of the client.

Description

Dynamic load balancing method and system for distributed file system
Technical Field
The present application relates to the field of cloud data, and in particular, to a dynamic load balancing method and system for a distributed file system, a computer device, and a computer-readable storage medium.
Background
With the development and widespread use of computer and information technology, data has increased explosively. At present, the accumulated data is written and stored in the distributed file system, and the load balance of the distributed file system is ensured while the data is effectively utilized and processed, so that the method becomes one of research hotspots for the distributed file system.
The distributed file system includes a plurality of data nodes and a management node. The data nodes are responsible for storing, reading and writing real files, and the management node is responsible for distributing tasks to the data nodes for execution. Task allocation is one of the most fundamental and challenging issues for distributed file systems. When the scale of the distributed system is enlarged to a certain degree, because data are distributed on different data nodes, the frequency difference of data writing and reading is huge, and meanwhile, due to the configuration difference of each data node, the load deviation among the data nodes is increased and the load is unbalanced. When the management node allocates the write task to the client, the write task may be continuously allocated to the data node with high load, so that the data processing speed is reduced, and the overall write speed is affected.
Disclosure of Invention
An object of the embodiments of the present application is to provide a dynamic load balancing method, system, computer device and computer readable storage medium for a distributed file system, so as to solve the problems of slow writing speed and unbalanced load of the distributed file system.
One aspect of an embodiment of the present application provides a dynamic load balancing method for a distributed file system, where the method includes:
an aspect of an embodiment of the present application further provides a dynamic load balancing system for a distributed file system, including: acquiring a plurality of heartbeat packets provided by a plurality of data nodes, wherein the data nodes are nodes for data storage in the distributed file system; acquiring node load information of each data node at least based on the plurality of heartbeat packets; receiving a write request of a client; and in response to the write request: and selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, so as to interface the write-in task of the client through the plurality of target data nodes.
Optionally, the distributed file system includes a plurality of racks, each rack including one or more data nodes; selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, including: selecting an ith batch of data nodes from an ith group of racks, and selecting one data node from the ith batch of data nodes as an ith target data node according to node load information of each data node in the ith batch of data nodes; wherein: when i is 1, the first set of racks includes the plurality of racks, the first plurality of data nodes includes at least two data nodes in the plurality of racks, and the first target data node is used for storing a first data copy written by the client; when i is larger than or equal to 2, the ith group of racks comprises other racks except the racks where the first to ith target data nodes are located in the plurality of racks; the ith batch of data nodes comprise at least two data nodes in other racks, and the ith target data node is used for storing an ith data copy written by the client.
Optionally, the distributed file system includes a plurality of racks, each rack including one or more data nodes; selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, including: allocating a first plurality of data nodes from the plurality of racks; selecting one data node from the first data nodes as a first target data node; the first target data node is used for storing a first data copy written by the client; distributing a second batch of data nodes from other racks except the rack where the first data node is located in the plurality of racks; judging whether the second batch of data nodes are successfully distributed in other racks except the rack where the first data node is located; if the second batch of data nodes fails to be distributed from other racks except the rack where the first data node is located, then: distributing the second batch of data nodes in the rack where the first data node is located; selecting one data node from the second batch of data nodes as a second target data node; wherein the second target data node is configured to store a second copy of data written by the client.
Optionally, selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, further comprising: judging whether the first target data node and the second target data node are located in the same rack or not; if the first target data node and the second target data node are located in the same rack, distributing a third batch of data nodes from other racks except the rack where the first data node is located in the plurality of racks; judging whether the third batch of data nodes are successfully distributed from other racks except the rack where the first data node is located in the plurality of racks; if the third batch of data nodes fails to be distributed from other racks except the rack where the first data node is located in the plurality of racks, distributing the third batch of data nodes in the rack where the first data node is located; if the first target data node and the second target data node are not in the same rack, allocating the third batch of data nodes from the plurality of racks; selecting one data node from the third batch of data nodes as a third target data node; wherein the third target data node is configured to store a third copy of data written by the client.
Optionally, obtaining node load information of each data node at least based on the plurality of heartbeat packets includes: and calculating the node load information of each data node according to the heartbeat packet of each data node in the previous time window and the times of selecting the data node as a target data node in a plurality of continuous time windows.
Optionally, each heartbeat packet includes at least one parameter mean value of the corresponding data node in the previous time window; the at least one parameter mean comprises: an average of the input/output volume per second over the previous time window, an average of the time taken to issue the I/O request as a percentage of the total time over the previous time window, an average of the system load over the previous time window, and an average of the bandwidth over the previous time window.
Optionally, the node load information of each data node is equal to a weighted sum of each parameter mean value in the heartbeat packet of the corresponding data node and the selection number coefficient of the corresponding data node; the selection frequency coefficient is obtained according to the frequency of the corresponding data node selected as the target data node in a plurality of continuous time windows, and the weight value of each parameter mean value and the weight of the selection frequency coefficient are dynamically adjusted.
An aspect of an embodiment of the present application further provides a dynamic load balancing system for a distributed file system, including: the first acquisition module is used for acquiring a plurality of heartbeat packets provided by a plurality of data nodes, wherein the data nodes are nodes for data storage in the distributed file system; a second obtaining module, configured to obtain node load information of each data node based on at least the plurality of heartbeat packets; the receiving module is used for receiving a write-in request of a client; and a response module, configured to respond to the write request: and selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, so as to interface the write-in task of the client through the plurality of target data nodes.
An aspect of the embodiments of the present application further provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the dynamic load balancing method for a distributed file system as described above when executing the computer program.
An aspect of the embodiments of the present application further provides a computer-readable storage medium, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor, when executing the computer program, implements the steps of the dynamic load balancing method for a distributed file system as described above.
According to the dynamic load balancing method, the system, the equipment and the computer readable storage medium for the distributed file system, the load related information of each data node is obtained through the heartbeat packet, and the appropriate data node is selected for writing based on the load related information of each data node, so that the writing speed of the client is guaranteed. In addition, because the embodiment provides load related information in the form of heartbeat packets, the heartbeat time interval of the data nodes is small, and after the previous high-load data nodes finish processing the tasks, the load is reduced, the high-load data nodes can be continuously distributed and written into the tasks, so that the load deviation of the data nodes in the whole cluster is ensured to be kept in a small range, and the load balance is ensured.
Drawings
FIG. 1 is a diagram schematically illustrating an application environment of a dynamic load balancing method for a distributed file system according to an embodiment of the present application;
FIG. 2 is a flow chart schematically illustrating a dynamic load balancing method for a distributed file system according to a first embodiment of the present application;
FIG. 3 schematically shows another flowchart of a dynamic load balancing method for a distributed file system according to a first embodiment of the present application;
FIG. 4 is a flowchart schematically illustrating a dynamic load balancing method for a distributed file system according to a first embodiment of the present application;
FIG. 5 is a diagram illustrating sub-steps of step S206 in FIG. 2;
FIG. 6 is a diagram illustrating sub-steps of step S206 in FIG. 2;
FIG. 7 schematically illustrates an example reference graph for selecting a target data node;
FIG. 8 schematically illustrates a block diagram of a dynamic load balancing system for a distributed file system according to a second embodiment of the present application; and
fig. 9 schematically shows a hardware architecture diagram of a computer device suitable for implementing a dynamic load balancing method for a distributed file system according to a third embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the descriptions relating to "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present application.
In the description of the present application, it should be understood that the numerical references before the steps do not indicate the sequence of executing the steps, but merely serve to facilitate the description of the present application and to distinguish each step, and thus should not be construed as limiting the present application.
Fig. 1 schematically shows an environment application diagram of a dynamic load balancing method for a distributed file system according to an embodiment of the present application. The environment schematic includes a distributed file system and a client 400. The distributed file system includes a management node 200 and a plurality of data nodes (e.g., DataNodes 300-308).
The Distributed File System (Distributed File System) is an extensible master-slave Distributed File System.
And a management node (NameNode)200, which is responsible for storing the metadata information of the distributed file system and selecting the written data nodes for the client 400 and the like.
The data nodes (e.g., DataNodes 300-308) are responsible for storing, reading and writing real files.
A Client (e.g., Client 400) may access the distributed file system and write and store data into the distributed file system.
Services may be provided between the management node 200, the DataNodes 300-308, and the client 400 via one or more networks. The one or more networks include various network devices such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and/or the like. The one or more networks may include physical links, such as coaxial cable links, twisted pair cable links, fiber optic links, combinations thereof, and the like. The one or more networks may include wireless links, such as cellular links, satellite links, Wi-Fi links, and the like.
The inventor finds that, after the cluster size of the distributed file system is enlarged to a certain extent, because data are distributed on different datanodes, frequency difference of data writing/reading is huge, and meanwhile, configuration difference of each DataNode causes load deviation among the datanodes to be large, and when the management node 200 selects the DataNode for writing for a client, load difference among the datanodes is not balanced, so that a great amount of data are continuously written into the datanodes with higher load, and load of a single DataNode is too high, thereby causing write delay of a part of clients.
The present application aims to enable the management node 200 to select an appropriate data node for data writing based on the load condition of each data node, so as to avoid data processing speed delay caused by a high-load data node, and ensure the writing speed of the client 400.
Example one
Fig. 2 schematically shows a flowchart of a dynamic load balancing method for a distributed file system according to a first embodiment of the present application. It should be noted that the following description is exemplarily made with the management node 200 as an execution subject.
As shown in fig. 2, the dynamic load balancing method for a distributed file system may include steps S200 to S206, wherein:
in step S200, a plurality of Heartbeat packets (Heartbeat) provided by a plurality of data nodes are acquired.
The data nodes are nodes used for data storage in the distributed file system, such as DataNodes 300-308.
As opposed to only reporting the survival information, each heartbeat packet of this embodiment is also used to report the load related information of the corresponding data node. The Load-related information comprises IOPS, IOUtil, Load, BandWidth and the like. Wherein: (1) the IPOS (Input/Output Operations Per Second, Input/Output volume) is a performance parameter used for performance test of computer storage devices (such as hard disks, solid state disks, storage area networks, or the like). (2) IOUtil, which is the percentage of the total time taken to issue an I/O request, is used to indicate how busy a disk or the like is. (3) Load may be a system Load parameter of a hardware device such as a CPU. (4) BandWidth, which refers to the amount of data that can be transmitted in a unit time, is an important index for measuring the network performance. It should be understood that the above parameters are not intended to limit the present application. Other parameters such as the utilization rate of a disk and the like can be added according to needs.
In an exemplary embodiment, to smooth the calculated load values, filter spikes and spikes, each data node provides a corresponding heartbeat packet in a sliding time window. The time window refers to: the time window is divided into smaller time segments, each time segment passes, the time window slides to the right by one, and each time segment is provided with an independent counter, so that the calculated load value can be smoothed, and peaks and burrs can be filtered. Therefore, each heartbeat packet comprises at least one parameter mean value of the corresponding data node in the previous time window; the at least one parameter mean comprises: the mean of IOPS over the previous time window, the mean of IOUtil over the previous time window, the mean of Load over the previous time window, and the mean of BandWidth over the previous time window.
Taking the DataNode 302 as an example, the DataNode 302 may start a separate thread to collect IOPS, ioutl, Load, and BandWidth of itself, calculate an average value of each parameter in a sliding manner of a time window, and report the average value to the management node 200 through a heartbeat packet. For example, the DataNode 302 may have a time window of 6 minutes, and each heartbeat packet includes an IOPS mean, an IOUtil mean, a Load mean, and a BandWidth mean in the previous time window.
Step S202, obtaining node load information of each data node at least based on the plurality of heartbeat packets.
The management node 200 obtains the IOPS, the IOUtil, the Load, the BandWidth and the like uploaded by each data node by analyzing the plurality of heartbeat packets; and acquiring the node Load information of each data node based on the IOPS, IOUtil, Load, BandWidth and the like uploaded by each data node. The node load information may be a score value, and a higher score value represents a busy corresponding data node. As an example, the point value + IOPS + ioutl + Load + BandWidth + band is. The weighted value of each parameter can be dynamically adjusted according to different environments and requirements.
Considering that the data node load of the write will be increased due to the fact that the data written recently will be read, the management node 200 may take the number of writes of each data node in the recent period of time into consideration when selecting the data node. As shown in fig. 3, the step S202 can also be implemented by the step S300: and calculating the node load information of each data node according to the heartbeat packet of each data node in the previous time window and the times of selecting the data node as a target data node in a plurality of continuous time windows.
The node load information of each data node is equal to a weighted sum of each parameter mean value in the heartbeat packet of the corresponding data node and a selection number coefficient (e.g., a selection number mean value) of the corresponding data node. The selection frequency coefficient is obtained according to the frequency of the corresponding data node selected as the target data node in a plurality of continuous time windows, and the weight value of each parameter mean value and the weight of the selection frequency coefficient are dynamically adjusted.
The following description will be made by taking the DataNode 302 as an example:
(1) the DataNode 302 may provide a heartbeat packet every 6 minutes with a time window of 6 minutes.
(2) The management node 200 receives the heartbeat packet reported by the DataNode 302 to obtain the IOPS, ioutl, Load, and BandWidth of the DataNode 302.
(3) The management node 200 may select the 10 most recent and consecutive time windows, calculate the number of times the DataNode 302 is selected for docking writing in each time window, and calculate the mean of the number of selections according to the 10 time windows.
(4) The management node 200 may calculate the score value for the DataNode 302 as follows: IOPS + ioutl + Load + BandWidth + selection count average value.
In step S204, a write Request (Request) from the client is received.
The write request is for requesting that the management node 200 select a data node (i.e., a target data node) for which to write data.
Step S206, in response to the write request: and selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, so as to interface the write-in task of the client through the plurality of target data nodes.
After the management node 200 selects the target data nodes, the information of the target data nodes may be fed back to the client 400, so that the client 400 may write data into the target data nodes. Where each target data node is used to store a corresponding copy of the data written by client 400.
As an example, management node 200 may randomly assign data nodes to clients 400 according to a default selection policy. The default selection strategy is to select a target data node according to information such as the connection number of the data nodes.
For example, the management node 200 may also consider the overall load condition of the data node to achieve write balancing of the data node.
The dynamic load balancing method for the distributed file system in the embodiment of the application has the following technical advantages:
(1) in the prior art, when a management node allocates a write task to a client, the management node may continuously allocate the write task to a data node with a high load, so that the data processing speed is reduced, and the overall write speed is affected.
In this embodiment, load related information of each data node is obtained through the heartbeat packet, and a low-load DataNode is selected for writing based on the load related information of each data node, so that the high-load DataNode is prevented from being used for writing, and the writing speed of the client is guaranteed. Meanwhile, the DataNodes with lower loads are selected based on the load related information of each data node, so that the load condition of the whole data node is balanced, and the reading speed is guaranteed.
In addition, because the embodiment provides the load related information in the form of the heartbeat packet, the heartbeat time interval of the DataNode is small, the load is reduced after the previous high-load DataNode processes the task, the management node 200 can continue to be distributed and written into the task, and the load deviation of the DataNode in the whole cluster is ensured to be kept in a small range.
(2) In this embodiment, heartbeat packets based on a time window are adopted, and each heartbeat packet carries various parameter mean values of a previous time window, so that load values calculated more smoothly can be used for filtering peaks and burrs.
(3) In this embodiment, when selecting a data node, each data node can be taken into consideration within the latest selected number of times, so that the load condition of the whole data node is further balanced, and the writing speed and the reading speed are guaranteed.
(4) In this embodiment, the weights of the parameters may be dynamically adjusted in different time periods or under different environments, so as to further balance the load conditions of the entire data nodes under various conditions, and ensure the writing speed and the reading speed.
(5) In this embodiment, the stored file may be further divided into multiple copies in the distributed file system, and different copies are placed on the datanodes of different racks, so as to uniformly distribute the copies in the cluster, so that the file loss can be effectively prevented when part of the datanodes fail, and the reliability of the distributed file system is improved.
The distributed file system includes a plurality of chassis, each chassis including one or more data nodes. The management node 200 may obtain rack information of the multiple racks, and learn a network topology of the distributed file system through the rack information. The rack information refers to the distribution of data nodes in a machine room (for example, the datanodes 300 to 304 are in one rack, and the datanodes 306 to 308 are in another rack), and the nodes of the same rack share the same external facilities such as a switch and a power supply, so that the probability of collective failure is high. The rack information can be provided by the machine room operation and maintenance and input into the configuration file. The management node 200 loads the configuration file when the service is started.
In an exemplary embodiment, when the management node 200 is to select a plurality of data nodes for the client 400 to store a plurality of data copies, as shown in fig. 4, the step S206 may include steps S400 to S404, wherein: step S400, selecting an ith batch of data nodes from an ith group of racks, and selecting one data node from the ith batch of data nodes as an ith target data node according to node load information of each data node in the ith batch of data nodes. Wherein: when i is 1, the first set of racks includes the plurality of racks, the first plurality of data nodes includes at least two data nodes in the plurality of racks, and the first target data node is used for storing a first data copy written by the client; when i is larger than or equal to 2, the ith group of racks comprises other racks except the racks where the first to ith target data nodes are located in the plurality of racks; the ith batch of data nodes comprise at least two data nodes in other racks, and the ith target data node is used for storing an ith data copy written by the client. i is a positive integer, and the maximum value of i is determined by the number of data copies. In this embodiment, the respective data copies are distributed in different chassis of the distributed file system to improve data security.
In another exemplary embodiment, as shown in fig. 5, when the management node 200 is to select a plurality of data nodes for the client to store two copies of data, the step S206 may include steps S500 to S510, wherein: step S500, distributing a first batch of data nodes from the plurality of racks; step S502, selecting one data node from the first batch of data nodes as a first target data node; the first target data node is used for storing a first data copy written by the client; step S504, distributing a second batch of data nodes from other racks except the rack where the first data node is located in the plurality of racks; step S506, judging whether the second batch of data nodes are successfully distributed from other racks except the rack where the first data node is located; step S508, if the second batch of data nodes fails to be allocated from other racks except the rack where the first data node is located, then: distributing the second batch of data nodes in the rack where the first data node is located; step S510, selecting one data node from the second batch of data nodes as a second target data node; wherein the second target data node is configured to store a second copy of data written by the client.
When the management node 200 is to select a plurality of data nodes for the client to store three copies of data, as shown in fig. 6, the step S206 may further include steps S512 to S522, wherein: step S512, judging whether the first target data node and the second target data node are positioned in the same rack; step S514, if the first target data node and the second target data node are located in the same rack, allocating a third batch of data nodes from other racks of the plurality of racks except the rack where the first data node is located; step S516, judging whether the third batch of data nodes are successfully distributed from other racks except the rack where the first data node is located in the plurality of racks; step S518, if the third batch of data nodes fails to be allocated from the other racks except the rack where the first data node is located in the plurality of racks, allocating the third batch of data nodes in the rack where the first data node is located; step S520, if the first target data node and the second target data node are not in the same rack, allocating the third batch of data nodes from the plurality of racks; step S522, selecting one data node from the third batch of data nodes as a third target data node; wherein the third target data node is configured to store a third copy of data written by the client.
As shown in fig. 7, in order to make the present embodiment more clearly understood, a reference example is provided below.
S1: a write request is received from client 400.
Selecting a first target data node for writing a first copy of data:
s2: and randomly distributing two data nodes from all the data nodes of the distributed file system.
S3: according to the node load information of the two data nodes of step S1, the data node with the smaller load is selected as the first target data node (DataNode a). DataNode A is in a chassis a of a plurality of chassis in the distributed file system.
Selecting a second target data node for writing a second copy of the data:
s4: two data nodes are randomly allocated from other racks except the rack a in the plurality of racks.
S5: it is determined whether two data nodes are successfully allocated in step S4. If not, the process proceeds to step S6, otherwise, the process proceeds to step S7.
S6: two data nodes are again randomly allocated from rack a.
S7: according to the node load information of the two data nodes of S4 or step S6, the data node with the smaller load is selected as the second target data node (DataNodeB). The datanode a and DataNodeB are not the same data node.
S8: it is determined whether the number of data copies is greater than 2. If so, the process proceeds to step S9, otherwise, the data node selection operation is ended.
Selecting a third target data node for writing a third copy of data:
s9: it is determined whether the DataNodeB and the DataNodeB are located in the same rack (i.e., rack a). If so, the process proceeds to step S10, otherwise, the process proceeds to step S13.
S10: two data nodes are randomly allocated from other racks except the rack a in the plurality of racks.
S11: it is determined whether the allocation of step S10 succeeded. If not, go to step S12; if so, the process proceeds to step S13.
S12: two data nodes are again randomly allocated from rack a.
S13: and randomly distributing two data nodes from all the data nodes of the distributed file system.
S14: from the two data nodes obtained in step S10 or S12 or S13, the data node with the smaller load is selected as the third target data node (DataNodeC) according to the node load information of the two data nodes.
And in the same way, judging whether the number of the data copies is more than 3. If so, a fourth target data node (DataNodeD) is selected.
In this embodiment, in response to a write request from the client 400, the management node 200 combines the rack to randomly select several data nodes from the whole data node topology for comparison, and further efficiently and quickly select a suitable data node.
In addition, for the convenience of the user to check, the node load information, heartbeat package information and the like of each data node can be visually displayed through a JMX (Java Management Extensions) interface.
Example two
Fig. 8 is a block diagram schematically illustrating a dynamic load balancing system for a distributed file system according to a second embodiment of the present application, where the dynamic load balancing system for a distributed file system may be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to implement the second embodiment of the present application. The program modules referred to in the embodiments of the present application refer to a series of computer program instruction segments that can perform specific functions, and the following description will specifically describe the functions of the program modules in the embodiments.
As shown in fig. 8, the dynamic load balancing system 800 for a distributed file system may include, among others:
a first obtaining module 810, configured to obtain a plurality of heartbeat packets provided by a plurality of data nodes, where the plurality of data nodes are nodes used for data storage in the distributed file system.
A second obtaining module 820, configured to obtain node load information of each data node based on at least the plurality of heartbeat packets.
The receiving module 830 is configured to receive a write request from a client.
A response module 840 for, in response to the write request: and selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, so as to interface the write-in task of the client through the plurality of target data nodes.
In an exemplary embodiment, the distributed file system includes a plurality of chassis, each chassis including one or more data nodes. The response module 840 is further configured to: selecting an ith batch of data nodes from an ith group of racks, and selecting one data node from the ith batch of data nodes as an ith target data node according to node load information of each data node in the ith batch of data nodes; wherein: when i is 1, the first set of racks includes the plurality of racks, the first plurality of data nodes includes at least two data nodes in the plurality of racks, and the first target data node is used for storing a first data copy written by the client; when i is larger than or equal to 2, the ith group of racks comprises other racks except the racks where the first to ith target data nodes are located in the plurality of racks; the ith batch of data nodes comprise at least two data nodes in other racks, and the ith target data node is used for storing an ith data copy written by the client.
In an exemplary embodiment, the distributed file system includes a plurality of chassis, each chassis including one or more data nodes. The response module 840 is further configured to: : allocating a first plurality of data nodes from the plurality of racks; selecting one data node from the first data nodes as a first target data node; the first target data node is used for storing a first data copy written by the client; distributing a second batch of data nodes from other racks except the rack where the first data node is located in the plurality of racks; judging whether the second batch of data nodes are successfully distributed in other racks except the rack where the first data node is located; if the second batch of data nodes fails to be distributed from other racks except the rack where the first data node is located, then: distributing the second batch of data nodes in the rack where the first data node is located; selecting one data node from the second batch of data nodes as a second target data node; wherein the second target data node is configured to store a second copy of data written by the client.
In an exemplary embodiment, the response module 840 is further configured to: judging whether the first target data node and the second target data node are located in the same rack or not; if the first target data node and the second target data node are located in the same rack, distributing a third batch of data nodes from other racks except the rack where the first data node is located in the plurality of racks; judging whether the third batch of data nodes are successfully distributed from other racks except the rack where the first data node is located in the plurality of racks; if the third batch of data nodes fails to be distributed from other racks except the rack where the first data node is located in the plurality of racks, distributing the third batch of data nodes in the rack where the first data node is located; if the first target data node and the second target data node are not in the same rack, allocating the third batch of data nodes from the plurality of racks; selecting one data node from the third batch of data nodes as a third target data node; wherein the third target data node is configured to store a third copy of data written by the client.
In an exemplary embodiment, the second obtaining module 820 is configured to: and calculating the node load information of each data node according to the heartbeat packet of each data node in the previous time window and the times of selecting the data node as a target data node in a plurality of continuous time windows.
In an exemplary embodiment, each heartbeat packet includes at least one parameter mean of the respective data node in the previous time window; the at least one parameter mean comprises: an average of the input/output volume per second over the previous time window, an average of the time taken to issue the I/O request as a percentage of the total time over the previous time window, an average of the system load over the previous time window, and an average of the bandwidth over the previous time window.
In an exemplary embodiment, the node load information of each data node is equal to a weighted sum between each parameter mean value in the heartbeat packet of the corresponding data node and the selection coefficient of the corresponding data node; the selection frequency coefficient is obtained according to the frequency of the corresponding data node selected as the target data node in a plurality of continuous time windows, and the weight value of each parameter mean value and the weight of the selection frequency coefficient are dynamically adjusted.
EXAMPLE III
Fig. 9 schematically shows a hardware architecture diagram of a computer device 9 suitable for implementing a dynamic load balancing method for a distributed file system according to a third embodiment of the present application. The computer device 9 may act as the management node 200 or as a component of the management node 200. In the present embodiment, the computer device 9 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set or stored in advance. For example, the server may be a workstation, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers). As shown in fig. 9, the computer device 9 includes at least, but is not limited to: the memory 910, processor 920, and network interface 930 may be communicatively linked to each other via a system bus. Wherein:
the memory 910 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 910 may be an internal storage module of the computer device 9, such as a hard disk or a memory of the computer device 9. In other embodiments, the memory 910 may also be an external storage device of the computer device 9, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 9. Of course, the memory 910 may also include both internal and external memory modules of the computer device 9. In this embodiment, the memory 910 is generally used for storing an operating system installed in the computer device 9 and various application software, such as program codes of a dynamic load balancing method for a distributed file system. In addition, the memory 910 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 920 may be, in some embodiments, a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor, or other data Processing chip. The processor 920 is generally configured to control the overall operation of the computer device 9, such as performing control and processing related to data interaction or communication with the computer device 9. In this embodiment, the processor 920 is configured to execute program codes stored in the memory 910 or process data.
Network interface 930 may include a wireless network interface or a wired network interface, with network interface 930 typically being used to establish communication links between computer device 9 and other computer devices. For example, the network interface 930 is used to connect the computer device 9 with an external terminal through a network, establish a data transmission channel and a communication link between the computer device 9 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), or Wi-Fi.
It is noted that FIG. 9 only shows a computer device having components 910 and 930, but it is to be understood that not all of the shown components are required and that more or fewer components may be implemented instead.
In this embodiment, the dynamic load balancing method for the distributed file system stored in the memory 910 may also be divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 920) to implement the embodiments of the present application.
Example four
The present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the dynamic load balancing method for a distributed file system in the first embodiment.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device. Of course, the computer-readable storage medium may also include both internal and external storage devices of the computer device. In this embodiment, the computer-readable storage medium is generally used for storing an operating system and various types of application software installed in a computer device, for example, the program code of the dynamic load balancing method for the distributed file system in the embodiment, and the like. Further, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the present application described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different from that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
It should be noted that the above mentioned embodiments are only preferred embodiments of the present application, and not intended to limit the scope of the present application, and all the equivalent structures or equivalent flow transformations made by the contents of the specification and the drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present application.

Claims (10)

1. A method for dynamic load balancing for a distributed file system, the method comprising:
acquiring a plurality of heartbeat packets provided by a plurality of data nodes, wherein the data nodes are nodes for data storage in the distributed file system;
acquiring node load information of each data node at least based on the plurality of heartbeat packets;
receiving a write request of a client; and
in response to the write request: and selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, so as to interface the write-in task of the client through the plurality of target data nodes.
2. The method of dynamic load balancing for a distributed file system according to claim 1, wherein the distributed file system comprises a plurality of chassis, each chassis comprising one or more data nodes; selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, including:
selecting an ith batch of data nodes from an ith group of racks, and selecting one data node from the ith batch of data nodes as an ith target data node according to node load information of each data node in the ith batch of data nodes; wherein:
when i is 1, the first set of racks includes the plurality of racks, the first plurality of data nodes includes at least two data nodes in the plurality of racks, and the first target data node is used for storing a first data copy written by the client;
when i is larger than or equal to 2, the ith group of racks comprises other racks except the racks where the first to ith target data nodes are located in the plurality of racks; the ith batch of data nodes comprise at least two data nodes in other racks, and the ith target data node is used for storing an ith data copy written by the client.
3. The method of dynamic load balancing for a distributed file system according to claim 1, wherein the distributed file system comprises a plurality of chassis, each chassis comprising one or more data nodes; selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, including:
allocating a first plurality of data nodes from the plurality of racks;
selecting one data node from the first data nodes as a first target data node; the first target data node is used for storing a first data copy written by the client;
distributing a second batch of data nodes from other racks except the rack where the first data node is located in the plurality of racks;
judging whether the second batch of data nodes are successfully distributed in other racks except the rack where the first data node is located;
if the second batch of data nodes fails to be distributed from other racks except the rack where the first data node is located, then: distributing the second batch of data nodes in the rack where the first data node is located; and
selecting one data node from the second batch of data nodes as a second target data node; wherein the second target data node is configured to store a second copy of data written by the client.
4. The dynamic load balancing method for a distributed file system according to claim 3, wherein a plurality of target data nodes are selected from the plurality of data nodes according to the node load information of each data node, further comprising:
judging whether the first target data node and the second target data node are located in the same rack or not;
if the first target data node and the second target data node are located in the same rack, distributing a third batch of data nodes from other racks except the rack where the first data node is located in the plurality of racks;
judging whether the third batch of data nodes are successfully distributed from other racks except the rack where the first data node is located in the plurality of racks;
if the third batch of data nodes fails to be distributed from other racks except the rack where the first data node is located in the plurality of racks, distributing the third batch of data nodes in the rack where the first data node is located;
if the first target data node and the second target data node are not in the same rack, allocating the third batch of data nodes from the plurality of racks; and
selecting one data node from the third batch of data nodes as a third target data node; wherein the third target data node is configured to store a third copy of data written by the client.
5. The dynamic load balancing method for the distributed file system according to any one of claims 1 to 4, wherein obtaining node load information of each data node based on at least the plurality of heartbeat packets includes:
and calculating the node load information of each data node according to the heartbeat packet of each data node in the previous time window and the times of selecting the data node as a target data node in a plurality of continuous time windows.
6. The method of claim 5, wherein each heartbeat packet includes at least one parameter mean of the corresponding data node in the previous time window; the at least one parameter mean comprises: an average of the input/output volume per second over the previous time window, an average of the time taken to issue the I/O request as a percentage of the total time over the previous time window, an average of the system load over the previous time window, and an average of the bandwidth over the previous time window.
7. The dynamic load balancing method for the distributed file system according to claim 6, wherein the node load information of each data node is equal to a weighted sum of each parameter mean value in the heartbeat packet of the corresponding data node and a selection number coefficient of the corresponding data node; the selection frequency coefficient is obtained according to the frequency of the corresponding data node selected as the target data node in a plurality of continuous time windows, and the weight value of each parameter mean value and the weight of the selection frequency coefficient are dynamically adjusted.
8. A dynamic load balancing system for a distributed file system, comprising:
the first acquisition module is used for acquiring a plurality of heartbeat packets provided by a plurality of data nodes, wherein the data nodes are nodes for data storage in the distributed file system;
a second obtaining module, configured to obtain node load information of each data node based on at least the plurality of heartbeat packets;
the receiving module is used for receiving a write-in request of a client; and
a response module to, in response to the write request: and selecting a plurality of target data nodes from the plurality of data nodes according to the node load information of each data node, so as to interface the write-in task of the client through the plurality of target data nodes.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the computer program, is adapted to carry out the steps of the method for dynamic load balancing for a distributed file system according to any of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program which is executable by at least one processor to cause the at least one processor to perform the steps of the method for dynamic load balancing for a distributed file system according to any one of claims 1 to 7.
CN202011107475.2A 2020-10-16 2020-10-16 Dynamic load balancing method and system for distributed file system Active CN112416888B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011107475.2A CN112416888B (en) 2020-10-16 2020-10-16 Dynamic load balancing method and system for distributed file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011107475.2A CN112416888B (en) 2020-10-16 2020-10-16 Dynamic load balancing method and system for distributed file system

Publications (2)

Publication Number Publication Date
CN112416888A true CN112416888A (en) 2021-02-26
CN112416888B CN112416888B (en) 2024-03-12

Family

ID=74854642

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011107475.2A Active CN112416888B (en) 2020-10-16 2020-10-16 Dynamic load balancing method and system for distributed file system

Country Status (1)

Country Link
CN (1) CN112416888B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794660A (en) * 2023-02-06 2023-03-14 青软创新科技集团股份有限公司 Control method, device and system based on distributed program evaluation

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011140951A1 (en) * 2010-08-25 2011-11-17 华为技术有限公司 Method, device and system for load balancing
CN103152395A (en) * 2013-02-05 2013-06-12 北京奇虎科技有限公司 Storage method and device of distributed file system
US20150169612A1 (en) * 2013-12-18 2015-06-18 International Business Machines Corporation Dynamically adjusting the number of replicas of a file according to the probability that the file will be accessed within a distributed file system
CN104852857A (en) * 2014-02-14 2015-08-19 航天信息股份有限公司 Distributed data transmission method and system based on load balancing
CN105897499A (en) * 2015-12-07 2016-08-24 乐视云计算有限公司 Distributed storage system node state monitoring method, center code and system
CN106027647A (en) * 2016-05-20 2016-10-12 云南云电同方科技有限公司 LXPFS (Linux XProgram File System) cluster distributed file storage system
CN107172214A (en) * 2017-07-18 2017-09-15 广州华多网络科技有限公司 A kind of service node with load balancing finds method and device
CN109740037A (en) * 2019-01-02 2019-05-10 山东省科学院情报研究所 The distributed online real-time processing method of multi-source, isomery fluidised form big data and system
CN110035122A (en) * 2019-04-04 2019-07-19 科讯嘉联信息技术有限公司 A kind of load-balancing method based on dynamic probability model, device and system
CN110781156A (en) * 2019-09-20 2020-02-11 苏州浪潮智能科技有限公司 Data node distribution method, equipment and medium
CN111726415A (en) * 2020-06-30 2020-09-29 国电南瑞科技股份有限公司 TCP long connection load balancing scheduling method and system based on negative feedback mechanism

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011140951A1 (en) * 2010-08-25 2011-11-17 华为技术有限公司 Method, device and system for load balancing
CN103152395A (en) * 2013-02-05 2013-06-12 北京奇虎科技有限公司 Storage method and device of distributed file system
US20150169612A1 (en) * 2013-12-18 2015-06-18 International Business Machines Corporation Dynamically adjusting the number of replicas of a file according to the probability that the file will be accessed within a distributed file system
CN104852857A (en) * 2014-02-14 2015-08-19 航天信息股份有限公司 Distributed data transmission method and system based on load balancing
CN105897499A (en) * 2015-12-07 2016-08-24 乐视云计算有限公司 Distributed storage system node state monitoring method, center code and system
CN106027647A (en) * 2016-05-20 2016-10-12 云南云电同方科技有限公司 LXPFS (Linux XProgram File System) cluster distributed file storage system
CN107172214A (en) * 2017-07-18 2017-09-15 广州华多网络科技有限公司 A kind of service node with load balancing finds method and device
CN109740037A (en) * 2019-01-02 2019-05-10 山东省科学院情报研究所 The distributed online real-time processing method of multi-source, isomery fluidised form big data and system
CN110035122A (en) * 2019-04-04 2019-07-19 科讯嘉联信息技术有限公司 A kind of load-balancing method based on dynamic probability model, device and system
CN110781156A (en) * 2019-09-20 2020-02-11 苏州浪潮智能科技有限公司 Data node distribution method, equipment and medium
CN111726415A (en) * 2020-06-30 2020-09-29 国电南瑞科技股份有限公司 TCP long connection load balancing scheduling method and system based on negative feedback mechanism

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
万翔等: "分布式数据传输系统关键技术设计", 《舰船电子工程》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794660A (en) * 2023-02-06 2023-03-14 青软创新科技集团股份有限公司 Control method, device and system based on distributed program evaluation

Also Published As

Publication number Publication date
CN112416888B (en) 2024-03-12

Similar Documents

Publication Publication Date Title
EP3419247B1 (en) Method and device for storage resource allocation for video cloud storage
CN108683720B (en) Container cluster service configuration method and device
US7631034B1 (en) Optimizing node selection when handling client requests for a distributed file system (DFS) based on a dynamically determined performance index
CN107426274B (en) Method and system for service application and monitoring, analyzing and scheduling based on time sequence
CN111666159B (en) Load balancing control method and device, storage medium and electronic equipment
CN111522636B (en) Application container adjusting method, application container adjusting system, computer readable medium and terminal device
CN111478857B (en) Interface current limiting control method and device and electronic equipment
CN107656807B (en) Automatic elastic expansion method and device for virtual resources
CN109981702B (en) File storage method and system
CN112689007B (en) Resource allocation method, device, computer equipment and storage medium
CN111277640B (en) User request processing method, device, system, computer equipment and storage medium
CN112269661B (en) Partition migration method and device based on Kafka cluster
CN111831232A (en) Data storage method and device, storage medium and electronic device
CN111490963A (en) Data processing method, system, equipment and storage medium based on QUIC protocol stack
CN110515728B (en) Server scheduling method and device, electronic equipment and machine-readable storage medium
CN116467082A (en) Big data-based resource allocation method and system
CN112416888B (en) Dynamic load balancing method and system for distributed file system
CN112422450A (en) Computer equipment, and flow control method and device for service request
CN110347546B (en) Dynamic adjustment method, device, medium and electronic equipment for monitoring task
CN109257256A (en) Apparatus monitoring method, device, computer equipment and storage medium
CN115469980A (en) Product medium download task scheduling method and device and electronic equipment
CN112367384B (en) Kafka cluster-based dynamic speed limiting method and device and computer equipment
CN112463754B (en) Data node switching method and device in HDFS (Hadoop distributed File System) and computer equipment
CN114338535B (en) Zookeeper-based cluster current limiting method, system, equipment and storage medium
CN114328604B (en) Method, device and medium for improving cluster data acquisition capacity

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant