A data storage method, device, equipment and computer readable storage medium

By updating the weight difference based on the mapping relationship and capacity information between placement groups and object storage devices in a distributed storage system, and selecting the target placement group for data storage, the data imbalance problem caused by hash algorithms is solved, achieving a balance between disk capacity and utilization as well as performance.

CN119690349BActive Publication Date: 2026-02-17SANGFOR TECH INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411848762.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2026-02-17
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

Existing hash algorithms cannot guarantee a balanced data distribution in distributed storage, leading to excessive load on some nodes and affecting disk utilization and performance.

Method used

By determining the weights of placement groups, and updating the weight gaps based on the capacity usage information and mapping relationships of object storage devices, the target placement group is selected for data storage, thereby optimizing data distribution.

Benefits of technology

It achieves a balance between disk capacity and utilization during data storage, taking into account both cluster write and read performance, and reducing fluctuations caused by uneven data distribution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690349B_ABST
    Figure CN119690349B_ABST
Patent Text Reader

Abstract

The application discloses a data storage method, device and equipment and a computer readable storage medium, and is applied to the technical field of distributed storage, and comprises the following steps: determining the weight of each placement group according to the mapping relationship between the placement group and the object storage device and the capacity usage information of the object storage device; sending the weight of each placement group to a client, so that the client determines a target placement group according to the weight of each placement group; and updating the weight of at least one placement group, so that the weight gap between the selected target placement group and the unselected placement group is increased. According to the mapping relationship between the placement group and the object storage device and the capacity usage information of the object storage device, the weight of each placement group is determined, so that the client determines the target placement group for data storage based on the weight of the placement group, and the weight of the target placement group and other placement groups is updated, so that other target placement groups can be selected for data storage in the future, and the utilization rate of the disk is kept balanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of distributed storage technology, and in particular to a data storage method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] Currently, the most common distribution method is hashing (such as the CRUSH algorithm). The CRUSH algorithm takes a unique data identifier, the current cluster topology, and data redundancy strategy as input. It can calculate and obtain the location of the underlying storage device (such as a disk) where the data resides at any time and communicate directly with it. However, when using hashing, in a small cluster, due to the limited number of nodes, different data items may be mapped to the same hash value, leading to uneven data distribution. This conflict is more pronounced when the number of nodes is small, because each node needs to handle a larger data load, thus increasing the load pressure on some nodes. Therefore, hashing cannot guarantee a balanced data distribution.

[0003] It is evident that ensuring a balance between disk capacity and disk utilization when storing data in a distributed manner is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a data storage method, apparatus, device and computer-readable storage medium, which solves the technical problem of unbalanced data storage in the prior art.

[0005] To address the aforementioned technical problems, this invention provides a data storage method applied to the management module of a distributed storage system. The distributed storage system includes a management module and a client, and the management module and the client are connected. The method includes:

[0006] The weight of each placement group is determined based on the mapping relationship between placement groups and object storage devices, and the capacity usage information of the object storage devices; wherein any placement group is mapped to multiple object storage devices.

[0007] The weight of each placement group is sent to the client, so that the client determines the target placement group based on the weight of each placement group;

[0008] Update the weights of at least one placement group to increase the weight gap between the selected target placement group and the unselected placement group; and return to the step of sending the weights of each placement group to the client and subsequent steps.

[0009] Optionally, the weights of the placement groups include data column read weights and data column write weights; determining the weight of each placement group based on the mapping relationship between the placement groups and the object storage devices, and the capacity usage information of the object storage devices, includes:

[0010] Based on the capacity usage information of the object storage device, determine the initial weight of the object storage device;

[0011] Based on the mapping relationship between placement groups and object storage devices, the initial weights of the object storage devices, and the data redundancy strategy, the data read weights and data write weights corresponding to each placement group are determined.

[0012] Optionally, based on the capacity usage information of the object storage device, the initial weight of the object storage device is determined, including:

[0013] The remaining capacity of the object storage device is determined based on the capacity usage information of the object storage device.

[0014] The initial weight of the object storage device is determined based on its remaining capacity; wherein the size of the remaining capacity is positively correlated with the initial weight of the object storage device.

[0015] Optionally, updating the weights of at least one placement group to increase the weight difference between the selected target placement group and the unselected placement group includes:

[0016] The weights of all placement groups are increased to obtain the weights of the first updated placement group, and the weights of the first updated placement group corresponding to the target placement group are decreased to obtain the weights of the second updated placement group corresponding to the target placement group.

[0017] Optionally, the step of increasing the weights of all placement groups to obtain the first updated placement group weights, and decreasing the weights of the first updated placement groups corresponding to the target placement group to obtain the second updated placement group weights corresponding to the target placement group, includes:

[0018] Based on the first preset parameter, the weights of all placement groups are increased to obtain the weights of the first updated placement group.

[0019] Based on the second preset parameter, the weight of the first updated placement group corresponding to the target placement group is reduced to obtain the weight of the second updated placement group corresponding to the target placement group.

[0020] Optionally, the weights of the placement groups include data column read weights and data column write weights; updating the weights of at least one placement group to increase the weight difference between the selected target placement group and the unselected placement group includes:

[0021] The data column read weight and data column write weight of the object storage device corresponding to all placement groups are increased to obtain the first data column read weight and the first data column write weight for each object storage device.

[0022] Based on the first data column read weight and the first data column write weight corresponding to each object storage device, update the data column read weight and data column write weight of each unselected placement group;

[0023] The first data column read weight and the first data column write weight of the target object storage device corresponding to the target placement group are reduced to obtain the second data column read weight and the second data column write weight of the target object storage device.

[0024] Based on the second data column read weight and the second data column write weight corresponding to the target object storage device, update the data column read weight and data column write weight corresponding to the target placement group.

[0025] Optionally, the data read weights and data write weights of the object storage devices corresponding to all placement groups are increased to obtain the first data read weight and the first data write weight for each object storage device, including:

[0026] Logical operations are performed based on the current data column read weight, the number of replicas, and the number of data columns to be read corresponding to the object storage device to determine the first data column read weight;

[0027] The first data column write weight is determined by performing logical operations based on the current data column write weight corresponding to the object storage device and the number of data columns to be written.

[0028] This invention also provides a method for determining a target placement group, applied to a client of a distributed storage system, comprising:

[0029] Receive the weight of each placement group; wherein, the weight of each placement group is the weight of the placement group determined based on the above data storage method;

[0030] In response to a data block write operation, a target placement group is determined based on the weight of each placement group;

[0031] The data block is written to the target placement group of the distributed storage system.

[0032] Optionally, in response to a data block write operation, determining the target placement group based on the weight of each placement group includes:

[0033] In response to a data block write operation, the group with the highest data column read weight is selected as the target group.

[0034] If all placement groups have the same data column read weight, the placement group with the largest data column write weight will be the target placement group.

[0035] If all placement groups have the same data column weight, the placement group with the highest weight will be selected as the target placement group.

[0036] This invention also provides a distributed storage system, comprising:

[0037] The management module is used to connect to the client and multiple object storage devices, and to execute the steps of the above data storage method to obtain the weight of each placement group;

[0038] The client is used to execute the steps of the target placement group determination method described above.

[0039] This invention also provides a data storage device applied to a management module of a distributed storage system. The distributed storage system includes a management module and a client, and the management module and the client are connected, including:

[0040] The weight determination module for each placement group is used to determine the weight of each placement group based on the mapping relationship between the placement group and the object storage device, and the capacity usage information of the object storage device.

[0041] The weight sending module is used to send the weight of each placement group to the client, so that the client can determine the target placement group based on the weight of each placement group;

[0042] The weight update module for placement groups is used to update the weight of at least one placement group so that the weight difference between the selected target placement group and the unselected placement group increases; and returns to the step of sending the weight of each placement group to the client and subsequent steps.

[0043] This invention also provides an electronic device, comprising:

[0044] Memory, used to store computer programs;

[0045] A processor is configured to execute the computer program to implement the steps of the data storage method described above, or to execute the computer program to implement the steps of the target placement group determination method described above.

