Metadata operation flow control method based on token bucket

By introducing token bucket structure and flow control logic into the cloud storage environment, the client's use of storage resources is solved, and the user experience and system stability are improved.

CN119094453AInactive Publication Date: 2024-12-06SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411238912.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2024-12-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In a cloud storage environment, multiple clients use server resources on the same storage cluster will lead to resource competition and occupation, affecting performance and user experience, and increasing the probability of metadata server failure in high-stress scenarios.

Method used

Using the metadata operation flow control method based on token bucket, by defining the token bucket structure and flow control logic, the client controls the computing resource occupancy of the storage nodes, limits the use of metadata operation resources of a single client, and avoids resource waste and load pressure.

Benefits of technology

It effectively improves the user experience, reduces resource competition and load pressure, reduces the probability of failure in high-load scenarios, and ensures the stability of the metadata server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094453A_ABST
    Figure CN119094453A_ABST
Patent Text Reader

Abstract

The invention discloses a metadata operation flow control method based on a token bucket, and relates to the technical field of data management. Comprising the following steps: step 1, defining tokens and a token bucket: storing the tokens through the token bucket, declaring a token bucket structure which comprises the total number of added tokens, a token lock, the number of available tokens, a token adding period, the capacity of the token bucket and a token waiting queue, declaring a token obtaining interface and a token adding interface, the method comprises the following steps of 1, acquiring a token, 2, defining a flow control logic: enabling a client to acquire the token through an acquisition token interface and then execute a processing logic of a metadata operation request, and controlling the number of tokens in a token bucket by adding a token interface, and 3, adding the flow control logic for the metadata operation of the client, and controlling the client to occupy computing resources of a cluster storage node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention discloses a metadata operation flow control method based on a token bucket, and relates to the technical field of data management. Background Art

[0002] In the current cloud storage, it is often involved that multiple clients use the server resources of the same storage cluster, and the server resources of such a storage cluster are limited. For example, when the usage pressure of a certain client is high, it will have a negative impact on the usage of other clients. The resulting resource competition and resource occupation will affect the client's usage performance and user experience. In addition, excessive pressure load for a long time will occupy the computing power of the metadata server, thereby increasing the probability of problems with the metadata server in high-pressure scenarios. Summary of the invention

[0003] In view of the problems of the prior art, the present invention provides a metadata operation flow control method based on token bucket, which effectively controls the computing resource occupation of storage nodes by each client, avoids resource waste caused by competition, thereby improving user experience, and also controls the load pressure of metadata servers to a certain extent, reducing the probability of problems caused by high load scenarios.

[0004] The specific scheme proposed by the present invention is:

[0005] The present invention provides a token bucket-based metadata operation flow control method, comprising:

[0006] Step 1: Define tokens and token buckets: Tokens are stored in token buckets and the token bucket structure is declared. The token bucket structure includes the total number of added tokens, token locks, the number of available tokens, the token adding cycle, the token bucket capacity, and the waiting token queue.

[0007] Declare the Get Token interface and Add Token interface.

[0008] Step 2: Define the flow control logic: Use the token acquisition interface to enable the client to obtain the token and then execute the processing logic of the metadata operation request. Add the token interface to control the number of tokens in the token bucket.

[0009] Step 3: Add flow control logic to the client's metadata operations to control the client's use of computing resources on the cluster storage nodes.

[0010] Further, in step 1 of the token bucket-based metadata operation flow control method, the token bucket structure is declared, including: indicating the total number of tokens added per second by adding the total number of tokens;

[0011] The token lock represents an exclusive lock and is locked when modifying the token bucket attributes, obtaining tokens, and adding tokens;

[0012] The token adding period indicates the time interval between two token additions, and the token added each time is the number of tokens that should be added within the period;

[0013] The available token count indicates the number of tokens in the token bucket that can be used for client metadata operations.

[0014] The token bucket capacity indicates the maximum number of tokens in the current token bucket.

