Ceph file system metadata server load balancing method and device

By keeping the directory shard readable and writeable state in the Ceph file system, the current data is first sent, and then frozen and calculate the incremental data, the problem of long freezing time caused by unbalanced load of metadata server is solved, and the performance and stability of metadata services are improved.

CN115757326BActive Publication Date: 2025-08-15ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211364568.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-02
Publication Date
2025-08-15
Estimated Expiration
2042-11-02

AI Technical Summary

Technical Problem

In the existing Ceph distributed file system, the metadata server load imbalance problem causes the directory shard to freeze too long, affecting the performance and stability of delay-sensitive services.

Method used

The method of first sending the current data first while keeping the directory fragment to be transmitted, and then freezing and calculating the incremental data is converted to full to incremental, reducing the freezing time.

Benefits of technology

It significantly reduces the freezing time of directory shards, improves the performance and stability of metadata services, especially in delay-sensitive scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115757326B_ABST
    Figure CN115757326B_ABST
Patent Text Reader

Abstract

This application discloses a method and apparatus for metadata server load balancing in a Ceph file system. The method includes: determining the current data of a directory shard to be transferred on an exporting metadata server in response to triggering metadata server load balancing; sending the current data of the directory shard to be transferred to an importing metadata server while maintaining the directory shard to be transferred in a readable and writable state; freezing the directory shard to be transferred, calculating incremental data for the directory shard to be transferred based on the current data; and sending the incremental data to the importing metadata server, so that the importing metadata server uses the incremental data and the current data to generate a directory shard to be transferred for providing external metadata services. This application can significantly reduce the freezing time of directory shards.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of distributed systems, and in particular to a method and device for load balancing a metadata server of a Ceph file system. Background Art

[0002] The Ceph distributed file system uses a centralized architecture. In real-world scenarios, metadata service hotspots can occur on individual data servers, limiting the performance of Ceph distributed storage clusters. To overcome the performance bottleneck of individual data servers in large-scale clusters, multi-data server technology has emerged. However, this technology suffers from uneven workloads caused by sharding, which is typically addressed by metadata server load balancing. However, current metadata server load balancing methods suffer from the prolonged freezing of directory shards, which can cause latency-sensitive services to fail or time out. Summary of the Invention

[0003] The present application provides a Ceph file system metadata server load balancing method and device, which can effectively reduce the freezing time of directory shards.

[0004] To achieve the above objectives, the present application provides a method for load balancing metadata servers of a Ceph file system. The Ceph file system includes at least two metadata servers. The method is applied to an export metadata server of the at least two metadata servers. The method includes:

[0005] In response to triggering metadata server load balancing, determining to export current data of the directory slice to be transferred on the metadata server;

[0006] While keeping the directory slice to be transferred in a readable and writable state, send the current data of the directory slice to be transferred to the import metadata server;

[0007] Freeze the directory shards to be transferred, and calculate the incremental data of the directory shards to be transferred based on the current data;

[0008] The incremental data is sent to the import metadata server, so that the import metadata server uses the incremental data and current data to generate a directory fragment to be transmitted for providing metadata services externally.

[0009] In one achievable manner, determining the current data of the directory slice to be transferred on the export metadata server includes: performing a snapshot creation operation of the directory slice to be transferred to obtain the current data;

[0010] Calculating incremental data of the directory slice to be transferred based on current data includes: calculating incremental data of the directory slice to be transferred based on the snapshot and the latest directory slice to be transferred.

[0011] In one practicable manner, the method further includes:

[0012] If it is confirmed that the import metadata server has not successfully received the current data, release the current data; or,

[0013] When it is confirmed that the import metadata server has not successfully received the incremental data, or when it is confirmed that the import metadata server has not successfully generated the directory slice to be transferred, the current data and / or incremental data are released, and the directory slice to be transferred is unfrozen.

[0014] In one achievable manner, the metadata server is exported as the metadata server with the largest number of directory fragments among at least two metadata servers, and the method includes:

[0015] When the popularity of the directory shards managed on the export metadata server exceeds the shard threshold, metadata server load balancing is triggered.