[0046] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the data storage method described above, or, when executed by a processor, implements the steps of the target placement group determination method described above.

[0047] This invention also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the data storage method described above, or, when executed by a processor, implement the steps of the target placement group determination method described above.

[0048] This invention determines the weight of each placement group based on the mapping relationship between placement groups and object storage devices, and the capacity usage information of the object storage devices; wherein any placement group is mapped to multiple object storage devices; the weight of each placement group is sent to the client, so that the client determines the target placement group based on the weight of each placement group; the weight of at least one placement group is updated to increase the weight difference between the selected target placement group and the unselected placement group; and the process returns to the step of sending the weight of each placement group to the client and subsequent steps. The beneficial effects of this invention are as follows: Compared with the current method of using hash operations, which cannot guarantee a balanced data distribution, this invention determines the weight of each placement group based on the mapping relationship between placement groups and object storage devices, and the capacity usage information of object storage devices when storing data. This allows the client to determine the target placement group for data storage based on the weight of each placement group. After the client uses the target placement group for data storage, the weights of the target placement group and other placement groups are updated, reducing the weight of the target placement group in subsequent priority selections. This maintains a balanced capacity of the cluster disks and a balanced disk utilization rate, taking into account both cluster write and read performance, and reducing fluctuations caused by uneven data distribution.

[0049] In addition, the present invention also provides a data storage device, apparatus and computer-readable storage medium, a target placement group determination method, apparatus and computer-readable storage medium, and a distributed storage system, which also have the above-mentioned beneficial effects. Attached Figure Description

[0050] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0051] Figure 1 A flowchart illustrating a data storage method provided in an embodiment of the present invention;

[0052] Figure 2 A flowchart illustrating a data storage method provided in an embodiment of the present invention;

[0053] Figure 3This is a schematic diagram illustrating the determination of available placement groups according to an embodiment of the present invention;

[0054] Figure 4 A flowchart of a target placement group determination method provided in an embodiment of the present invention;

[0055] Figure 5 This is a schematic diagram of the structure of a data storage device provided in an embodiment of the present invention;

[0056] Figure 6 This is a schematic diagram of a target placement group determination device provided in an embodiment of the present invention;

[0057] Figure 7 A schematic diagram of a distributed storage system provided in an embodiment of the present invention;

[0058] Figure 8 A specific schematic diagram of a distributed storage system provided in an embodiment of the present invention;

[0059] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0060] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0061] Some terms that appear in the description of the embodiments of the present invention are subject to the following interpretation:

[0062] Data redundancy strategy: A data backup and redundant storage strategy adopted in computer systems. By creating redundant copies of data in the system, the reliability and availability of data can be improved to cope with situations such as hardware failure, data corruption, or accidental deletion. Common data redundancy strategies include replication and erasure coding (EC). These strategies can help the system maintain data integrity in the event of a failure and quickly restore it to a normal working state.

[0063] File: A file is an ordered sequence of related information items with symbolic names and logically complete meaning.

[0064] Copy: A backup of the file content.

[0065] Fault tolerance: The ability of a distributed system to tolerate failures, such as the number of disks that can fail and the number of hosts that can fail.

[0066] Disk Groups: In a hybrid hard drive configuration, cache disks and data disks are paired in disk group relationships. Each disk group's SSD (Solid State Drive) only provides caching acceleration capabilities to the HDDs (Hard Drives) in its disk group.

[0067] Please refer to Figure 1 , Figure 1 A flowchart illustrating a data storage method provided in an embodiment of the present invention. This method is applied to the management module of a distributed storage system. The distributed storage system includes a management module and a client, and the management module and client are connected. The method may include:

[0068] S101, determine the weight of each placement group based on the mapping relationship between placement groups and object storage devices, and the capacity usage information of object storage devices; wherein any placement group is mapped to multiple object storage devices.

[0069] In this embodiment, the placement group is a proper noun in the Ceph (Unified Storage System) distributed architecture. In the Ceph distributed storage system, a placement group (pg) is a fragment of a logical object pool, which places objects as a group into OSDs (Object Storage Daesel). The object storage device (OSD) in this embodiment is a disk specifically designed for storing large amounts of unstructured data. The main function of placement groups is to reduce the amount of metadata that needs to be tracked for each object and to reduce the number of processes that need to be run. Each object is fixedly mapped into a pg, so when searching for an object, only the pg to which the object belongs needs to be found, and then that pg can be traversed, without having to traverse all objects. Objects in a pg are mapped to multiple OSDs to achieve data redundancy and reliability. If an OSD fails, Ceph will remap the pg data replicas on that OSD to other healthy OSDs. This embodiment does not impose any limitations on the applicable distributed architecture; it can be applied to distributed architectures such as Ceph and HDFS (Master-Slave Distributed Architecture). In this embodiment, the mapping relationship between placement groups and object storage devices is calculated based on hash operations. That is, a data block `slog` corresponds to one placement group, and `pg`s are mapped to multiple `osd`s based on redundancy information. The mapping relationship between `pg`s and `osd`s still uses hash operations. In this embodiment, the initial weight can be determined based on the remaining capacity (capacity usage information) of the object storage device; the larger the remaining capacity, the larger the weight. Alternatively, this embodiment can also determine the initial weight of each object storage device based on its used capacity (capacity usage information); the larger the used capacity, the smaller the initial weight. For example, taking `ec4+2` as an example, assume there are `pg0-pg31` (32 `pg`s) and `osd0-osd29` (30 `osd`s), where `pg1` corresponds to `osd0-osd5`. The first four `osd`s of all `pg`s are data columns, and the last two `osd`s are check columns. Assume all `osd`s have 30% remaining capacity. The `osd` weight is related to the remaining capacity; for simplification, the initial weight of all `osd`s is 3. Here, `ec` represents the erasure coding strategy, and `pg` represents the placement group (page group). This embodiment can set the initial weight of each placement group to a predetermined value. For example, the initial weight of each placement group in this embodiment can be 1; or the initial weight of each placement group in this embodiment can be 2. This embodiment does not limit the specific placement group weights. For example, the placement group weights in this embodiment can be the weights of the placement group itself; or the placement group weights in this embodiment can also be the weights of the placement group itself, as well as the data read weights and data write weights of the placement group determined based on the data read weights and data write weights of the object storage device. This embodiment does not limit the specific timing of placement group updates.For example, this embodiment can utilize monitoring equipment to periodically acquire OSD capacity information and update the placement group weight; or, this embodiment can also update the placement group weight after the client determines the target placement group. That is, this embodiment updates the placement group weight at two different times: 1. Periodically acquire OSD capacity usage information according to a preset cycle, reset the initial weight of the object storage device, and thus reset the placement group weight, thereby adapting the placement group weight to changes in disk capacity; 2. Acquire OSD capacity usage information only once, and continuously update the placement group weight according to the placement group weight update method until a reset signal is received.

