Task request processing method and device, equipment and medium

By deleting overdue tokens in the task current limit container, combining the token bucket algorithm and sliding window algorithm, the problem of instantaneous rejection and high computational complexity in high concurrency scenarios is solved, and the smooth control request rate and Server stability.

CN119172320APending Publication Date: 2024-12-20BEIJING JIAXUN FEIHONG ELECTRIC CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411121301.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

The existing current limiting algorithms have problems such as instantaneous rejection of requests, high computational complexity, and insufficient flexibility in high concurrency scenarios, making it difficult to effectively deal with scenarios with high requirements for burst traffic and time accuracy.

Method used

Combining the token bucket algorithm, counter algorithm and sliding window algorithm, container space recycling is realized by deleting overdue tokens in the task current limit container, ensuring smooth control of the request rate in high concurrency scenarios and avoiding request rejection.

Benefits of technology

It improves the effectiveness and server stability of task current limit containers, reduces the probability of overloading, simplifies the computational complexity, and improves space recycling efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119172320A_ABST
    Figure CN119172320A_ABST
Patent Text Reader

Abstract

The invention provides a task request processing method and device, equipment and a medium, and relates to the technical field of computers.The task request processing method comprises the steps that under the condition that a task request is received, a task flow limiting container matched with the task request is determined; when the state of the task traffic limiting container is full, determining a token state of a first token according to token information of the first token in the task traffic limiting container; when the token state is overdue, deleting the first token from the flow limiting container; generating token information corresponding to the task request, and storing the token information in the task flow limiting container; and transmitting the task request to a server, so that the server processes the task request. According to the embodiment of the invention, when the task traffic-limiting container is full, the overdue token can be deleted, the effectiveness of the task traffic-limiting container is improved, and the stability of the server is ensured and the occurrence probability of the overload condition of the server is reduced under the scene that the task requests are highly concurrent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a task request processing method, device, equipment and medium. Background Art

[0002] With the rapid development of the Internet, current limiting technology has been widely used to control the rate of service requests. For example, in high-concurrency scenarios, in order to maintain the stable operation of the system, it is necessary to limit the rate of task requests.

[0003] Commonly used current limiting algorithms include counter algorithm, sliding window algorithm, leaky bucket algorithm, token bucket algorithm, etc.

[0004] Among them, the counter algorithm is suitable for protecting backend services from large traffic impacts and avoiding service crashes, but there is a critical problem, that is, a large number of requests may be rejected instantly when the window switches. The implementation of the sliding window algorithm is relatively complex and requires additional computing and storage resources. The leaky bucket algorithm is not flexible enough for burst traffic processing and may cause some requests to be discarded. The token bucket algorithm is complex to implement and has high requirements for time accuracy, so it is not suitable for burst traffic processing. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a task request processing method, which combines the application scenarios and advantages of the token bucket algorithm, the counter algorithm and the sliding window algorithm, and deletes the first overdue token by matching the task current limiting container when the task current limiting container is full, thereby realizing space recovery of the task current limiting container and improving the effectiveness of the task current limiting container. In the scenario of high concurrency of task requests, the stability of the server is guaranteed and the probability of server overload is reduced.

[0006] In a first aspect, an embodiment of the present invention provides a task request processing method, comprising:

[0007] When a task request is received, a task current limiting container matching the task request is determined;

[0008] When the task current limiting container is in a full state, determining the token state of the first token according to the token information of the first token in the task current limiting container;

[0009] When the token status is expired, the token information of the first token is deleted from the current limiting container;

[0010] Generate the token information corresponding to the task request and store the token information in the task current limiting container;

[0011] The task request is transmitted to the server so that the server can process the task request.

[0012] In a preferred embodiment of the present invention, the above method further includes:

[0013] When the token status is not expired, the task request is rejected.

[0014] In a preferred embodiment of the present invention, the above method further includes:

[0015] When the task current limiting container is in a state of not full, the token information corresponding to the task request is generated;

[0016] Store the token information in the task current limiting container.