[0016] In one achievable manner, determining the current data of the directory fragment to be transmitted on the export metadata server includes:

[0017] The directory fragment managed by the export metadata server is split into two fragments. The two fragments include the directory fragment to be transferred and the fragment still managed by the export metadata server.

[0018] To achieve the above objectives, the present application provides a method for load balancing metadata servers of a Ceph file system. The Ceph file system includes at least two metadata servers. The method is applied to an import metadata server among the at least two metadata servers. The method includes:

[0019] In response to triggering metadata server load balancing, obtaining current data of the directory slice to be transferred from the exporting metadata server while the exporting metadata server keeps the directory slice to be transferred in a readable and writable state;

[0020] When the export metadata server freezes the directory fragments to be transferred, the incremental data of the directory fragments to be transferred are obtained from the export metadata server;

[0021] Incremental data and current data are used to generate directory fragments to be transmitted for providing metadata services externally.

[0022] In one achievable manner, the current data of the directory slice to be transmitted is a snapshot of the directory slice to be transmitted;

[0023] The incremental data and current data are used to generate directory fragments to be transferred for providing metadata services externally, including: using snapshots and incremental data to restore the full data of the directory fragments to be transferred, and using the full data to provide metadata services for the directory fragments to be transferred.

[0024] In one practicable manner, the method further includes:

[0025] Feedback receipt confirmation information and / or recovery confirmation information to the export metadata service;

[0026] If the import metadata server fails to successfully receive the current data, or fails to successfully receive the incremental data, or fails to successfully generate the directory fragments to be transferred, the relevant data of the directory fragments to be transferred on the import metadata server is released.

[0027] To achieve the above objectives, the present application also provides an electronic device, which includes a processor; the processor is used to execute instructions to implement the above method.

[0028] To achieve the above objectives, the present application also provides a computer-readable storage medium for storing instructions / program data, which can be executed to implement the above method.

[0029] In the metadata server load balancing method of the Ceph file system of the present application, if the metadata server load balancing is triggered, the exporting metadata server will determine the current data of its own directory shards to be transferred and send it to the importing metadata server while keeping the directory shards to be transferred in a readable and writable state; then, while freezing the directory shards to be transferred, it will send the incremental data of the directory shards to be transferred to the importing metadata server, so that the directory shard transmission form is converted from full to incremental, and the full shard snapshot is transmitted first. This time-consuming logic does not require freezing the directory shards. The directory can still be updated during this process until the shard snapshot is transmitted. The directory shards need to be frozen when the shard increment is transmitted. Since the incremental directory shards are much smaller than the full snapshot of the directory shards, the time for transmitting the incremental directory shards is short and can reach the millisecond level, thereby greatly improving the metadata service performance in this scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0031] Figure 1 This is a schematic diagram of the operation of the Ceph distributed file system;

[0032] Figure 2 This is a diagram of metadata server load balancing in the Ceph distributed file system;

[0033] Figure 3 This is a flow chart of an implementation method of a metadata server load balancing method for a Ceph file system of the present application;

[0034] Figure 4 This is a schematic diagram of the workflow of exporting metadata servers in the metadata server load balancing method of the Ceph file system of this application;

[0035] Figure 5 This is a schematic diagram of the workflow of importing a metadata server in the metadata server load balancing method of the Ceph file system of this application;

[0036] Figure 6 This is a schematic structural diagram of an embodiment of the electronic device of the present application;

[0037] Figure 7 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0038] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative work are within the scope of protection of this application. In addition, unless otherwise specified (for example, "or in addition" or "or in an alternative"), the term "or" as used herein refers to a non-exclusive "or" (that is, "and / or"). Furthermore, the various embodiments described herein are not necessarily mutually exclusive, because some embodiments can be combined with one or more other embodiments to form new embodiments.

[0039] The Ceph distributed file system uses a centralized architecture. In real-world scenarios, a single MDS can lead to metadata service hotspots, limiting the performance of the Ceph distributed storage cluster. To overcome the performance bottleneck of a single MDS in large-scale clusters, multi-MDS technology has emerged. For large-scale Ceph clusters, file services can be deployed on multiple MDSs, which share the metadata load, thereby alleviating the metadata load of a single MDS.

