Metadata load balancing method, device and electronic equipment

CN114064570BActive Publication Date: 2026-10-09XINHUASAN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111401376.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-19
Publication Date
2026-10-09
Estimated Expiration
2041-11-19

AI Technical Summary

Technical Problem

但是元数据迁移时,实际物理存储地址内的文件或目录是不能被写操作的,会导致用户操作中断,而实时迁移元数据信息会严重影响用户对目录或文件进行读写的效率

Benefits of technology

[0016]The technical solution provided in this application first creates a shared directory within each metadata server to store metadata information of actual subdirectories or files within the external data storage space, allowing multiple metadata servers to manage the overall directory structure collaboratively. The load parameters of the shared directories in each metadata server are calculated in real time. Only when the maximum and minimum load parameters exceed preset thresholds is the metadata information in the corresponding first shared directory migrated to a second shared directory. This achieves load balancing between the metadata server with the highest and lowest load, thus avoiding real-time load adjustments. While ensuring load balancing across metadata servers, this reduces the number of metadata migrations and minimizes the impact on user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114064570B_ABST
    Figure CN114064570B_ABST
Patent Text Reader

Abstract

The application discloses a metadata load balancing method and device and electronic equipment, which are applied to a server cluster composed of multiple metadata servers, and the method comprises the following steps: a shared directory is created in each metadata server to store metadata information through the shared directory; load parameters corresponding to each shared directory are counted, and a difference between a maximum load parameter and a minimum load parameter is determined; if the difference reaches a preset threshold, part of metadata information in a first shared directory corresponding to the maximum load parameter is migrated to a second shared directory corresponding to the minimum load parameter. The technical scheme provided by the application takes the load parameter difference between the maximum load metadata server and the minimum load metadata server as the measurement, and the metadata information migration is only performed when the difference meets the preset threshold, so that the migration times in the metadata management process are reduced, and the influence of interrupting user operation services is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of distributed file storage systems, and more specifically to a metadata load balancing method, apparatus, and electronic device. Background Technology

[0002] With the development of technologies such as high-definition video, image processing, and video surveillance, user data capacity is increasing rapidly, and users' demands for read / write performance of stored data are also rising simultaneously. Distributed file storage systems have emerged to meet this need. Metadata management, which involves managing metadata information, is a crucial aspect of distributed file storage systems. It governs all data distribution information within the system and is its core component. The efficiency of metadata management directly determines the performance of the distributed file storage system. Therefore, efficient metadata management is extremely important. A large number of shared directory files can overload the metadata server, severely impacting metadata management efficiency.

[0003] Current technology first stores all metadata information of a directory structure on a single metadata server. As the number of directory files in the directory increases, it uses real-time load balancing to determine if the load across multiple metadata servers is consistent. If inconsistent, it migrates the metadata information in the directory in real time to achieve load consistency across the multiple metadata servers. However, during metadata migration, files or directories in the actual physical storage address cannot be written to, causing user operation interruption. Real-time migration of metadata information can severely impact the efficiency of users reading and writing directories or files. Therefore, how to reduce the impact of user operation interruption during metadata management is an urgent problem to be solved. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a metadata load balancing method, apparatus, and electronic device, thereby reducing the impact of user operation interruptions during metadata management.

[0005] According to a first aspect, the present invention provides a metadata load balancing method applied to a server cluster consisting of multiple metadata servers. The method includes: creating a shared directory in each of the metadata servers to store metadata information through the shared directory; calculating the load parameters corresponding to each of the shared directories and determining the difference between the maximum load parameter and the minimum load parameter; if the difference reaches a preset threshold, migrating a portion of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter.

[0006] Optionally, the load parameter is the number of metadata files in the shared directory, and migrating a portion of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter includes: migrating a portion of the metadata information in the first shared directory to the second shared directory until the difference between the number of files in the first shared directory and the second shared directory is less than a second preset threshold.