[0017] In a preferred embodiment of the present invention, when a task request is received, before determining the task current limiting container matching the task request, the process includes:

[0018] Create at least one initial task current limiting container;

[0019] Each initial task current limiting container is initialized according to the configuration parameters corresponding to each initial task current limiting container to obtain at least one task current limiting container.

[0020] In a preferred embodiment of the present invention, the above method further includes:

[0021] Determine the token state of the first token based on the token information of the first token in the task current limiting container;

[0022] When the token status is expired, the token information of the first token is deleted from the task current limiting container;

[0023] Updating the token information of the first token in the task current limiting container, and returning the step of determining the token state of the first token according to the token information of the first token in the task current limiting container;

[0024] When the token status is not expired, the token information of the first token is retained, and the step of determining the token status of the first token according to the token information of the first token in the task current limiting container is returned.

[0025] In a preferred embodiment of the present invention, the token state of the first token is determined according to the token information of the first token in the task current limiting container, including:

[0026] The difference between the storage time in the token information and the current time is determined as the storage time of the first token;

[0027] When the storage time is greater than or equal to the time threshold, determining that the token state of the first token is overdue;

[0028] When the storage time is less than the time threshold, the token state of the first token is determined to be not expired.

[0029] In a preferred embodiment of the present invention, the state of the task current limiting container is full, including:

[0030] Get the number of tokens in the task current limiting container and the container capacity in the configuration parameters of the task current limiting container;

[0031] When the number is greater than or equal to the container capacity, the task current limiting container is determined to be full;

[0032] When the number is less than the container capacity, the state of the task current limiting container is determined to be not full.

[0033] In a second aspect, an embodiment of the present invention further provides a task request processing device, comprising:

[0034] A container determination module, used for determining a task current limiting container matching the task request when a task request is received;

[0035] A token state determination module, used to determine the token state of the first token according to the token information of the first token in the task current limiting container when the task current limiting container is full;

[0036] The token recovery module is used to delete the first token from the current limiting container when the token status is overdue;

[0037] The token storage module is used to generate the token information corresponding to the task request and store the token information in the task current limiting container;

[0038] The request transmission module is used to transmit the task request to the server so that the server can process the task request.

[0039] In a third aspect, an embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the task request processing method of the first aspect.

[0040] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the task request processing method of the first aspect mentioned above.

[0041] The embodiments of the present invention bring the following beneficial effects:

[0042] The embodiment of the present invention provides a task request processing method. When a task request is received, a task current limiting container matching the task request is determined. When the task current limiting container is full, the token state of the first token is determined, the first overdue token is deleted, the space of the task current limiting container is recovered, the token information corresponding to the task request is generated, and the token information is stored in the task current limiting container. The task request with the token is transmitted to a server so that the server can process the task request. The method sets a task current limiting container with a fixed capacity for storing the token information corresponding to the task request. In the case of high concurrency of task requests, the request rate can be smoothly controlled to ensure the stability of the server when processing the task request. When the task current limiting container is full, the first overdue token is deleted, and the space of the task current limiting container is recovered, avoiding the situation that the task request is rejected due to the occupation of the space of the task current limiting container by the overdue token, improving the effectiveness of the task current limiting container, without traversing all the tokens in the task current limiting container, only judging the state of the first token, simplifying the calculation complexity, and improving the efficiency of space recovery of the task current limiting container.

[0043] Other features and advantages of the present invention will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present invention.

[0044] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0046] Figure 1 A flowchart of a task request processing method provided by an embodiment of the present invention;

[0047] Figure 2 A flowchart of another task request processing method provided by an embodiment of the present invention;

[0048] Figure 3 A schematic diagram of the structure of a task request processing device provided by an embodiment of the present invention;

[0049] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] Commonly used current limiting algorithms include counter algorithm, sliding window algorithm and token bucket algorithm. The following are several common current limiting algorithms and their advantages and disadvantages:

[0052] The counter algorithm (fixed window algorithm) divides the time into fixed window sizes, such as 1 second. During the window period, each request increases the counter by 1. When the counter reaches the set time limit, the excess requests are discarded. This method is simple to implement and has high performance. However, there is a critical problem, that is, a large number of requests may be rejected instantly when the window is switched.