[0040] like Figure 1As shown, in a multi-MDS solution, MDS0, MDS1, and MDS2 share the file system metadata load. By sharding directories into subtrees, specific subtrees are processed only by specific MDSs. For example, the root directory of the Ceph distributed file system is divided into three directory shards: shard 0, shard 1, and shard 2. Shard 0 is managed exclusively by MDS0, shard 1 is managed exclusively by MDS1, and shard 2 is managed exclusively by MDS2. These shards do not interfere with each other. If any of the MDSs fails, access to the shards managed by that node will be suspended, and the MDS cluster will be in an abnormal state. Furthermore, if the service access pressure on shards 0, 1, and 2 is inconsistent, the pressure on the hot shard will not be distributed to the other shards, resulting in an unbalanced MDS load. In extreme cases, only one MDS will bear the metadata service pressure.

[0041] To solve Figure 1 The uneven business load caused by uneven business in the sharding can be solved by Figure 2 The dynamic subtree transmission method shown is used to transmit directory shards to achieve MDS load balancing, thereby effectively solving the problem of load imbalance. Specifically, the shards managed by each MDS will be dynamically adjusted according to the business pressure on the shard. If the pressure on a shard is high, then the shard will be automatically sharded, and the shard directory will be automatically transferred to an idle MDS. Before the transmission, the shard subtree to be transferred needs to be frozen, and then the subtree transmission is triggered. After the subtree transmission is completed, the frozen shard subtree is unfrozen to achieve dynamic adjustment of the load between multiple MDSs.

[0042] Based on the above, when a directory shard on an MDS (Meta Data Service) is split and transferred to a target MDS, the currently split directory shard needs to be frozen until the directory shard is transferred and confirmed by the target MDS node. Only then will the source MDS node unfreeze the directory shard. The freezing is mainly to prevent the cached data from being trimmed or modified during the directory shard transfer process. Frozen directory shards cannot provide external services. If the frozen directory shards to be transferred are large, the delay in freezing the directory shards will be very long, which may directly lead to failure or timeout of delay-sensitive services.

[0043] Based on this, the present application proposes a metadata server load balancing method for the Ceph file system. In this method, if the metadata server load balancing is triggered, the exporting metadata server will determine the current data of its own directory shards to be transferred and send it to the importing metadata server while keeping the directory shards to be transferred in a readable and writable state; then, while freezing the directory shards to be transferred, the incremental data of the directory shards to be transferred will be sent to the importing metadata server, thereby converting the directory shard transmission form from full to incremental, and first transmitting the full shard snapshot. This time-consuming logic does not require freezing the directory shards. The directory can still be updated during this process until the shard snapshot is transmitted. The directory shards need to be frozen when the shard increment is transmitted. Since the incremental directory shards are much smaller than the full snapshot of the directory shards, the time for transmitting the incremental directory shards is short and can reach milliseconds, thereby greatly improving the metadata service performance in this scenario.

[0044] Specific as Figure 3 As shown, the metadata server load balancing method for the Ceph file system of this embodiment includes the following steps. It should be noted that the following step numbers are only used to simplify the description and are not intended to limit the execution order of the steps. The execution order of the steps of this embodiment can be changed arbitrarily without violating the technical concept of this application.

[0045] S101: In response to triggering metadata server load balancing, determine and export current data of a directory fragment to be transmitted on the metadata server.

[0046] Optionally, after the metadata server load balancing is triggered, the current data of the directory slice to be transferred on the exporting metadata server may be determined, so that the current data of the directory slice to be transferred may be subsequently sent to the importing metadata server.

[0047] Metadata server load balancing can be triggered when the access pressure on the export metadata server far exceeds that of the remaining metadata servers in the file system, that is, when the difference between the maximum, median, or average value of the access pressure on the remaining metadata servers in the file system and the access pressure on the export metadata server is greater than a first threshold. The first threshold is set based on actual conditions and is not limited here. For example, it can be 20%.

