Data copy storage and access method and device of distributed system
By determining the weight value based on the state information of the physical node in a distributed system and combining logical partitions, the problems of load balancing and data replica security are solved, and efficient data recovery and resource utilization are achieved.
Patent Information
- Application Number
- CN202411466064.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2024-12-27
AI Technical Summary
In distributed systems, how to effectively utilize and process large amounts of data while ensuring load balancing and data replica security is a challenge.
By determining its weight value based on the status information of the physical nodes, combining physical nodes with different logical partitions into a placement group, and storing multiple shards of data replicas on the physical nodes of the same placement group to optimize load balancing and improve Security of data copy.
It improves the security of data replicas and the load balancing capability of distributed systems, while reducing the system's storage cost, ensuring data recovery speed and reasonable allocation of resources.
Smart Images

Figure CN119201002A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information processing technology, specifically to the field of artificial intelligence technology such as distributed storage, and more particularly to a data copy storage method and access method, device, electronic device, computer-readable storage medium and computer program product for a distributed system. Background Art
[0002] With the development, popularization and application of computer and information technology, data is growing explosively. Currently, the accumulated data is written and stored in distributed systems. How to effectively utilize and process this data while ensuring the load balancing of distributed systems and the security of data copies has become one of the research hotspots in distributed systems. Summary of the invention
[0003] The embodiments of the present disclosure propose a data copy storage method for a distributed system, a data copy access method, device, electronic device, computer-readable storage medium and computer program product for a distributed system, which improve the security of data copies and the load balancing capability of the distributed system.
[0004] In a first aspect, an embodiment of the present disclosure proposes a data replica storage method for a distributed system, comprising: determining a weight value of a physical node based on status information of the physical node in the distributed system, wherein the status information includes load information of the physical node; based on the weight value of the physical node, combining physical nodes belonging to different logical partitions in the distributed system into a placement group; and storing multiple shards of the data replica in physical nodes of the same placement group.
[0005] In the second aspect, an embodiment of the present disclosure proposes a method for accessing data copies of a distributed system, including: constructing an access list based on status information of physical nodes where multiple shards of the data copy are located, wherein the multiple shards are stored in the same placement group of the distributed system, and the placement group includes physical nodes belonging to different logical partitions in the distributed system; based on the arrangement order of the physical nodes in the access list, accessing the multiple shards of the data copy.
[0006] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: at least one processor; a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that when the at least one processor executes, it is able to implement the data copy storage method of a distributed system as described in any implementation method in the first aspect or the data copy access method of a distributed system as described in any implementation method in the second aspect.
[0007] In a fourth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, which are used to enable a computer to implement a data copy storage method for a distributed system as described in any implementation method in the first aspect or a data copy access method for a distributed system as described in any implementation method in the second aspect when executed.
[0008] In a fifth aspect, an embodiment of the present disclosure provides a computer program product comprising a computer program, which, when executed by a processor, can implement a data copy storage method for a distributed system as described in any implementation manner in the first aspect or a data copy access method for a distributed system as described in any implementation manner in the second aspect.
[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0011] Figure 1 is an exemplary system architecture in which the present disclosure may be applied;
[0012] Figure 2 A flowchart of an embodiment of a data copy storage method for a distributed system provided by an embodiment of the present disclosure;
[0013] Figure 3 A flowchart of another embodiment of a data copy storage method for a distributed system provided by an embodiment of the present disclosure;
[0014] Figure 4 A schematic diagram of updating the CPU idle rate of a physical node in a data replica storage method of a distributed system in an application scenario provided by an embodiment of the present disclosure;
[0015] Figure 5 A flowchart of another embodiment of a data copy storage method for a distributed system provided by an embodiment of the present disclosure;
[0016] Figure 6 A schematic diagram of a combined placement group of a data replica storage method for a distributed system in an application scenario provided by an embodiment of the present disclosure;
[0017] Figure 7 for Figure 6 Schematic diagram of the distribution of physical nodes in the placement group in the application scenario;
[0018] Figure 8 A schematic diagram of updating a placement group in a data replica storage method of a distributed system in an application scenario provided by an embodiment of the present disclosure;
[0019] Fig. 9 A schematic diagram of multiple shards for storing data copies in a data copy storage method of a distributed system in an application scenario provided by an embodiment of the present disclosure;
[0020] Fig.10 A schematic diagram of multiple shards for storing data copies in a data copy storage method of a distributed system in an application scenario provided by an embodiment of the present disclosure;
[0021] Fig.11 A flowchart of an embodiment of a data copy access method for a distributed system provided by an embodiment of the present disclosure;
[0022] Fig.12 A flowchart of another embodiment of a data copy access method for a distributed system provided by an embodiment of the present disclosure;
[0023] Fig.13 A schematic diagram of the structure of an embodiment of a data replica storage device for a distributed system provided by an embodiment of the present disclosure;
[0024] Fig.14 A schematic diagram of the structure of an embodiment of a data copy access device for a distributed system provided by an embodiment of the present disclosure;
[0025] Fig.15 A block diagram of an electronic device suitable for executing a data copy storage method or access method of a distributed system provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the embodiments in the present disclosure and the features in the embodiments may be combined with each other without conflict.
[0027] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0028] Figure 1An exemplary system architecture 100 is shown to which embodiments of the distributed system data copy storage method, distributed system data copy access method, apparatus, electronic device, and computer-readable storage medium of the present disclosure can be applied.
[0029] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0030] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various applications for realizing information communication between the terminal devices 101, 102, 103 and server 105 can be installed, such as distributed system data copy storage applications, distributed system data copy access applications, instant messaging applications, etc.
[0031] Terminal devices 101, 102, 103 and server 105 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc.; when terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here. When server 105 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server; when the server is software, it can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here.
[0032] The server 105 can provide various services through various built-in applications. Taking the data copy storage application that can provide a distributed system as an example, the server 105 can achieve the following effects when running the data copy storage application of the distributed system: determine the weight value of the physical node based on the status information of the physical node in the distributed system, where the status information includes the load information of the physical node; based on the weight value of the physical node, combine the physical nodes belonging to different logical partitions in the distributed system into a placement group; store multiple shards of the data copy in the physical nodes of the same placement group.
[0033] It should be noted that, in addition to being obtained from the terminal devices 101, 102, 103 through the network 104, the state information of the physical nodes can also be pre-stored in the server 105 in various ways. Therefore, when the server 105 detects that the data has been stored locally, it can choose to directly obtain the data locally. In this case, the exemplary system architecture 100 may also not include the terminal devices 101, 102, 103 and the network 104.
[0034] Since determining the state information of a physical node requires more computing resources and stronger computing power, the data copy storage method of a distributed system or the data copy access method of a distributed system provided in the subsequent embodiments of the present disclosure is generally executed by a server 105 having stronger computing power and more computing resources, and accordingly, the data copy storage or access device of the distributed system is generally also set in the server 105. However, it should also be pointed out that when the terminal devices 101, 102, and 103 also have computing power and computing resources that meet the requirements, the terminal devices 101, 102, and 103 can also complete the various operations assigned to the server 105 through the data copy storage application of the distributed system and the data copy access application of the distributed system installed thereon, and then output the same results as the server 105. Especially when there are multiple terminal devices with different computing capabilities, but the distributed system data copy storage application or the distributed system data copy access application determines that the terminal device has a stronger computing capability and more remaining computing resources, the terminal device can be allowed to perform the above operations, thereby appropriately reducing the computing pressure of the server 105. Correspondingly, the distributed system data copy storage or access device can also be set in the terminal devices 101, 102, and 103. In this case, the exemplary system architecture 100 may also not include the server 105 and the network 104.
[0035] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0036] Please refer to Figure 2 , Figure 2 This is a flow chart of a data copy storage method for a distributed system provided by an embodiment of the present disclosure, wherein process 200 includes the following steps:
[0037] Step 201: Determine a weight value of a physical node based on state information of the physical node in a distributed system, wherein the state information includes load information of the physical node.
[0038] In this embodiment, the execution subject of the data copy storage method of the distributed system (for example Figure 1 The server 105 shown in the figure determines the weight value of the physical node based on the state information of the physical node in the distributed system, which can optimize the load balancing capability of the distributed system. In a large-scale cluster scenario, taking a heterogeneous cluster as an example, the storage and computing performance of multiple physical nodes may be different. According to the storage and computing capabilities of the physical node and its weight value, the probability of the physical node taking over data is determined, which can optimize the load balancing capability of the distributed system and reduce the overall storage cost of the distributed system.
[0039] Step 202: Based on the weight values of the physical nodes, physical nodes belonging to different logical partitions in the distributed system are combined into a placement group.
[0040] In this embodiment, the above-mentioned execution entity uses the rack-aware strategy to combine the physical nodes belonging to different logical partitions in the distributed system into placement groups, thereby ensuring that each shard of the data copy can fall into different logical partitions, such as different racks, switches, computer rooms, regions, etc., to ensure the security of the data copy.
[0041] Step 203: Store multiple shards of the data replica in the physical nodes of the same placement group.
[0042] In this embodiment, based on step 202, the execution subject forms multiple placement groups by combining and dividing the physical nodes of different logical partitions, and stores multiple shards of the data replica on the physical nodes of the same placement group. This can reduce the probability of data replica loss due to failure of physical nodes under different logical partitions. In addition, in the case of multiple physical nodes failing at the same time, if these physical nodes do not belong to the same placement group, there is no possibility of all data replica shards being lost.
[0043] The data copy storage method of the distributed system provided by the embodiment of the present disclosure can reduce the probability of data copy loss caused by failure of physical nodes under different logical partitions. In other words, the data copy storage method of the distributed system provided by the embodiment of the present disclosure can determine the probability of a physical node taking over data based on the weight value of the physical node, and store each shard of the data copy in a different logical partition. Therefore, while ensuring the security of the data copy, the speed of system data recovery is improved, the load balancing capability of the system is optimized, and the overall storage cost of the system is reduced.
[0044] Further reference Figure 3 , which shows a process 300 of another embodiment of a data replica storage method for a distributed system according to the present disclosure. The training method includes the following steps:
[0045] Step 301: determine a weight value of a physical node based on state information of the physical node in a distributed system, wherein the state information includes load information of the physical node.
[0046] In this embodiment, the specific operation of step 301 is already Figure 2 In the illustrated embodiment, step 201 is introduced in detail and will not be repeated here.
[0047] Step 302: Dynamically update the state information of the physical node. In this embodiment, the state information of the physical node may be dynamically updated according to the dynamic multi-dimensional load capacity of the physical node.
[0048] In an optional implementation of this embodiment, the load information of the physical node may include: CPU idle rate, memory idle rate, disk idle rate and network idle rate, wherein the load information of the physical node may represent the storage and computing capacity when the node is completely idle. According to the storage and computing capacity of the physical node, the weight value of the physical node is determined, and based on the weight value of the physical node, the probability of the physical node taking over data is determined, so as to optimize the load balancing capacity of the distributed system.
[0049] For example, the state information of the physical node may be updated according to the dynamic changes of the network load in the distributed system. In addition, the state information of the physical node may be updated according to the dynamic changes of the memory load in the distributed system. Alternatively, the state information of the physical node may be updated according to the dynamic changes of the computing load in the distributed system. In addition, the state information of the physical node may be updated according to the dynamic changes of the disk load in the distributed system.
[0050] Furthermore, in some embodiments of the present disclosure, dynamically updating the status information of the physical node also includes: performing smoothing processing on the data set of CPU idle rate, the data set of memory idle rate, the data set of disk idle rate, and the data set of network idle rate within the update cycle.
[0051] Considering that the idle rate changes in real time, the noise has a great impact. For example, high-frequency fluctuations can cause oscillations in the distributed system. Therefore, in order to reduce the impact of noise in the real-time idle rate on the weight value of the physical node, the above-mentioned adjustment of the weight value of the physical node based on the minimum value of the updated CPU idle rate, memory idle rate, disk idle rate and network idle rate may include: performing smoothing processing on the data set of CPU idle rate, the data set of memory idle rate, the data set of disk idle rate and the data set of network idle rate within the update period; and determining the minimum value of the updated CPU idle rate, memory idle rate, disk idle rate and network idle rate based on the smoothed data set of CPU idle rate, memory idle rate, disk idle rate and network idle rate respectively.
[0052] As an option, the Simple Moving Average (SMA) method can be used to smooth the idle rate data set to remove short-term fluctuations, thereby facilitating the observation of long-term trends.
[0053] Figure 4 A schematic diagram of updating the CPU idle rate of a physical node in a data replica storage method of a distributed system in an application scenario provided by an embodiment of the present disclosure.
[0054] like Figure 4 As shown, taking the CPU idle rate of the physical node as an example, the exponentially weighted moving average of the CPU idle rate within the update cycle can be expressed by formula (1):
[0055] EWMA t = αx t +(1-α)EWMA t-1 (1)
[0056] Among them, EWMA t represents the exponentially weighted moving average of the CPU idle rate within the update period; α represents the smoothing factor, which can be between 0 and 1; x t Represents the true value of the CPU idle rate at time t; and EWMA t-1 Represents the exponentially weighted moving average of the CPU idle rate at time t-1.
[0057] The data sets with CPU idle rate in the update cycle include x1, x2, x3...x t For example, the smoothing factor α is selected as 0.3, and the calculation process can be expressed as follows:
[0058] EWMA1=αx1+(1-α)EWMA0
[0059] EWMA2=αx2+(1-α)EWMA1
[0060] EWMA3=αx3+(1-α)EWMA2
[0061] …
[0062] EWMA t = αx t +(1-α)EWMA t-1 (2)
[0063] When the initial value of the CPU idle rate is set to 50, the data points x1 = 55, x2 = 45, x3 = 50... t , after the smoothing factor α = 0.3, the effect is as follows Figure 3By smoothing the idle rate data, short-term fluctuations in the idle rate data set within the update cycle can be removed, making it easier to observe long-term trends, thereby reducing the impact of noise in the real-time idle rate on the weight value of the physical node.
[0064] Optionally, in some embodiments of the present disclosure, the state information of the physical node may be updated based on a predetermined period (e.g., a second predetermined period). Alternatively, the state information of the physical node may be updated based on the load information of the physical node satisfying a preset condition. By monitoring the load and resource usage of the physical node and determining its remaining resource amount, the weight value of the physical node may be dynamically adjusted based on these real-time status information of the physical node, thereby ensuring that the physical node with a larger weight value is not continuously overloaded and fully utilizing the resources of all physical nodes in the distributed system. Through real-time monitoring and inspection, the weight value of the physical node can be passively triggered to change, thereby realizing the redistribution of the probability of the physical node taking over data.
[0065] Step 303: Adjust the weight value of the physical node based on the updated state information of the physical node.
[0066] In this embodiment, the state information of the physical node can be dynamically updated according to the dynamic multi-dimensional load capacity of the physical node, and the weight value of the physical node can be adjusted based on the updated state information of the physical node. The weight value of the physical node can be dynamically adjusted according to at least one of the capacity, performance and current load of the physical node, thereby ensuring that the distribution of each shard of the data copy is reasonable and reducing the occurrence of physical node overload.
[0067] For example, the weight value of a physical node may be affected by the dynamic changes of the network load, and the product of the initial weight value of the physical node and the network idle rate may be used to characterize the degree to which the weight value of the physical node is affected by the dynamic changes of the network load. The weight value of a physical node may also be affected by the dynamic changes of the memory load, and the product of the initial weight value of the physical node and the memory idle rate may be used to characterize the degree to which the weight value of the physical node is affected by the dynamic changes of the memory load. The weight value of a physical node may also be affected by the dynamic changes of the computing load, and the product of the initial weight value of the physical node and the CPU idle rate may be used to characterize the degree to which the weight value of the physical node is affected by the dynamic changes of the computing load. The weight value of a physical node may also be affected by the dynamic changes of the disk load, and the product of the initial weight value of the physical node and the disk idle rate may be used to characterize the degree to which the weight value of the physical node is affected by the dynamic changes of the disk load.
[0068] After determining the impact of each of the above loads, the value that has the greatest impact on the weight of the physical node can be determined as the updated weight of the physical node based on the barrel principle. In other words, the weight of the physical node can be adjusted based on the minimum value of the updated CPU idle rate, memory idle rate, disk idle rate, and network idle rate.
[0069] By dynamically collecting the status information of physical nodes, such as CPU idle rate, memory idle rate, network idle rate, etc., and intelligently adjusting the weight value of each physical node based on the dynamically collected status information of physical nodes, more refined load balancing can be achieved. The weight value of the physical node is adjusted based on the actual load of the physical node.
[0070] In other words, based on the dynamic state information of the physical node, the weight value of the physical node can be adjusted. For example, a physical node with a high load will be assigned a lower weight value, while a physical node with a low load will be assigned a higher weight value. In addition, in response to the adjusted weight value of a physical node (e.g., a first physical node) being less than a first predetermined threshold, the first physical node may stop receiving shards of a data copy. This dynamic adjustment ensures the rational allocation and utilization of resources in a distributed system. The first predetermined threshold is set so that physical nodes that meet the conditions no longer continue to receive a large proportion of data, thereby avoiding the problem of data skew.
[0071] Step 304: Based on the updated weight values of the physical nodes, the physical nodes belonging to different logical partitions in the distributed system are grouped into placement groups.
[0072] In this embodiment, the specific operation of step 304 is already Figure 2 Step 202 is described in detail in the illustrated embodiment and will not be described again here.
[0073] In an optional implementation of this embodiment, the logical partition may include: at least one of: rack partition, switch partition, computer room partition and regional partition. By placing data replicas across logical partitions, the reliability and fault tolerance of data replica storage can be improved; the bandwidth consumption of data transmission across logical partitions can be reduced, and the read and write performance of data can be improved; in addition, the load between logical partitions can be balanced to reduce the risk of data loss caused by the failure of a single logical partition. According to the division of logical partitions, different physical nodes are selected in different logical partitions to form placement groups, which can tolerate overall failures at the logical partition level that are less than the number of shards in the data replica.
[0074] Step 305: Store multiple shards of the data replica in the physical nodes of the same placement group.
[0075] In this embodiment, the specific operation of step 305 is already Figure 2Step 203 is described in detail in the illustrated embodiment and will not be described again here.
[0076] In an optional implementation of this embodiment, multiple different selected placement group combinations can be randomly formed, wherein some of the multiple physical nodes can be distributed differently in different combinations. This can obtain the best distribution strategy for the shards of the data replica on the basis of ensuring the data recovery time.
[0077] Further reference Figure 5 , which shows a process 400 of another embodiment of a data replica storage method for a distributed system according to the present disclosure. The training method includes the following steps:
[0078] Step 401: determine a weight value of a physical node based on state information of the physical node in a distributed system, wherein the state information includes load information of the physical node.
[0079] In this embodiment, the specific operation of step 401 is already Figure 2 In the embodiment shown, step 201 or Figure 3 Step 301 is described in detail in the illustrated embodiment and will not be described again here.
[0080] Step 402, determining the required number of physical nodes in the placement group.
[0081] In this embodiment, the number of placement groups can be determined based on the number of multiple shards in the data replica and the number of physical nodes in the distributed system; the required number of physical nodes in the placement group can be determined based on the number of physical nodes in the distributed system and the number of placement groups. This can obtain the optimal distribution strategy for the shards of the data replica on the basis of ensuring data recovery time.
[0082] For example, taking the number of physical nodes in a distributed system as N and the number of multiple shards in a data copy as R, multiple rounds of calculations can be performed based on the number of multiple physical nodes N and the number of multiple shards R. In each round, the number of multiple physical nodes N is divided into N / R placement groups (Copysets) according to the number of multiple shards R. In each round, ensure that the distribution of the placement groups is not the same as the distribution of the placement groups generated in the current and all previous rounds. After determining multiple placement groups, select at least one placement group to store the data copy.
[0083] In addition, the copies of data on a disk will be scattered to other disks, and the number of disks corresponding to all these copies will be represented by Scatter width (S). The larger the Scatter width, the more nodes involved in data recovery and the faster the recovery speed. The recovery speed is positively correlated with the Scatter width. Therefore, when the recovery speed is fixed, the Scatter width (hash width) required for data recovery can be calculated. After each of the above rounds, S can be increased by R-1, and then the round P can be expressed as P=S / (R-1) times, and the number of placement groups K can be expressed as: K=P(N / R)=S(N / R) / (R-1).
[0084] Figure 6 A schematic diagram of a combined placement group of a data replica storage method for a distributed system in an application scenario provided by an embodiment of the present disclosure. Figure 7 for Figure 6 Schematic diagram of the distribution of physical nodes in a placement group in an application scenario.
[0085] like Figure 6 As shown, in this application scenario, the 9 physical nodes (Nodes) in the distributed system can be combined to form multiple placement groups (Copysets). The 9 physical nodes are Node1, Node2, Node3, Node4, Node5, Node6, Node7, Node8 and Node9. In combination mode 1, three placement groups can be formed, namely Copyset1, Copyset2 and Copyset3. Copyset1 may include Node1, Node7 and Node5; Copyset2 may include Node4, Node6 and Node9; and Copyset3 may include Node2, Node3 and Node8. In addition, based on the required number of physical nodes in the placement group, the above physical nodes can also be combined into other placement groups, such as combination mode 2. In combination mode 2, three placement groups can be formed, namely Copyset4, Copyset5 and Copyset6. Copyset4 may include Node2, Node7 and Node9; Copyset5 may include Node1, Node6 and Node3; and Copyset6 may include Node4, Node5 and Node8.
[0086] like Figure 7 As shown, after Figure 6In the process of combining placement groups shown in the figure, the physical node Node2 can be distributed in the placement group Copyset3 in combination mode 1; and can be distributed in the placement group Copyset4 in combination mode 2. In other words, the number of placement groups can be determined based on the number of multiple shards in the data copy and the number of physical nodes in the distributed system, and the required number of physical nodes in the placement group can be determined based on the number of physical nodes in the distributed system and the number of placement groups. After the required number of physical nodes in the placement group is determined, a plurality of different selected placement group combinations can be randomly formed, wherein the distribution of some of the multiple physical nodes in different combination modes can be different. This can obtain the optimal distribution strategy for the shards of the data copy on the basis of ensuring the data recovery time.
[0087] In addition, in the case of random placement, if a storage strategy of merging small files into large files is adopted, the number of small files on each disk can be controlled by controlling the size of large files. For example, if the large file is 100G, the maximum number of files stored on an 8T disk is 8T / 100G. In this way, the degree of data copy fragmentation or the scatter width required for data recovery can be controlled.
[0088] Step 403: Based on the required number of physical nodes in the placement group, physical nodes belonging to different logical partitions and having weight values distributed within a predetermined range are grouped into a placement group.
[0089] In this embodiment, after the required number of physical nodes in the placement group is determined, the physical nodes belonging to different logical partitions and having weight values distributed within a predetermined range may be combined into a placement group.
[0090] Specifically, according to the barrel principle, the storage capacity of a placement group depends on the physical node with the smallest storage capacity in the placement group. Therefore, in order to ensure that all physical nodes in the placement group can be fully utilized, physical nodes with weight values distributed within a predetermined range and as equal as possible weight values can be selected based on the physical nodes belonging to different logical partitions to form a placement group. For example, physical nodes with equal weight values and belonging to different logical partitions are combined into a placement group.
[0091] In some embodiments of the present disclosure, in order to optimize the load balancing capability of the distributed system and reduce the probability of data skew, the weight value of the placement group can be dynamically adjusted. Optionally, dynamically adjusting the weight value of the placement group may include: dynamically adjusting the weight value of the placement group based on a predetermined period (e.g., a first predetermined period); or dynamically adjusting the weight value of the placement group based on the remaining hash value of the physical node in the placement group being less than a first predetermined value, wherein the remaining hash value is used to characterize the number of times the physical node can participate in the placement group.
[0092] For example, based on the weight values of multiple physical nodes in the placement group, an initial value of the weight value of the placement group can be determined, and based on a predetermined period or based on the residual hash value of the physical node in the placement group being less than a first predetermined value, the weight value of the placement group can be dynamically adjusted. The weight value of the placement group can characterize the processing capacity of the placement group, so the placement group with a large weight value has a higher data placement rate. Periodically evaluating the weight value of the placement group and dynamically adjusting the weight value of the placement group can optimize the load balancing capability of the distributed system and reduce the probability of data skew.
[0093] In addition, in some embodiments of the present disclosure, based on the weight values of the physical nodes, combining physical nodes belonging to different logical partitions in a distributed system into placement groups may also include: removing physical nodes in the placement group whose remaining hash values are less than 0, and based on the remaining number of physical nodes in the placement group after the removal process is performed, adding physical node groups belonging to different logical partitions and whose weight values are distributed within a predetermined range into the placement group after the removal process is performed.
[0094] Specifically, when a physical node joins a placement group, the state information of the physical node can be initialized, and its logical partition tag, such as RackID, can be set according to the logical partition to which the physical node belongs. According to the state information of the physical node, its weight value, such as Base Weight, can be determined. In addition, the maximum hash value of the physical node can also be set according to the plan, where the maximum hash value determines the maximum number of physical nodes that can jointly recover the data of the physical node when the physical node fails, and the maximum hash value can represent the data recovery speed.
[0095] Figure 8 A schematic diagram of updating a placement group in a data replica storage method of a distributed system in an application scenario provided by an embodiment of the present disclosure.
[0096] like Figure 8 As shown, step 4031: when adding the physical node information to the small top heap (any placement group), the top heap can be sorted according to the remaining hash values, and the physical nodes with large remaining hash values are returned first to improve the resource utilization of the distributed system, and try to form the most idle physical nodes into a new placement group for data placement.
[0097] In addition, step 4032: the physical node with the smallest remaining hash value can also be taken out from the top heap, and other physical nodes can be found based on the physical node to form a new placement group. In the process of finding other physical nodes in step 4033, the RackIDs of other physical nodes can be required to be unequal, which ensures that other physical nodes come from different logical partitions and tolerates failures at the logical partition level. In addition, the remaining hash values of these other physical nodes can be greater than zero. In addition, the weight values of these other physical nodes can be distributed within a predetermined range with the weight value of the physical node with the smallest remaining hash value mentioned above. In other words, the weight values of the physical nodes constituting the placement group are as equal as possible. According to the wooden barrel principle, the storage capacity of the placement group depends on the physical node with the smallest storage capacity. Therefore, in order to ensure that all physical nodes in the placement group can be fully utilized, the weight values of the physical nodes constituting the placement group can be set to be distributed within a predetermined range.
[0098] Based on condition 4034: after the number of other physical nodes found and the number of remaining physical nodes in the placement group, the number of shards in the data replica is satisfied, step 4035 can be executed. Step 4035: End the process of finding other physical nodes in step 4033, and reduce the remaining hash value of each physical node in the placement group by 1. After that, step 4036 can be executed to add the placement group combined by executing the above process to the top heap.
[0099] The placement group provided by the embodiment of the present disclosure can be dynamically expanded and shrunk horizontally. For the dynamic expansion and contraction of the placement group, the placement group can be deleted and reorganized while ensuring that the combination of non-related placement groups remains unchanged. For example, in the process of taking out the physical node with the smallest remaining hash value from the top heap and searching for other physical nodes to form a new placement group, only the placement group related to the physical node with the smallest remaining hash value can be deleted and reorganized.
[0100] For the physical nodes that have formed the placement group, the remaining hash value of the physical node can be obtained through reverse calculation. During the horizontal shrinking process, only the placement group related to the physical node to be deleted can be cleared. Based on the remaining number of physical nodes in the relevant placement group after the elimination process, the physical node groups belonging to different logical partitions and with weight values distributed within a predetermined range are added to the placement group after the elimination process. During the horizontal expansion process, the remaining hash values of all physical nodes can be obtained through reverse calculation, and the physical nodes whose remaining hash values meet the requirements are brought into the calculation process, the physical nodes that meet the conditions are determined, and these physical nodes are combined into new placement groups.
[0101] Step 404: store multiple shards of the data replica in the physical nodes of the same placement group.
[0102] In this embodiment, the specific operation of step 404 is already in Figure 2In the embodiment shown, step 203 or Figure 3 Step 304 is described in detail in the illustrated embodiment and will not be repeated here.
[0103] also, Fig. 9 A schematic diagram of multiple shards for storing data copies in a data copy storage method of a distributed system in an application scenario provided by an embodiment of the present disclosure.
[0104] like Fig. 9 As shown, in an optional implementation of the present embodiment, based on the weight values of the physical nodes, the physical nodes belonging to different logical partitions in the distributed system are combined into placement groups, and multiple shards of data copies are stored in the physical nodes of the same placement group, thereby covering fault domain failures at all levels; and dynamic planning of placement groups is implemented to support dynamic horizontal expansion and contraction of placement groups; in addition, physical node weight values and placement group weight values are introduced to support application scenarios of heterogeneous clusters.
[0105] Specifically, physical nodes belonging to different logical partitions in the distributed system may be grouped into placement groups according to the division of the logical partitions. Fig. 9 The distributed system shown may include three logical partitions, namely logical partition 1, logical partition 2 and logical partition 3, wherein the physical node NodeA is from logical partition 1; the physical nodes NodeB and NodeD are from logical partition 2; and the physical nodes NodeC and NodeE are from logical partition 3. Based on the weight values of these physical nodes, the physical nodes belonging to different logical partitions in the distributed system and whose weight values are distributed in a predetermined range are combined into placement groups. For example, NodeA, NodeB and NodeC can be combined into placement group 1; NodeA, NodeD and NodeE can be combined into placement group 2. The multiple shards of the data replica may include shards 1, 2, 3, 4 and 5. Taking shard 2 as an example, it can be stored in NodeA, NodeB and NodeC of placement group 1, and taking shard 4 as an example, it can be stored in NodeA, NodeD and NodeE of placement group 2. Therefore, only when NodeA, NodeB and NodeC or NodeA, NodeD and NodeE fail at the same time, will all shards of the data replica be lost. However, the physical nodes in the above placement groups all come from different logical partitions, and can tolerate overall failures at the logical partition level that are less than the number of shards of data copies, greatly reducing the risk of data loss when physical nodes in different logical partitions fail.
[0106] In addition, for the distribution of data replicas, the overall capacity of the placement group depends on the physical node with the weakest internal capacity, so the probability of data being located in placement group 1 is higher.
[0107] Fig.10 A schematic diagram of multiple shards for storing data copies in a data copy storage method of a distributed system in an application scenario provided by an embodiment of the present disclosure.
[0108] like Fig.10 As shown, in some embodiments of the present disclosure, the data placement rate of the placement group with a large weight value is high. Optionally, the data placement rate P is proportional to the placement group weight value CW, and inversely proportional to the greatest common divisor GCD (CW1, CW2, ... CWn) of the weight values of all physical nodes in the placement group. Specifically, the relationship between the three can be expressed by formula (3):
[0109]
[0110] Wherein, P is the data placement rate; CW is the placement group weight value; and GCD (CW1, CW2, ... CWn) is the greatest common divisor of the weight values of all physical nodes in the placement group.
[0111] Fig.10 The Shuffle shown refers to the process of repartitioning the shards of data copies. Slot refers to a data structure used to store data copies. Optionally, Solt is defined based on the above-mentioned data placement rate P, so that the Solt attribute carries the characteristics of the placement group (Copyset). When selecting the data placement position and allocating the data shard Slot, the placement group corresponding to the data shard can be determined. The data placement rate P determines the number of Slots corresponding to the placement group. For example, the number of Slots corresponding to Copyset1 is P1=3; the number of Slots corresponding to Copyset2 is P2=2; the number of Slots corresponding to Copyset3 is P3=1. Shullte all Copyset slots, and take the slots for the incoming data shards in turn for allocation, ensuring that all slots have the opportunity to be allocated. The probability control of this allocation method is more precise.
[0112] Therefore, the data copy storage method of the distributed system provided by the embodiment of the present disclosure determines the probability of a physical node taking over data based on the weight value of the physical node, and stores each shard of the data copy in a different logical partition. While ensuring the security of the data copy, it improves the speed of system data recovery, optimizes the system's load balancing capability, and reduces the overall storage cost of the system.
[0113] refer to Fig.11 , Fig.11 A flowchart of a data copy access method of a distributed system provided in an embodiment of the present disclosure, wherein process 500 includes the following steps:
[0114] Step 501: construct an access list based on the status information of the physical nodes where multiple shards of the data replica are located, wherein the multiple shards are stored in the same placement group of the distributed system, and the placement group includes physical nodes belonging to different logical partitions in the distributed system.
[0115] Since the features described in the data copy storage method of the distributed system above involve content that can be fully or partially applied to the "multiple shards are stored in the same placement group of the distributed system, and the placement group includes physical nodes belonging to different logical partitions in the distributed system" in step 501 described here, the related or similar content will not be repeated. However, it can be understood by those skilled in the art that the multiple shards of the data copy in the data copy access method of the distributed system are stored in the physical nodes described in the data copy storage method of the distributed system above, so the characteristics, implementation principles and technical effects of step 501 can be similar to those of the data copy storage method of the distributed system.
[0116] In some optional implementations of this embodiment, in the access list, the physical nodes of the shards located in the same logical partition as the access client are arranged before the physical nodes of the shards located in different logical partitions from the access client. In addition, when the shards of the same-region data replica are unavailable, the shards of the cross-region data replica are selected to ensure high availability of data.
[0117] In addition, in some embodiments of the present disclosure, in the access list, the physical nodes in the access list may be arranged in ascending order according to the number of waiting requests of the physical nodes. As an option, in the access list, the physical nodes in the access list may be arranged in descending order according to the size of the historical access success rate of the physical nodes. In addition, in the access list, the physical nodes in the access list may be arranged in ascending order according to the size of the historical access delay value of the physical nodes.
[0118] Step 502: Access multiple shards based on the order of arrangement of the physical nodes in the access list.
[0119] In this embodiment, by establishing an access list, the user can access the physical nodes in the access list in sequence. When an access exception occurs, the user can select the physical nodes in the access list in sequence for retrying.
[0120] Further reference Fig.12 , which shows a process 600 of another embodiment of the data copy access method of the distributed system according to the present disclosure. The process 600 includes the following steps:
[0121] Step 601: construct an access list based on status information of physical nodes where multiple shards of a data copy are located, wherein the multiple shards are stored in the same placement group of a distributed system, and the placement group includes physical nodes belonging to different logical partitions in the distributed system.
[0122] In this embodiment, the specific operation of step 601 is already Fig.11 In the illustrated embodiment, step 501 is introduced in detail and will not be repeated here.
[0123] Step 602: Update the order of the physical nodes in the access list.
[0124] In this embodiment, based on the arrangement order of the physical nodes in the access list, before accessing multiple shards, the arrangement order of the physical nodes in the access list may be updated.
[0125] Specifically, a placement group includes multiple shards of a data replica, so by accessing a placement group, the data shards stored on its physical nodes can be obtained. By establishing an access list, users can access the physical nodes in the access list in sequence. When an access exception occurs, the physical nodes in the access list can be selected in sequence for retry. Therefore, the order of the physical nodes in the access list determines the access order of the client. As an option, when accessing the shards of a data replica, the order of the physical nodes in the access list can be rearranged to ensure that the best access service can be provided, and in the event of an access failure, the access operation can be restored and completed again as soon as possible.
[0126] In addition, in the process of reordering the physical nodes in the access list according to the access policy to optimize the access performance, the order may be based on the priority of the following policies:
[0127] For example, updating the arrangement order of the physical nodes in the access list may include: in the access list, arranging the physical nodes of the shards in the same logical partition as the access client before the physical nodes of the shards in different logical partitions from the access client. Giving priority to the shards of the data replicas in the same logical partition as the request source can reduce network latency and the cost of cross-regional data transmission. In addition, when the shards of the data replicas in the same region are unavailable, the shards of the cross-regional data replicas are selected to ensure high availability of data.
[0128] In addition, in some embodiments of the present disclosure, updating the arrangement order of the physical nodes in the access list may include: arranging the physical nodes in the access list in ascending order according to the number of waiting requests for the physical nodes. Prioritizing the selection of shards of data replicas with fewer current waiting requests can reduce access delays and balance the load in the distributed system.
[0129] As an option, updating the arrangement order of the physical nodes in the access list may include: arranging the physical nodes in the access list in descending order according to the historical access success rates of the physical nodes. Prioritizing the shards of the data replicas with higher historical access success rates can improve the reliability of access.
[0130] In addition, updating the arrangement order of the physical nodes in the access list may include: arranging the physical nodes in the access list in ascending order according to the historical access delay values of the physical nodes. Preferentially selecting shards of data replicas with lower historical access delays can reduce access response time.
[0131] In addition, updating the arrangement order of the physical nodes in the access list may also include: balancing the access requests of each placement group as much as possible, reducing the probability of access bottlenecks caused by accessing only a single placement group. Take the distributed system including three placement groups A, B and C as an example, and placement groups A, B and C store fragments of the same data copy. The arrangement order of the physical nodes in the access list is to access the physical nodes of placement groups A, B and C in sequence in the initial state. If it is found that the access to the physical node in placement group A fails during the access process, the arrangement order of the physical nodes in the access list can be rearranged when accessing the fragments of the data copy to ensure that the best access service can be provided, and in the case of access failure, it can be restored as soon as possible and the access operation can be completed again. For example, it is adjusted to access the physical nodes of placement groups B, C and A in sequence, so that the fragments of the data copy can be obtained from other placement groups as soon as possible, reducing the impact of access failure.
[0132] Step 603: Access multiple shards based on the order of arrangement of the physical nodes in the access list.
[0133] In this embodiment, the specific operation of step 603 is already Fig.11 Step 502 is described in detail in the illustrated embodiment and will not be described again here.
[0134] Further references Fig.13 The present disclosure provides an embodiment of a data replica storage device for a distributed system. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0135] like Fig.13As shown, the data replica storage device 700 of the distributed system of this embodiment may include a weight determination module 701, a placement group acquisition module 702, and a data storage module 703. The weight determination module 701 is configured to determine the weight value of the physical node based on the state information of the physical node in the distributed system, wherein the state information includes the load information of the physical node; the placement group acquisition module 702 is configured to combine the physical nodes belonging to different logical partitions in the distributed system into a placement group based on the weight value of the physical node; the data storage module 703 is configured to store multiple shards of the data replica in the physical nodes of the same placement group.
[0136] In this embodiment, in the data replica storage device 700 of the distributed system, the specific processing of the weight determination module 701, the placement group acquisition module 702, and the data storage module 703 and the technical effects thereof can be referred to in Figure 2 The relevant descriptions of steps 201 - 203 in the corresponding embodiment are not repeated here.
[0137] In some optional implementations of this embodiment, the placement group acquisition module 702 includes: a combining unit configured to combine physical nodes belonging to different logical partitions and having weight values distributed within a predetermined range into a placement group based on the required number of physical nodes in the placement group.
[0138] In some optional implementations of this embodiment, the placement group acquisition module 702 also includes: a first quantity obtaining unit, configured to determine the number of placement groups based on the number of physical nodes in the distributed system of multiple shards; a second quantity obtaining unit, configured to determine the required number of physical nodes in the placement group based on the number of physical nodes in the distributed system and the number of placement groups.
[0139] In some optional implementations of the present embodiment, the data storage module 703 may include: an initial value obtaining unit, configured to determine the initial value of the weight value of the placement group based on the weight values of multiple physical nodes in the placement group; a placement group weight value adjustment unit, configured to dynamically adjust the weight value of the placement group; and a placement group determination unit, configured to store multiple shards in the placement group with the largest weight value after dynamic adjustment.
[0140] In some optional implementations of the present embodiment, the placement group weight value adjustment unit may include: a first response subunit, configured to dynamically adjust the weight value of the placement group based on a first predetermined period; or a second response subunit, configured to dynamically adjust the weight value of the placement group based on the remaining hash value of the physical nodes in the placement group being less than a first predetermined value, wherein the remaining hash value represents the remaining number of times the physical node can participate in the placement group.
[0141] In some optional implementations of the present embodiment, the placement group acquisition module 702 may further include: a removal unit, configured to remove physical nodes whose remaining hash values are less than 0 in the placement group; and a supplement unit, configured to supplement physical node groups belonging to different logical partitions and whose weight values are distributed within a predetermined range into the placement group after the removal process is performed, based on the remaining number of physical nodes in the placement group after the removal process is performed.
[0142] In some optional implementations of this embodiment, the logical partition may include: at least one of: rack partition, switch partition, computer room partition and regional partition.
[0143] In some optional implementations of this embodiment, the weight determination module 701 may include: an update unit configured to dynamically update the status information of the physical node; and a physical node weight value adjustment unit configured to adjust the weight value of the physical node based on the updated status information of the physical node.
[0144] In some optional implementations of this embodiment, the load information of the physical node includes: CPU idle rate, memory idle rate, disk idle rate and network idle rate.
[0145] In some optional implementations of this embodiment, the physical node weight value adjustment unit may include: a selection subunit configured to adjust the weight value of the physical node based on the minimum value of the updated CPU idle rate, memory idle rate, disk idle rate and network idle rate.
[0146] In some optional implementations of the present embodiment, the physical node weight value adjustment unit may further include: a smoothing processing subunit, configured to perform smoothing processing on the data set of CPU idle rate, the data set of memory idle rate, the data set of disk idle rate, and the data set of network idle rate within the update period; a minimum value determination subunit, configured to determine the minimum value of the updated CPU idle rate, memory idle rate, disk idle rate, and network idle rate based on the smoothed data set of CPU idle rate, the data set of memory idle rate, the data set of disk idle rate, and the data set of network idle rate, respectively.
[0147] In some optional implementations of this embodiment, the update unit may include: a periodic response subunit, configured to update the status information of the physical node based on a second predetermined period; or a preset condition response subunit, configured to update the status information of the physical node based on the load information of the physical node satisfying a preset condition.
[0148] In some optional implementations of this embodiment, the data copy storage device 700 of the distributed system also includes a stop receiving module, which is configured to stop the first physical node from receiving shards in response to the adjusted weight value of the first physical node being lower than a first predetermined threshold.
[0149] Further references Fig.14 The present disclosure provides an embodiment of a data copy access device for a distributed system. Fig.11 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0150] like Fig.14 As shown, the data copy access device 800 of the distributed system of this embodiment may include: an access list construction module 801, configured to construct an access list based on the status information of the physical nodes where the multiple shards of the data copy are located, wherein the multiple shards are stored in the same placement group of the distributed system, and the placement group includes physical nodes belonging to different logical partitions in the distributed system; an access module 802, configured to access the multiple shards based on the arrangement order of the physical nodes in the access list.
[0151] In this embodiment, the specific processing of each module in the data copy access device 800 of the distributed system and the technical effects brought by it can be referred to respectively. Fig.11 The relevant descriptions of steps 501-502 in the corresponding embodiment are not repeated here.
[0152] In some optional implementations of this embodiment, the data copy access device 800 of the distributed system also includes an update module, which is configured to update the arrangement order of physical nodes in the access list before accessing multiple shards based on the arrangement order of physical nodes in the access list.
[0153] In some optional implementations of this embodiment, the update module includes: a first update unit, configured to arrange in the access list the physical nodes of the shards located in the same logical partition as the access client before the physical nodes of the shards located in different logical partitions as the access client.
[0154] In some optional implementations of this embodiment, the update module further includes: a second update unit configured to arrange the physical nodes in the access list in ascending order according to the number of waiting requests of the physical nodes.
[0155] In some optional implementations of this embodiment, the update module further includes: a third update unit configured to arrange the physical nodes in the access list in descending order according to the historical access success rates of the physical nodes.
[0156] In some optional implementations of this embodiment, the updating module further includes: a fourth updating unit configured to arrange the physical nodes in the access list in ascending order according to the historical access delay values of the physical nodes.
[0157] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that when the at least one processor executes, the data copy storage method of the distributed system or the data copy access method of the distributed system described in any of the above embodiments can be implemented.
[0158] According to an embodiment of the present disclosure, the present disclosure also provides a readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to implement the data copy storage method of a distributed system or the data copy access method of a distributed system described in any of the above embodiments when executed.
[0159] According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, which, when executed by a processor, can implement the data copy storage method of a distributed system or the data copy access method of a distributed system described in any of the above embodiments.
[0160] Fig.15 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0161] like Fig.15 As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0162] A number of components in the device 600 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0163] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as a data copy storage method for a distributed system or a data copy access method for a distributed system. For example, in some embodiments, a data copy storage method for a distributed system or a data copy access method for a distributed system may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the data copy storage method for a distributed system or the data copy access method for a distributed system described above may be executed. Alternatively, in other embodiments, the computing unit 901 may be configured to execute a data copy storage method for a distributed system or a data copy access method for a distributed system in any other appropriate manner (eg, by means of firmware).
[0164] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0165] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0166] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0167] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0168] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0169] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.
[0170] According to the technical solution of the embodiment of the present disclosure, the probability of data copy loss caused by failure of physical nodes under different logical partitions can be reduced. Specifically, by combining and dividing the physical nodes of different logical partitions to form multiple placement groups, and storing multiple fragments of data copies on physical nodes of the same placement group, when multiple physical nodes fail at the same time, if these physical nodes do not belong to the same placement group, then there is no possibility of all data copy fragments being lost. In other words, the data copy storage method of the distributed system provided by the embodiment of the present disclosure can determine the probability of a physical node taking over data based on the weight value of the physical node, and store each fragment of the data copy in a different logical partition. Therefore, while ensuring the security of the data copy, the speed of system data recovery is improved, the load balancing capability of the system is optimized, and the overall storage cost of the system is reduced.
[0171] In addition, according to the technical solution of the embodiment of the present disclosure, the placement group includes multiple shards of the data replica, so by accessing the placement group, the data shards stored on its physical nodes can be obtained. By establishing an access list, the user can access the physical nodes in the access list in sequence. When an access exception occurs, the physical nodes in the access list can be selected in sequence for retry.
[0172] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0173] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A data copy storage method for a distributed system, comprising: Determine a weight value of the physical node based on state information of the physical node in the distributed system, wherein the state information includes load information of the physical node; Based on the weight values of the physical nodes, physical nodes belonging to different logical partitions in the distributed system are combined into placement groups; The multiple shards of the data replica are stored in the physical nodes of the same placement group.
2. The storage method according to claim 1, wherein: Combining physical nodes belonging to different logical partitions in the distributed system into placement groups based on weight values of the physical nodes includes: Based on the required number of the physical nodes in the placement group, the physical nodes belonging to the different logical partitions and having weight values distributed within a predetermined range are combined into the placement group.
3. The storage method according to claim 2, wherein: The required number of the physical nodes in the placement group is determined based on the following steps: Determining the number of the placement groups based on the number of the plurality of shards and the number of the physical nodes in the distributed system; Based on the number of the physical nodes in the distributed system and the number of the placement groups, a required number of the physical nodes in the placement groups is determined.
4. The storage method according to claim 1, wherein: The physical nodes storing the multiple shards of the data replica in the same placement group include: Determining an initial value of the weight value of the placement group based on the weight values of the plurality of physical nodes in the placement group; Dynamically adjusting the weight value of the placement group; The plurality of shards are stored in a placement group having a maximum dynamically adjusted weight value.
5. The storage method according to claim 4, wherein: Dynamically adjusting the weight value of the placement group includes: Based on a first predetermined period, dynamically adjust the weight value of the placement group; or Based on the remaining hash value of the physical node in the placement group being less than a first predetermined value, the weight value of the placement group is dynamically adjusted, wherein the remaining hash value represents the remaining number of times the physical node can participate in the placement group.
6. The storage method according to claim 5, wherein: Based on the weight values of the physical nodes, combining the physical nodes belonging to different logical partitions in the distributed system into placement groups further includes: Eliminate the physical nodes whose remaining hash values in the placement group are less than 0; Based on the remaining number of the physical nodes in the placement group after the elimination process is performed, the physical node groups belonging to the different logical partitions and having weight values distributed in a predetermined range are added to the placement group after the elimination process is performed.
7. The storage method according to claim 1, wherein: The logical partition includes: at least one of: rack partition, switch partition, computer room partition and regional partition.
8. The storage method according to claim 1, wherein: Also includes: Dynamically update the status information of the physical node; Based on the updated state information of the physical node, the weight value of the physical node is adjusted.
9. The storage method according to claim 8, wherein: The load information of the physical node includes: CPU idle rate, memory idle rate, disk idle rate and network idle rate.
10. The storage method according to claim 9, wherein: Adjusting the weight value of the physical node based on the updated state information of the physical node includes: The weight value of the physical node is adjusted based on the updated minimum value among the CPU idle rate, the memory idle rate, the disk idle rate, and the network idle rate.
11. The storage method according to claim 10, wherein: Also includes: Performing smoothing processing on the data set of the CPU idle rate, the data set of the memory idle rate, the data set of the disk idle rate, and the data set of the network idle rate within an update period; Based on the smoothed data set of the CPU idle rate, the data set of the memory idle rate, the data set of the disk idle rate and the data set of the network idle rate, respectively, determine the minimum value of the updated CPU idle rate, the memory idle rate, the disk idle rate and the network idle rate.
12. The storage method according to claim 8, wherein: Dynamically updating the state information of the physical node includes: Based on a second predetermined period, updating the state information of the physical node; or Based on the load information of the physical node satisfying a preset condition, the state information of the physical node is updated.
13. The storage method according to claim 8, wherein: The method further comprises: In response to the adjusted weight value of the first physical node being lower than a first predetermined threshold, the first physical node stops receiving the slice.
14. A method for accessing data copies in a distributed system, comprising: Building an access list based on state information of physical nodes where multiple shards of the data replica are located, wherein the multiple shards are stored in the same placement group of the distributed system, and the placement group includes the physical nodes belonging to different logical partitions of the distributed system; Based on the arrangement order of the physical nodes in the access list, multiple shards are accessed.
15. The access method according to claim 14, wherein: Also includes: Before accessing the plurality of shards based on the arrangement order of the physical nodes in the access list, the arrangement order of the physical nodes in the access list is updated.
16. The access method according to claim 15, wherein: Updating the arrangement order of the physical nodes in the access list includes: In the access list, the physical nodes of the slices located in the same logical partition as the access client are arranged before the physical nodes of the slices located in different logical partitions as the access client.
17. The access method according to claim 15, wherein: Updating the arrangement order of the physical nodes in the access list further includes: The physical nodes in the access list are arranged in ascending order according to the number of waiting requests of the physical nodes.
18. The access method according to claim 15, wherein: Updating the arrangement order of the physical nodes in the access list further includes: The physical nodes in the access list are arranged in descending order according to the historical access success rates of the physical nodes.
19. The access method according to claim 15, wherein: Updating the arrangement order of the physical nodes in the access list further includes: The physical nodes in the access list are arranged in ascending order according to the historical access delay values of the physical nodes.
20. A data replica storage device for a distributed system, comprising: A weight determination module, configured to determine a weight value of the physical node based on state information of the physical node in the distributed system, wherein the state information includes load information of the physical node; a placement group acquisition module configured to combine physical nodes belonging to different logical partitions in the distributed system into a placement group based on the weight values of the physical nodes; The data storage module is configured to store multiple fragments of the data replica in the physical nodes of the same placement group.
21. The storage device according to claim 20, wherein: The placement group acquisition module includes: The combining unit is configured to combine the physical nodes belonging to the different logical partitions and having weight values distributed within a predetermined range into the placement group based on the required number of the physical nodes in the placement group.
22. The storage device according to claim 21, wherein: The placement group acquisition module also includes: A first quantity obtaining unit is configured to determine the number of the placement groups based on the number of the plurality of shards and the number of the physical nodes in the distributed system; The second quantity obtaining unit is configured to determine a required quantity of the physical nodes in the placement group based on the quantity of the physical nodes in the distributed system and the quantity of the placement groups.
23. The storage device according to claim 20, wherein: The data storage module comprises: an initial value obtaining unit, configured to determine an initial value of the weight value of the placement group based on the weight values of the plurality of physical nodes in the placement group; a placement group weight value adjustment unit, configured to dynamically adjust the weight value of the placement group; The placement group determination unit is configured to store the plurality of shards into a placement group with the largest dynamically adjusted weight value.
24. The storage device according to claim 23, wherein: The placement group weight value adjustment unit includes: A first response subunit is configured to dynamically adjust the weight value of the placement group based on a first predetermined period; or The second response subunit is configured to dynamically adjust the weight value of the placement group based on the remaining hash value of the physical node in the placement group being less than a first predetermined value, wherein the remaining hash value represents the remaining number of times the physical node can participate in the placement group.
25. The storage device according to claim 24, wherein: The placement group acquisition module includes: A removal unit, configured to remove the physical node whose remaining hash value is less than 0 in the placement group; The supplement unit is configured to supplement the physical node groups belonging to the different logical partitions and having weight values distributed within a predetermined range into the placement group after the elimination process is performed based on the remaining number of the physical nodes in the placement group after the elimination process is performed.
26. The storage device according to claim 20, wherein: The logical partitions include: at least one of rack partitions, switch partitions, computer room partitions and regional partitions.
27. The storage device according to claim 20, wherein: The weight determination module comprises: An updating unit, configured to dynamically update the state information of the physical node; The physical node weight value adjustment unit is configured to adjust the weight value of the physical node based on the updated state information of the physical node.
28. The storage device according to claim 27, wherein: The load information of the physical node includes: CPU idle rate, memory idle rate, disk idle rate and network idle rate.
29. The storage device according to claim 28, wherein: The physical node weight value adjustment unit includes: The selection subunit is configured to adjust the weight value of the physical node based on the updated minimum value among the CPU idle rate, the memory idle rate, the disk idle rate and the network idle rate.
30. The storage device according to claim 29, wherein: The physical node weight value adjustment unit also includes: a smoothing processing subunit, configured to perform smoothing processing on the data set of the CPU idle rate, the data set of the memory idle rate, the data set of the disk idle rate, and the data set of the network idle rate within an update period; The minimum value determination subunit is configured to determine the minimum value of the updated CPU idle rate, the memory idle rate, the disk idle rate and the network idle rate based on the smoothed CPU idle rate data set, the memory idle rate data set, the disk idle rate data set and the network idle rate data set, respectively.
31. The storage device according to claim 27, wherein: The updating unit comprises: a periodic response subunit, configured to update the state information of the physical node based on a second predetermined period; or The preset condition response subunit is configured to update the state information of the physical node based on the load information of the physical node meeting the preset condition.
32. The storage device according to claim 27, wherein: Also includes: The stop receiving module is configured to, in response to the adjusted weight value of the first physical node being lower than a first predetermined threshold, cause the first physical node to stop receiving the fragment.
33. A data copy access device for a distributed system, comprising: an access list construction module, configured to construct an access list based on state information of physical nodes where multiple shards of the data replica are located, wherein the multiple shards are stored in the same placement group of the distributed system, and the placement group includes the physical nodes belonging to different logical partitions of the distributed system; The access module is configured to access the plurality of shards based on the arrangement order of the physical nodes in the access list.
34. The access device according to claim 33, wherein: Also includes: The update module is configured to update the arrangement order of the physical nodes in the access list before accessing the plurality of shards based on the arrangement order of the physical nodes in the access list.
35. The access device according to claim 34, wherein: The update module includes: The first updating unit is configured to arrange, in the access list, the physical nodes of the shards located in the same logical partition as the access client before the physical nodes of the shards located in different logical partitions as the access client.
36. The access device of claim 34, wherein: The update module also includes: The second updating unit is configured to arrange the physical nodes in the access list in ascending order according to the number of waiting requests of the physical nodes.
37. The access device according to claim 34, wherein: The update module also includes: The third updating unit is configured to arrange the physical nodes in the access list in descending order according to the historical access success rates of the physical nodes.
38. The access device of claim 34, wherein: The update module also includes: The fourth updating unit is configured to arrange the physical nodes in the access list in ascending order according to the historical access delay values of the physical nodes.
39. An electronic device comprising: at least one processor; a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data copy storage method of a distributed system described in any one of claims 1-13 or the data copy access method of a distributed system described in any one of claims 14-19.
40. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the data copy storage method of a distributed system described in any one of claims 1-13 or the data copy access method of a distributed system described in any one of claims 14-19.
41. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the data copy storage method of a distributed system according to any one of claims 1-13 or the data copy access method of a distributed system according to any one of claims 14-19.
Citation Information
Cited By
Large-scale data distributed storage and processing method and system
CN120687304A
Distributed storage system capacity expansion and contraction method and device, equipment and medium
CN120848812A