[0070] It should be further explained that the weights of the aforementioned placement groups include data read weights and data write weights. Determining the weight of each placement group based on the mapping relationship between the placement group and the object storage device, and the capacity usage information of the object storage device, can include: determining the initial weight of the object storage device based on its capacity usage information; and determining the corresponding data read weight and data write weight for each placement group based on the mapping relationship between the placement group and the object storage device, the initial weight of the object storage device, and the data redundancy strategy. In this embodiment, when determining the weight of the placement group for the first time, the initial weight of the object storage device can be directly determined based on its capacity usage information. This embodiment does not limit the specific data redundancy strategy. The data redundancy strategy in this embodiment can be a multi-replica strategy; or it can also be an erasure coding strategy. A multi-replica data redundancy strategy refers to copying data into multiple identical copies and distributing these copies across different storage nodes or geographical locations. In this case, the data read weight and data write weight are not distinguished, and are treated as if they were the same. In this embodiment, when the data redundancy strategy is erasure coding, if the erasure coding strategy is EC2+1, the data column read weight is determined only by two data columns, and the data column write weight is determined by two data columns and one check column. For ease of understanding, taking EC4+2 as an example, when the initial weight of all OSDs is determined to be 6, the data column write weight of all OSDs is determined to be osd_write_weight=6, and the data column read weight is osd_read_weight=6 / 6=1 (the denominator 6 is the threshold, which is determined according to the number of replicas; for example, if it is three replicas, the threshold is 3; if it is EC4+2, the threshold is 6). Therefore, for each PG, total_write=sum(osd)=6x6=36, and for each PG, total_read=sum(osd read weight)=1x4=4. It can be understood that in this embodiment, the data column read weight and data column write weight corresponding to each placement group need to be determined based on the data column read weight and data column write weight of the object storage device corresponding to each placement group. This embodiment does not limit the specific method for determining the data read weight and data write weight corresponding to each placement group based on the mapping relationship between placement groups and object storage devices, the initial weight of object storage devices, and data redundancy strategies.For example, this embodiment can directly determine the object storage device corresponding to the placement group based on the mapping relationship between the placement group and the object storage device, as well as the data redundancy strategy. The data read weights of all object storage devices are summed to obtain the data read weight corresponding to each placement group, and the data write weights of all object storage devices are directly summed to obtain the data write weight corresponding to each placement group. Alternatively, to improve the feasibility of selecting the target placement group based on the data write weight, data read weight, and placement group weight, this embodiment can also adopt a certain strategy to adjust the data read weights so that they are less likely to be the same. For example, the read weight of each object storage device can be divided by a set value, such as 3 or 4.

[0071] It should be further explained that determining the initial weight of an object storage device based on its capacity usage information may include: determining the remaining capacity of the object storage device based on its capacity usage information; and determining the initial weight of the object storage device based on its remaining capacity. The remaining capacity and the initial weight of the object storage device are positively correlated. This embodiment can directly determine the initial weight of the object storage device based on its remaining capacity, thus improving the efficiency of determining the initial weight of the object storage device.

[0072] It should be further explained that when the data redundancy strategy is an erasure coding strategy, the above-mentioned determination of the data column read weight and data column write weight corresponding to each placement group based on the mapping relationship between the placement group and the object storage device, the initial weight of the object storage device, and the data redundancy strategy may include:

[0073] S1021, determine the number of data columns and the number of check columns according to the erasure coding strategy.

[0074] The check column in this embodiment is a method to improve data reliability by adding redundant check information. In erasure coding strategies, the check column typically refers to a column used to store check information, which can be used to detect and correct errors. In this embodiment, the data column refers to the column that actually stores user data. In erasure coding strategies, the data column contains the original data, while the check column contains additional information for data recovery. For ease of understanding, taking EC4+2 as an example, assume there are pg0-pg31 (32 pgs) and osd0-osd29 (30 osds), where pg1 corresponds to osd0-osd5. Then, the first four osds of each pg are the data column, and the last two osds are the check column. Taking EC2+1 as an example, assume there are pg0-pg31 (32 pgs) and osd0-osd29 (30 osds), where pg1 corresponds to osd0-osd2. Then, the first two osds of each pg are the data column, and the last osd is the check column.

[0075] S1022, based on the mapping relationship between the placement group and the object storage device, and the initial weight of the object storage device, determine the read weight of the data column corresponding to each placement group as the product of the read weight and the number of data columns; wherein, the read weight is the ratio of the initial weight of the object storage device to the sum of the number of data columns and the number of check columns.

[0076] For ease of understanding, when the write weight of all OSDs is osd_write_weight=3, the read weight osd_read_weight=3 / 3=1. 3 is a threshold for ignoring decimals; weights less than 3 are ignored. A larger threshold makes it easier for data column read weights to be the same, making it less likely that a placement group (PG) will be selected based on data column read weight. This is essentially a controllable parameter. The data column read weight for each placement group = read weight x (number of data columns) = 1 x 4 = 4, because the erasure coding strategy is EC4+2; where x represents a multiplication logical operation.

[0077] S1023, based on the mapping relationship between the placement group and the object storage device, and the initial weight of the object storage device, determine the data column write weight corresponding to each placement group as the product of the initial weight of the object storage device and the sum of the number of data columns and the number of verification columns.

[0078] In this embodiment, the initial weight of the object storage device is 3. Therefore, the data write weight for each placement group is sum(osd) = 3 x 6 = 18, where 3 is the weight corresponding to each object storage device, and 6 is the sum of the number of data columns and the number of check columns. This embodiment provides a specific method for determining the data write weight and data read weight for each placement group, improving the accuracy of selecting the target placement group.

[0079] It should be further explained that the above-mentioned determination of the data read weight and data write weight corresponding to each placement group based on the mapping relationship between placement groups and object storage devices, the initial weight of the object storage devices, and the data redundancy strategy may include: determining a portion of available placement groups; and determining the data read weight and data write weight corresponding to the portion of available placement groups based on the mapping relationship between placement groups and object storage devices, the initial weight of the object storage devices, and the data redundancy strategy. This embodiment does not limit the method for determining available placement groups. For example, the available placement groups in this embodiment may be fully healthy placement groups; or the available placement groups in this embodiment may be fully healthy placement groups that can be used, but the data consistency in the placement groups is weak (weak consistency means that after some OSDs in the placement group are offline (reboot, network failure, etc.) and reloaded, some objects in the PG have not been fully recovered. That is, the PG is in a recovering or backfilling state); or the available placement groups in this embodiment may be usable, but the disks (OSDs) corresponding to the placement group PG that is being migrated have changed. This embodiment only considers a portion of the available placement groups when selecting the target placement group, and does not consider all of the available placement groups, thereby reducing the time to traverse the placement groups and improving the efficiency of determining the target placement group.

[0080] S102, the weight of each placement group is sent to the client, so that the client can determine the target placement group based on the weight of each placement group.

[0081] The purpose of this invention is to select placement groups for data blocks. In this embodiment, the client can be a user-side client. This embodiment determines the target placement group based on the weight of each placement group, which can be the placement group with the highest weight as the target placement group.

[0082] S103, update the weight of at least one placement group to increase the weight difference between the selected target placement group and the unselected placement group; and return to the step of sending the weight of each placement group to the client and subsequent steps.

[0083] In this embodiment, updating the weight of at least one placement group can be done by updating only the weight of the target placement group; or, in this embodiment, updating the weight of at least one placement group can be done by updating the weights of all unselected placement groups and the selected target placement group. In this embodiment, increasing the weight difference between the selected target placement group and the unselected placement groups means decreasing the weight of the target placement group and increasing the weight of the unselected placement groups, thus increasing the weight difference between the selected target placement group and the unselected placement groups. In this embodiment, returning to the step of sending the weight of each placement group to the client and subsequent steps means that after updating the weight of the placement groups, step S102, which sends the weight of each placement group to the client, is executed so that the client can determine the target placement group based on the weight of each placement group.

[0084] It should be further explained that, in order to improve the accuracy of the placement group weight update, the above-mentioned updating of the weight of at least one placement group to increase the weight difference between the selected target placement group and the unselected placement groups can include: increasing the weight of all placement groups to obtain a first updated placement group weight, and decreasing the first updated placement group weight corresponding to the target placement group to obtain a second updated placement group weight corresponding to the target placement group. This embodiment reduces the probability of subsequently selecting the target placement group by decreasing the weight of the target placement group. This embodiment provides a specific method for updating placement group weights, improving the accuracy of placement group weight updates.

[0085] It should be further explained that the above process of increasing the weights of all placement groups to obtain the weights of the first updated placement group, and then decreasing the weights of the first updated placement group corresponding to the target placement group to obtain the weights of the second updated placement group corresponding to the target placement group, may include:

[0086] S1031, based on the first preset parameter, the weights of all placement groups are increased to obtain the weights of the first updated placement groups.

[0087] This embodiment does not limit the specific first preset parameter. For example, the first preset parameter in this embodiment can be 1, or the first preset parameter in this embodiment can be 2, or the first preset parameter in this embodiment can be the weight of the reset group during the update.