[0048] Alternatively, metadata server load balancing can be triggered when the volume of directory fragments managed on the export metadata server far exceeds that of the remaining metadata servers of the file system, that is, when the difference between the maximum, median, or average volume of directory fragments managed on the remaining metadata servers of the file system and the volume of directory fragments managed on the export metadata server is greater than a second threshold. The first threshold is set based on actual conditions and is not limited here. For example, it can be 1GB.

[0049] Alternatively, metadata server load balancing can be triggered when the difference in access popularity (e.g., read / write popularity) between the directory shards managed on the export metadata server and the directory shards managed on the remaining metadata servers of the file system exceeds a heat threshold. The heat threshold can also be set based on actual conditions and is not limited here.

[0050] Alternatively, when the heat of the directory shards managed on the export metadata server exceeds the shard threshold, the metadata server load balancing can be triggered. The shard threshold can also be set according to actual conditions and is not limited here. For example, the file client reads and writes metadata to the MDS cluster. Assuming that the read and write of directory shard 1 is much greater than that of directory shard 0 and directory shard 2, the directory shard heat of directory shard 1 will continue to increase until the directory shard heat of directory shard 1 reaches the shard threshold and triggers the metadata server load balancing.

[0051] When the metadata server load balancing is triggered, the directory fragments to be transferred from the export metadata server can be confirmed first.

[0052] The directory fragments to be transferred of the export metadata server may be confirmed according to the situation of the export metadata server and / or the situations of other metadata servers of the file system.

[0053] Generally speaking, a metadata server is responsible for managing a directory slice. Thus, the export metadata server can comprehensively determine the size of the directory slice to be transferred that needs to be split from the directory slice it manages based on the situation of the export metadata server and the situation of the other metadata servers in the file system. For example, the export metadata server can determine the size of the directory slice to be transferred that needs to be split from the directory slice it manages based on the maximum value, median value, or average value of the directory slices managed by the other metadata servers in the file system and the number of directory slices managed by the export metadata server. It is understood that after the directory slice to be transferred is split from the directory slice managed by the export metadata server, the remaining directory slices are still managed by the export metadata server.

[0054] Of course, it is not ruled out that the export metadata server is responsible for managing at least two directory shards. In this case, the export metadata server can use one of the directory shards as the directory shard to be transferred, or the export metadata server can split a directory shard to be transferred from one of the directory shards.

[0055] After the export metadata server determines the directory shard to be transferred based on the above method, it can extract the current data of the directory shard to be transferred. For example, it can perform a snapshot operation on the directory shard to be transferred to obtain the current data of the directory shard to be transferred. It is understood that the current data of the directory shard to be transferred can be the current full data.

[0056] S102: While keeping the directory slice to be transferred in a readable and writable state, sending the current data of the directory slice to be transferred to the import metadata server.

[0057] After determining the current data of the directory shard to be transferred on the export metadata server, the current data of the directory shard to be transferred can be sent to the import metadata server while keeping the directory shard to be transferred in a readable and writable state, so that the import metadata server can obtain the current full data. In this way, even if the directory shard to be transferred is accessed during the transmission of the current data and there is a difference with the current data, the subsequent export metadata server only needs to send the incremental data during the transmission process (that is, the difference data generated by accessing the directory shard to be transferred during the transmission process) to the import metadata server, so that the import metadata server can combine the current data and the incremental data to obtain the final data of the directory shard to be transferred on the export metadata server.

[0058] After the importing metadata server has received the current data of the directory shard to be transmitted, it can send a confirmation message (i.e., receive the confirmation message) to the exporting metadata server to let the exporting metadata server know that the current data of the directory shard to be transmitted has been transmitted, so that the exporting metadata server can proceed to the next step - i.e., step S103.

