A method for optimizing data balance in distributed storage system

By calculating the expected bearer and usage of each disk in a distributed storage system, and generating migration instructions to achieve data balance, the problem of failure to effectively utilize disk space in the prior art is solved and the performance of the storage system is improved.

CN117850680BActive Publication Date: 2025-02-11CHINA TELECOM CLOUD TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311722336.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-14
Publication Date
2025-02-11
Estimated Expiration
2043-12-14

AI Technical Summary

Technical Problem

When performing data equalization, the actual amount of data carried by each PG is not considered, resulting in the disk space not being effectively utilized, resulting in some disks carrying more data and heavy read and write loads, resulting in the performance of the entire storage system being degraded. .

Method used

By calculating the total storage system capacity, the number of PGs expected to carry per disk, and the used capacity, determine whether it is marked as insufficient or migrated disk, and generate migration instructions to migrate the PG from the migrated disk to the insufficient disk to achieve data equalization.

Benefits of technology

Make the capacity of disks more balanced, improve the effective utilization of capacity, and the read and write load of each disk is more balanced, improving the performance of the entire storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117850680B_ABST
    Figure CN117850680B_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computer storage, and discloses an optimization method for data balancing in a distributed storage system; calculating the total capacity of the storage system; calculating the number of PGs that each disk in the storage system is expected to carry; calculating the total used capacity of the storage system: calculating the average use rate of the storage system and the expected used capacity of each disk: analyzing each disk in the storage system, judging whether it is marked as an insufficient disk, and calculating the number of insufficient PGs, insufficient capacity and the amount of data expected to be migrated to the PG corresponding to the insufficient disk; analyzing each disk in the storage system, judging whether it is marked as a migration disk, analyzing each PG in the migration disk, and judging whether to generate a migration instruction; when performing data balancing, making the use of the disk capacity more balanced, and improving the effective utilization rate of the capacity use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer storage technology, and more specifically, to a method for optimizing data balance in a distributed storage system. Background Art

[0002] The resources in the storage system are composed of a large number of disks. The data management method is as follows: (1) Data is organized into chunks; (2) Chunk hashes are mapped to logical layer PGs (placement groups); (3) PGs are fixedly mapped to disks by selecting disks. When the storage system is running, there will inevitably be scenarios where disks are added or deleted, resulting in an uneven distribution of PGs on the disks, which in turn leads to an uneven amount of data on the disks, resulting in a large amount of storage space wasted.

[0003] The existing patent application publication number CN114237520A discloses a ceph cluster data balancing method and system, which evenly divides the data blocks to be balanced by the master placement group to generate multiple balancing lists, and then the master placement group retains one balancing list and sends the other balancing lists to the slave placement groups respectively. Finally, the master placement group and the slave placement group send the data blocks stored in themselves to the newly added data storage device according to the data block names on the balancing list to achieve balancing. Multiple placement groups cooperate with each other to perform balancing operations at the same time in a unit time, which greatly improves the efficiency of data balancing;

[0004] However, the above-mentioned technology and the existing technology do not consider the actual amount of data carried by each PG when performing data balancing, and do not use the amount of data carried by the PG as a condition for selecting the target PG, resulting in that the space of each disk is not used more effectively, and some disks carry more data and have a heavier read and write load, resulting in a decrease in the performance of the entire storage system;

[0005] In view of this, the present invention proposes an optimization method for data balancing in a distributed storage system to solve the above problem. Summary of the invention

[0006] In order to overcome the above-mentioned defects of the prior art and to achieve the above-mentioned purpose, the present invention provides the following technical solution: a method for optimizing data balancing in a distributed storage system, comprising:

[0007] Step S1: Calculate the total capacity XZR of the storage system;

[0008] Step S2: Calculate the number of PGs CPS that each disk in the storage system is expected to carry i ;

[0009] Step S3: Calculate the total used capacity XZS of the storage system:

[0010] Step S4: Calculate the average usage rate PJL of the storage system and the expected usage capacity CZS of each disk i :

[0011] Step S5: Analyze each disk in the storage system to determine whether it is marked as an insufficient disk, and calculate the insufficient PG number BPS corresponding to the insufficient disk i 、Insufficient capacity BZR i And the amount of data RPS expected to be migrated to PG i ;

[0012] Step S6: Analyze each disk in the storage system to determine whether to mark it as a migration disk, analyze each PG in the migration disk to determine whether to generate a migration instruction; mark the PG corresponding to the migration instruction as a migration PG, and move the migration PG to the insufficient disk.

[0013] Furthermore, the calculation method of the total storage system capacity XZR includes:

[0014] Collect the capacity information of each disk in the storage system through the API i ;

[0015]

[0016] Where i is the i-th disk, m is the total number of disks in the storage system, i∈m.