[0053] The sliding window algorithm controls the number of requests per unit time by maintaining a time window. The number of requests within the time window is counted, and a decision is made based on a preset threshold whether to allow new requests to pass. This method has high traffic limit requirements and needs to better cope with burst traffic, such as cache systems and message queues. This method has high accuracy and strong scalability, and can dynamically adjust the threshold. However, the disadvantage is that the implementation is relatively complex and requires additional computing and storage resources.

[0054] The token bucket algorithm maintains a token bucket with a fixed capacity, and the system puts tokens into the bucket at a certain rate. Each request consumes a token, and when the bucket is empty, the request is rejected. This method is fair and flexible, with high stability and high-precision current limiting. However, it consumes a lot of resources, is complex to implement, has high requirements for time accuracy, and may have delays, making it unsuitable for burst traffic.

[0055] The embodiment of the present invention provides a task request processing method. By setting a task current limiting container with a fixed capacity for storing token information corresponding to the task request, the request rate can be smoothly controlled in the case of high concurrency of task requests to ensure the stability of the server in processing the task request. When the task current limiting container is full, the first overdue token is deleted and the space of the task current limiting container is reclaimed, thereby avoiding the probability of the task request being rejected due to the occupation of the task current limiting container space by the overdue token, and improving the effectiveness of the task current limiting container. There is no need to traverse all the tokens in the task current limiting container, and only the state of the first token is judged, which simplifies the calculation complexity and improves the efficiency of space recovery of the task current limiting container.

[0056] To facilitate understanding of this embodiment, a task request processing method disclosed in an embodiment of the present invention is first introduced in detail.

[0057] Example 1

[0058] The embodiment of the present invention provides a task request processing method, which is applicable to the application scenarios of API interface current limiting, current limiting in microservice architecture and distributed system current limiting. The method can protect the backend API interface from being overwhelmed by excessive requests in the API interface current limiting scenario, ensuring the stability and availability of the service; in the microservice architecture, the entire call chain formed by calls between services can be current limited to ensure the stable operation of the call chain in high concurrency scenarios; in the distributed system, the entire distributed system can be current limited to prevent a certain node from being overloaded and affecting the performance of the entire system. Figure 1 A flowchart of a task request processing method provided by an embodiment of the present invention.

[0059] like Figure 1 As shown, the task request processing method may include the following steps:

[0060] Step S101, when a task request is received, determining a task current limiting container that matches the task request.

[0061] A task request refers to a request that needs to be transmitted to a server for processing by the server. In an embodiment of the present invention, a task request may be a TCP request, an HTTP request, etc. One type of task request corresponds to a task current limiting container. Specifically, the task request may be classified according to the URL (Uniform Resource Locator) of the task request. Exemplarily, the URL of the task request is obtained, and the task request is classified according to the protocol, port or path in the URL to determine the type of the task request.

[0062] The task current limiting container is a container for storing a preset number of token information, which can also be called a token container. Only task requests with corresponding token information stored in the task current limiting container can be allowed to be transmitted to the server.

[0063] Specifically, when a task request is received, the URL of the task request is read, and the task current limiting container matching the task request is queried by table lookup according to the protocol, port or path in the URL. There may be multiple task requests received, and the URLs of the task requests are read in sequence in the order in which the task requests are received, and the task current limiting container matching the task requests is queried.

[0064] Step S102: when the task current limiting container is in a full state, the token state of the first token is determined according to the token information of the first token in the task current limiting container.

[0065] The status of the task current limiting container is full, indicating that new token information cannot be stored in the task current limiting container. It is understandable that the multiple token information stored in the task current limiting container is arranged in a certain order. For example, the token information can be arranged in the order of the time when the token information is stored, that is, the token information stored first is arranged in front, and the token information stored later is arranged in the back. The first token refers to the token whose token information is the first in the task current limiting container. That is, the token with the earliest time to store token information. The token information is used to describe the token. The token information may include the token status. The token status is used to describe whether the token is overdue. When the token status is overdue, it means that the token has occupied too long in the task current limiting container, which exceeds the processing time limit of the server for the task request, that is, the task request has been processed or an exception occurs when processing the task request. At this time, the token information with an overdue token status can be deleted. When the token status is not overdue, it means that the task request has not been processed or has not started processing. At this time, the token information with a non-overdue token status cannot be deleted.