[0059] In the case where the importing metadata server fails to successfully receive the current data of the directory slice to be transferred, the importing metadata server can release the relevant data of the directory slice to be transferred (for example, the current data of the directory slice to be transferred) that it has received, so as to achieve timely deletion of useless data. In addition, the importing metadata server can also send information confirming that the current data has not been successfully received to the exporting metadata server, so that the exporting metadata server knows that the importing metadata server has failed to successfully receive the current data of the directory slice to be transferred, so that the exporting metadata server can unfreeze the directory slice to be transferred and restore the IO business on the directory slice to be transferred. In addition, the exporting metadata server can also delete the generated current data of the directory slice to be transferred (i.e., a snapshot of the directory slice to be transferred) etc., in the case of confirming that the importing metadata server has failed to successfully receive the current data of the directory to be transferred, so as to achieve timely deletion of useless data.

[0060] S103: Freeze the directory fragment to be transmitted, and calculate incremental data of the directory fragment to be transmitted based on current data.

[0061] After the current data of the directory shard to be transferred is sent to the import metadata server, the directory shard to be transferred can be frozen, and the incremental data of the directory shard to be transferred can be calculated based on the current data.

[0062] Freezing the directory slice to be transferred may refer to closing the read and write permissions of the directory slice to be transferred, so that the data of the directory slice to be transferred will not be updated during the freezing period.

[0063] In this way, when the directory shards to be transferred are frozen, the incremental data of the directory shards to be transferred can be calculated based on the current data and the latest data of the directory shards to be transferred, so that after the incremental data of the directory shards to be transferred are sent to the import metadata server, the import metadata server can calculate the latest data of the directory shards to be transferred based on the incremental data of the directory shards to be transferred and the current data previously received, thereby ensuring that the directory shard data is transmitted correctly while reducing the freezing time of the directory shards to be transferred, minimizing the impact of dynamic directory shard transmission on the business in multi-MDS scenarios, greatly reducing the delay of multi-MDS dynamic directory shard transmission, and effectively improving the performance and robustness of the Ceph distributed file system in delay-sensitive scenarios.

[0064] Optionally, incremental data of the directory shard to be transferred can be calculated based on the snapshot of the directory shard to be transferred and the latest directory shard to be transferred. Specifically, the snapshot of the directory shard to be transferred and the latest directory shard to be transferred can be compared to determine the modified content of the directory shard to be transferred after the snapshot of the directory shard to be transferred was generated, thereby generating incremental data of the directory shard to be transferred.

[0065] S104: Sending the incremental data to the import metadata server, so that the import metadata server generates a to-be-transmitted directory fragment for providing metadata services externally by using the incremental data and current data.

[0066] After calculating the incremental data of the directory shards to be transferred based on the current data, the incremental data of the directory shards to be transferred can be sent to the import metadata server, so that the import metadata server can use the incremental data and the current data to generate the latest data of the directory shards to be transferred, that is, the import metadata server can use the incremental data and the current data to restore the full shards of the directory shards to be transferred. In this way, the import metadata server can use the full shards of the directory shards to be transferred to provide metadata services to the outside world accurately, that is, it can obtain the services of the directory shards to be transferred from the import metadata server.

[0067] After the importing metadata server has received the incremental data of the directory shard to be transmitted, it can send a confirmation message (i.e., receive the confirmation message) to the exporting metadata server to let the exporting metadata server know that the incremental data of the directory shard to be transmitted has been transmitted, so that the exporting metadata server can proceed to the next step - i.e., step S105.

[0068] In the case that the importing metadata server fails to successfully receive the incremental data of the directory slice to be transferred, the importing metadata server can release the relevant data of the directory slice to be transferred (such as the snapshot and / or incremental data of the directory slice to be transferred) received by it, so as to achieve timely deletion of useless data. In addition, the importing metadata server can also send confirmation of unsuccessful receipt of the incremental information to the exporting metadata server, so that the exporting metadata server knows that the importing metadata server has failed to successfully receive the incremental data of the directory slice to be transferred, so that the exporting metadata server can unfreeze the directory slice to be transferred and restore the IO business on the directory slice to be transferred. In addition, the exporting metadata server can also delete the generated snapshot and incremental data of the directory slice to be transferred, etc., in the case of confirming that the importing metadata server has failed to successfully receive the incremental data of the directory to be transferred, so as to achieve timely deletion of useless data.