[0017] Furthermore, the number of PGs CPS expected to be carried by each disk in the computing storage system is i ;

[0018] The number of PGs that each disk in the storage system is expected to carry in CPS i The calculation methods include:

[0019]

[0020] Where PGZ is the total number of PGs in the storage system.

[0021] Furthermore, the calculation method of the total used capacity XZS of the storage system includes:

[0022] Collect the usage capacity information of each disk in the storage system through the API SPR i ;

[0023]

[0024] Furthermore, the calculation method of the average usage rate PJL includes:

[0025]

[0026] Furthermore, the method for calculating the expected usage capacity of each disk includes:

[0027]

[0028] Further, the method for determining whether to mark as insufficient disk includes:

[0029] If the number of PGs carried by the disk is less than the expected number of PGs CPS i And use volume CPR i Less than expected usage capacity CZS i , then mark the disk as insufficient disk;

[0030] If the number of PGs carried by the disk is greater than or equal to the expected number of PGs CPS i Or use volume CPR i Greater than or equal to the expected usage capacity CZS i , the disk is not marked as insufficient.

[0031] Furthermore, the insufficient PG number BPS i The calculation methods include:

[0032] BPS i =CPS i -PGC i ;

[0033] In the formula, PGC i The number of PGs carried by the disk;

[0034] The insufficient capacity BZR i The calculation methods include:

[0035] BZR i =CZS i -SPR i

[0036] The amount of data RPS expected to be migrated to PG i The calculation methods include:

[0037]

[0038] Furthermore, the method for determining whether to mark a disk as a migration disk includes:

[0039] If the number of PGs carried by the disk is greater than the expected number of PGs CPS i And use volume CPR i Greater than expected usage capacity CZS i If a disk is found, the disk is marked as a migration disk;

[0040] If the number of PGs carried by the disk is less than or equal to the expected number of PGs carried CPS i Or use volume CPR i Less than or equal to the expected usage capacity CZS i If a disk is not marked as a migration disk, the disk is not marked as a migration disk.

[0041] Furthermore, the method for determining whether to generate a migration instruction includes:

[0042] Subtract the amount of data for each PG in the migration disk from the amount of data RPS expected to be migrated to the PG i Get the difference;

[0043] If the absolute value of the difference is less than the difference threshold, a migration instruction is generated;

[0044] If the absolute values ​​of the differences are all greater than or equal to the difference threshold, no migration instruction is generated.

[0045] The technical effects and advantages of the optimization method for data balancing in a distributed storage system of the present invention are as follows:

[0046] 1. When performing data balancing, make the disk capacity usage more balanced and improve the effective utilization of capacity.

[0047] 2. The read and write loads of each disk are more balanced, improving the performance of the entire storage system. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A schematic diagram of a method for optimizing data balancing in a distributed storage system according to Embodiment 1 of the present invention;

[0049] Figure 2 This is a schematic diagram of PG migration in Example 1 of the present invention;

[0050] Figure 3 This is a schematic diagram of the structure of an electronic device according to Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] Example 1

[0053] See also Figure 1 As shown, the method for optimizing data balance in a distributed storage system described in this embodiment includes:

[0054] S1: Calculate the total capacity of the storage system XZR;

[0055] The calculation method of the total storage system capacity XZR includes:

[0056] Collect the capacity information of each disk in the storage system through the API i ;

[0057]

[0058] Where i is the i-th disk, m is the total number of disks in the storage system, i∈m;

[0059] API is an application programming interface, which is a set of specifications that define the interaction between software components; it allows different software systems or applications to communicate, exchange data, or access each other's functions and services in order to achieve specific operations or functions;

[0060] S2: Calculate the number of PGs CPS that each disk in the storage system is expected to carry i ;

[0061] The number of PGs that each disk in the storage system is expected to carry in CPS i The calculation methods include:

[0062]

[0063] Where PGZ is the total number of PGs in the storage system;

[0064] The total number of PGs in the storage system (PGZ) is obtained by querying the command line tool in the storage system;

[0065] It should be noted that the PG in the storage system is the basic unit of data distribution and data recovery. The number of PGs is the total number of PGs in the storage system. It is an important parameter for the performance and load distribution of the storage system. The number of PGs determines the distribution of data in the storage system. More PGs means better data distribution and better load balancing, but it also increases the management overhead and storage overhead of the storage system. Therefore, a suitable number of PGs is required to provide good performance and reliability.

[0066] S3: Calculate the total used capacity of the storage system XZS:

[0067] The calculation method of the total used capacity XZS of the storage system includes:

[0068] Collect the usage capacity information of each disk in the storage system through the API SPR i ;

[0069]

[0070] S4: Calculate the average usage rate PJL of the storage system and the expected usage capacity CZS of each disk i :

[0071] The calculation method of average usage rate PJL includes:

[0072]