[0066] Specifically, after determining the task current limiting container that matches the task request, read the status of the task current limiting container, and when the status of the task current limiting container is full, obtain the token information of the first token in the task current limiting container, and read the token status in the token information of the first token. The status of the task current limiting container can be used as an output parameter of the task current limiting container and can be directly read.

[0067] Step S103: When the token status is expired, the token information of the first token is deleted from the current limiting container.

[0068] When the token status is not expired, the token information of the first token is retained, and the task request is rejected, that is, no processing is performed on the task request, and the process of the task request processing method is ended.

[0069] Step S104: Generate token information corresponding to the task request, and store the token information in the task current limiting container.

[0070] The token information may also include a deposit time, that is, a time when the token information is generated. In the present application, the time when the token information is generated is the same as the time when the token information is stored in the task current limiting container. Specifically, the deposit time is used as the token information corresponding to the task request and stored in the task current limiting container.

[0071] Step S105, transmitting the task request to the server so that the server can process the task request.

[0072] Specifically, the task request with the corresponding token information is transmitted to the server, and after receiving the task request, the server processes the task request.

[0073] Furthermore, when the state of the task current limiting container is not full, token information corresponding to the task request is generated; and the token information is stored in the task current limiting container.

[0074] That is, when the task current limiting container is not full, it indicates that new token information can be stored in the task current limiting container, and the storage time is used as the token information corresponding to the task request and stored in the task current limiting container.

[0075] The task request processing method provided by the embodiment of the present invention, by setting a task current limiting container with a fixed capacity for storing token information corresponding to the task request, can smoothly control the request rate in the case of high concurrency of task requests, ensure the stability of the server when processing the task request, and when the task current limiting container is full, delete the first overdue token and recycle the space of the task current limiting container, thereby avoiding the probability of task request rejection due to the occupation of the task current limiting container space by the overdue token, and improving the effectiveness of the task current limiting container. There is no need to traverse all tokens in the task current limiting container, and only the state of the first token is judged, which simplifies the calculation complexity and improves the efficiency of space recovery of the task current limiting container.

[0076] Example 2

[0077] An embodiment of the present invention also provides another task request processing method; this method is implemented on the basis of the method in the above embodiment; this method focuses on describing the specific implementation method before determining the task current limiting container that matches the task request when a task request is received.

[0078] Figure 2 A flowchart of another task request processing method provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the task request processing method may include the following steps:

[0079] Step S201: Create at least one initial task current limiting container.

[0080] The initial task current limiting container refers to a task current limiting container that needs to be initialized. In an embodiment of the present invention, steps S203 to S207 can be directly executed based on the pre-initialized task current limiting container. When a new task current limiting container needs to be initialized, at least one initial task current limiting container is created according to actual needs.

[0081] Step S202: Initialize each initial task current limiting container according to the configuration parameters corresponding to each initial task current limiting container to obtain at least one task current limiting container.

[0082] Configuration parameters refer to the values ​​of parameters that need to be set when initializing a task current limiting container. Configuration parameters include at least container capacity and token processing rate. Among them, container capacity refers to the maximum number of token information that a task current limiting container can store. Token processing rate refers to the number of tokens that a task current limiting container can store per unit time. Specifically, for each initial task current limiting container, according to the configuration parameters corresponding to the initial task current limiting container, the parameters that need to be set for the initial task current limiting container are assigned values, the initialization of the initial task current limiting container is completed, and the initialized initial task current limiting container is used as the task current limiting container.

[0083] Step S203: upon receiving a task request, determining a task current limiting container that matches the task request.

[0084] Step S204: when the status of the task current limiting container is full, determine the token status of the first token according to the token information of the first token in the task current limiting container.