[0069] In addition, after the importing metadata server receives the incremental data of the directory shard to be transferred, it also needs to confirm whether the full shard of the directory shard to be transferred has been successfully restored, and send the confirmation result (and recovery confirmation information) to the exporting metadata server so that the exporting metadata server knows whether the importing metadata server has successfully restored the full data of the directory shard to be transferred.

[0070] If the importing metadata server successfully recovers the full data of the directory shard to be transferred, the importing metadata server can provide metadata services based on the recovered full data of the directory shard to be transferred. That is, the importing metadata server can recover the metadata I / O operations of the directory shard to be transferred based on the full data of the directory shard to be transferred. In addition, the importing metadata server can also send a confirmation of successful recovery to the exporting metadata server, so that the exporting metadata server knows that the importing metadata server has successfully recovered the full data of the directory shard to be transferred, thereby allowing the exporting metadata server to proceed to the next step, namely, step S105.

[0071] In the case that the import metadata server fails to successfully recover the full amount of data of the directory shard to be transferred, the import metadata server can release the relevant data of the directory shard to be transferred that it has received (such as the current data and / or incremental data of the directory shard to be transferred) to achieve timely deletion of useless data. In addition, the import metadata server can also send confirmation of unsuccessful recovery information to the export metadata server, so that the export metadata server knows that the import metadata server has failed to successfully recover the full amount of data of the directory shard to be transferred, so that the export metadata server can unfreeze the directory shard to be transferred and restore the IO business on the directory shard to be transferred. In addition, the export metadata server can also delete the generated snapshots and incremental data of the directory shard to be transferred, etc., to achieve timely deletion of useless data, if it is confirmed that the import metadata server has failed to successfully recover the full amount of data of the directory to be transferred.

[0072] S105: Unfreeze and release the directory fragment to be transferred.

[0073] After the incremental data of the directory shards to be transferred are successfully transmitted to the importing metadata server, the exporting metadata server can unfreeze the directory shards to be transferred and release the unfrozen directory shards to be transferred. In this way, the exporting metadata server can transfer the directory shards to the importing metadata server through the load balancing method of the present application while consuming a shorter freezing time, and delete the relevant content of its own directory shards to be transferred after the transmission is successful, so as to share the service pressure of the exporting metadata server and balance the service pressure among multiple metadata servers.

[0074] Here, releasing the directory slice to be transferred may refer to the export metadata server deleting the relevant content of the directory slice to be transferred on itself.

[0075] In this embodiment, if the metadata server load balancing is triggered, the exporting metadata server will determine the current data of its own directory shards to be transferred and send it to the importing metadata server while keeping the directory shards to be transferred in a readable and writable state; then, while freezing the directory shards to be transferred, it will send the incremental data of the directory shards to be transferred to the importing metadata server. In this way, the directory shard transmission format is converted from full to incremental, and the full shard snapshot is transmitted first. This time-consuming logic does not require freezing the directory shards. The directory can still be updated during this process until the shard snapshot is transmitted. The directory shards need to be frozen when the shard increment is transmitted. Since the incremental directory shards are much smaller than the full snapshot of the directory shards, the time for transmitting the incremental directory shards is short and can reach the millisecond level, thereby greatly improving the metadata service performance in this scenario.

[0076] For the export metadata server in the Ceph file system, the steps to implement the Ceph file system metadata server load balancing method are as follows: Figure 4 , Figure 4 This is a schematic diagram of the workflow of exporting metadata servers in the metadata server load balancing method of the Ceph file system in this application.

[0077] S201: In response to triggering metadata server load balancing, determine and export current data of a directory fragment to be transmitted on the metadata server.

[0078] S202: While keeping the directory slice to be transferred in a readable and writable state, send the current data of the directory slice to be transferred to the import metadata server.

[0079] S203: Freeze the directory fragment to be transferred, and calculate incremental data of the directory fragment to be transferred based on current data.

[0080] S204: Send the incremental data to the import metadata server, so that the import metadata server generates a to-be-transmitted directory fragment for providing metadata services externally by using the incremental data and current data.