[0073] The calculation method for the expected used capacity of each disk includes:

[0074] CZS i =CPR i ×PJL;

[0075] S5: Analyze each disk in the storage system to determine whether it is marked as insufficient disk, and calculate the insufficient PG number BPS corresponding to the insufficient disk i 、Insufficient capacity BZR i And the amount of data RPS expected to be migrated to PG i ;

[0076] Methods for determining whether a disk is marked as insufficient include:

[0077] If the number of PGs carried by the disk is less than the expected number of PGs CPS i And use volume CPR i Less than expected usage capacity CZS i , the disk is marked as insufficient.

[0078] If the number of PGs carried by the disk is greater than or equal to the expected number of PGs CPS i Or use volume CPR i Greater than or equal to the expected usage capacity CZS i , then the disk is not marked as insufficient disk;

[0079] Insufficient PG number BPS i The calculation methods include:

[0080] BPS i =CPS i -PGC i ;

[0081] In the formula, PGC i The number of PGs carried by the disk;

[0082] The number of PGs carried by each disk in the storage system PGC i Obtained through querying command line tools in the storage system;

[0083] Insufficient capacity BZR i The calculation methods include:

[0084] BZR i =CZS i -SPR i ;

[0085] The amount of data to be migrated to PG RPS i The calculation methods include:

[0086]

[0087] S6: Analyze each disk in the storage system to determine whether to mark it as a migration disk, analyze each PG in the migration disk to determine whether to generate a migration instruction; mark the PG corresponding to the migration instruction as a migration PG, and move the migration PG to the insufficient disk;

[0088] Methods for determining whether a disk is marked for migration include:

[0089] If the number of PGs carried by the disk is greater than the expected number of PGs CPS i And use volume CPR i Greater than expected usage capacity CZS i If a disk is found, the disk is marked as a migration disk;

[0090] If the number of PGs carried by the disk is less than or equal to the expected number of PGs carried CPS i Or use volume CPR i Less than or equal to the expected usage capacity CZS i If a disk is not marked as a migration disk, the disk is not marked as a migration disk;

[0091] Methods for determining whether to generate a migration instruction include:

[0092] Subtract the amount of data for each PG in the migration disk from the amount of data RPS expected to be migrated to the PG i Get the difference;

[0093] If the absolute value of the difference is less than the difference threshold, a migration instruction is generated;

[0094] If the absolute values ​​of the differences are all greater than or equal to the difference threshold, no migration instruction is generated;

[0095] The amount of data for each PG in the migration disk is obtained by the storage system API;

[0096] It should be noted that the difference threshold is preset. In the experimental environment, technicians in this field repeatedly move the PGs in the migration disk to the insufficient disk to ensure that the usage rate of each disk space is similar. The RPS value is calculated by subtracting the data volume RPS of the PG to be migrated from the insufficient disk each time. iGet the difference, calculate the average of the absolute values ​​of multiple differences, sort the averages calculated multiple times, and use the largest average as the difference threshold;

[0097] The purpose of PG migration is to improve the effective utilization of disk space, balance the read and write load of the disk, and improve the performance of the entire storage system.

[0098] For example, see Figure 2 As shown, there are 3 disks, and the number of PGs is unevenly distributed, and the amount of data carried by PGs also has certain differences; since the capacity of disks disk1, disk2 and disk3 is 50G, the total capacity of the storage system is 50+50+50=150G, and the total used capacity of the storage system is 40+3+31=74G, then the average utilization rate of the storage system is 74 / 150=49%; the expected used capacity of disks disk1, disk2 and disk3 is 50×49%=24.5G, and the number of PGs expected to be carried by disks disk1, disk2 and disk3 is 12×(50 / 150×100%)=4. Since the used capacity of disks disk1 and disk3 is greater than the expected used capacity, and the number of PGs carried is greater than the expected number of PGs carried, disks disk1 and disk3 are marked as migration disks; since disk 2's used capacity is less than the expected used capacity, and the number of PGs it carries is less than the expected number of PGs, so disk disk2 is marked as insufficient disk; the amount of data expected to be migrated to PG corresponding to disk disk2 is (24.5-3) / (4-1)=7.17G; disks disk1 and disk3 are analyzed, and PG5 or PG2 and PG6 in disk disk1 and PG9 or PG11 in disk disk3 are marked as migration PGs; the migrated PGs are moved to disk disk2; after completing the PG migration, the corresponding usage rate of disk disk1 is (2+6+10+8) / 50×100%=52%, the corresponding usage rate of disk disk2 is (3+6+8+7) / 50×100%=48%, and the corresponding usage rate of disk disk3 is (6+5+7+6) / 50×100%=48%, that is, the usage rate of each disk space is similar;