[0088] S1032, based on the second preset parameter, the weight of the first updated placement group corresponding to the target placement group is reduced to obtain the weight of the second updated placement group corresponding to the target placement group.

[0089] This embodiment does not limit the specific second preset parameter. For example, the second preset parameter in this embodiment can be 1, or it can be 2, or it can be the weight of the target placement group during the update. By updating the placement group weight, this embodiment enables further selection based on the weight, achieving round-robin selection and maintaining a balanced capacity of the cluster disks.

[0090] It should be further explained that the above process of increasing the weights of all placement groups to obtain the weights of the first updated placement group, and then decreasing the weights of the first updated placement group corresponding to the target placement group to obtain the weights of the second updated placement group corresponding to the target placement group, may include:

[0091] S1: Increase the weights of all placement groups to obtain the weights of the first updated placement groups; where the weights of the first updated placement groups = the weights of the current placement groups + the initial weights of the placement groups.

[0092] In this embodiment, all placement group weights are updated (initially 1): new_pg_weight = pg_weight + 1. Here, new_pg_weight represents the weight of the first updated placement group, and pg_weight represents the weight of the current placement group. Assuming there are 3 placement groups, then total_pgs_weight (total weight) = 1 + 1 + 1 = 3. The weight of pg1 is incremented by 1 (initial weight) = 2, similarly, the weight of pg2 is 2, and the weight of pg3 is 2.

[0093] S2: Reduce the weight of the target placement group to obtain the weight of the second updated placement group; where the weight of the second updated placement group = the weight of the first updated placement group corresponding to the target placement group - the total weight of the placement group.

[0094] In this embodiment, for the selected target placement group, the target placement group weight is updated as pg_weight = pg_weight - total_pgs_weight; where pg_weight represents the weight of the second updated placement group and the weight of the first updated placement group corresponding to the target placement group. For example, if pg1 is selected, then the latest pg1 weight = pg1 weight - the weight of all pgs = 2 - 3 = -1. After this step, the total weight = sum(pg) = -1 + 2 + 2 = 3. Therefore, the total weight remains unchanged, but the weight of pg1 becomes -1, and it will not be selected again.

[0095] It should be further explained that, in order to improve the comprehensiveness of the placement group weight update, the weights of the aforementioned placement groups include data column read weights and data column write weights; updating the weight of at least one placement group to increase the weight difference between the selected target placement group and the unselected placement groups may include:

[0096] Step 1: Increase the data read weight and data write weight of the object storage devices corresponding to all placement groups to obtain the first data read weight and the first data write weight for each object storage device.

[0097] Step 2: Based on the first data column read weight and the first data column write weight corresponding to each object storage device, update the data column read weight and data column write weight of each unselected placement group.

[0098] Step 3: Reduce the first data column read weight and the first data column write weight of the target object storage device corresponding to the target placement group to obtain the second data column read weight and the second data column write weight of the target object storage device.

[0099] Step 4: Based on the second data column read weight and the second data column write weight corresponding to the target object storage device, update the data column read weight and data column write weight corresponding to the target placement group.

[0100] This embodiment improves the comprehensiveness of weight updates for placement groups by updating the weights corresponding to the object storage device, as well as the read and write weights of the data columns corresponding to the target placement group.

[0101] It should be further explained that the above-mentioned process of increasing the data column read weights and data column write weights of all object storage devices corresponding to all placement groups to obtain the first data column read weight and first data column write weight for each object storage device can include: performing logical operations based on the current data column read weight, the number of replicas, and the number of data columns to be read to determine the first data column read weight; and performing logical operations based on the current data column write weight and the number of data columns to be written to determine the first data column write weight. In this embodiment, the read weight of each object storage device is determined as the first data column read weight; wherein the logical operation is: first data column read weight += (current object storage device data column read weight / (number of data columns and number of check columns)) x number of data columns to be read; the write weight of each object storage device is determined as the first data column write weight; wherein the logical operation is: first data column write weight += current object storage device data column write weight x number of data columns to be written. Each logical operation adds the value at the end of the equation to the original weight.

[0102] This embodiment updates the read weight (data column read weight) of each object storage device (the initial value is the weight calculated based on the object storage device capacity): `new_read_weight += (initial osd_weight / 3) x number of osd data columns (the number of osds that PG mapping needs to read).` Here, `new_read_weight` represents the latest object storage device read weight, i.e., the first data column read weight; `initial osd_weight` represents the current object storage device read weight. The first time, the object storage device's read weight is its initial weight; the second time, it's the previously determined read weight. 3 is a threshold value, determined by the number of replicas. For example, with three replicas, the threshold is 3; with EC4+2, it's 6. The 3 here is used to ignore decimals; weights less than 3 are ignored. A larger threshold makes it easier for read weights to be the same, making it less likely to select a placement group based on read weight. This is essentially a controllable parameter used to adjust osd capacity balance. The read weights of all object storage devices are updated (including selected and unselected ones). For ease of understanding, `new_read_weight = 1 + 3 / 3 x 4 = 5`, where the first 3 is the initial weight of the object storage device, 3 is the threshold, and the read weight of the object storage device is 1. Therefore, 1 is added to (initial osd_weight / 3) x the number of osd data columns. After this step, the read weight of all object storage devices is 5. This embodiment updates the write weight (data column write weight) of each object storage device (the initial value is the weight calculated based on the osd capacity): `new_write_weight += initial osd_weight x number of PG-mapped osds`, where `new_write_weight` represents the latest object storage device write weight, i.e., the first data column write weight, `initial osd_weight` represents the current object storage device write weight, and the number of PG-mapped osds represents the number of data columns to be written. This embodiment updates the `write_weight` of all osds (including selected and unselected ones). `new_write_weight = 3 + 3 x 6 = 21`. After this step, the write weight of all osds is 21.

[0103] It should be further explained that the above-mentioned reduction processing of the first data column read weight and the first data column write weight of the target object storage device corresponding to the target placement group to obtain the second data column read weight and the second data column write weight of the target object storage device may include: determining the target object storage device corresponding to the target placement group, reducing the data column read weight and the data column write weight of the target object storage device to obtain the second data column read weight and the second data column write weight of the target object storage device; wherein, the second data column read weight is equal to (the total weight of the object storage device / (the number of data columns and the number of check columns)), and the second data column write weight is equal to the total weight of the object storage device.

[0104] In this embodiment, the second data column read weight -= (total weight of the object storage device / (number of data columns and number of check columns)) can be understood as the second data column read weight = the first data column read weight - (total weight of the object storage device / (number of data columns and number of check columns)); in this embodiment, the second data column read weight -= (total weight of the object storage device / (number of data columns and number of check columns)) can be understood as the second data column read weight = the first data column write weight - (total weight of the object storage device / (number of data columns and number of check columns)). In this embodiment, for the selected target placement group, the read_weight data column read weight corresponding to its mapped OSD is updated: read_weight -= total_osds_read_weight, total_osds_read_weight = sum(osd_weight / 3), where 3 is a threshold used to ignore decimals, read_weight represents the data column read weight of the target object storage device corresponding to the target placement group, total_osds_read_weight represents the total data column read weight of the object storage device, and osd_weight represents the total weight of the object storage device. For ease of understanding, for example, total_osds_read_weight = sum(osd_read_weight) / 3 = 3 x 30 / 3 = 30 (rounded down), where 3 represents the data column read weight and 30 represents the number of data columns. The data column read weight of OSD0, read_weight = 5 (data column read weight before update) - 30 = -25, where 5 is the data column read weight of the target object storage device after update. Similarly, the read weights of other OSDs in the selected PG are calculated to be -25. For the selected placement group, update the write_weight corresponding to its mapped OSD, write_weight -= total_write_weight, total_osds_write_weight = sum(osd_weight). total_osds_write_weight = sum(osd_weight) = 3 x 30 = 90 (rounded down); where write_weight represents the latest data column write weight, and total_osds_write_weight represents the total write weight of all object storage devices. The data column write weight of OSD0 is write_weight = 21 - 90 = -69, where 21 is the previously uniformly updated data column write weight of the target object storage device, and 90 represents the total data column write weight; similarly, the write weights of other OSD shards in the selected PG are calculated to be -69. This invention improves the accuracy of updates by providing a specific method for updating the data column write weight and data column read weight corresponding to the placement group.