[0081] In this embodiment, the above steps are Figure 3 The relevant steps in the illustrated embodiment are similar and will not be described in detail. If the metadata server load balancing is triggered, the exporting metadata server will determine the current data of its own directory shards to be transferred and send it to the importing metadata server while keeping the directory shards to be transferred in a readable and writable state; then, while freezing the directory shards to be transferred, it will send the incremental data of the directory shards to be transferred to the importing metadata server, thereby converting the directory shard transmission form from full to incremental, and first transmitting the full shard snapshot. This time-consuming logic does not require freezing the directory shards, and the directory in this process can still be updated until the shard snapshot is transmitted. The directory shards need not be frozen until the shard snapshot is transmitted and the shard increment is transmitted. Since the incremental directory shards are much smaller than the full snapshot of the directory shards, the time to transmit the incremental directory shards is short and can reach the millisecond level, thereby greatly improving the metadata service performance in this scenario.

[0082] For the Ceph file system metadata server import, the steps to implement the Ceph file system metadata server load balancing method are as follows: Figure 5 , Figure 5 This is a workflow diagram of importing a metadata server in the metadata server load balancing method of the Ceph file system of this application.

[0083] S301: In response to triggering metadata server load balancing, the importing metadata server obtains current data of the directory slice to be transmitted from the exporting metadata server.

[0084] The current data is transmitted under the condition that the export metadata server keeps the directory fragment to be transmitted in a readable and writable state.

[0085] S302: Acquire incremental data of the directory fragment to be transmitted from the export metadata server.

[0086] The incremental data is transmitted by the export metadata server when the directory fragments to be transmitted are frozen on the export metadata server.

[0087] Determine the current data of the directory shard to be transferred on the export metadata server.

[0088] S303: The import metadata server uses the incremental data and the current data to generate directory fragments to be transmitted for providing metadata services externally.

[0089] In this embodiment, the above steps are Figure 3 The relevant steps in the illustrated embodiment are similar and will not be described in detail. If the metadata server load balancing is triggered, the importing metadata server will obtain the current data of the directory shard to be transferred from the exporting metadata server while the exporting metadata server keeps the directory shard to be transferred in a readable and writable state; then, when the exporting metadata server freezes the directory shard to be transferred, the importing metadata server will obtain the incremental data of the directory shard to be transferred from the exporting metadata server, thereby converting the directory shard transmission form from full to incremental, and first transmitting the full shard snapshot. This time-consuming logic does not require freezing the directory shard, and the directory in this process can still be updated until the shard snapshot is transmitted. It is only when the shard increment is transmitted that the directory shard needs to be frozen. Since the incremental directory shard is much smaller than the full snapshot of the directory shard, the time to transmit the incremental directory shard is short and can reach milliseconds, thereby greatly improving the metadata service performance in this scenario.

[0090] See also Figure 6 , Figure 6 1 is a schematic diagram of the structure of an embodiment of an electronic device of the present application. The electronic device 10 includes a processor 12, which is configured to execute instructions to implement the above-mentioned Ceph file system metadata server load balancing method. The specific implementation process is described in the above-mentioned embodiment and will not be repeated here.

[0091] The processor 12 may also be referred to as a CPU (Central Processing Unit). The processor 12 may be an integrated circuit chip having signal processing capabilities. The processor 12 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. A general-purpose processor may be a microprocessor, or the processor 12 may be any conventional processor.

[0092] The electronic device 10 may further include a memory 11 for storing instructions and data required for the processor 12 to operate.

[0093] The processor 12 is used to execute instructions to implement the method provided by any embodiment of the metadata server load balancing method and image encoding method of the Ceph file system of the present application and any non-conflicting combination.

[0094] See also Figure 7 , Figure 7 Schematic diagram of the structure of the computer-readable storage medium in the embodiment of the present application. The computer-readable storage medium 30 of the embodiment of the present application stores instruction / program data 31, and when the instruction / program data 31 is executed, it implements the method provided by any embodiment of the metadata server load balancing method of the Ceph file system of the present application and any non-conflicting combination. Among them, the instruction / program data 31 can form a program file and be stored in the above-mentioned storage medium 30 in the form of a software product, so that a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) executes all or part of the steps of the various embodiments of the method of the present application. The aforementioned storage medium 30 includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or terminal devices such as a computer, a server, a mobile phone, and a tablet.