[0015] When acquiring a token fails, the corresponding metadata operation will be added to the waiting token queue.

[0016] Further, in step 2 of the token bucket-based metadata operation flow control method, flow control logic is defined, including: defining a token acquisition function to implement a client request to acquire a token, and if the token acquisition is successful, executing the processing logic of subsequent metadata operation requests;

[0017] Otherwise, execute the logic of token acquisition failure: try to obtain a token from the number of available tokens. If the token is obtained, execute the processing logic of subsequent metadata operation requests and update the number of available tokens. If the token acquisition still fails, add the corresponding metadata operation to the waiting token queue and wait for the next token acquisition operation.

[0018] Further, the flow control logic is defined in step 2 of the token bucket-based metadata operation flow control method, including: creating a thread to call the add token interface to add the number of available tokens to the token bucket every token adding cycle,

[0019] Execute the metadata operation requests in the waiting token queue, and remove the metadata operation requests that successfully obtain the token from the waiting token queue.

[0020] Furthermore, the flow control logic is defined in step 2 of the token bucket-based metadata operation flow control method, including: defining a callback function for failing to obtain a token, and when the client's metadata operation request fails to obtain a complete token or fails, and the next time a token is added, the callback function is called to add the number of tokens required for the metadata operation request to the token bucket, and wait for the next execution to cache tokens through the token bucket according to the number of tokens required for the metadata operation request, so that the metadata operation request directly obtains the token cached in the token bucket.

[0021] The present invention also provides a token bucket-based metadata operation flow control device, comprising a token bucket management module, a flow control management module and a resource control module.

[0022] The token bucket management module defines tokens and token buckets: tokens are stored in token buckets, and the token bucket structure is declared. The token bucket structure includes the total number of added tokens, token locks, the number of available tokens, the token adding cycle, the token bucket capacity, and the waiting token queue.

[0023] Declare the Get Token interface and Add Token interface.

[0024] The flow control management module defines the flow control logic: the client obtains the token through the token acquisition interface and then executes the processing logic of the metadata operation request. The number of tokens in the token bucket is controlled by adding the token interface.

[0025] The resource control module adds flow control logic to the client's metadata operations to control the client's usage of computing resources on the cluster storage nodes.

[0026] Further, the token bucket management module of the token bucket-based metadata operation flow control device declares the token bucket structure, including: indicating the total number of tokens added per second by adding the total number of tokens;

[0027] The token lock represents an exclusive lock and is locked when modifying the token bucket attributes, obtaining tokens, and adding tokens;

[0028] The token adding period indicates the time interval between two token additions, and the token added each time is the number of tokens that should be added within the period;

[0029] The available token count indicates the number of tokens in the token bucket that can be used for client metadata operations.

[0030] The token bucket capacity indicates the maximum number of tokens in the current token bucket.

[0031] When acquiring a token fails, the corresponding metadata operation will be added to the waiting token queue.

[0032] Furthermore, the flow control management module of the metadata operation flow control device based on the token bucket defines the flow control logic, including: defining a token acquisition function to implement a client request to acquire a token, and if the token acquisition is successful, executing the processing logic of subsequent metadata operation requests;

[0033] Otherwise, execute the logic of token acquisition failure: try to obtain a token from the number of available tokens. If the token is obtained, execute the processing logic of subsequent metadata operation requests and update the number of available tokens. If the token acquisition still fails, add the corresponding metadata operation to the waiting token queue and wait for the next token acquisition operation.

[0034] Furthermore, the flow control management module of the token bucket-based metadata operation flow control device defines the flow control logic, including: creating a thread to call the add token interface every token adding cycle to add the number of available tokens to the token bucket,

[0035] Execute the metadata operation requests in the waiting token queue, and remove the metadata operation requests that successfully obtain the token from the waiting token queue.