[0007] Optionally, the load parameter further includes the number of times the metadata information files in the shared directory are called. Determining the difference between the maximum load parameter and the minimum load parameter includes: calculating a weighted result of the number of files and the number of calls for each metadata server; and calculating the difference between the maximum weighted result and the minimum weighted result as the difference between the maximum load parameter and the minimum load parameter.

[0008] Optionally, migrating some metadata information from the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter includes: migrating some metadata information from the first shared directory to the second shared directory until the difference between the weighted results of the first shared directory and the second shared directory is less than a third preset threshold.

[0009] Optionally, the method further includes: adding the metadata information corresponding to each newly added subdirectory to the shared directory of each metadata server in a cyclic manner.

[0010] Optionally, before migrating some metadata information from the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter, the method further includes: periodically detecting the number of calls to metadata information in all shared directories, and obtaining a time period in which the number of calls is lower than a fourth preset threshold as a migration time period; if the current time point is within the migration time period, then returning to the step of migrating some metadata information from the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter; if the current time point is not within the migration time period, then suspending the migration task until the time reaches the migration time period, then returning to the step of migrating some metadata information from the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter.

[0011] According to a second aspect, the present invention provides a metadata load balancing device applied in a server cluster composed of multiple metadata servers. The device includes: an initialization module for creating shared directories in each of the metadata servers to store metadata information through the shared directories; a load calculation module for calculating the load parameters corresponding to each of the shared directories and determining the difference between the maximum load parameter and the minimum load parameter; and a load balancing module for migrating part of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter if the difference reaches a preset threshold.

[0012] Optionally, before the load balancing module, the system further includes: a time detection module, used to periodically detect the number of calls to metadata information in all shared directories, and obtain a time period in which the number of calls is lower than a fourth preset threshold as the migration time period; a migration module, used to return the step of migrating part of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter if the current time is not within the migration time period; and a suspension module, used to suspend the migration task until the migration time period is reached, and then return the step of migrating part of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter.

[0013] According to a third aspect, embodiments of the present invention provide an electronic device, including: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the method described in the first aspect, or any optional embodiment of the first aspect.

[0014] According to a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing computer instructions for causing the computer to perform the method described in the first aspect, or any alternative embodiment of the first aspect.

[0015] The technical solution provided in this application has the following advantages:

[0016] The technical solution provided in this application first creates a shared directory within each metadata server to store metadata information of actual subdirectories or files within the external data storage space, allowing multiple metadata servers to manage the overall directory structure collaboratively. The load parameters of the shared directories in each metadata server are calculated in real time. Only when the maximum and minimum load parameters exceed preset thresholds is the metadata information in the corresponding first shared directory migrated to a second shared directory. This achieves load balancing between the metadata server with the highest and lowest load, thus avoiding real-time load adjustments. While ensuring load balancing across metadata servers, this reduces the number of metadata migrations and minimizes the impact on user experience.

[0017] Furthermore, by using the number of files and access frequency of metadata information within the shared directory as load parameters, the accuracy of load balancing calculations is further improved. Additionally, whenever a new subdirectory needs to be added, the newly added subdirectory files are stored cyclically across all metadata servers, ensuring that the addition of subdirectories follows an even distribution principle to reduce the number of subsequent metadata migrations. On the other hand, setting the metadata migration time to the period with the fewest user accesses to directories or files further reduces the disruption to user operations caused by metadata migration. Attached Figure Description

[0018] The features and advantages of the invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the invention in any way. In the drawings:

[0019] Figure 1 This diagram illustrates the steps of a metadata load balancing method according to one embodiment of the present invention.

[0020] Figure 2 A flowchart illustrating a metadata load balancing method according to one embodiment of the present invention is shown.

[0021] Figure 3 A schematic diagram of a metadata load balancing device according to one embodiment of the present invention is shown;

[0022] Figure 4 This diagram illustrates another structural schematic of a metadata load balancing device according to one embodiment of the present invention.

[0023] Figure 5 A schematic diagram of an electronic device according to one embodiment of the present invention is shown. Detailed Implementation

[0024] 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 a part of the embodiments of the present invention, and not all of them. 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.