[0085] For ease of understanding, it can be determined through steps A1 to A3 that the state of the task current limiting container is full.

[0086] Step A1, obtaining the number of tokens in the task current limiting container and the container capacity in the configuration parameters of the task current limiting container.

[0087] The number of tokens in the task current limiting container refers to the number of token information stored in the task current limiting container at the current moment. The number of tokens in the task current limiting container can be directly read as an output parameter of the task current limiting container. Specifically, the number of tokens in the task current limiting container is read, and the container capacity is read from the configuration parameters.

[0088] Step A2: When the quantity is greater than or equal to the container capacity, determine that the state of the task current limiting container is full.

[0089] The number is greater than or equal to the container capacity, which means that the number of tokens in the task current limiting container is greater than or equal to the container capacity. This indicates that the task current limiting container cannot store new token information, that is, the status of the task current limiting container is full.

[0090] Step A3: When the quantity is less than the container capacity, determine that the state of the task current limiting container is not full.

[0091] The number is less than the container capacity, which means that the number of tokens in the task current limiting container is less than the container capacity. At this time, when a new task request is received, the task current limiting container can store the token information corresponding to the new task request, that is, the status of the task current limiting container is not full.

[0092] For ease of understanding, the token state of the first token may be determined through steps B1 to B3.

[0093] Step B1, determining the difference between the storage time in the token information and the current time as the storage time of the first token.

[0094] The deposit time refers to the time when the token information is stored in the task current limiting container. The storage time refers to the length of time from the time when the token information is stored in the task current limiting container to the current time. Specifically, the deposit time is read from the token information of the first token, the deposit time is subtracted from the current time, the difference between the deposit time and the current time is determined, and the difference is used as the storage time of the first token.

[0095] Step B2: When the storage time is greater than or equal to the time threshold, determining that the token state of the first token is overdue.

[0096] The time threshold is used to determine the token status of the first token. The time threshold can be set according to the actual situation, or it can be determined based on the configuration parameters of the task current limiting container. For example, when setting the time threshold, it should be greater than or equal to the ratio of the container capacity to the token processing rate.

[0097] Specifically, the storage time and the time threshold are compared. When the storage time is greater than or equal to the time threshold, it indicates that the token state of the first token is overdue.

[0098] Step B3: When the storage time is less than the time threshold, determine that the token state of the first token is not expired.

[0099] Specifically, the storage time and the time threshold are compared. When the storage time is less than the time threshold, it indicates that the token status of the first token is not expired.

[0100] Step S205: When the token status is expired, the token information of the first token is deleted from the current limiting container.

[0101] Step S206, generating token information corresponding to the task request, and storing the token information in the task current limiting container.

[0102] Step S207: transmitting the task request to the server so that the server can process the task request.

[0103] The task request processing method provided by the embodiment of the present invention can establish an initial task current limiting container and initialize it to form a task current limiting container when a new task current limiting container needs to be added, thereby increasing the flexibility of setting the task current limiting container. By setting a task current limiting container with a fixed capacity for storing token information corresponding to task requests, the request rate can be smoothly controlled in the case of high concurrency of task requests to ensure the stability of the server in processing task requests. When the task current limiting container is full, the first overdue token is deleted and the space of the task current limiting container is reclaimed, thereby avoiding the probability of task requests being rejected due to the occupation of the task current limiting container space by overdue tokens, thereby improving the effectiveness of the task current limiting container. There is no need to traverse all tokens in the task current limiting container, and only the state of the first token is judged, thereby simplifying the calculation complexity and improving the efficiency of space recovery of the task current limiting container.

[0104] Furthermore, after obtaining at least one task current limiting container, it also includes: determining the token status of the first token based on the token information of the first token in the task current limiting container; when the token status is overdue, deleting the token information of the first token from the task current limiting container; updating the token information of the first token in the task current limiting container, and returning the step of determining the token status of the first token based on the token information of the first token in the task current limiting container; when the token status is not overdue, retaining the token information of the first token, and returning the step of determining the token status of the first token based on the token information of the first token in the task current limiting container.