[0095] In the several embodiments provided in this application, 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 merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, 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 an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0096] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0097] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0098] The above is only an implementation method of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the description and drawings of this application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for balancing the load of a metadata server of a Ceph file system, characterized in that: The Ceph file system includes at least two metadata servers, and the method is applied to an export metadata server among the at least two metadata servers, and the method includes: In response to triggering metadata server load balancing, determining to export current data of the directory slice to be transferred on the metadata server; While keeping the directory slice to be transmitted in a readable and writable state, sending the current data of the directory slice to be transmitted to an import metadata server; Freeze the directory slice to be transmitted, and calculate incremental data of the directory slice to be transmitted based on the current data; The incremental data is sent to the import metadata server, so that the import metadata server uses the incremental data and the current data to generate the directory fragment to be transmitted for providing metadata services externally.

2. The load balancing method according to claim 1, wherein: The determining of the current data of the directory slice to be transmitted on the export metadata server includes: performing a snapshot creation operation of the directory slice to be transmitted to obtain the current data; Calculating the incremental data of the directory slice to be transmitted based on the current data includes: calculating the incremental data of the directory slice to be transmitted based on the snapshot and the latest directory slice to be transmitted.

3. The load balancing method according to claim 1, wherein: The method further comprises: If it is confirmed that the import metadata server has not successfully received the current data, releasing the current data; or When it is confirmed that the import metadata server has not successfully received the incremental data, or when it is confirmed that the import metadata server has not successfully generated the directory slice to be transmitted, the current data and / or incremental data are released, and the directory slice to be transmitted is unfrozen.

4. The load balancing method according to claim 1, wherein: The export metadata server is a metadata server with the largest directory fragment amount among the at least two metadata servers, and the method includes: When the popularity of the directory shards managed on the export metadata server exceeds a shard threshold, metadata server load balancing is triggered.

5. The load balancing method according to claim 1, wherein: The step of determining the current data of the directory fragment to be transmitted on the export metadata server includes: The directory slice managed by the export metadata server is split into two slices, wherein the two slices include the directory slice to be transmitted and the slice still managed by the export metadata server.

6. A method for load balancing metadata servers of a Ceph file system, wherein the Ceph file system includes at least two metadata servers, and the method is applied to an import metadata server among the at least two metadata servers, characterized in that: The method comprises: In response to triggering metadata server load balancing, obtaining current data of the to-be-transmitted directory slice from the exporting metadata server while the exporting metadata server keeps the to-be-transmitted directory slice in a readable and writable state; In a case where the export metadata server freezes the directory slice to be transmitted, acquiring incremental data of the directory slice to be transmitted from the export metadata server; The incremental data and the current data are used to generate directory fragments to be transmitted for providing metadata services externally.

7. The method according to claim 6, characterized in that The current data of the directory slice to be transmitted is a snapshot of the directory slice to be transmitted; The method of using the incremental data and the current data to generate a directory shard to be transmitted for providing metadata services externally includes: using the snapshot and the incremental data to restore the full data of the directory shard to be transmitted, and using the full data to provide metadata services for the directory shard to be transmitted.

8. The method according to claim 6, characterized in that The method further comprises: Feedback receipt confirmation information and / or recovery confirmation information to the export metadata service; In the case that the import metadata server fails to successfully receive the current data, or in the case that the import metadata server fails to successfully receive the incremental data, or in the case that the import metadata server fails to successfully generate the directory fragment to be transmitted, the relevant data of the directory fragment to be transmitted on the import metadata server is released.

9. An electronic device, characterized in that: The electronic device comprises a processor; the processor is configured to execute instructions to implement the steps of the method according to any one of claims 1 to 8.

10. A computer-readable storage medium having instructions / program data stored thereon, characterized in that: When the instructions / program data are executed, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Metadata-cluster-directory dynamic load balancing method and system

    CN107480310A

  • Ceph metadata cluster directory distribution method, system and device and readable storage medium

    CN110008029A