[0025] Please see Figure 1 and Figure 2 In one implementation, a metadata load balancing method is applied to a server cluster consisting of multiple metadata servers, specifically including the following steps:

[0026] Step S101: Create a shared directory in each metadata server to store metadata information through the shared directory.

[0027] Step S102: Calculate the load parameters corresponding to each shared directory and determine the difference between the maximum load parameter and the minimum load parameter.

[0028] Step S103: If the difference reaches a preset threshold, migrate some metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter.

[0029] Specifically, in a distributed file system, the actual storage location of a whole directory and its subdirectories and files is called the storage layer. The data used to describe the directory and files is called metadata. Metadata information is stored on a metadata server to manage the directory structure, which is called the metadata layer. The computing layer can access the corresponding location in the storage layer through the metadata information in the metadata layer, thereby performing read and write operations on the corresponding files. The storage layer, metadata layer, and computing layer can all include multiple devices. In this embodiment of the invention, a shared directory is created in each metadata server to manage the metadata information. For example, if a directory structure includes 10 pieces of metadata information, and each metadata server contains a shared directory, distributing the 10 pieces of metadata information among the shared directories allows multiple metadata servers to jointly manage the directory structure. To solve the problem of severe user interruption caused by real-time migration of metadata information in existing technologies, a preset threshold is set. Metadata migration will only occur when, in extreme cases, the difference in load parameters between the highest-loaded shared directory and the lowest-loaded shared directory exceeds the threshold, i.e., the load of the highest-loaded metadata server is much higher than the load of the lowest-loaded metadata server, thus ensuring load balancing. Typically, based on the number of files managed by the metadata server, migration is only performed when the difference reaches millions. Therefore, based on the above steps, load balancing can be achieved while ensuring the normal operation of the metadata server. Compared with real-time load calculation and migration, this significantly reduces the number of metadata information migrations and also significantly reduces the impact of interrupting user file operations.

[0030] Specifically, in one embodiment, the load parameter is the number of metadata information files in the shared directory of each metadata server, and step S103 above specifically includes the following steps:

[0031] Step 1: Migrate some metadata information from the first shared directory to the second shared directory until the difference in the number of files between the first and second shared directories is less than a second preset threshold. Specifically, when the number of files managed by the metadata server is too large, it can slow down server operation, startup, and invocation. Therefore, when the difference in the number of files between the shared directory with the most files and the shared directory with the fewest files on the metadata server is too large (usually in the millions), it is necessary to balance the number of files between the two metadata servers until the difference in the number of files in the shared directories of the two metadata servers is less than the second preset threshold. In this embodiment, a difference in the number of files between the two shared directories within 1000 is considered load balancing. Using the number of files as the standard for load parameters provides a more specific description of the load parameters, thereby improving the accuracy of load balancing. For example, if the first shared directory contains 10,000 metadata entries and the second shared directory contains 2,000 metadata entries, the metadata entries in the first shared directory are migrated to the second shared directory in batches of 100 entries each time. After 36 migrations, the first shared directory contains 6,400 files and the second shared directory contains 5,600 files. The difference between them is 800, which is less than 1,000, thus meeting the condition of the second preset threshold, and the migration is completed.

[0032] Specifically, in one embodiment, the load parameter also includes the number of times the metadata information file in the shared directory is called. The above step S102 specifically includes the following steps:

[0033] Step 2: Calculate the weighted result of the number of files and the number of calls for each metadata server.

[0034] Step 3: Calculate the difference between the maximum weighted result and the minimum weighted result as the difference between the maximum load parameter and the minimum load parameter.