[0036] Furthermore, the flow control management module of the metadata operation flow control device based on the token bucket defines the flow control logic, including: defining a callback function for failing to obtain a token, and when the client's metadata operation request fails to obtain a token or fails, and the next time a token is added, the callback function is called, and the number of tokens required for the metadata operation request is added to the token bucket, and the token bucket is used to cache the tokens according to the number of tokens required for the metadata operation request when waiting for the next execution, so that the metadata operation request directly obtains the token cached in the token bucket.

[0037] The benefits of the present invention are:

[0038] When the present invention requests access to metadata, if the token is successfully acquired, the read-write business logic will continue to be executed; otherwise, the token to be acquired will be converted into a token bucket cache token, waiting for the next token addition cycle to be executed. By limiting the maximum metadata resources that can be used by the client, the situation in which the excessive metadata operation pressure of a single client affects the use of other clients is reduced;

[0039] At the same time, since an upper limit is set on the metadata resources that can be used by a single client, the pressure on the metadata server can be controlled, thereby reducing the probability of problems occurring in high-pressure scenarios to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic flow chart of the method of the present invention.

[0041] Figure 2 It is a schematic diagram of the application process of the present invention. DETAILED DESCRIPTION

[0042] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0043] Example 1

[0044] The present invention provides a token bucket-based metadata operation flow control method, comprising:

[0045] Step 1: Define tokens and token buckets: Tokens are stored in token buckets and the token bucket structure is declared. The token bucket structure includes the total number of added tokens, token locks, the number of available tokens, the token adding cycle, the token bucket capacity, and the waiting token queue.

[0046] Declare the Get Token interface and the Add Token interface.

[0047] Wherein, declaring the token bucket structure in step 1 includes: indicating the total number of tokens added per second by adding the total number of tokens;

[0048] The token lock represents an exclusive lock and is locked when modifying the token bucket attributes, obtaining tokens, and adding tokens;

[0049] The token adding period indicates the time interval between two token additions, and the token added each time is the number of tokens that should be added within the period;

[0050] The available token count indicates the number of tokens in the token bucket that can be used for client metadata operations.

[0051] The token bucket capacity indicates the maximum number of tokens in the current token bucket.

[0052] When acquiring a token fails, the corresponding metadata operation will be added to the waiting token queue.

[0053] Step 2: Define the flow control logic: Use the token acquisition interface to enable the client to obtain the token and then execute the processing logic of the metadata operation request. Use the token addition interface to control the number of tokens in the token bucket.

[0054] The flow control logic is defined, including: defining a token acquisition function to implement the client's request to acquire a token. If the token is acquired successfully, the processing logic of the subsequent metadata operation request is executed;

[0055] Otherwise, execute the logic of token acquisition failure: try to obtain a token from the number of available tokens. If the token is obtained, execute the processing logic of the subsequent metadata operation request and update the number of available tokens. If the token acquisition still fails, add the corresponding metadata operation to the waiting token queue and wait for the next token acquisition operation. For example, for a token bucket with a metadata operation IOPS limit of 1000, 1300 metadata operations are sent in the current token time period, of which the last 300 metadata operations will be added to the waiting token queue and wait for the next token time period to try to obtain the token again.

[0056] It also includes: creating a thread to call the add token interface every token adding cycle to add the number of available tokens to the token bucket,

[0057] Execute the metadata operation requests in the waiting token queue, and remove the metadata operation requests that successfully obtain the token from the waiting token queue.

[0058] It also includes: defining a callback function for failure to obtain a token. When the client's metadata operation request fails to obtain a token or fails, and the next time a token is added, the callback function is called to add the number of tokens required for the metadata operation request to the token bucket, and the token bucket is used to cache the tokens according to the number of tokens required for the metadata operation request when waiting for the next execution, so that the metadata operation request can directly obtain the token bucket cache token. For example, for a token bucket with a metadata operation IOPS limit of 1000, 1300 metadata operations are sent within the current token time period, of which the last 300 metadata operations fail to obtain the token. When waiting for the next token to be added, 300 token bucket cache tokens will be generated in the token bucket. The number of tokens that can be obtained in the next period is 300 token bucket cache tokens and 700 available tokens.