[0105] This invention provides a data storage method, which may include: S101, determining the weight of each placement group based on the mapping relationship between placement groups and object storage devices, and the capacity usage information of the object storage devices; wherein any placement group is mapped to multiple object storage devices; S102, sending the weight of each placement group to a client, so that the client determines the target placement group based on the weight of each placement group; S103, updating the weight of at least one placement group to increase the weight difference between the selected target placement group and the unselected placement groups; and returning to the step of sending the weight of each placement group to the client and subsequent steps. Compared to current methods that use hashing and cannot guarantee balanced data distribution, this invention determines the weight of each placement group during data storage based on the mapping relationship between placement groups and object storage devices, as well as the capacity usage information of the object storage devices. This allows clients to determine the target placement group for data storage based on the weight of each placement group. After the client uses the target placement group for data storage, the weights of the target placement group and other placement groups are updated, reducing the weight of the target placement group in subsequent priority selections. This maintains balanced capacity of the cluster disks and balanced disk utilization, balancing cluster write and read performance, and reducing fluctuations caused by uneven data distribution.

[0106] For a clearer understanding of this invention, please refer to the following details. Figure 2 , Figure 2 This is a flowchart illustrating a data storage method provided in an embodiment of the present invention. It is applied to the management module of a distributed storage system. The distributed storage system includes a management module and a client, and the management module and client are connected. Specifically, it may include:

[0107] In this embodiment, a data block `slog` corresponds to a placement group `pg`. Based on a hash operation, the `pg` is mapped to multiple object storage devices (OSDs). When selecting a placement group for a data block, this invention determines available placement groups based on their status, identifies a subset of usable placement groups from these available groups, and then selects from among them. There are five current placement group states: 1. Fully healthy `pg`; 2. Unusable `pg`; 3. Usable, but with weak data consistency; 4. Temporarily unusable `pg`; 5. Usable, but undergoing migration (the disk (OSD) corresponding to the `pg` has changed). When selecting a `pg`, its status is checked. If a `pg` is unusable (e.g., missing shards, the `pg` corresponds to 6 OSDs, but one OSD is offline), this OSD will be avoided. For easier understanding, please refer to [reference needed]. Figure 3 , Figure 3 This is a schematic diagram for determining an available placement group in an embodiment of the present invention. pg2 is in an unavailable state, so pg2 is not selected.

[0108] To select a suitable placement group (PG) for a data block, it's necessary to obtain the capacity information of the OSDs in the cluster and the status information of the placement groups. Only based on the current cluster status can a suitable PG be selected. OSDs report information to the monitoring component, and the client periodically retrieves the necessary information for PG selection from the monitoring component and stores it in memory. By periodically obtaining the capacity information of each OSD in the storage pool, as well as the status information of the PGs, the current cluster status can be perceived during data writing, serving as the basis for selecting which OSDs to write to.

[0109] S201, calculate the OSD weights corresponding to all available OSDs based on the OSD capacity information, and determine that the initial weights of all available PGs are 1.

[0110] This embodiment determines the weight of each OSD based on its capacity information. The weight of a PG (Packet Group) in this embodiment serves to poll the PGs in a round-robin fashion, avoiding the selection of the same PG repeatedly. Taking EC4+2 as an example, assume there are PG0-PG31 (32 PGs) and OSD0-OSD29 (30 OSDs), where PG1 corresponds to OSD0-OSD5. The first four OSDs of each PG are the data columns, and the last two OSDs are the validation columns. Assume all OSDs have 30% remaining capacity. The OSD weight is related to the remaining capacity; for simplicity, all OSDs have a weight of 3.

[0111] S202, the traversal part can use pg. Based on the OSD weight information mapped by the pg, calculate the data column read weight and data column write weight of the pg. Among them, the OSD write weight corresponding to each pg is equal to the OSD weight, and the OSD read weight corresponding to each pg is equal to the ratio of the OSD weight to the set threshold. The set threshold is determined according to the data redundancy strategy.

[0112] Based on the OSD weights, the weights of each PG type are calculated. In this embodiment, the write weight of all OSDs is osd_write_weight=3, and the read weight of OSDs is osd_read_weight=3 / 3=1. Therefore, the write weight of each PG's data column = sum(osd) = 3 x 6 = 18, and the read weight of each PG's data column = sum(osd read weight) = 1 x 4 = 4. The initial weight of the PG is 1.

[0113] S203, send the weight information of pg to the client so that the client can determine the target pg based on the weight information of pg.

[0114] In this embodiment, the weight information of a PG includes the weight of an available PG, and the data column read weight and data column write weight corresponding to the available PG. In this embodiment, when the client determines a target PG, it can first compare the data column read weights. If the data column read weights of all PGs are the same, then the data column write weights are compared. If the data column write weights are still the same, then the PG weights are compared. Since the weights calculated in S202 are all the same, it is assumed here that PG0 is selected.

[0115] S204, update the read weight of each OSD. The latest read weight of the OSD is += (initial OSD weight / 3) x number of OSD data columns, where 3 is a set threshold. The initial value of the read weight of the OSD is the weight calculated based on the OSD capacity.

[0116] In this embodiment, steps S204 and S205 update the weights of all OSDs, thereby affecting read and write weights (increased processing). This embodiment updates the read weights of all OSDs (including selected and unselected ones). The latest read weight of an OSD = 1 + 3 / 3 x 4 = 5. After this step, the read weight of all OSDs is 5.

[0117] S205, update the write weight of each OSD. The latest write weight of the OSD is increased by the initial OSD weight and the number of OSDs mapped by xpg. The initial value of the write weight of the OSD is the weight calculated based on the OSD capacity.

[0118] This embodiment updates the write weights of all OSDs (including selected and unselected ones). The latest write weight of an OSD is 3 + 3 x 6 = 21. After this step, all OSDs have a write weight of 21.

[0119] S206, Update available PG weights, latest PG weight = current PG weight + 1.

[0120] This embodiment updates the weights of all PGs, affecting the capacity weights (incremental processing). In this embodiment, it is assumed that total_pgs_weight = 1 + 1 + 1 = 3 (assuming that 3 parts are available as PGs). The weight of PG1 is incremented by 1 (initial self-weight) = 2, similarly the weight of PG2 = 2, and the weight of PG3 = 2.

[0121] S207, Update the weight of the target PG. The latest weight of the target PG = the updated weight of the PG - the total weight of the PG.

[0122] This embodiment updates the weight of the selected PG, affecting the capacity weight (decrease processing). In this embodiment, PG0 is selected, so PG0's weight = PG0's weight - the weight of all PGs = 2 - 3 = -1. After this step, the total weight = sum(PG) = -1 + 2 + 2 = 3. Therefore, the total weight remains unchanged, but PG0's weight becomes -1, and it will not be selected again.

[0123] S208, Update the read weights corresponding to the OSD data columns mapped to the target PG. The latest read weight of the target PG data column is equal to the total read weight of the data column. The total read weight of the data column is equal to sum(OSD weight t / 3).

[0124] In this embodiment, the total data column read weight = sum(OSD weight) / 3 = 3 x 30 / 3 = 30 (rounded down). The read weight of OSD0 is read_weight = 5 - 30 = -25. Similarly, the read weights of other OSD slices of the selected PG are all calculated to be -25.

[0125] S209, Update the write weights corresponding to the OSD data columns mapped to the target PG. The latest write weight of the target PG data column is equal to the total write weight of the data columns. The total write weight of the data columns is the sum of the write weights of all data columns.

[0126] This embodiment updates the OSD weight of the selected PG, thereby affecting the read weight and write weight (decrease processing). In this embodiment, the total data column write weight t = sum(osd_weight) = 3 x 30 = 90 (rounded down). The write weight of OSD0 is write_weight = 21 - 90 = -69. Similarly, the write weights of other OSD shards of the selected PG are calculated to be -69.