[0035] Specifically, in this embodiment, the load parameter includes not only the number of files but also the number of times each file in the shared directory is accessed. When a user accesses the actual files in the storage layer through the computing layer, they need to call the metadata information files managed by the metadata server to obtain information such as the actual location and attributes of the files in the storage layer. When a user accesses a certain type of file frequently, the metadata server will frequently call the metadata information directory and files, increasing the CPU and memory usage pressure on the metadata server. Therefore, this embodiment comprehensively considers the number of metadata information files in the shared directory and the number of times the metadata information directory files are accessed, and uses a weighted algorithm (average weighting in this embodiment) to combine the results of the two types of parameters as the load parameter, thereby obtaining a comprehensive index to measure the load of the metadata server. The resulting load parameter difference is more accurate, further improving the accuracy of load balancing by the metadata server. For example, if the first shared directory contains 2000 files and its internal metadata files are accessed 3000 times, in this embodiment, the load parameter obtained by the weighted average algorithm is 2000×0.5+3000×0.5=2500. If the second shared directory contains 600 metadata files and its internal files are accessed 800 times, the load parameter obtained by the weighted average algorithm is 600×0.5+800×0.5=700. The difference between the weighted results is 1800.

[0036] Specifically, in one embodiment, based on steps two and three, step S103 above specifically includes the following steps:

[0037] Step 4: Migrate some metadata information from the first shared directory to the second shared directory until the difference between the weighted results of the first and second shared directories is less than the third preset threshold.

[0038] Specifically, some metadata information in the first shared directory is migrated to the second shared directory until the difference in the weighted result is less than a third preset threshold (200 in this embodiment), at which point the migration stops. This further ensures the accuracy and reliability of the load balancing operation. For example, based on the examples in steps two and three above, the difference in the weighted result between the first and second shared directories is 1800. Each time, 50 metadata information items are migrated from the first shared directory to the second shared directory. After the first migration, the number of files in the first shared directory is 1950, and the number of files in the second shared directory is 650. Assuming that the calculated difference in the weighted result is 1700, which is not less than the third preset threshold of 200, migration needs to continue. After 20 migrations, the number of files in the first shared directory is 1000, and the number of files in the second shared directory is 1600. The difference in the weighted result between the two shared directories is recalculated to be 180, which meets the condition of being less than the third preset threshold of 200, thus completing the migration.

[0039] Specifically, in one embodiment, a metadata load balancing method further includes the following steps:

[0040] Step 5: Add the metadata information corresponding to each newly added subdirectory to the shared directory of each metadata server in a circular manner.

[0041] Specifically, each time a user creates a new subdirectory in the actual storage location of the directory structure, the metadata information of the subdirectory is sequentially and cyclically stored in the shared directories of various different metadata servers. For example, the first newly created subdirectory is stored in metadata server 1, the next newly created subdirectory is stored in metadata server 2, and the operation of storing metadata information cycles among multiple metadata servers. This ensures that each newly created subdirectory is distributed evenly among multiple metadata servers as much as possible. If the number of files in each subdirectory is not significantly different, the load on each shared directory will not vary too much, at least in the short term. This further reduces the number of times metadata information is migrated and reduces the impact of metadata migration on user operations.

[0042] Specifically, in one embodiment, prior to step S103 above, a metadata load balancing method further includes the following steps:

[0043] Step Six: Periodically check the number of times metadata information is called in all shared directories, and select the time period when the number of calls is lower than the fourth preset threshold as the migration time period.

[0044] Step 7: If the current time point is within the migration period, return to the steps of migrating some metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter.

[0045] Step 8: If the current time point is not within the migration period, suspend the migration task until the migration period arrives, then return to the step of migrating part of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter.

[0046] Specifically, in this embodiment, when user services are running normally, the computing layer periodically counts the total number of times metadata information is accessed across various metadata servers (e.g., once per hour). The more times metadata information is accessed, the more times the actual data files are read or written in the storage layer (the more frequent the service), and the greater the access traffic to the server storing the actual data files. During the periodic detection process, time periods when the number of times user metadata information is accessed is recorded below a fourth preset threshold (e.g., time periods when the number of metadata information accesses is below 200). In other words, the least frequent service period is used as the migration time period, such as 3 AM to 4 AM. Then, the metadata information migration step is performed within the migration time period, which further minimizes the impact of service interruptions on users and improves the user experience.