[0105] Specifically, after obtaining at least one task current limiting container, the token information of the first token stored in the task current limiting container can be read by an asynchronous thread or by setting a scheduled task to obtain the token status in the token information. When the token status is overdue, the token information of the first token is deleted from the current limiting container, that is, the first token is deleted. And the token arranged after the first token is used as the new first token, that is, the token information arranged after the token information of the first token is used as the token information of the new first token, thereby updating the token information of the first token in the task current limiting container. And return to execute the step of determining the token status of the first token according to the token information of the first token in the task current limiting container. When the token status is not overdue, retain the token information of the first token, and return to execute the step of determining the token status of the first token according to the token information of the first token in the task current limiting container.

[0106] By judging the token status of the first token through asynchronous threads or by setting a scheduled task, the overdue token information in the task current limiting container can be deleted while using the task current limiting container to store the token information, thereby reclaiming the space of the task current limiting container, improving the effectiveness of the task current limiting container, and avoiding the probability of task request rejection due to the occupation of the task current limiting container space by overdue tokens.

[0107] Example 3

[0108] Corresponding to the above method embodiment, the embodiment of the present invention provides a task request processing device, Figure 3 A schematic diagram of a task request processing device provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the task request processing device may include:

[0109] The container determination module 301 is used to determine the task current limiting container matching the task request when receiving the task request;

[0110] A first token state determination module 302 is used to determine the token state of the first token according to the token information of the first token in the task current limiting container when the task current limiting container is full;

[0111] The token recovery module 303 is used to delete the first token from the current limiting container when the token status is overdue;

[0112] The token storage module 304 is used to generate token information corresponding to the task request and store the token information in the task current limiting container;

[0113] The request transmission module 305 is used to transmit the task request to the server so that the server can process the task request.

[0114] The task request processing device provided by the embodiment of the present invention, by setting a task current limiting container with a fixed capacity for storing token information corresponding to the task request, can smoothly control the request rate in the case of high concurrency of task requests, ensure the stability of the server when processing the task request, and when the task current limiting container is full, delete the first overdue token and recycle the space of the task current limiting container, thereby avoiding the probability of task request rejection due to the occupation of the task current limiting container space by the overdue token, thereby improving the effectiveness of the task current limiting container, without traversing all the tokens in the task current limiting container, only the state of the first token is judged, thereby simplifying the calculation complexity and improving the efficiency of space recovery of the task current limiting container.

[0115] In some embodiments, the apparatus further comprises:

[0116] The request rejection module is used to reject the task request when the token status is not expired.

[0117] In some embodiments, the apparatus further comprises:

[0118] A token generation module, used to generate token information corresponding to a task request when the task current limiting container is not full;

[0119] The second token storage module is used to store token information in the task current limiting container.

[0120] In some embodiments, the apparatus further comprises:

[0121] A container creation module, used to create at least one initial task current limiting container;

[0122] The initialization module is used to initialize each initial task current limiting container according to the configuration parameters corresponding to each initial task current limiting container to obtain at least one task current limiting container.

[0123] In some embodiments, the apparatus further comprises:

[0124] A second token state determination module, used to determine the token state of the first token according to the token information of the first token in the task current limiting container;

[0125] The second token recovery module is used to delete the token information of the first token from the task current limiting container when the token status is overdue;

[0126] An update module, used to update the token information of the first token in the task current limiting container, and return a step of determining the token state of the first token according to the token information of the first token in the task current limiting container;

[0127] The return module is used to retain the token information of the first token when the token status is not expired, and return the step of determining the token status of the first token based on the token information of the first token in the task current limiting container.

[0128] In some embodiments, the first token state determination module 302 or the second token state determination module is further configured to:

[0129] The difference between the storage time in the token information and the current time is determined as the storage time of the first token;

[0130] When the storage time is greater than or equal to the time threshold, determining that the token state of the first token is overdue;

[0131] When the storage time is less than the time threshold, the token state of the first token is determined to be not expired.

[0132] In some embodiments, the first token state determination module 302 is further configured to:

[0133] Get the number of tokens in the task current limiting container and the container capacity in the configuration parameters of the task current limiting container;

[0134] When the number is greater than or equal to the container capacity, the task current limiting container is determined to be full;

[0135] When the number is less than the container capacity, the state of the task current limiting container is determined to be not full.

[0136] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0137] Example 4

[0138] The embodiment of the present invention also provides an electronic device for executing the task request processing method; see Figure 4 A structural diagram of an electronic device is shown, the electronic device includes a memory 400 and a processor 401, wherein the memory 400 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 401 to implement the above-mentioned task request processing method.

[0139] Further, Figure 4 The electronic device shown further includes a bus 402 and a communication interface 403 , and the processor 401 , the communication interface 403 and the memory 400 are connected via the bus 402 .

[0140] The memory 400 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 402 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0141] The processor 401 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 401. The above processor 401 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 400, and the processor 401 reads the information in the memory 400 and completes the steps of the method of the above embodiment in combination with its hardware.

[0142] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned task request processing method. The specific implementation can be found in the method embodiment, which will not be repeated here.

[0143] The computer program product for performing the task request processing method provided in the embodiment of the present invention includes a computer-readable storage medium storing a non-volatile program code executable by a processor. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be referred to the method embodiment, which will not be repeated here.

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

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

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

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

[0148] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0149] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A task request processing method, characterized in that: include: When receiving a task request, determining a task current limiting container matching the task request; When the state of the task current limiting container is full, determining the token state of the first token according to the token information of the first token in the task current limiting container; When the token status is overdue, deleting the token information of the first token from the current limiting container; Generate token information corresponding to the task request, and store the token information in the task current limiting container; The task request is transmitted to a server so that the server can process the task request.

2. The method according to claim 1, characterized in that Also includes: When the token status is not expired, the task request is rejected.

3. The method according to claim 1, characterized in that: Also includes: When the state of the task current limiting container is not full, generating token information corresponding to the task request; The token information is stored in the task current limiting container.

4. The method according to claim 1, characterized in that: In the case of receiving a task request, before determining the task current limiting container matching the task request, the method further includes: Create at least one initial task current limiting container; Each of the initial task current limiting containers is initialized according to the configuration parameters corresponding to each of the initial task current limiting containers to obtain at least one task current limiting container.

5. The method according to claim 4, characterized in that Also includes: Determine the token state of the first token according to the token information of the first token in the task current limiting container; When the token status is overdue, deleting the token information of the first token from the task current limiting container; Updating the token information of the first token in the task current limiting container, and returning to the step of determining the token state of the first token according to the token information of the first token in the task current limiting container; When the token status is not expired, the token information of the first token is retained, and the step of determining the token status of the first token according to the token information of the first token in the task current limiting container is returned.

6. The method according to claim 1 or 5, characterized in that: The determining the token state of the first token according to the token information of the first token in the task current limiting container includes: Determine the difference between the storage time in the token information and the current time as the storage time of the first token; When the storage time is greater than or equal to the time threshold, determining that the token state of the first token is overdue; When the storage time is less than the time threshold, it is determined that the token state of the first token is not expired.

7. The method according to claim 4, characterized in that The task current limiting container is in a full state, including: Obtain the number of tokens in the task current limiting container and the container capacity in the configuration parameters of the task current limiting container; When the number is greater than or equal to the container capacity, determining that the state of the task current limiting container is full; When the number is less than the container capacity, it is determined that the state of the task current limiting container is not full.

8. A task request processing device, characterized in that: include: A container determination module, configured to determine, upon receiving a task request, a task current limiting container matching the task request; A first token state determination module, configured to determine the token state of the first token in the task current limiting container according to the token information of the first token in the task current limiting container when the task current limiting container is full; A first token recovery module, configured to delete the first token from the current limiting container when the token status is overdue; A first token storage module, used to generate token information corresponding to the task request, and store the token information in the task current limiting container; The request transmission module is used to transmit the task request to the server so that the server can process the task request.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the task request processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the task request processing method according to any one of claims 1 to 7.