[0127] This invention embodiment achieves balanced disk utilization as much as possible by polling and traversing the disk, thereby improving the overall performance of the cluster. This algorithm considers both data write performance and data read performance.

[0128] For ease of understanding, assume a three-node cluster, with each node having 10 disks (i.e., 10 OSDs), for a total of 30 disks. Assume the cluster's storage pool has redundancy of EC4+2, with 32 PGs, each mapped to 6 disks (OSDs). These 32 PGs will be mapped across the cluster's 30 disks. Different PGs can be mapped to the same OSD, and a single OSD can host multiple PGs.

[0129] Desired outcomes: 1. During data read / write operations, the utilization of all 30 disks (OSDs) should remain consistent (e.g., all disks should be at 10% or 20% utilization). Balanced utilization ensures full utilization of disk space. If a single disk is underutilized, other OSDs may be unable to write data (due to EC4+2, data needs to be written to 6 disks simultaneously). Conversely, if a single disk is overutilized, the performance of the high-watermark disk will often decline, becoming a bottleneck for cluster performance. Therefore, maintaining a balanced utilization across all disks is optimal. 2. During read / write operations, disk utilization should be relatively consistent (if one disk is at 100% utilization while others are at 10%, the overall cluster performance cannot be maximized; the 100% utilized disk becomes a hotspot. Ideally, all disks should have the same utilization to maximize cluster performance). Note that for EC4+2, reading data requires only 4 disks, while writing data requires (4+2) = 6 disks. Calculation method:

[0130] 1. Assuming that out of 32 PGs, 10 PGs are currently unavailable due to expansion or other operations, a selection is made from the remaining 22 PGs. Assuming all disk capacity is currently at 40%, the weight is 60. To calculate this, 60 is changed to 3. Each OSD has a weight of 3, and each PG has an initial weight of 1 (this embodiment does not limit the initial weight of the placement group. For example, in this embodiment, the initial weight of the placement group can be 1; or in this embodiment, the initial weight of the placement group can also be 2, but in this embodiment, the initial weight is 1). The above calculation is performed by the monitor (monitoring component), which can obtain the cluster's status and usage information. Through this information from the monitor, data blocks can obtain relevant information about the disks and PGs when writing, providing negative feedback information for data block writing. The calculation related to data blocks selecting PGs is as follows:

[0131] Assume that PG2 maps to OSDs 28, 14, 18, 6, 23, and 2. Each OSD has a write weight of 3 and a read weight of 1. (The read weight needs to be the OSD weight divided by 3. Dividing the weight of the OSD corresponding to the read shard by 3 is essential for balancing, because after dividing by 3, the capacity difference within 3 is ignored, resulting in a large number of PGs with the same total_read. Then, the OSD with the higher weight (lower capacity) is selected through total_write, thus achieving capacity balancing.) The total data column write weight is 3 x 30 = 90, and the total data column read weight is 1 x 30 = 30. One iteration calculates: the data column write weight is 3 x 6 + 3 = 21. Since OSDs 28, 14, 18, 6, 23, and 2 are selected, their weights need to be subtracted by 90, which is -69. The calculation of the data column read weight is 1 x 4 + 1 = 5. Since 28, 14, 18, and 6 are the data columns selected for read, their weights need to be subtracted by 30, resulting in -25. After iteration: Data column write weights: OSD0 weight 21, OSD1 weight 21, OSD2 weight -69... OSD29 weight 21 (OSDs 28, 14, 18, 6, 2, and 2 have a weight of -69, the rest are 21); Data column read weights: OSD0 weight 5, OSD1 weight 5, OSD2 weight 5... OSD29 weight 5 (OSDs 28, 14, 18, and 6 have a weight of -25, the rest are 5). This way, the data column write and read weights corresponding to the selected PG will decrease, and the probability of selecting this PG and its corresponding OSD will become very small, thus achieving smooth polling.

[0132] This invention considers OSD capacity, PG status, and OSD status to avoid faulty OSDs, thus enhancing data reliability and cluster performance. By using a weighted round-robin approach, it maintains a balanced distribution of disk capacity and utilization across the cluster, improving both write and read performance while ensuring smooth cluster performance and reducing fluctuations caused by uneven data distribution.

[0133] Please refer to Figure 4 , Figure 4 A flowchart illustrating a target placement group determination method provided in an embodiment of the present invention. Applied to a client in a distributed storage system, the method may include:

[0134] S401, Receive the weight of each placement group; wherein, the weight of each placement group is the weight of the placement group determined based on the above data storage method.

[0135] The execution entity in this embodiment is the client.

[0136] S402, in response to a data block write operation, determines the target placement group based on the weight of each placement group.

[0137] This embodiment does not limit the specific process of determining the target placement group based on the weight of each placement group. For example, this embodiment can determine the total weight based on the placement group weight, the data column read weight, and the data column write weight corresponding to each placement group, and select the placement group with the highest total weight as the target placement group; or this embodiment can also use the data column read weight as the first priority parameter, the data column write weight as the second priority parameter, and the placement group weight as the third priority parameter. When the data column read weights are different, the placement group with the largest data column read weight is selected as the target placement group; when the data column read weights are the same, the second priority parameter is given priority, and the placement group with the largest data column write weight is selected as the target placement group; when the data column read weight and write weight are the same, the third priority weight is considered, and the placement group with the largest placement group weight is selected as the target placement group (when selecting for the first time, all placement groups have the same initial weight; when not selecting for the first time, all placement groups have the weights after the last update, and the placement group weights are different, so selection is possible); or this embodiment can also use the data column write weight as the first priority parameter, the data column read weight as the second priority parameter, and the placement group weight as the third priority parameter.

[0138] It should be further explained that the above-mentioned response to the write operation of the data block, determining the target placement group based on the weight of each placement group, may include:

[0139] S4021, responding to the write operation of the data block, selects the placement group with the highest data column read weight as the target placement group.

[0140] S4022, if all placement groups have the same data read weight, the placement group with the largest data write weight shall be the target placement group.

[0141] S4023, if all placement groups have the same data writing weight, the placement group with the largest placement group weight shall be the target placement group.

[0142] S403, writes the data block to the target placement group of the distributed storage system.

[0143] This embodiment first compares the data column read weights. If all placement groups have the same data column read weight, it continues to compare the data column write weights. If the data column write weights are still the same, it compares the placement group weights. Specific execution steps may include: determining whether the data column read weights corresponding to each placement group are the same; when the data column read weights corresponding to each placement group are different, selecting the placement group with the largest data column read weight as the target placement group; when the data column read weights corresponding to each placement group are the same, determining whether the data column write weights corresponding to each placement group are the same; when the data column write weights corresponding to each placement group are different, selecting the placement group with the largest data column write weight as the target placement group; when the data column write weights corresponding to each placement group are the same, selecting the placement group with the largest placement group weight as the target placement group. In this embodiment, considering that read operations are usually more frequent than write operations and have higher performance requirements, the read weight has a higher priority than the write weight. Based on performance requirements, this embodiment improves the accuracy of selecting the target placement group by using data column read weight as the first priority, data column write weight as the second priority, and placement group weight as the third priority.

[0144] The target placement group determination method provided in this embodiment of the invention may include: S401, receiving the weight of each placement group; wherein, the weight of each placement group is the weight of the placement group determined based on the above data storage method. S402, in response to a data block write operation, determining the target placement group based on the weight of each placement group. S403, writing the data block to the target placement group of the distributed storage system. Compared with the current method where polling is not possible, this embodiment of the invention obtains the weight of each placement group, enabling the determination of the target placement group based on the weight of each placement group, thereby achieving polling of placement groups according to weights and maintaining the capacity balance of the cluster disks.

[0145] The data storage device provided in the embodiments of the present invention will be described below. The data storage device described below can be referred to in correspondence with the data storage method described above.