[0059] Step 3: Add flow control logic to the client's metadata operations to control the client's use of computing resources on the cluster storage nodes.

[0060] For example, taking the cephfs file system as an example, flow control logic is executed in the client for operations such as creating, deleting files, directories, and modifying files and directory attributes to control the client's use of computing resources on the cluster storage nodes.

[0061] Example 2

[0062] The present invention also provides a token bucket-based metadata operation flow control device, comprising a token bucket management module, a flow control management module and a resource control module.

[0063] The token bucket management module defines tokens and token buckets: tokens are stored in token buckets, and the token bucket structure is declared. The token bucket structure includes the total number of added tokens, token locks, the number of available tokens, the token adding cycle, the token bucket capacity, and the waiting token queue.

[0064] Declare the Get Token interface and Add Token interface.

[0065] The flow control management module defines the flow control logic: the client obtains the token through the token acquisition interface and then executes the processing logic of the metadata operation request. The number of tokens in the token bucket is controlled by adding the token interface.

[0066] The resource control module adds flow control logic to the client's metadata operations to control the client's usage of computing resources on the cluster storage nodes.

[0067] As the contents of information interaction between modules of the above-mentioned device, execution of readable program process, etc. are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention, and will not be repeated here.

[0068] Similarly, when the device of the present invention requests access to metadata, if the token is successfully acquired, the read-write business logic will continue to be executed; otherwise, the token to be acquired will be converted into a token bucket cache token, waiting for the next token addition cycle to be executed. By limiting the maximum metadata resources that can be used by the client, the situation in which the metadata operation pressure of a single client is too high and the impact on the use of other clients is reduced;

[0069] At the same time, since an upper limit is set on the metadata resources that can be used by a single client, the pressure on the metadata server can be controlled, thereby reducing the probability of problems occurring in high-pressure scenarios to a certain extent.

[0070] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.

[0071] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. A metadata operation flow control method based on a token bucket, characterized in that include: Step 1: Define tokens and token buckets: Tokens are stored in token buckets and the token bucket structure is declared. The token bucket structure includes the total number of added tokens, token locks, the number of available tokens, the token adding cycle, the token bucket capacity, and the waiting token queue. Declare the Get Token interface and Add Token interface. Step 2: Define the flow control logic: Use the token acquisition interface to enable the client to obtain the token and then execute the processing logic of the metadata operation request. Add the token interface to control the number of tokens in the token bucket. Step 3: Add flow control logic to the client's metadata operations to control the client's use of computing resources on the cluster storage nodes.

2. According to the token bucket-based metadata operation flow control method of claim 1, it is characterized by: Declaring the token bucket structure in step 1 includes: indicating the total number of tokens added per second by adding the total number of tokens; The token lock represents an exclusive lock and is locked when modifying the token bucket attributes, obtaining tokens, and adding tokens; The token adding period indicates the time interval between two token additions, and the token added each time is the number of tokens that should be added within the period; The available token count indicates the number of tokens in the token bucket that can be used for client metadata operations. The token bucket capacity indicates the maximum number of tokens in the current token bucket. When acquiring a token fails, the corresponding metadata operation will be added to the waiting token queue.

3. A token bucket-based metadata operation flow control method according to claim 2, characterized in that In step 2, the flow control logic is defined, including: defining a token acquisition function to implement the client's request to acquire a token, and if the token is successfully acquired, executing the processing logic of subsequent metadata operation requests; Otherwise, execute the logic of token acquisition failure: try to obtain a token from the number of available tokens. If the token is obtained, execute the processing logic of subsequent metadata operation requests and update the number of available tokens. If the token acquisition still fails, add the corresponding metadata operation to the waiting token queue and wait for the next token acquisition operation.