[0099] This embodiment proposes an optimization solution for a more balanced amount of data carried by the disk in a data balancing scenario. It uses uniform PG distribution as a balancing strategy to trigger data migration within the storage system to make the utilization rate of each disk space consistent. It improves the effective utilization rate of the disk space and balances the read and write load of the disk at the same time, thereby improving the performance of the entire storage system.

[0100] Example 2

[0101] See also Figure 3 As shown, this embodiment discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements any one of the above methods to implement an optimization method for data balancing in a distributed storage system.

[0102] Since the electronic device introduced in this embodiment is an electronic device used to implement a method for optimizing data balance in a distributed storage system in the embodiment of the present application, based on the method for optimizing data balance in a distributed storage system introduced in the embodiment of the present application, a person skilled in the art can understand the specific implementation of the electronic device of the present embodiment and its various variations, so how the electronic device implements the method in the embodiment of the present application is not described in detail here. As long as a person skilled in the art implements an electronic device used in a method for optimizing data balance in a distributed storage system in the embodiment of the present application, it belongs to the scope of protection of the present application.

[0103] Example 3

[0104] This embodiment discloses a computer-readable storage medium, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any one of the above methods to implement an optimization method for data balancing in a distributed storage system.

[0105] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center through a wired network or a wireless network. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.

[0106] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0107] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0108] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only one, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0109] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0110] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0111] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

[0112] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for optimizing data balance in a distributed storage system, characterized in that: include: Step S1: Calculate the total capacity XZR of the storage system; The calculation method of the total storage system capacity XZR includes: Collect the capacity information of each disk in the storage system through the API i ; Where i is the i-th disk, m is the total number of disks in the storage system, i∈m Step S2: Calculate the number of PGs CPS that each disk in the storage system is expected to carry i ; Step S3: Calculate the total used capacity XZS of the storage system: Step S4: Calculate the average usage rate PJL of the storage system and the expected usage capacity CZS of each disk i : Step S5: Analyze each disk in the storage system to determine whether it is marked as an insufficient disk, and calculate the insufficient PG number BPS corresponding to the insufficient disk i 、Insufficient capacity BZR i And the amount of data RPS expected to be migrated to PG i ; The calculation method of the total storage system capacity XZR includes: Collect the capacity information of each disk in the storage system through the API i ; Where i is the i-th disk, m is the total number of disks in the storage system, i∈m; Step S6: Analyze each disk in the storage system to determine whether it is marked as a migration disk, analyze each PG in the migration disk to determine whether to generate a migration instruction; mark the PG corresponding to the migration instruction as a migration PG, and move the migration PG to the insufficient disk; The method for determining whether to mark a disk as a migration disk includes: If the number of PGs carried by the disk is greater than the expected number of PGs CPS i , and use volume CPR i Greater than expected usage capacity CZS i If a disk is found, the disk is marked as a migration disk; If the number of PGs carried by the disk is less than or equal to the expected number of PGs carried CPS i , Use volume CPR i Less than or equal to the expected usage capacity CZS i If a disk is not marked as a migration disk, the disk is not marked as a migration disk; The method for determining whether to generate a migration instruction includes: Subtract the amount of data for each PG in the migration disk from the amount of data RPS expected to be migrated to the PG i Get the difference; If the absolute value of the difference is less than the difference threshold, a migration instruction is generated; If the absolute values ​​of the differences are all greater than or equal to the difference threshold, no migration instruction is generated.

2. The method for optimizing data balance in a distributed storage system according to claim 1, characterized in that: The number of PGs that each disk in the storage system is expected to carry (CPS) i ; The number of PGs that each disk in the storage system is expected to carry in CPS i The calculation methods include: Where PGZ is the total number of PGs in the storage system.

3. The method for optimizing data balance in a distributed storage system according to claim 2, characterized in that: The calculation method of the total used capacity XZS of the storage system includes: Collect the usage capacity information of each disk in the storage system through the API SPR i ; 4. The method for optimizing data balance in a distributed storage system according to claim 3, characterized in that: The calculation method of the average usage rate PJL includes:

5. The method for optimizing data balance in a distributed storage system according to claim 4, characterized in that: The method for calculating the expected usage capacity of each disk includes: CZSi=CPRi×PJL.

6. The method for optimizing data balance in a distributed storage system according to claim 5, characterized in that: The insufficient PG number BPS i The calculation methods include: BPSi=CPSi-PGCi; In the formula, PGC i The number of PGs carried by the disk; The insufficient capacity BZR i The calculation methods include: BZRi=CZSi-SPRi The amount of data RPS expected to be migrated to PG i The calculation methods include:

Citation Information

Patent Citations

  • Method and system for balancing ceph cluster data

    CN114237520A

  • Capacity balancing method and device of storage system, computer equipment and storage medium

    CN113268203A

  • Data balancing method and device based on distributed storage system

    CN114047883A