[0146] Please refer to the details. Figure 5 , Figure 5 A schematic diagram of a data storage device provided in an embodiment of the present invention may include:

[0147] The weight determination module 100 for each placement group is used to determine the weight of each placement group based on the mapping relationship between the placement group and the object storage device, and the capacity usage information of the object storage device.

[0148] The weight sending module 200 is used to send the weight of each placement group to the client, so that the client can determine the target placement group according to the weight of each placement group;

[0149] The weight update module 300 for placement groups is used to update the weight of at least one placement group so that the weight difference between the selected target placement group and the unselected placement group increases; and returns to the step of sending the weight of each placement group to the client and subsequent steps.

[0150] Furthermore, based on the above embodiments, the weights of the placement groups include data column read weights and data column write weights; the weight determination module 100 for each placement group may include:

[0151] An initial weight determination unit for an object storage device is used to determine the initial weight of the object storage device based on the capacity usage information of the object storage device.

[0152] The data column read weight and data column write weight determination unit corresponding to the placement group is used to determine the data column read weight and data column write weight corresponding to each placement group based on the mapping relationship between the placement group and the object storage device, the initial weight of the object storage device, and the data redundancy strategy.

[0153] Furthermore, based on the above embodiments, the initial weight determination module of the object storage device may include:

[0154] The remaining capacity determination subunit of the object storage device is used to determine the remaining capacity of the object storage device based on the capacity usage information of the object storage device.

[0155] An initial weight determination subunit for object storage devices is used to determine the initial weight of the object storage device based on its remaining capacity; wherein the size of the remaining capacity is positively correlated with the initial weight of the object storage device.

[0156] Furthermore, based on any of the above embodiments, the weight update module 300 of the placement group may include:

[0157] The weight increase unit of the placement group is used to increase the weight of all placement groups to obtain the first updated placement group weight, and to decrease the weight of the first updated placement group corresponding to the target placement group to obtain the second updated placement group weight corresponding to the target placement group.

[0158] Furthermore, based on the above embodiments, the weight increase unit of the above-mentioned placement group may include:

[0159] The weight increase subunit of all placement groups is used to increase the weight of all placement groups based on the first preset parameter to obtain the weight of the first updated placement group.

[0160] The weight reduction subunit of the target placement group is used to reduce the weight of the first updated placement group corresponding to the target placement group based on a second preset parameter, so as to obtain the weight of the second updated placement group corresponding to the target placement group.

[0161] Furthermore, based on any of the above embodiments, the weight of the placement group includes data column read weight and data column write weight; the weight update module 300 of the placement group may include:

[0162] The data column weighting unit of the object storage device is used to increase the data column read weight and data column write weight of the object storage device corresponding to all placement groups to obtain the first data column read weight and first data column write weight for each object storage device.

[0163] The data column weight update unit corresponding to the unselected placement group is used to update the data column read weight and data column write weight of each unselected placement group based on the first data column read weight and the first data column write weight corresponding to each object storage device.

[0164] The data column weight reduction unit of the target placement group is used to reduce the first data column read weight and the first data column write weight of the target object storage device corresponding to the target placement group to obtain the second data column read weight and the second data column write weight of the target object storage device.

[0165] The data column update unit corresponding to the target placement group is used to update the data column read weight and data column write weight corresponding to the target placement group based on the second data column read weight and the second data column write weight corresponding to the target object storage device.

[0166] Furthermore, based on the above embodiments, the data column weighting unit of the object storage device may include:

[0167] The first data column read weight determination subunit is used to perform logical operations based on the current data column read weight, the number of replicas, and the number of data columns to be read corresponding to the object storage device to determine the first data column read weight;

[0168] The first data column write weight determination subunit is used to perform logical operations based on the current data column write weight corresponding to the object storage device and the number of data columns to be written, to determine the first data column write weight.

[0169] It should be noted that the order of the modules and units in the aforementioned data storage device can be changed without affecting the logic.

[0170] The data storage device provided in this embodiment of the invention may include: a weight determination module 100 for each placement group, configured to determine the weight of each placement group based on the mapping relationship between the placement group and the object storage device, and the capacity usage information of the object storage device; a weight sending module 200, configured to send the weight of each placement group to a client, so that the client determines a target placement group based on the weight of each placement group; a weight updating module 300 for each placement group, configured to update the weight of at least one placement group, so that the weight difference between the selected target placement group and the unselected placement group increases; and return to execute the step of sending the weight of each placement group to the client and subsequent steps. Compared to current methods that use hashing and cannot guarantee balanced data distribution, this invention determines the weight of each placement group during data storage based on the mapping relationship between placement groups and object storage devices, as well as the capacity usage information of the object storage devices. This allows clients to determine the target placement group for data storage based on the weight of each placement group. After the client uses the target placement group for data storage, the weights of the target placement group and other placement groups are updated, reducing the weight of the target placement group in subsequent priority selections. This maintains balanced capacity of the cluster disks and balanced disk utilization, balancing cluster write and read performance, and reducing fluctuations caused by uneven data distribution.

[0171] The target placement group determination device provided in the embodiments of the present invention will be described below. The target placement group determination device described below and the target placement group determination method described above can be referred to in correspondence.

[0172] Please refer to the details. Figure 6 , Figure 6 A schematic diagram of a target placement group determination device provided in an embodiment of the present invention may include:

[0173] The weight determination module 400 for placement groups is used to receive the weight of each placement group; wherein, the weight of each placement group is the weight of the placement group determined based on the above data storage method;

[0174] The target placement group determination module 500 is used to determine the target placement group based on the weight of each placement group in response to the write operation of the data block.

[0175] The data block writing module 600 is used to write the data block into the target placement group of the distributed storage system.

[0176] Furthermore, based on the above embodiments, the target placement group determination module 500 may include:

[0177] The first target placement group determination unit is used to respond to the write operation of the data block and select the placement group with the largest data column read weight as the target placement group.

[0178] The second target placement group determination unit is used to determine the placement group with the largest data column write weight if all placement groups have the same data column read weight.

[0179] The third target placement group determination unit is used to determine the placement group with the largest placement group weight as the target placement group if all placement groups have the same data writing weight.

[0180] It should be noted that the order of the modules and units in the above-mentioned target placement group determination device can be changed without affecting the logic.

[0181] The target placement group determination apparatus provided in this embodiment of the invention may include: a placement group weight determination module 400, used to receive the weight of each placement group; wherein the weight of each placement group is the weight of the placement group determined based on the above-described data storage method; a target placement group determination module 500, used to determine a target placement group based on the weight of each placement group in response to a data block write operation; and a data block writing module 600, used to write the data block into the target placement group of the distributed storage system. Compared with the current method that cannot perform polling, this embodiment of the invention obtains the weight of each placement group, enabling the determination of the target placement group based on the weight of each placement group, thereby realizing polling of placement groups according to weights and maintaining the capacity balance of the cluster disks.

[0182] The following describes a distributed storage system provided by an embodiment of the present invention. The distributed storage system described below can be referred to in correspondence with the data storage method and target placement group determination method described above.

[0183] Please refer to Figure 7 , Figure 7 A schematic diagram of a distributed storage system provided in an embodiment of the present invention may include:

[0184] The management module is used to connect to the client and multiple object storage devices, and to execute the steps of the above data storage method to obtain the weight of each placement group;

[0185] The client is used to execute the steps of the target placement group determination method described above.

[0186] In this embodiment, the management module can be a monitor, and it relies on the monitor to implement related functions. This application does not impose any restrictions on the specific implementation method of the management module. For ease of understanding, please refer to... Figure 8 , Figure 8 A specific schematic diagram of a distributed storage system provided as an embodiment of the present invention is shown below. Figure 8As can be seen, the client (software) belongs to the user side, while the management module (software) and object storage device (hardware) belong to the service side. Figure 8 The object storage device is used to report the information required by the management module to the management module. The management module is used to execute the steps of the above data storage method based on the information obtained from the object storage device, obtain the weight of each placement group, and send the weight of each placement group to the client.