[0047] Through the above steps, the technical solution provided in this application first creates a shared directory within each metadata server to store metadata information of actual subdirectories or files within the external data storage space, allowing multiple metadata servers to manage the overall directory structure collaboratively. The load parameters of the shared directories in each metadata server are calculated in real time. Only when the maximum and minimum load parameters exceed preset thresholds is the metadata information in the corresponding first shared directory migrated to the second shared directory. This achieves load balancing between the metadata server with the highest and lowest load, thus avoiding real-time load adjustments. While ensuring load balancing across metadata servers, this reduces the number of metadata migrations and minimizes the impact on user experience.

[0048] Furthermore, by using the number of files and access frequency of metadata information within the shared directory as load parameters, the accuracy of load balancing calculations is further improved. Additionally, whenever a new subdirectory needs to be added, the newly added subdirectory files are stored cyclically across all metadata servers, ensuring that the addition of subdirectories follows an even distribution principle to reduce the number of subsequent metadata migrations. On the other hand, setting the metadata migration time to the period with the fewest user accesses to directories or files further reduces the disruption to user operations caused by metadata migration.

[0049] like Figure 3As shown, this embodiment also provides a metadata load balancing device, applied in a server cluster composed of multiple metadata servers. The device includes:

[0050] Initialization module 101 is used to create shared directories in each metadata server to store metadata information. For details, please refer to the relevant description of step S101 in the above method embodiments, which will not be repeated here.

[0051] The load calculation module 102 is used to calculate the load parameters corresponding to each shared directory and determine the difference between the maximum and minimum load parameters. For details, please refer to the relevant description of step S102 in the above method embodiment, which will not be repeated here.

[0052] The load balancing module 103, if the difference reaches a preset threshold, migrates some metadata information from the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter. For details, please refer to the relevant description of step S103 in the above method embodiment, which will not be repeated here.

[0053] Specifically, such as Figure 4 As shown, in one embodiment, the device further includes, prior to the equalization module:

[0054] The time detection module 104 is used to periodically detect the number of times metadata information is called in all shared directories, and to obtain the time period when the number of calls is lower than a fourth preset threshold as the migration time period. For details, please refer to the relevant description in step six of the above method embodiment, which will not be repeated here.

[0055] Migration module 105, if the current time point is within the migration time period, is used to return the steps of migrating some metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter. For details, please refer to the relevant description in step seven of the above method embodiment, which will not be repeated here.

[0056] The suspension module 106, if the current time point is not within the migration time period, is used to suspend the migration task until the migration time period arrives, at which point it returns to the step of migrating part of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter. For details, please refer to the relevant description in step eight of the above method embodiment, which will not be repeated here.

[0057] The present invention provides a metadata load balancing device for executing a metadata load balancing method provided in the above embodiments. Its implementation method and principle are the same. For details, please refer to the relevant description of the above method embodiments, which will not be repeated here.

[0058] Through the collaborative efforts of the aforementioned components, the technical solution provided in this application first creates a shared directory within each metadata server to store metadata information of actual subdirectories or files within the external data storage space. This allows multiple metadata servers to manage the overall directory structure collaboratively. The load parameters of the shared directories in each metadata server are calculated in real time. Only when the maximum and minimum load parameters exceed preset thresholds is the metadata information in the corresponding first shared directory migrated to the second shared directory. This achieves load balancing between the metadata server with the highest and lowest load, thus avoiding real-time load adjustments. While ensuring load balancing across all metadata servers, this reduces the number of metadata migrations and minimizes the impact on user experience.

[0059] Furthermore, by using the number of files and access frequency of metadata information within the shared directory as load parameters, the accuracy of load balancing calculations is further improved. Additionally, whenever a new subdirectory needs to be added, the newly added subdirectory files are stored cyclically across all metadata servers, ensuring that the addition of subdirectories follows an even distribution principle to reduce the number of subsequent metadata migrations. On the other hand, setting the metadata migration time to the period with the fewest user accesses to directories or files further reduces the disruption to user operations caused by metadata migration.

[0060] Figure 5 An electronic device according to an embodiment of the present invention is shown. The device includes a processor 901 and a memory 902, which can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.

