Quota allocation method and device and other equipment
By using gradient allocation strategies to allocate quotas to clients in distributed file systems, the problem of difficulty in accurately controlling disk space quotas in the existing technology is solved, and precise control of disk space and optimization of performance is achieved.
Patent Information
- Application Number
- CN202311839356.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-09-18
- Filing Date
- 2023-12-27
- Publication Date
- 2025-03-18
AI Technical Summary
In the multi-client scenario of distributed file systems, it is difficult for the existing technology to accurately control disk space quotas, resulting in the problem of performance loss and quota exceeding limits.
The gradient allocation strategy is used to allocate quotas to the client. By limiting the size of the client's writeable space, the quota exceeds the limit is constrained. The metadata management node allocates different quotas to the client step by step based on the remaining space size of the total quota space and the preset quota level.
Accurate control of disk space quotas is achieved, performance loss and quota exceeding limits are avoided, and write operations on the client are carried out within a safe space range.
Smart Images

Figure CN119645948A_ABST
Abstract
Description
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on September 18, 2023, with application number 202311203612.6 and invention name “A method, device and other equipment for quota management”, the entire contents of which are incorporated by reference in this application. Technical Field
[0002] The present application relates to the storage field, and in particular to a quota allocation method, device and other equipment. Background Art
[0003] A distributed file system (DFS) refers to a file system that manages physical storage resources that are not necessarily directly connected to local nodes, but are connected to nodes through a computer network; or a complete hierarchical file system formed by combining several different logical disk partitions or volumes. The file system can set quota limits on the overall disk space to achieve the purpose of disk space control.
[0004] In a multi-client scenario of a distributed file system, in order to avoid performance loss, most existing solutions manage quotas by updating them in real time on the metadata server and passively updating quota information on the client. However, this makes it impossible to control the overall disk space quota accuracy. Summary of the invention
[0005] The present application provides a quota allocation method, apparatus and other devices for allocating quotas to clients according to a gradient allocation strategy, thereby limiting the amount of quota overruns by limiting the size of the client's writable space.
[0006] In view of this, in a first aspect, the present application provides a quota allocation method, which is applied to a metadata management node in a distributed file system, wherein the distributed file system includes one or more directory entries and one or more clients, wherein the one or more directory entries are used to store data written by one or more clients, and the metadata management node is used to allocate quotas to the one or more clients, the quota of each client indicates the size of the storage space allocated by the metadata management node to the client for storing data, and the client is used to store the data to be written in the directory entry according to the quota.
[0007] The metadata management node allocates a target quota to a target client; when the target quota of the target client expires, the metadata management node updates the target quota according to a gradient allocation strategy, wherein the gradient allocation strategy is that the metadata management node allocates quotas to one or more clients according to a first remaining space and a preset quota level, the preset quota level can be divided according to the first remaining space, the first remaining space includes the storage space after the total quota space is deducted from the allocation area, the total quota space is the total storage space of one or more directory items, and the allocation area is the storage space occupied by the quotas allocated to one or more clients;
[0008] When the target quota of the target client is valid, after the target client writes the data to be written, the metadata management node updates the target quota of the target client according to the gradient allocation strategy.
[0009] In an embodiment of the present application, the metadata management node can use a gradient allocation strategy to allocate different quotas to clients step by step according to the remaining space size of the total quota space and the preset quota level, so as to limit the size of the space that the client can write, thereby constraining the amount of excess and the duration of the excess.
[0010] In a possible implementation, if the target quota of the target client is valid, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy, which may include: if the target quota of the target client is valid, and the reserved quota of the target client is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space, the reserved quota is the quota space reserved by the target client from the quota to store the data to be written, the space to be written is the storage space occupied by the data to be written, and the total write space is the sum of the storage space occupied by the data written by one or more clients; if the total write space is less than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
[0011] In an implementation manner of the present application, when the client has reserved sufficient quota, the metadata management node can first determine whether the metadata server exceeds the limit, that is, whether the total write space is less than the total quota space before updating the quota for the client, so that the metadata server can be constrained in time when it exceeds the limit.
[0012] In one possible implementation, if the target quota of the target client is valid, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy, which may include: if the target quota of the target client is valid, and the reserved quota of the target client is less than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written, and the total remaining space includes the total quota space minus the storage space of the data written in the allocation area; if the total remaining space is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space; if the total write space is less than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
[0013] In an implementation manner of the present application, when the client's reserved quota is insufficient, the metadata management node can update the client's quota based on the total remaining space. When the total remaining space is sufficient and the total write space is less than the total quota space, the metadata management node can update the client's quota so that the client can obtain a new quota for operations related to reading and writing data.
[0014] In a possible implementation, the quota allocation method may further include: when the total write space is greater than or equal to the total quota space, the metadata management node sends a stop message to the target client, where the stop message is used to instruct the target client to stop writing data.
[0015] In an implementation manner of the present application, after the client writes data, the metadata management node can determine the size of the total write space and the total quota space. When the total write space is larger than the total quota space, a stop message is sent to the client in a timely manner to stop the client from writing data to constrain the client's excess quota.
[0016] In a possible implementation, if the reserved quota of the target client is less than the space to be written, the quota allocation method may further include: if the second remaining space is greater than or equal to the space to be written, the metadata management node allocates the second remaining space to the client, the second remaining space includes the remaining space of the allocation area and the overflow buffer, the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of one or more clients; if the second remaining space is less than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written; if the total remaining space is greater than or equal to the space to be written, the metadata management node recalls the allocated quotas of one or more clients; if the recall is successful, the metadata management node calculates the quotas of one or more clients according to the gradient allocation strategy and allocates them; if the recall fails, the metadata management node returns insufficient quota to the target client.
[0017] In an implementation manner of the present application, when the reserved quota of the client is less than the space to be written, that is, when the reserved quota is insufficient, a centralized management mode can also be adopted. By gradually judging whether the second remaining space and the total remaining space are sufficient, when the second remaining space is insufficient and the total remaining space is sufficient, a quota recall method is adopted. First, the unused quota of one or more clients is recalled, and then the quota is reallocated to all clients, so that each client can obtain a quota according to the remaining space, thereby avoiding exceeding the total quota space limit of the metadata server.
[0018] In a possible implementation, the aforementioned if the total remaining space is greater than or equal to the space to be written, the metadata management node recalls the allocated quotas from one or more clients may include: if the total remaining space is greater than or equal to the space to be written, the metadata management node deletes the metadata of one or more clients.
[0019] In a possible implementation, the aforementioned if the target quota of the target client fails, the metadata management node updates the target quota according to the gradient allocation strategy, which may include: if the target quota of the target client fails, the metadata management node determines the size of the first remaining space and the overflow buffer; if the first remaining space is smaller than the overflow buffer, the metadata management node updates the target quota according to the gradient allocation strategy; if the first remaining space is greater than or equal to the overflow buffer, the metadata management node allocates the target quota to the target client.
[0020] In a second aspect, the present application provides a quota allocation method, which is applied to a target client in a distributed file system, wherein the distributed file system includes one or more directory items, one or more clients and a metadata management node, wherein the one or more directory items are used to store data written by one or more clients, and the metadata management node is used to allocate quotas to the one or more clients, including: the target client sends a write request, and the write request carries the data to be written; if the target quota of the target client fails, the target client obtains an updated target quota, and the updated target quota is obtained by the metadata management node according to a gradient allocation strategy for updating the target quota, and the gradient allocation strategy is that the metadata management node allocates quotas to the one or more clients based on a first remaining space and a preset quota level, and the first remaining space includes the storage space after the total quota space is deducted from the allocation area, the total quota space is the total storage space of the one or more directory items, and the allocation area is the storage space occupied by the quotas allocated to the one or more clients;
[0021] If the target quota of the target client is valid, the target client writes the data to be written.
[0022] In the embodiment of the present application, the client can write data according to the total remaining space of the directory entry when the reserved quota is insufficient, thereby making full use of the quota space and avoiding the situation where the total quota is sufficient but the writing fails.
[0023] In a possible implementation, if the target quota of the target client is valid, the target client writes the data to be written, which may include: the target client determines whether the reserved quota is greater than or equal to the space to be written, the reserved quota is the quota space reserved by the target client from the quota to store the data to be written, and the space to be written is the storage space occupied by the data to be written; if the reserved quota is greater than or equal to the space to be written, the target client writes the data to be written; if the reserved quota is less than the space to be written, and the total remaining space is greater than or equal to the space to be written, the target client writes the data to be written, and the total remaining space is the total quota space minus the storage space of the data already written in the allocated area.
[0024] In a possible implementation, when the reserved quota is less than the space to be written, the method further includes: if the second remaining space is greater than or equal to the space to be written, the target client obtains an updated target quota, the second remaining space includes the remaining space of the allocation area and the overflow buffer, the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of one or more clients; if the second remaining space is less than the space to be written, and the total remaining space is greater than or equal to the space to be written, after the metadata management node recalls the quotas allocated to one or more clients, the target client obtains the updated target quota.
[0025] In a third aspect, the present application provides a quota allocation device, which is applied to a metadata management node in a distributed file system, wherein the distributed file system further includes one or more directory items and one or more clients, wherein the one or more directory items are used to store data written by the one or more clients, and the metadata management node is used to allocate quotas to the one or more clients, including:
[0026] An allocation module is used by the metadata management node to allocate target quotas to target clients;
[0027] An update module, used for, when a target quota of a target client fails, the metadata management node updates the target quota according to a gradient allocation strategy, the gradient allocation strategy is used to instruct the metadata management node to allocate quotas to one or more clients based on a first remaining space and a preset quota level, the preset quota level is divided according to the first remaining space, the first remaining space includes the storage space after the allocation area is deducted from the total quota space, the total quota space is the total storage space of one or more directory entries, and the allocation area is the storage space occupied by the quotas allocated to one or more clients;
[0028] The update module is also used for, when the target quota of the target client is valid, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
[0029] In one possible implementation, the update module is specifically used to: if the target quota of the target client is valid, and the reserved quota of the target client is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space, the reserved quota is the quota space reserved by the target client from the quota to store the data to be written, the space to be written is the storage space occupied by the data to be written, and the total write space is the sum of the storage space occupied by the data written by one or more clients; if the total write space is less than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
[0030] In one possible implementation, the update module is specifically used to: if the target quota of the target client is valid and the reserved quota of the target client is less than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written, and the total remaining space is the total quota space minus the storage space of the data written in the allocation area; if the total remaining space is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space; if the total write space is less than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
[0031] In a possible implementation, the device further includes: a sending module, configured to cause the metadata management node to send a stop message to the target client when the total write space is greater than or equal to the total quota space, wherein the stop message is used to instruct the target client to stop writing data.
[0032] In a possible implementation manner, if the reserved quota of the client is less than the space to be written, the device further includes:
[0033] an allocation module, configured to allocate the second remaining space to the target client by the metadata management node when the second remaining space is greater than or equal to the space to be written, wherein the second remaining space includes the remaining space of the allocation area and the overflow buffer, the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of one or more clients;
[0034] A judgment module, configured to, when the second remaining space is smaller than the space to be written, determine by the metadata management node whether the total remaining space is greater than or equal to the space to be written;
[0035] The recall module is used for the metadata management node to recall the quotas allocated to one or more clients when the total remaining space is greater than or equal to the space to be written;
[0036] A processing module, used for when the recall is successful, the metadata management node calculates the quota of one or more clients according to the gradient allocation strategy and allocates it;
[0037] The processing module is also used for the metadata management node to return insufficient quota to the target client when the recall fails.
[0038] In a possible implementation, the recall module is specifically configured to: if the total remaining space is greater than or equal to the space to be written, the metadata management node deletes the metadata of one or more clients.
[0039] In a possible implementation, the update module is specifically configured to:
[0040] If the target quota of the target client fails, the metadata management node determines the size of the first remaining space and the overflow buffer;
[0041] If the first remaining space is smaller than the overflow buffer, the metadata management node updates the target quota according to the gradient allocation strategy;
[0042] If the first remaining space is greater than or equal to the overflow buffer, the metadata management node allocates a target quota to the target client.
[0043] In a fourth aspect, an embodiment of the present application provides a quota allocation device, which is applied to a target client in a distributed file system, wherein the distributed file system includes one or more directory entries, one or more clients, and a metadata management node, wherein the one or more directory entries are used to store data written by one or more clients, and the metadata management node is used to allocate quotas to one or more clients, including:
[0044] A sending module, used for the target client to send a write request, the write request carries the data to be written;
[0045] an acquisition module, configured to enable the target client to acquire an updated target quota when the target quota of the target client becomes invalid, wherein the updated target quota is obtained by updating the target quota by the metadata management node according to a gradient allocation strategy, wherein the gradient allocation strategy is used to instruct the metadata management node to allocate quotas to one or more clients based on a first remaining space and a preset quota level, wherein the first remaining space includes the storage space after deducting the allocation area from the total quota space, wherein the total quota space is the total storage space of one or more directory entries, and the allocation area is the storage space occupied by the quotas allocated to one or more clients;
[0046] The writing module is used for the target client to write the data to be written when the target quota of the target client is valid.
[0047] In one possible implementation, the write module is specifically used for: the target client determines whether the reserved quota is greater than or equal to the space to be written, the reserved quota is the quota space reserved by the target client from the quota to store the data to be written, and the space to be written is the storage space occupied by the data to be written; if the reserved quota is greater than or equal to the space to be written, the target client writes the data to be written; if the reserved quota is less than the space to be written, and the total remaining space is greater than or equal to the space to be written, the target client writes the data to be written, and the total remaining space is the total quota space minus the storage space of the data already written in the allocation area.
[0048] In a possible implementation, when the reserved quota is less than the space to be written, the device further includes: an acquisition module, configured to, when the second remaining space is greater than or equal to the space to be written, enable the target client to acquire an updated target quota, wherein the second remaining space includes the remaining space of the allocation area and an overflow buffer, the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of one or more clients;
[0049] The acquisition module is further used to, when the second remaining space is smaller than the space to be written and the total remaining space is greater than or equal to the space to be written, after the metadata management node recalls the quotas allocated to one or more clients, the target client acquires the updated target quota.
[0050] In a fifth aspect, the present application provides a computing device cluster, which includes at least one computing device, each computing device including a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the method described in the first aspect.
[0051] In a sixth aspect, the present application provides a computing device cluster, which includes at least one computing device, each computing device including a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the method described in the second aspect.
[0052] In a seventh aspect, the present application provides a computer program product comprising instructions, characterized in that when the instructions are executed by a computing device cluster, the computing device cluster executes the method described in the first aspect above.
[0053] In an eighth aspect, the present application provides a computer program product comprising instructions, characterized in that when the instructions are executed by a computing device cluster, the computing device cluster executes the method described in the second aspect above.
[0054] In a ninth aspect, the present application provides a computer-readable storage medium, characterized in that it includes computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method described in the first aspect above.
[0055] In a tenth aspect, the present application provides a computer-readable storage medium, characterized in that it includes computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method described in the second aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A schematic diagram of a system architecture provided for this application;
[0057] Figure 2 A flowchart of a quota allocation method provided for this application;
[0058] Figure 3 A flowchart of another quota allocation method provided for this application;
[0059] Figure 4 A flowchart of another quota allocation method provided for this application;
[0060] Figure 5 A flowchart of another quota allocation method provided for this application;
[0061] Figure 6 A schematic diagram of the structure of a quota allocation device provided in this application;
[0062] Figure 7 A schematic diagram of the structure of another quota allocation device provided for this application;
[0063] Figure 8 A schematic diagram of the structure of a computing device provided for this application;
[0064] Fig. 9 A schematic diagram of the structure of another computing device provided for this application;
[0065] Fig.10 A schematic diagram of a computing device cluster provided in this application;
[0066] Fig.11 Another structural schematic diagram of a computing device cluster provided by this application;
[0067] Fig.12 A structural schematic diagram of another computing device cluster provided by the present application;
[0068] Fig.13 Another structural schematic diagram of another computing device cluster provided in this application. DETAILED DESCRIPTION
[0069] The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0070] The embodiment of the present application can be applied to one or more solutions of disk quota, directory quota or user group quota, which is not limited in this embodiment.
[0071] The following is an introduction to the system framework on which the embodiments of the present application are based.
[0072] See also Figure 1 An embodiment of the present application provides a system framework that is a distributed file system framework, which includes a metadata service cluster 101, at least one client 102, and a storage service cluster 103, wherein the metadata service cluster 101 includes at least one metadata management node, and the storage service cluster 103 includes at least one directory item for storing data.
[0073] Among them, in an embodiment of the present application, the total storage space of a directory item can be divided into a pre-allocated area and an overflow buffer, the pre-allocated area can be further divided into an allocated area and an unallocated area, the allocated area is the storage space occupied by the quota pre-allocated to the client by the metadata management node; the metadata management node can allocate quotas to the client based on the data storage situation in the directory item, and can also allocate quotas to the client based on the quota cache duration of the client, or can also send a stop message to the client based on the data storage situation in the directory item to stop the client from writing data; the client can then complete the reading and writing of data based on the quota allocated by the metadata management node or stop writing data according to the stop message sent by the metadata management node.
[0074] In the existing solutions, the metadata management node regularly allocates and updates the client quota or allocates and updates the client quota in an equal distribution mode. The metadata management node regularly updates the client quota, and the client passively updates at a fixed time. It cannot sense whether the total disk quota has reached the maximum amount. Data is written only based on whether the quota has timed out, which will cause the total disk quota to exceed the limit, and the excess cannot be controlled. For the solution that uses the equal distribution mode to update the quota, the remaining quota will be evenly allocated to each client based on the number of clients and the remaining quota. In this solution, the client still cannot perceive the total disk quota, which will cause an overlimit. It will also cause some clients to be unable to write data when the quota is sufficient, because the allocation is not based on the actual situation of the client, resulting in insufficient quota for some clients.
[0075] To solve the current problems, the embodiment of the present application proposes a quota allocation method, whereby the data management node can use a gradient allocation strategy to allocate quotas to one or more clients to limit the size of the client's write space and constrain the amount of excess. In addition, when the client's reserved quota is insufficient, the data to be written can be written according to the size of the total remaining space, thereby making full use of the quota space and avoiding the situation where the total quota is sufficient but the write fails.
[0076] The following is an introduction to the method flow of the embodiment of the present application in conjunction with the aforementioned system framework.
[0077] participate Figure 2 , a flow chart of a quota allocation method provided in this application is described as follows.
[0078] Step 201: The metadata management node allocates a target quota to a target client;
[0079] The metadata management node may pre-allocate target quotas for one or more target clients, so that the target clients can read and write data according to the obtained target quotas.
[0080] Step 202: The target client determines whether the target quota is invalid;
[0081] After obtaining the target quota, the target client can determine whether the target quota is invalid and perform the next operation according to the determination result. If the target quota is invalid, step 204, step 205 and step 206 are executed; if the target quota is valid, step 207 and step 208 are executed.
[0082] Among them, quota expiration means that the use and management of quota has exceeded the validity period, and quota validity means that the use and management of quota has not exceeded the validity period. You can obtain the validity period and allocation duration of the quota. The allocation duration is the use and management duration of the quota. By comparing the allocation duration with the validity period, you can determine whether the quota is invalid.
[0083] For example, when the target client writes data, it will first determine whether the target quota is invalid. The allocation duration and validity period of the target quota can be obtained. If the allocation duration is 130s and the validity period of the target quota is 120s, the target quota is determined to be invalid; if the allocation duration is 80s and the validity period of the target quota is 120s, the target quota is determined to be valid.
[0084] Step 203: The target client sends information to the metadata management node;
[0085] After obtaining the judgment result, the target client may carry the judgment result in information and send the information to the metadata management node, so that the metadata management node can perform the next operation according to the information.
[0086] Step 204: If the target quota is invalid, the metadata management node updates the target quota according to the gradient allocation strategy;
[0087] When the target quota expires, the metadata management node may update the target quota of the target client according to the gradient allocation strategy after receiving the query request sent by the target client.
[0088] Among them, the gradient allocation strategy is to allocate quotas to one or more clients based on the first remaining space and the preset quota level. The preset quota level can be divided according to the first remaining space. The first remaining space includes the storage space after the total quota space is deducted from the allocation area. The total quota space is the total storage space of one or more directory items, and the allocation area is the storage space occupied by the quotas allocated to one or more clients. For example, after the metadata management node allocates quotas to one or more clients, the first remaining space is 5G. The preset quota level can set different quotas such as 2G, 200M, 20M and 2M according to the preset ratio and the size of the first remaining space. According to the first remaining space and the preset quota level, the target quota can be updated to 2G.
[0089] Step 205: The metadata management node sends the updated target quota to the target client;
[0090] After obtaining the updated target quota, the metadata management node sends the updated target quota to the target client, so that the target client can read and write data according to the updated target quota, thereby adjusting and allocating the quota according to the remaining space size.
[0091] Step 206: If the target quota is invalid, the target client obtains the updated target quota;
[0092] When the target quota is invalid, the target client may send a query request to the metadata management node. The metadata management node updates the quota for the target client according to the query request and sends the updated target quota to the target client.
[0093] Step 207: If the target quota is valid, the target client writes the data to be written;
[0094] When the target quota is valid, the target client can directly write the data to be written if the reserved quota is sufficient; if the reserved quota is insufficient, but the total remaining space is sufficient, the data to be written can also be directly written. The total remaining space is the total quota space minus the storage space of the written data in the allocation area.
[0095] Step 208: If the target quota is valid, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
[0096] When the target quota is valid and the target client writes data, the metadata management node can update the target quota for the target client according to the gradient allocation strategy, and adjust the client's quota in time according to the size of the first remaining space and the preset quota level, thereby limiting the size of the space that the client can write and constraining the amount when the quota exceeds the limit.
[0097] based on Figure 2 The quota allocation method described above, the specific implementation of the quota allocation method provided by this application is introduced below.
[0098] See also Figure 3 , a flow chart of another quota allocation method provided by this application is described as follows.
[0099] Step 301: The client determines whether the allocation duration of the first quota of the client exceeds the first effective duration of the first quota;
[0100] After the client obtains the quota, the first validity period (also called the first validity period) and the allocation period, it can determine whether the allocation period of the quota is greater than the first validity period (it can also be used to determine whether the client's quota is invalid). The client and the metadata management node can then perform the next step based on the judgment result. If the allocation period of the first quota is greater than the first validity period, that is, the first quota of the client is invalid, then execute step 305; if the allocation period of the first quota is less than or equal to the first validity period, that is, the first quota of the client is valid, then execute step 306.
[0101] Usually, the quota obtained by each client has a validity period. If the allocation duration of the first quota of the client exceeds the first validity period of the first quota, the metadata management node will reallocate the quota to the client, and the client will also reacquire the quota and validity period.
[0102] Step 302: The client sends first information to the metadata management node;
[0103] After obtaining the judgment result of the first allocated duration and its effective duration, the client can carry the judgment result in the first information and send the first information to the metadata management node. The metadata management node can perform the next operation according to the judgment result.
[0104] Step 303: If the allocation duration of the first quota exceeds the first effective duration, the metadata management node updates the first quota according to the gradient allocation strategy to obtain a second quota and a second effective duration of the second quota;
[0105] When the judgment result carried in the first information is that the allocation duration of the first quota exceeds the first effective duration, the metadata management node can update the first quota according to the gradient allocation strategy to obtain an updated second quota and a second effective duration of the second quota.
[0106] Specifically, when the allocation duration of the first quota of the client exceeds the first effective duration, the metadata management node can first determine the size of the first remaining space and the overflow buffer. The first remaining space can include the remaining storage space of the total quota space minus the allocated area, and the total quota space includes the total storage space of the directory item; the allocated area includes the storage space occupied by the quota allocated in advance by the metadata management node for each client; the overflow buffer can include the storage space reserved in the total quota space according to the number of clients, that is, the storage space of the overflow buffer can be divided according to the size of the total quota space and the preset quota level. The preset quota level is a quota set of different quota space sizes set according to the first remaining space and according to a preset ratio. The preset quota level can be an arithmetic progression, a geometric progression, or a combination that meets other preset ratios. For example, the number of clients is 3, and the preset quota levels are divided into 1G, 100M, 10M and 1M. If the total quota space is greater than 1G, then the storage space size of the overflow buffer can be divided into 3*1G=3G.
[0107] If the first remaining space is greater than or equal to the overflow buffer, the metadata management node can allocate the first quota to the client as the quota of the client, that is, the quota size is not recalculated, and the original quota size can be allocated to the client; if the first remaining space is less than the overflow buffer, the metadata management node can update the first quota according to the gradient allocation strategy to obtain the second quota and the second effective duration.
[0108] Among them, the metadata management node updates the first quota according to the gradient allocation strategy, and can reallocate the quota to the client according to the size of the first remaining space and the preset quota level. For example, when the first remaining space includes 3G of storage space, according to the preset quota level (1G, 100M, 10M and 1M), a quota of 1G can be allocated to the client; when the first remaining space includes 0.1G of storage space, a quota of 100M can be allocated to the client.
[0109] Step 304: The metadata management node sends the second quota and the second validity period to the client;
[0110] After obtaining the second quota and the second effective duration, the metadata management node may send them to the client, so that the client's quota can be updated immediately, and the client's overtime duration can be constrained by setting the second effective duration.
[0111] Step 305: If the allocation duration of the first quota exceeds the first effective duration, the client obtains the second quota and the second effective duration;
[0112] After determining that the allocated duration exceeds the first effective duration, the client can reacquire the quota, ie, the second quota and the second effective duration of the second quota, from the metadata management node and update the original quota to facilitate subsequent data writing.
[0113] Step 306: If the allocation duration of the first quota does not exceed the first effective duration, the client determines whether the reserved quota is greater than or equal to the space to be written;
[0114] When the allocation duration of the first quota does not exceed the first effective duration, the client can judge the size of the reserved quota and the space to be written, so as to determine whether the data to be written can be directly written. The reserved quota includes the quota space reserved by the client from the allocated quota for storing the data to be written, and the space to be written includes the storage space occupied by the data to be written. If the reserved quota is greater than or equal to the space to be written, step 307 is executed; if the reserved quota is less than the space to be written, step 308 is executed.
[0115] Step 307: If the allocation duration of the first quota does not exceed the first effective duration, and the reserved quota is greater than or equal to the space to be written, the client writes the data to be written and updates the metadata;
[0116] When the allocation duration of the first quota of the client does not exceed the first effective duration, the client can determine whether its reserved quota is sufficient. When the reserved quota is greater than or equal to the space to be written, the client can directly write the data to be written and update the metadata.
[0117] Step 308: If the reserved quota is less than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written;
[0118] On the premise that the allocation duration of the first quota does not exceed the first effective duration, when the reserved quota of the client is insufficient, the metadata management node can determine whether the total remaining space is sufficient, that is, whether the total remaining space is greater than or equal to the space to be written, wherein the total remaining space includes the total quota space minus the storage space of the data written in the allocation area; if the total remaining space is less than the space to be written, execute step 309; if the total remaining space is greater than or equal to the space to be written, execute step 310.
[0119] Step 309: If the total remaining space is less than the space to be written, the metadata management node returns insufficient quota;
[0120] When the total remaining space is less than the space to be written, the metadata management node returns insufficient quota, that is, the remaining space of the directory entry is insufficient to store the data to be written, so that the client can stop writing data.
[0121] Step 310: If the allocation duration of the first quota does not exceed the first effective duration, the reserved quota is less than the space to be written and the total remaining space is greater than or equal to the space to be written, the client writes the data to be written and updates the metadata.
[0122] When the total remaining space is sufficient, the client can write the data to be written and update the metadata. When the reserved quota is insufficient, the client can determine whether the total remaining space is sufficient and then write the data to be written, avoiding the situation where the total quota is sufficient but the writing fails.
[0123] In the implementation mode of the present application, a gradient allocation strategy can be adopted, and different preset quota levels are selected to allocate quotas to clients according to the size of the storage space after deducting the allocated area from the first remaining space, i.e., the total quota space, so as to limit the size of the space that can be written by the client and constrain the amount of excess. In addition, when the reserved quota is insufficient, the client can also write the data to be written when the total remaining space is sufficient, so as to make full use of the quota space and avoid the situation where the total quota is sufficient but the writing fails.
[0124] See also Figure 4 , a flow chart of another quota allocation method provided by this application is described as follows.
[0125] Step 401: The client sends a quota query request to the metadata management node;
[0126] The client can query the quota size, the validity period of the quota, and the allocation period of the quota by sending a quota query request to the metadata management node.
[0127] Step 402: The metadata management node sends a query response to the client.
[0128] After receiving the query request from the client, the metadata management node can send a query response to the client, which carries the quota size of the client, the validity period of the quota and the allocation period. The allocation period can be the cumulative period of the quota allocated to the client accumulated by the timer.
[0129] Step 403: The client determines whether the allocation duration of the first quota of the client exceeds the first effective duration of the first quota;
[0130] Step 404: The client sends first information to the metadata management node;
[0131] Step 405: If the allocation duration of the first quota exceeds the first effective duration, the metadata management node updates the first quota according to the gradient allocation strategy to obtain a second quota and a second effective duration of the second quota;
[0132] Step 406: The metadata management node sends the second quota and the second validity period to the client.
[0133] Step 407: If the allocation duration of the first quota exceeds the first effective duration, the client obtains the second quota and the second effective duration;
[0134] Step 408: If the allocation duration of the first quota does not exceed the first effective duration, the client determines whether the reserved quota is greater than or equal to the space to be written;
[0135] Step 409: If the allocation duration of the first quota does not exceed the first effective duration, and the reserved quota is greater than or equal to the space to be written, the client writes the data to be written and updates the metadata;
[0136] Step 410: If the reserved quota is less than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written;
[0137] Step 411: If the total remaining space is less than the space to be written, the metadata management node returns insufficient quota;
[0138] Step 412: If the allocation duration of the first quota does not exceed the first effective duration, the reserved quota is less than the space to be written and the total remaining space is greater than or equal to the space to be written, the client writes the data to be written and updates the metadata;
[0139] In this embodiment, steps 403 to 412 are the same as those described above. Figure 3 Steps 301 to 310 in the illustrated embodiment are similar and will not be described in detail herein.
[0140] Step 413: The metadata management node determines whether the total write space is less than the total quota space;
[0141] After the client writes the data to be written, the metadata management node can determine whether the limit is exceeded, that is, whether the total write space is greater than or equal to the total quota space by judging the size of the total write space and the total quota space. The total write space includes the sum of the storage space occupied by each client writing the data to be written. If the total write space is greater than or equal to the total quota space, execute step 414; if the total write space is less than the total quota space, execute step 415.
[0142] Step 414: If the total write space is greater than or equal to the total quota space, the metadata management node sends a stop write message to the client;
[0143] If the total write space is greater than or equal to the total quota space, the metadata management node may send a stop-write message to the client, so that the client stops writing the data to be written, thereby limiting the excess amount.
[0144] Step 415: If the total write space is less than the total quota space, the metadata management node updates the first quota according to the gradient allocation strategy;
[0145] On the premise that the allocation duration of the first quota does not exceed the first effective duration, the total write space is less than the total quota space, that is, it is not exceeded, the metadata management node can reallocate quotas to the client according to the gradient allocation strategy. The specific process of allocating quotas to the client using the gradient allocation strategy is as described in step 405 and will not be repeated here.
[0146] Step 416: The metadata management node sends the updated first quota to the client.
[0147] After obtaining the updated first quota, the metadata management node may send the first quota to the corresponding client, so that the client can perform subsequent data reading related operations according to the first quota.
[0148] In an implementation manner of the present application, after the client writes data, the metadata management node can also make an over-limit judgment on the metadata server by judging the size of the total write space and the total quota space. When the total write space is greater than or equal to the total quota space after the client writes data, the metadata management node can send a stop message to stop the client from writing data, so that it can be stopped in time when the limit is exceeded.
[0149] The embodiments of the present application can be applied not only to quota management in the near-precision scenario, but also to the aforementioned Figure 4 The steps in the above example can also be applied to quota management in an absolutely precise scenario if the client's reserved quota is insufficient. The approximate precise quota management and the absolutely precise quota management schemes can be switched through the out-of-band application programming interface (API). The following is an example of the absolutely precise quota management process.
[0150] See also Figure 5 , a flow chart of another quota allocation method provided by this application is described as follows.
[0151] Step 501: The client sends a quota query request to the metadata management node;
[0152] Step 502: The metadata management node sends a query response to the client;
[0153] Step 503: The client determines whether the allocation duration of the first quota of the client exceeds the first effective duration of the first quota;
[0154] Step 504: The client sends first information to the metadata management node;
[0155] Step 505: If the allocation duration of the first quota exceeds the first effective duration, the metadata management node updates the first quota according to the gradient allocation strategy to obtain a second quota and a second effective duration of the second quota;
[0156] Step 506: The metadata management node sends the second quota and the second validity period to the client;
[0157] Step 507: If the allocation duration of the first quota exceeds the first effective duration, the client obtains the second quota and the second effective duration;
[0158] Step 508: If the allocation duration of the first quota does not exceed the first effective duration, the client determines whether the reserved quota is greater than or equal to the space to be written;
[0159] In this embodiment, steps 501 to 508 are the same as those described above. Figure 4 Steps 401 to 408 in the illustrated embodiment are similar and will not be described in detail herein.
[0160] Step 509: If the allocation duration of the first quota does not exceed the first effective duration, and the reserved quota is greater than or equal to the space to be written, the metadata management node updates the first quota according to the gradient allocation strategy;
[0161] When the first quota cache time of the client has not timed out and the reserved quota of the client is sufficient, the metadata management node can update the first quota according to the gradient allocation strategy. The specific process of allocating quotas to the client using the gradient allocation strategy is as described in step 405 and will not be repeated here.
[0162] Step 510: The metadata management node sends the updated first quota to the client;
[0163] After obtaining the updated first quota, the metadata management node may send the updated quota to the corresponding client, and the client may perform subsequent operations related to reading data according to the updated first quota.
[0164] Step 511: If the allocation duration of the first quota does not exceed the first effective duration, and the reserved quota is greater than or equal to the space to be written, the client writes the data to be written and updates the metadata;
[0165] Step 512: If the allocation duration of the first quota does not exceed the first effective duration and the reserved quota is less than the space to be written, the metadata management node determines whether the second remaining space is greater than or equal to the space to be written;
[0166] Optionally, when the allocation duration of the first quota does not exceed the first effective duration and the reserved quota is smaller than the space to be written, it is possible to query whether the second remaining space is sufficient. The second remaining space includes the remaining space of the allocation area and the overflow buffer. The remaining space of the allocation area includes the storage space remaining after the allocation area removes the storage space in which the data has been written. If the second remaining space is greater than or equal to the space to be written, execute step 513; if the second remaining space is smaller than the space to be written, execute step 514.
[0167] Step 513: If the second remaining space is greater than or equal to the space to be written, the metadata management node allocates the second remaining space to the client;
[0168] Optionally, when the second remaining space is greater than or equal to the space to be written, the metadata management node may allocate the second remaining space to the client, and the client may write the data to be written into the second remaining space.
[0169] Step 514: If the second remaining space is smaller than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written;
[0170] Optionally, when the second remaining space is smaller than the space to be written, the metadata management node may query whether the total remaining space is sufficient, that is, determine whether the total remaining space is greater than or equal to the space to be written. The total remaining space includes the storage space remaining after deducting the storage space in the allocated area from the total quota space. If the total remaining space is smaller than the space to be written, execute step 515; if the total remaining space is greater than or equal to the space to be written, execute step 516.
[0171] Step 515: If the total remaining space is less than the space to be written, the metadata management node returns insufficient quota;
[0172] When the total remaining space is less than the space to be written, the metadata management node returns insufficient quota, that is, the remaining space of the directory entry is insufficient to store the data to be written, so that the client can stop writing data.
[0173] Step 516: If the total remaining space is greater than or equal to the space to be written, the metadata management node recalls the allocated quota from each client;
[0174] When the total remaining space is greater than or equal to the space to be written, the metadata management node may first recall the unoccupied portion of the quota allocated to each client, and if the recall is successful, execute step 517 ; if the recall fails, execute step 519 .
[0175] Specifically, the original metadata management node can be invalidated by writing code, so that the quota allocated to the client is invalidated, thereby recalling the quota of each client.
[0176] Step 517: If the recall is successful, the metadata management node calculates the quota of each client;
[0177] When the recall is successful, the metadata management node can recalculate the quota for each client according to the gradient allocation strategy.
[0178] In an embodiment of the present application, when the total remaining space is sufficient, the unused quota of each client can be recalled, and a gradient allocation strategy can be used to reallocate the quota to each client, so that the quota of each client can be updated according to the total remaining space, thereby ensuring that each client writes data according to the updated quota without causing quota overruns.
[0179] Step 518: The metadata management node allocates the calculated client quota to the corresponding client.
[0180] After recalculating the quota of each client, the metadata management node may allocate the quota corresponding to each client to each client, so that the client can successfully write the data to be written.
[0181] Step 519: If the recall fails, the metadata management node returns insufficient quota.
[0182] When the metadata management node recalls the quota of each client, if a client is writing data at this time, the recall will fail. When the recall fails, the metadata management node can return insufficient quota to stop the client from writing data.
[0183] In the implementation manner of the present application, when the reserved quota of the client is insufficient, the client can gradually determine whether the second remaining space (including the available space in the allocation area and the available space in the overflow buffer) and the total remaining space (including the available space in the allocation area, the unallocated area and the available space in the overflow buffer) are sufficient, and allocate quota to the client. When the second remaining space is sufficient, the space can be allocated to the client. When the second remaining space is insufficient but the total remaining space is sufficient, the unused quota of each client can be recalled first. If the recall is successful, the metadata management node can recalculate the quota for each client according to the gradient allocation strategy and allocate it. If the recall fails, that is, there are clients writing data at this time, the quota will be returned as insufficient to avoid overlimit caused by multiple clients writing data at the same time. The embodiment of the present application can enable the client to write data when the total remaining space is sufficient and make the total write space not exceed the total quota space.
[0184] The above is an introduction to the method flow provided by the present application. Based on the above method flow, the following is an introduction to the device provided by the present application.
[0185] See also Figure 6 , a schematic diagram of the structure of a quota allocation device 600 provided in the present application includes:
[0186] Allocation module 601, used for the metadata management node to allocate target quotas to target clients;
[0187] An updating module 602 is used for, when the target quota of the target client fails, the metadata management node to update the target quota according to the gradient allocation strategy, the gradient allocation strategy is used to instruct the metadata management node to allocate quotas to one or more clients based on the first remaining space and the preset quota level, the preset quota level is divided according to the first remaining space, the first remaining space includes the storage space after the allocation area is removed from the total quota space, the total quota space is the total storage space of one or more directory entries, and the allocation area is the storage space occupied by the quotas allocated to one or more clients;
[0188] The updating module 602 is also used for, when the target quota of the target client is valid, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
[0189] In one possible implementation, the update module 602 is specifically used to: if the target quota of the target client is valid, and the reserved quota of the target client is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space, the reserved quota is the quota space reserved by the target client from the quota to store the data to be written, the space to be written is the storage space occupied by the data to be written, and the total write space is the sum of the storage space occupied by the data written by one or more clients; if the total write space is less than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
[0190] In one possible implementation, the update module 602 is specifically used to: if the target quota of the target client is valid and the reserved quota of the target client is less than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written, and the total remaining space is the total quota space minus the storage space of the data written in the allocation area; if the total remaining space is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space; if the total write space is less than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
[0191] In a possible implementation, the device further includes: a sending module 603, configured to cause the metadata management node to send a stop message to the target client when the total write space is greater than or equal to the total quota space, wherein the stop message is used to instruct the target client to stop writing data.
[0192] In a possible implementation manner, if the reserved quota of the client is less than the space to be written, the device further includes:
[0193] The allocation module 601 is further configured to allocate the second remaining space to the target client by the metadata management node when the second remaining space is greater than or equal to the space to be written, wherein the second remaining space includes the remaining space of the allocation area and the overflow buffer, wherein the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of one or more clients;
[0194] The judging module 604 is configured to, when the second remaining space is smaller than the space to be written, determine by the metadata management node whether the total remaining space is greater than or equal to the space to be written;
[0195] The recall module 605 is used for the metadata management node to recall the quotas allocated to one or more clients when the total remaining space is greater than or equal to the space to be written;
[0196] Processing module 606, configured to calculate and allocate quotas of one or more clients according to a gradient allocation strategy by the metadata management node when the recall is successful;
[0197] The processing module 606 is also used for the metadata management node to return insufficient quota to the target client when the recall fails.
[0198] In a possible implementation, the recall module 605 is specifically configured to: if the total remaining space is greater than or equal to the space to be written, the metadata management node deletes the metadata of one or more clients.
[0199] In a possible implementation, the updating module 602 is specifically configured to:
[0200] If the target quota of the target client fails, the metadata management node determines the size of the first remaining space and the overflow buffer;
[0201] If the first remaining space is smaller than the overflow buffer, the metadata management node updates the target quota according to the gradient allocation strategy;
[0202] If the first remaining space is greater than or equal to the overflow buffer, the metadata management node allocates a target quota to the target client.
[0203] Among them, the allocation module, update module, sending module, judgment module, recall module and processing module can all be implemented by software, or can be implemented by hardware. Exemplarily, the implementation of the allocation module is introduced below by taking the allocation module as an example. Similarly, the implementation of the update module, sending module, judgment module, recall module and processing module can refer to the implementation of the allocation module.
[0204] As an example of a software functional unit, the allocation module may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the above-mentioned computing instance may be one or more. For example, the allocation module may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple data centers with close geographical locations. Among them, usually a region may include multiple AZs.
[0205] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0206] As an example of a hardware functional unit, the allocation module may include at least one computing device, such as a server, etc. Alternatively, the allocation module may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0207] The multiple computing devices included in the allocation module can be distributed in the same region or in different regions. The multiple computing devices included in the A module can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the A module can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0208] It should be noted that, in other embodiments, the allocation module can be used to execute any step in the quota allocation method, the update module can be used to execute any step in the quota allocation method, the sending module can be used to execute any step in the quota allocation method, the judgment module can be used to execute any step in the quota allocation method, the recall module can be used to execute any step in the quota allocation method, and the processing module can be used to execute any step in the quota allocation method. The steps that the allocation module, update module, sending module, judgment module, recall module and processing module are responsible for implementing can be specified as needed. The full functions of the quota allocation device are realized by respectively implementing different steps in the quota allocation method through the allocation module, update module, sending module, judgment module, recall module and processing module.
[0209] See also Figure 7 , a schematic diagram of the structure of a quota allocation device 700 provided in the present application includes:
[0210] A sending module 701 is used for a target client to send a write request, where the write request carries data to be written;
[0211] The acquisition module 702 is used for the target client to acquire an updated target quota when the target quota of the target client becomes invalid. The updated target quota is obtained by the metadata management node updating the target quota according to the gradient allocation strategy. The gradient allocation strategy is used to instruct the metadata management node to allocate quotas to one or more clients based on the first remaining space and the preset quota level. The first remaining space includes the storage space after the allocation area is deducted from the total quota space. The total quota space is the total storage space of one or more directory items. The allocation area is the storage space occupied by the quotas allocated to one or more clients.
[0212] The writing module 703 is used for the target client to write the data to be written when the target quota of the target client is valid.
[0213] In one possible implementation, the write module 703 is specifically used for: the target client determines whether the reserved quota is greater than or equal to the space to be written, the reserved quota is the quota space reserved by the target client from the quota to store the data to be written, and the space to be written is the storage space occupied by the data to be written; if the reserved quota is greater than or equal to the space to be written, the target client writes the data to be written; if the reserved quota is less than the space to be written, and the total remaining space is greater than or equal to the space to be written, the target client writes the data to be written, and the total remaining space is the total quota space minus the storage space of the data already written in the allocated area.
[0214] In a possible implementation, when the reserved quota is less than the space to be written, the device further includes: an acquisition module 702, further configured to, when the second remaining space is greater than or equal to the space to be written, the target client acquires an updated target quota, the second remaining space includes the remaining space of the allocation area and an overflow buffer, the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of one or more clients;
[0215] The acquisition module 702 is further configured to enable the target client to acquire an updated target quota after the metadata management node recalls the quotas allocated to one or more clients when the second remaining space is smaller than the space to be written and the total remaining space is greater than or equal to the space to be written.
[0216] Among them, the sending module, the acquisition module and the writing module can all be implemented by software, or can be implemented by hardware. Exemplarily, the implementation of the sending module is introduced below by taking the sending module as an example. Similarly, the implementation of the acquisition module and the writing module can refer to the implementation of the sending module.
[0217] As an example of a software functional unit, the sending module may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the sending module may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple data centers with close geographical locations. Among them, usually a region may include multiple AZs.
[0218] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0219] As an example of a hardware functional unit, the sending module may include at least one computing device, such as a server, etc. Alternatively, the sending module may also be a device implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0220] The multiple computing devices included in the sending module can be distributed in the same region or in different regions. The multiple computing devices included in the sending module can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the sending module can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0221] It should be noted that, in other embodiments, the sending module can be used to execute any step in the quota allocation method, the obtaining module can be used to execute any step in the quota allocation method, and the writing module can be used to execute any step in the quota allocation method. The steps that the sending module, the obtaining module, and the writing module are responsible for implementing can be specified as needed. The full functions of the quota allocation device are realized by respectively implementing different steps in the quota allocation method through the sending module, the obtaining module, and the writing module.
[0222] The present application also provides a computing device 800. Figure 8 As shown, the computing device 800 includes: a bus 802, a processor 804, a memory 806, and a communication interface 808. The processor 804, the memory 806, and the communication interface 808 communicate through the bus 802. The computing device 800 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 800.
[0223] The bus 802 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus 804 is represented by only one line, but does not mean that there is only one bus or one type of bus. The bus 804 may include a path for transmitting information between various components of the computing device 800 (eg, the memory 806, the processor 804, and the communication interface 808).
[0224] The processor 804 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0225] The memory 806 may include a volatile memory, such as a random access memory (RAM). The processor 804 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0226] The memory 806 stores executable program codes, and the processor 804 executes the executable program codes to respectively implement the functions of the aforementioned allocation module, update module, sending module, judgment module, recall module and processing module, thereby implementing the quota allocation method. That is, the memory 806 stores instructions for executing the quota allocation method.
[0227] The present application also provides another computing device 900. Fig. 9 As shown, the computing device 900 includes: a bus 902, a processor 904, a memory 906, and a communication interface 908. The processor 904, the memory 906, and the communication interface 908 communicate through the bus 902. The computing device 900 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 900.
[0228] The bus 902 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 The bus 904 is represented by only one line, but does not mean that there is only one bus or one type of bus. The bus 904 may include a path for transmitting information between various components of the computing device 900 (eg, the memory 906, the processor 904, and the communication interface 908).
[0229] The processor 904 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0230] The memory 906 may include a volatile memory, such as a random access memory (RAM). The processor 904 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0231] The memory 906 stores executable program codes, and the processor 904 executes the executable program codes to respectively implement the functions of the aforementioned sending module, obtaining module, and writing module, thereby implementing the quota allocation method. That is, the memory 906 stores instructions for executing the quota allocation method.
[0232] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0233] like Fig.10 As shown, the computing device cluster includes at least one computing device 800. The memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the quota allocation method.
[0234] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the quota allocation method. In other words, the combination of one or more computing devices 800 may jointly execute instructions for executing the quota allocation method.
[0235] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster can store different instructions, which are respectively used to execute part of the functions of the quota allocation device. That is, the instructions stored in the memory 806 in different computing devices 800 can implement the functions of one or more modules among the allocation module, the update module, the sending module, the judgment module, the recall module and the processing module.
[0236] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.11 A possible implementation is shown. Fig.11As shown, two computing devices 800A and 800B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 806 in the computing device 800A stores instructions for executing the functions of the identification module. At the same time, the memory 806 in the computing device 800B stores instructions for executing the functions of the allocation module, the update module, the sending module, the judgment module, the recall module, and the processing module.
[0237] It should be understood that Fig.11 The functions of the computing device 800A shown in FIG. 8 may also be completed by multiple computing devices 800. Similarly, the functions of the computing device 800B may also be completed by multiple computing devices 800.
[0238] The present application embodiment also provides another computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0239] like Fig.12 As shown, the computing device cluster includes at least one computing device 900. The memory 906 in one or more computing devices 900 in the computing device cluster may store the same instructions for executing the quota allocation method.
[0240] In some possible implementations, the memory 906 of one or more computing devices 900 in the computing device cluster may also store partial instructions for executing the quota allocation method. In other words, the combination of one or more computing devices 900 may jointly execute instructions for executing the quota allocation method.
[0241] It should be noted that the memory 906 in different computing devices 900 in the computing device cluster can store different instructions, which are respectively used to execute part of the functions of the quota allocation device. That is, the instructions stored in the memory 906 in different computing devices 900 can implement the functions of one or more modules among the sending module, the obtaining module, and the writing module.
[0242] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.13 A possible implementation is shown. Fig.13As shown, two computing devices 900A and 900B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 906 in the computing device 900A stores instructions for executing the functions of the identification module. At the same time, the memory 906 in the computing device 900B stores instructions for executing the functions of the sending module, the obtaining module, and the writing module.
[0243] It should be understood that Fig.13 The functions of the computing device 900A shown in FIG. 9A may also be completed by multiple computing devices 900. Similarly, the functions of the computing device 900B may also be completed by multiple computing devices 900.
[0244] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the quota allocation method.
[0245] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by the computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the quota allocation method.
[0246] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0247] Finally, it should be noted that the above is only a specific implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A quota allocation method, characterized in that: The method is applied to a metadata management node in a distributed file system, the distributed file system further comprising one or more directory items and one or more clients, the one or more directory items being used to store data written by the one or more clients, the metadata management node being used to allocate quotas to the one or more clients, the method comprising: The metadata management node allocates a target quota to a target client; If the target quota is invalid, the metadata management node updates the target quota according to a gradient allocation strategy, where the gradient allocation strategy is used to instruct the metadata management node to allocate the quota to the one or more clients based on a first remaining space and a preset quota level, where the preset quota level is divided according to the first remaining space, where the first remaining space includes a storage space after the allocation area is removed from the total quota space, where the total quota space is the total storage space of the one or more directory entries, and where the allocation area is the storage space occupied by the quotas allocated to the one or more clients; If the target quota is valid, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
2. The method according to claim 1, characterized in that If the target quota is valid, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy, including: If the target quota is valid, and the reserved quota of the target client is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space, the reserved quota is the quota space reserved by the target client from the quota to store the data to be written, the space to be written is the storage space occupied by the data to be written, and the total write space is the sum of the storage spaces occupied by the data written by one or more clients; If the total write space is smaller than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
3. The method according to claim 1, characterized in that If the target quota is valid, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy, including: If the target quota is valid, and the reserved quota of the target client is less than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written, where the total remaining space is the total quota space minus the storage space of the data written in the allocation area; If the total remaining space is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space; If the total write space is smaller than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: When the total write space is greater than or equal to the total quota space, the metadata management node sends a stop message to the target client, where the stop message is used to instruct the target client to stop writing data.
5. The method according to claim 1, characterized in that The reserved quota of the target client is smaller than the space to be written, and the method further includes: If the second remaining space is greater than or equal to the space to be written, the metadata management node allocates the second remaining space to the target client, the second remaining space includes the remaining space of the allocation area and an overflow buffer, the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of the one or more clients; If the second remaining space is smaller than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written; If the total remaining space is greater than or equal to the space to be written, the metadata management node recalls the quotas allocated to the one or more clients; If the recall is successful, the metadata management node calculates the quotas of the one or more clients according to the gradient allocation strategy and allocates them; If the recall fails, the metadata management node returns insufficient quota to the target client.
6. The method according to claim 5, characterized in that If the total remaining space is greater than or equal to the space to be written, the metadata management node recalls the allocated quotas from the one or more clients, including: If the total remaining space is greater than or equal to the space to be written, the metadata management node deletes the metadata of the one or more clients.
7. The method according to any one of claims 1 to 6, characterized in that If the target quota fails, the metadata management node updates the target quota according to the gradient allocation strategy, including: If the target quota fails, the metadata management node determines the size of the first remaining space and the overflow buffer; If the first remaining space is smaller than the overflow buffer, the metadata management node updates the target quota according to the gradient allocation strategy; If the first remaining space is greater than or equal to the overflow buffer, the metadata management node allocates the target quota to the target client.
8. A quota allocation method, characterized in that: The method is applied to a target client in a distributed file system, the distributed file system includes one or more directory items, one or more clients and a metadata management node, the one or more directory items are used to store data written by the one or more clients, and the metadata management node is used to allocate quotas to the one or more clients, the method includes: The target client sends a write request, where the write request carries data to be written; If the target quota is invalid, the target client obtains the updated target quota, where the updated target quota is obtained by the metadata management node updating the target quota according to a gradient allocation strategy, where the gradient allocation strategy is used to instruct the metadata management node to allocate the quota to the one or more clients based on a first remaining space and a preset quota level, where the first remaining space includes the storage space after the allocation area is deducted from the total quota space, where the total quota space is the total storage space of the one or more directory entries, and the allocation area is the storage space occupied by the quotas allocated to the one or more clients; If the target quota is valid, the target client writes the data to be written.
9. The method according to claim 8, characterized in that If the target quota is valid, the target client writes the data to be written, including: The target client determines whether the reserved quota is greater than or equal to the space to be written, the reserved quota being the quota space reserved by the target client from the quota for storing the data to be written, and the space to be written being the storage space occupied by the data to be written; If the reserved quota is greater than or equal to the space to be written, the target client writes the data to be written; If the reserved quota is smaller than the space to be written, and the total remaining space is greater than or equal to the space to be written, the target client writes the data to be written, and the total remaining space is the total quota space minus the storage space of the written data in the allocation area.
10. The method according to claim 9, characterized in that If the reserved quota is smaller than the space to be written, the method further includes: If the second remaining space is greater than or equal to the space to be written, the target client obtains the updated target quota, the second remaining space includes the remaining space of the allocation area and the overflow buffer, the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of the one or more clients; If the second remaining space is smaller than the space to be written, and the total remaining space is greater than or equal to the space to be written, after the metadata management node recalls the quotas allocated to the one or more clients, the target client obtains the updated target quota.
11. A quota allocation device, characterized in that: The device is applied to a metadata management node in a distributed file system, the distributed file system further comprising one or more directory items and one or more clients, the one or more directory items being used to store data written by the one or more clients, the metadata management node being used to allocate quotas to the one or more clients, the device comprising: An allocation module, used by the metadata management node to allocate a target quota to a target client; an update module, configured to, when the target quota becomes invalid, cause the metadata management node to update the target quota according to a gradient allocation strategy, wherein the gradient allocation strategy is used to instruct the metadata management node to allocate the quota to the one or more clients based on a first remaining space and a preset quota level, wherein the preset quota level is divided according to the first remaining space, wherein the first remaining space includes a storage space obtained by subtracting an allocation area from the total quota space, wherein the total quota space is a total storage space of the one or more directory entries, and the allocation area is a storage space occupied by the quotas allocated to the one or more clients; The updating module is further configured to, when the target quota is valid, cause the metadata management node to update the target quota according to the gradient allocation strategy after the target client writes the data to be written.
12. The device according to claim 11, characterized in that The update module is specifically used for: If the target quota is valid, and the reserved quota of the target client is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space, the reserved quota is the quota space reserved by the target client from the quota to store the data to be written, the space to be written is the storage space occupied by the data to be written, and the total write space is the sum of the storage spaces occupied by the data written by one or more clients; If the total write space is smaller than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
13. The device according to claim 11, characterized in that The update module is specifically used for: If the target quota is valid, and the reserved quota of the target client is less than the space to be written, the metadata management node determines whether the total remaining space is greater than or equal to the space to be written, where the total remaining space is the total quota space minus the storage space of the data written in the allocation area; If the total remaining space is greater than or equal to the space to be written, the metadata management node determines whether the total write space is less than the total quota space; If the total write space is smaller than the total quota space, after the target client writes the data to be written, the metadata management node updates the target quota according to the gradient allocation strategy.
14. The device according to any one of claims 11 to 13, characterized in that The device also includes: A sending module is used for, when the total write space is greater than or equal to the total quota space, the metadata management node to send a stop message to the target client, wherein the stop message is used to instruct the target client to stop writing data.
15. The device according to claim 11, characterized in that If the reserved quota of the client is smaller than the space to be written, the device further includes: an allocation module, configured to allocate, by the metadata management node, the second remaining space to the target client when the second remaining space is greater than or equal to the space to be written, wherein the second remaining space includes the remaining space of the allocation area and an overflow buffer, wherein the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of the one or more clients; a judging module, configured to, when the second remaining space is smaller than the space to be written, cause the metadata management node to judge whether the total remaining space is greater than or equal to the space to be written; A recall module, configured to cause the metadata management node to recall the quotas allocated to the one or more clients when the total remaining space is greater than or equal to the space to be written; A processing module, configured to, when the recall is successful, cause the metadata management node to calculate and allocate the quotas of the one or more clients according to the gradient allocation strategy; The processing module is further configured to cause the metadata management node to return insufficient quota to the target client when the recall fails.
16. The device according to claim 15, characterized in that The recall module is specifically used to: if the total remaining space is greater than or equal to the space to be written, the metadata management node deletes the metadata of the one or more clients.
17. The device according to any one of claims 11 to 16, characterized in that The update module is specifically used for: If the target quota fails, the metadata management node determines the size of the first remaining space and the overflow buffer; If the first remaining space is smaller than the overflow buffer, the metadata management node updates the target quota according to the gradient allocation strategy; If the first remaining space is greater than or equal to the overflow buffer, the metadata management node allocates the target quota to the target client.
18. A quota allocation device, characterized in that: The device is applied to a target client in a distributed file system, the distributed file system includes one or more directory items, one or more clients and a metadata management node, the one or more directory items are used to store data written by the one or more clients, the metadata management node is used to allocate quotas to the one or more clients, and the device includes: A sending module, used for the target client to send a write request, wherein the write request carries data to be written; an acquisition module, configured to enable the target client to acquire an updated target quota when the target quota becomes invalid, wherein the updated target quota is obtained by the metadata management node updating the target quota according to a gradient allocation strategy, wherein the gradient allocation strategy is used to instruct the metadata management node to allocate the quota to the one or more clients based on a first remaining space and a preset quota level, wherein the first remaining space includes a storage space after deducting an allocation area from the total quota space, wherein the total quota space is the total storage space of the one or more directory entries, and the allocation area is the storage space occupied by the quotas allocated to the one or more clients; A writing module is used for causing the target client to write the data to be written when the target quota is valid.
19. The device according to claim 18, characterized in that The writing module is specifically used for: The target client determines whether the reserved quota is greater than or equal to the space to be written, the reserved quota being the quota space reserved by the target client from the quota for storing the data to be written, and the space to be written being the storage space occupied by the data to be written; If the reserved quota is greater than or equal to the space to be written, the target client writes the data to be written; If the reserved quota is smaller than the space to be written and the total remaining space is greater than or equal to the space to be written, the target client writes the data to be written, and the total remaining space is the total quota space minus the storage space of the written data in the allocation area.
20. The device according to claim 19, characterized in that When the reserved quota is smaller than the to-be-written space, the device further includes: If the second remaining space is greater than or equal to the space to be written, the target client obtains the updated target quota, the second remaining space includes the remaining space of the allocation area and the overflow buffer, the remaining space of the allocation area includes the storage space of the allocation area minus the written data, and the overflow buffer includes the storage space reserved in the total quota space according to the number of the one or more clients; If the second remaining space is smaller than the space to be written, and the total remaining space is greater than or equal to the space to be written, after the metadata management node recalls the quotas allocated to the one or more clients, the target client obtains the updated target quota.
21. A computing device cluster, characterized in that: It includes at least one computing device, each computing device includes a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method as described in any one of claims 1-7.
22. A computing device cluster, characterized in that: It includes at least one computing device, each computing device includes a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method as described in any one of claims 8-10.
23. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster is caused to perform the method according to any one of claims 1 to 7.
24. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 8 to 10.
25. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 7.
26. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 8 to 10.