[0187] It should be noted that, Figure 7 and Figure 8 The inclusion of one client is merely an example. In a distributed storage system, multiple clients can be deployed on the user side, with the number of clients determined by user needs. The server side can respond to multiple clients simultaneously and provide distributed storage services.

[0188] The following describes an electronic device provided by an embodiment of the present invention. The data storage device described below can be referred to in correspondence with the data storage method and target placement group determination method described above.

[0189] Please refer to Figure 9 , Figure 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present invention may include:

[0190] Memory 10 is used to store computer programs;

[0191] Processor 20 is used to execute computer programs to implement the above-described data storage method and target placement group determination method.

[0192] The memory 10, processor 20, and communication interface 30 all communicate with each other through the communication bus 40.

[0193] In this embodiment of the invention, the memory 10 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment of the invention, the memory 10 may store programs for implementing the following functions.

[0194] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; and the data storage area may store data created during use.

[0195] Furthermore, memory 10 may include read-only memory and random access memory, providing instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores operating systems and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and handling hardware-based tasks.

[0196] Processor 20 can be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic device. Processor 20 can be a microprocessor or any conventional processor. Processor 20 can call programs stored in memory 10.

[0197] The communication interface 30 can be an interface for the communication module, used to connect with other devices or systems.

[0198] Of course, it should be noted that, Figure 9 The structure shown does not constitute a limitation on the data storage device in the embodiments of the present invention. In practical applications, the data storage device may include more than Figure 9 More or fewer components as shown, or combinations of certain components.

[0199] The computer-readable storage medium provided in the embodiments of the present invention is described below. The computer-readable storage medium described below can be referred to in correspondence with the data storage method described above.

[0200] The present invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the above-described data storage method.

[0201] The computer-readable storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0202] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0203] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0204] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0205] The present invention has provided a detailed description of a data storage method, apparatus, device, and computer-readable storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A data storage method, characterized by, The application discloses a management module applied to a distributed storage system, the distributed storage system comprising a management module and a client, the management module and the client being connected, and comprising: Determine the initial weight of the object storage device based on the capacity usage information of the object storage device; determine the weight of each homing group according to the mapping relationship between the homing group and the object storage device and the initial weight of the object storage device; wherein any homing group is mapped with multiple object storage devices; the weight of the homing group is determined according to the weight of all the object storage devices mapped; Send the weight of each homing group to the client, so that the client determines the target homing group according to the weight of each homing group; Update the weight of at least one homing group, so that the weight gap between the selected target homing group and the unselected homing group is increased; and return to execute the step of sending the weight of each homing group to the client and the subsequent steps.

2. The data storage method of claim 1, wherein, The weight of the homing group comprises a data column read weight and a data column write weight; The step of determining the weight of each homing group according to the mapping relationship between the homing group and the object storage device and the initial weight of the object storage device comprises: Determine the data column read weight and the data column write weight corresponding to each homing group according to the mapping relationship between the homing group and the object storage device, the initial weight of the object storage device and a data redundancy strategy.

3. The data storage method of claim 1, wherein, The step of determining the initial weight of the object storage device based on the capacity usage information of the object storage device comprises: Determine the residual capacity of the object storage device according to the capacity usage information of the object storage device; Determine the initial weight of the object storage device according to the residual capacity of the object storage device; wherein the size of the residual capacity and the initial weight of the object storage device are positively correlated.

4. The data storage method according to any one of claims 1 to 3, characterized in that, The step of updating the weight of at least one homing group, so that the weight gap between the selected target homing group and the unselected homing group is increased, comprises: Perform ascending processing on the weight of all the homing groups to obtain the first updated homing group weight, and perform descending processing on the first updated homing group weight corresponding to the target homing group to obtain the second updated homing group weight corresponding to the target homing group.

5. The data storage method of claim 4, wherein, The step of performing ascending processing on the weight of all the homing groups to obtain the first updated homing group weight, and performing descending processing on the first updated homing group weight corresponding to the target homing group to obtain the second updated homing group weight corresponding to the target homing group, comprises: Perform ascending processing on the weight of all the homing groups based on a first preset parameter to obtain the first updated homing group weight; Perform descending processing on the first updated homing group weight corresponding to the target homing group based on a second preset parameter to obtain the second updated homing group weight corresponding to the target homing group.

6. The data storage method of claim 1, wherein, The weight of the homing group comprises a data column read weight and a data column write weight; The step of updating the weight of at least one homing group, so that the weight gap between the selected target homing group and the unselected homing group is increased, comprises: Perform ascending processing on the data column read weight and the data column write weight of the object storage device corresponding to all the homing groups to obtain the first data column read weight and the first data column write weight corresponding to each object storage device; updating, based on the first data column read weight and the first data column write weight corresponding to each object storage device, the data column read weight and the data column write weight of each unselected homing group; performing descending processing on the first data column read weight and the first data column write weight corresponding to the target object storage device of the target homing group, to obtain the second data column read weight and the second data column write weight corresponding to the target object storage device; updating, based on the second data column read weight and the second data column write weight corresponding to the target object storage device, the data column read weight and the data column write weight corresponding to the target homing group.

7. The data storage method of claim 6, wherein, performing ascending processing on the data column read weight and the data column write weight of the object storage device corresponding to all homing groups, to obtain the first data column read weight and the first data column write weight corresponding to each object storage device, including: performing logical operation based on the current data column read weight, the number of replicas and the number of data columns to be read corresponding to the object storage device, to determine the first data column read weight; performing logical operation based on the current data column write weight and the number of data columns to be written corresponding to the object storage device, to determine the first data column write weight.

8. A target homing group determination method characterized by comprising: A client applied to a distributed storage system, including: receiving the weight of each homing group; wherein the weight of each homing group is the weight of the homing group determined based on the data storage method of any one of claims 1 to 7; in response to a write operation of a data block, determining a target homing group based on the weight of each homing group; writing the data block to the target homing group of the distributed storage system.

9. The target disposition group determination method of claim 8, wherein, The response to the write operation of the data block, the weight of each homing group based on the determination of the target homing group, including: in response to the write operation of the data block, the homing group with the largest data column read weight is taken as the target homing group; if the data column read weights of all homing groups are the same, the homing group with the largest data column write weight is taken as the target homing group; if the data column write weights of all homing groups are the same, the homing group with the largest homing group weight is taken as the target homing group.

10. A distributed storage system, characterized by, including: a management module for connecting with the client and connecting with a plurality of object storage devices, and performing the steps of the data storage method of any one of claims 1 to 7 to obtain the weight of each homing group; a client for performing the steps of the target homing group determination method of claim 8 or claim 9.

11. A data storage device, characterized by A management module applied to a distributed storage system, the distributed storage system including a management module and a client, the management module and the client are connected, including: a weight determination module for determining the initial weight of the object storage device based on the capacity usage information of the object storage device; determining the weight of each homing group according to the mapping relationship between the homing group and the object storage device and the initial weight of the object storage device; wherein any homing group is mapped with a plurality of object storage devices; the weight of the homing group is determined according to the weight of all the object storage devices mapped; a weight sending module for sending the weight of each homing group to the client, so that the client determines the target homing group according to the weight of each homing group. The weight updating module of the collection group is configured to update the weight of at least one collection group so as to increase the weight gap between the selected target collection group and the unselected collection group, and return to the step of sending the weight of each collection group to the client and the subsequent steps.

12. An electronic device, comprising: The data storage method comprises the following steps: a memory for storing a computer program; a processor for executing the computer program to implement the steps of the data storage method according to any one of claims 1 to 7, or for executing the computer program to implement the steps of the target collection group determination method according to claim 8 or claim 9.

13. A computer-readable storage medium, characterized in that, The computer program stored on the computer readable storage medium is executed by the processor to implement the steps of the data storage method according to any one of claims 1 to 7, or the computer program is executed by the processor to implement the steps of the target collection group determination method according to claim 8 or claim 9.

Citation Information

Patent Citations

  • Data object storage method and device

    CN107391039A

  • A distributed storage data equalization method and device

    CN109933285A