[0061] Processor 901 can be a Central Processing Unit (CPU). Processor 901 can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips.

[0062] The memory 902, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the above method embodiments. The processor 901 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions, and modules stored in the memory 902, thereby implementing the methods in the above method embodiments.

[0063] The memory 902 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created by the processor 901, etc. Furthermore, the memory 902 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 902 may optionally include memory remotely located relative to the processor 901, and these remote memories may be connected to the processor 901 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0064] One or more modules are stored in memory 902, and when executed by processor 901, they perform the methods described in the above method embodiments.

[0065] The specific details of the aforementioned electronic device can be understood by referring to the relevant descriptions and effects in the above method embodiments, and will not be repeated here.

[0066] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The implemented program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.

[0067] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A metadata load balancing method, characterized in that, The method, applied to a server cluster consisting of multiple metadata servers, includes: A shared directory is created in each of the aforementioned metadata servers to store metadata information. The load parameters corresponding to each of the shared directories are statistically analyzed, and the difference between the maximum load parameter and the minimum load parameter is determined. The load parameters include the number of metadata files in the shared directory and the number of times the metadata files are accessed. Determining the difference between the maximum load parameter and the minimum load parameter includes: calculating the weighted result of the number of files and the number of accesses for each metadata server using an average weighted algorithm; and calculating the difference between the maximum weighted result and the minimum weighted result as the difference between the maximum load parameter and the minimum load parameter. If the difference reaches a first preset threshold, some metadata information in the first shared directory corresponding to the maximum load parameter is migrated to the second shared directory corresponding to the minimum load parameter, including: migrating some metadata information in the first shared directory to the second shared directory until the difference between the weighted result of the first shared directory and the second shared directory is less than the second preset threshold.

2. The method according to claim 1, characterized in that, The method further includes adding the metadata information corresponding to each newly added subdirectory to the shared directory of each metadata server in a cyclic manner.

3. The method according to claim 1, characterized in that, Before migrating some metadata information from the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter, the method further includes: The number of times metadata information is called in all shared directories is periodically detected, and the time period in which the number of calls is lower than a fourth preset threshold is used as the migration time period; If the current time point is within the migration time period, then return to the step of migrating part of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter; If the current time point is not within the migration time period, the migration task will be suspended until the migration time period is reached, at which point the step of migrating part of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter will be returned.

4. A metadata load balancing device, characterized in that, The apparatus is used in a server cluster consisting of multiple metadata servers and includes: An initialization module is used to create a shared directory in each of the metadata servers to store metadata information through the shared directory; The load calculation module is used to calculate the load parameters corresponding to each of the shared directories and determine the difference between the maximum load parameter and the minimum load parameter. The load parameters include the number of metadata files in the shared directory and the number of times the metadata files are accessed. Determining the difference between the maximum load parameter and the minimum load parameter includes: calculating the weighted result of the number of files and the number of accesses for each metadata server using an average weighted algorithm; and calculating the difference between the maximum weighted result and the minimum weighted result as the difference between the maximum load parameter and the minimum load parameter. The load balancing module, if the difference reaches a first preset threshold, is used to migrate some metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter, including: migrating some metadata information in the first shared directory to the second shared directory until the difference between the weighted results of the first shared directory and the second shared directory is less than the second preset threshold.

5. The apparatus according to claim 4, characterized in that, Before the load balancing module, the following is also included: The time detection module is used to periodically detect the number of times metadata information is called in all shared directories, and to obtain the time period when the number of calls is lower than a fourth preset threshold as the migration time period; The migration module, if the current time point is within the migration time period, is used to return the step of migrating part of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter; The suspension module is used to suspend the migration task if the current time point is not within the migration time period, until the time reaches the migration time period, and then return to the step of migrating part of the metadata information in the first shared directory corresponding to the maximum load parameter to the second shared directory corresponding to the minimum load parameter.

6. An electronic device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method as described in any one of claims 1-3.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the method as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Metadata management method and device and computer readable storage medium

    CN107766159A

  • Data migration method and device, storage system and storage medium

    CN113495680A