4. According to the token bucket-based metadata operation flow control method of claim 2, it is characterized by: In step 2, the flow control logic is defined, including: creating a thread to call the add token interface every token adding cycle to add the number of available tokens to the token bucket, Execute the metadata operation requests in the waiting token queue, and remove the metadata operation requests that successfully obtain the token from the waiting token queue.

5. The method for metadata operation flow control based on token bucket according to claim 1, characterized in that The flow control logic is defined in step 2, including: defining a callback function for failure to obtain a token, and when the client's metadata operation request fails to obtain a complete token or fails, and the next time a token is added, the callback function is called, and the number of tokens required for the metadata operation request is added to the token bucket, and the token bucket is used to cache the tokens according to the number of tokens required for the metadata operation request when waiting for the next execution, so that the metadata operation request directly obtains the token cached in the token bucket.

6. A metadata operation flow control device based on a token bucket, characterized in that Including token bucket management module, flow control management module and resource control module, The token bucket management module defines tokens and token buckets: tokens are stored in token buckets, and the token bucket structure is declared. The token bucket structure includes the total number of added tokens, token locks, the number of available tokens, the token adding cycle, the token bucket capacity, and the waiting token queue. Declare the Get Token interface and Add Token interface. The flow control management module defines the flow control logic: the client obtains the token through the token acquisition interface and then executes the processing logic of the metadata operation request. The number of tokens in the token bucket is controlled by adding the token interface. The resource control module adds flow control logic to the client's metadata operations to control the client's usage of computing resources on the cluster storage nodes.

7. A token bucket-based metadata operation flow control device according to claim 6, characterized in that The token bucket management module declares the token bucket structure, including: indicating the total number of tokens added per second by adding the total number of tokens; The token lock represents an exclusive lock and is locked when modifying the token bucket attributes, obtaining tokens, and adding tokens; The token adding period indicates the time interval between two token additions, and the token added each time is the number of tokens that should be added within the period; The available token count indicates the number of tokens in the token bucket that can be used for client metadata operations. The token bucket capacity indicates the maximum number of tokens in the current token bucket. When acquiring a token fails, the corresponding metadata operation will be added to the waiting token queue.

8. A token bucket-based metadata operation flow control device according to claim 7, characterized in that The flow control management module defines the flow control logic, including: defining a token acquisition function to implement the client's request to acquire a token, and if the token is acquired successfully, executing the processing logic of subsequent metadata operation requests; Otherwise, execute the logic of token acquisition failure: try to obtain a token from the number of available tokens. If the token is obtained, execute the processing logic of subsequent metadata operation requests and update the number of available tokens. If the token acquisition still fails, add the corresponding metadata operation to the waiting token queue and wait for the next token acquisition operation.

9. A token bucket-based metadata operation flow control device according to claim 7, characterized in that The flow control management module defines the flow control logic, including: creating a thread to call the add token interface every token adding cycle to add the number of available tokens to the token bucket, Execute the metadata operation requests in the waiting token queue, and remove the metadata operation requests that successfully obtain the token from the waiting token queue.

10. The token bucket-based metadata operation flow control device according to claim 7, characterized in that The flow control management module defines the flow control logic, including: defining a callback function for failure to obtain a token. When the client's metadata operation request fails to obtain a complete token or fails, and the next time a token is added, the callback function is called to add the number of tokens required for the metadata operation request to the token bucket. When waiting for the next execution, the token bucket is used to cache the tokens according to the number of tokens required for the metadata operation request, so that the metadata operation request can directly obtain the token cached in the token bucket.

Citation Information

Patent Citations

  • QoS setting method for Ceph cloud storage system based on token bucket algorithm

    CN107579926A

  • Distributed system current limiting method and system

    CN114745334A

  • Current limiting method, device, equipment, medium and product

    CN116132371A

  • Metadata operation request processing method and device, equipment and storage medium

    CN117376373A

  • Token bucket speed limiting method and device, computer equipment and storage medium

    CN118646713A