Data Processing Method, Apparatus, Electronic Device, and Storage Medium

By obtaining the target processing identity of the access request and the current request time, the comparison result between the time interval and the preset time is determined, and the access request is processed using the corresponding processing method, which solves the access request denial problem caused by no token in the token bucket, and improves the accuracy of access request processing and service performance.

CN116155820BActive Publication Date: 2025-08-05BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310102915.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-28
Publication Date
2025-08-05
Estimated Expiration
2043-01-28

AI Technical Summary

Technical Problem

In the prior art, the token bucket is created when receiving the first request, causing the access request to be unable to obtain the token and is denied, resulting in inaccurate access request processing.

Method used

By obtaining the target processing identifier of the access request and the current request time, the comparison result between the time interval and the preset time is determined, and the access request is processed using the corresponding processing method, including using the pre-generated token bucket when the time interval is greater than the preset time and using the counter to record the number of requests when the time interval is less than or equal to the preset time.

Benefits of technology

Improves the accuracy of access request processing, avoids the problem of denying access requests without tokens in the token bucket when the processing is started, and ensures service performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116155820B_ABST
    Figure CN116155820B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a data processing method, apparatus, electronic device, and storage medium. The method comprises: obtaining a target processing identifier and the current request time of an access request in an access request; obtaining the request time of the first access request corresponding to the target processing identifier as the initial request time; determining the time interval between the current request time and the initial request time; and processing the access request based on a comparison of the time interval with a preset time. The present disclosure solves the problem of rejecting an access request when control flow is not reached at the start of processing but there are no tokens in the token bucket, thereby improving the accuracy of access request processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technology, and in particular to a data processing method, device, electronic device, and storage medium. Background Art

[0002] A large number of concurrent accesses will affect service stability. To ensure service stability, access requests within a unit of time can be processed.

[0003] In the related art, when a token bucket is used to process an access request, a token bucket is created when the first request is received. This may result in the request being rejected because it cannot obtain a token, leading to inaccurate access request processing. Summary of the Invention

[0004] The present disclosure provides a data processing method, apparatus, electronic device, and storage medium to at least address the problem of inaccurate access request processing in related technologies. The technical solutions of the present disclosure are as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a data processing method, including:

[0006] Obtaining a target processing identifier in an access request and a current request time of the access request;

[0007] Obtaining the request time of the first access request corresponding to the target processing identifier as the initial request time;

[0008] Determining a time interval between the current request time and the initial request time;

[0009] The access request is processed according to a comparison result between the time interval and a preset time.

[0010] Optionally, the processing the access request according to a comparison result between the time interval and a preset time includes:

[0011] When the time interval is greater than the preset time, the access request is processed according to the target token bucket corresponding to the target processing identifier, and the target token bucket is a pre-generated token bucket corresponding to the target processing identifier. After the target token bucket is generated, tokens are added according to the target control flow corresponding to the target processing identifier.

[0012] Optionally, before obtaining the target processing identifier in the access request, the method further includes:

[0013] When the target service corresponding to the target processing identifier is started, obtaining configuration information, the configuration information including at least one processing identifier and control flow corresponding to each processing identifier;

[0014] A token bucket corresponding to each of the processing identifiers is generated respectively, and tokens are added to the token bucket based on the control flow corresponding to the processing identifier.

[0015] Optionally, also include:

[0016] When the time interval is less than or equal to the preset time, obtaining the target control flow corresponding to the target processing identifier;

[0017] A target token bucket corresponding to the target processing identifier is generated, and tokens are added to the target token bucket based on the target control flow.

[0018] Optionally, also include:

[0019] If it is determined based on the configuration information that the target control flow corresponding to the target processing identifier has changed, the target token bucket is deleted.

[0020] Optionally, the processing the access request according to the comparison result of the time interval and the preset time further includes:

[0021] When the time interval is less than or equal to the preset time, the access request is processed according to the number of requests between the initial request time and the current request time.

[0022] Optionally, processing the access request according to the number of requests between the initial request time and the current request time includes:

[0023] If the number of requests is greater than or equal to the target control flow corresponding to the target process identifier, the access request is rejected, and the target control flow is the control flow corresponding to the target process identifier.

[0024] Optionally, also include:

[0025] If the access request does not include any processing identifier in the configuration information, the access request is allowed to access.

[0026] According to a second aspect of an embodiment of the present disclosure, there is provided a data processing apparatus, including:

[0027] a processing identifier acquisition module configured to acquire a target processing identifier in an access request and a current request time of the access request;

[0028] an initial request time acquisition module configured to acquire the request time of the first access request corresponding to the target processing identifier as the initial request time;

[0029] a time interval determining module, configured to determine a time interval between the current request time and the initial request time;

[0030] The request processing module is configured to process the access request according to a comparison result between the time interval and a preset time.

[0031] Optionally, the request processing module includes:

[0032] The first processing unit is configured to process the access request according to the target token bucket corresponding to the target processing identifier when the time interval is greater than the preset time. The target token bucket is a pre-generated token bucket corresponding to the target processing identifier. After the target token bucket is generated, tokens are added according to the target control flow corresponding to the target processing identifier.

[0033] Optionally, the device further includes:

[0034] a configuration acquisition module configured to acquire configuration information when the target service corresponding to the target processing identifier is started, the configuration information including at least one processing identifier and a control flow corresponding to each processing identifier;

[0035] The preheating module is configured to generate a token bucket corresponding to each of the processing identifiers respectively, and add tokens to the token bucket based on the control flow corresponding to the processing identifier.

[0036] Optionally, the device further includes:

[0037] a control flow acquisition module configured to acquire a target control flow corresponding to the target processing identifier when the time interval is less than or equal to the preset time;

[0038] The generating module is configured to generate a target token bucket corresponding to the target processing identifier, and add tokens to the target token bucket based on the target control flow.

[0039] Optionally, the device further includes:

[0040] The token bucket deletion module is configured to delete the target token bucket if it is determined based on the configuration information that the target control flow corresponding to the target processing identifier changes.

[0041] Optionally, the request processing module further includes:

[0042] The second processing unit is configured to process the access request according to the number of requests between the initial request time and the current request time when the time interval is less than or equal to the preset time.

[0043] Optionally, the second processing unit is configured to execute:

[0044] If the number of requests is greater than or equal to the target control flow corresponding to the target process identifier, the access request is rejected, and the target control flow is the control flow corresponding to the target process identifier.

[0045] Optionally, the device further includes:

[0046] The access request release module is configured to allow the access request to proceed if the access request does not include any processing identifier in the configuration information.

[0047] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0048] processor;

[0049] a memory for storing instructions executable by the processor;

[0050] The processor is configured to execute the instructions to implement the data processing method as described in the first aspect.

[0051] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data processing method as described in the first aspect.

[0052] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program or computer instructions, which implement the data processing method described in the first aspect when executed by a processor.

[0053] The technical solutions provided by the embodiments of the present disclosure bring at least the following beneficial effects:

[0054] The embodiment of the present disclosure obtains the target processing identifier in the access request, and uses the request time of the access request as the current request time, obtains the initial request time of the first access request corresponding to the target processing identifier, determines the time interval between the current request time and the initial request time, and processes the access request according to the comparison result of the time interval and the preset time. Since the access request is processed based on the comparison result of the time interval and the preset time using the corresponding processing method, the problem of rejecting the access request because the control flow is not reached when the processing starts but there is no token in the token bucket is solved, and the accuracy of the access request processing is improved.

[0055] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.

[0057] Figure 1 is a flow chart showing a data processing method according to an exemplary embodiment;

[0058] Figure 2 is a flow chart showing a data processing method according to an exemplary embodiment;

[0059] Figure 3 is a flow chart showing a data processing method according to an exemplary embodiment;

[0060] Figure 4 is a block diagram of a data processing device according to an exemplary embodiment;

[0061] Figure 5 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0062] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0063] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.

[0064] Figure 1 is a flow chart showing a data processing method according to an exemplary embodiment. Figure 1 As shown, the data processing method is used in electronic devices such as servers and includes the following steps.

[0065] In step S11, the target processing identifier in the access request and the current request time of the access request are obtained.

[0066] The processing identifier can be an identifier under at least one processing dimension, such as an interface, user, or application. When the target processing dimension is an interface, the processing identifier is the interface identifier. The current service can correspond to at least one processing identifier, and the target processing identifier is one of the at least one processing identifiers.

[0067] Upon receiving an access request, the access request is parsed, and the identifier of the current service under the processing dimension is obtained from the access request to obtain the target processing identifier. The request time of the access request is obtained. For example, the time when the access request was received can be determined as the request time of the access request, and the request time is used as the current request time.

[0068] In step S12, the request time of the first access request corresponding to the target processing identifier is obtained as the initial request time.

[0069] An access request record corresponding to the target processing identifier is saved in a database, a first access request corresponding to the target processing identifier is determined from the access request record corresponding to the target processing identifier, and a request time of the first access request is obtained from the access request record, and the request time of the first access request is used as the initial request time corresponding to the target processing identifier.

[0070] In step S13, the time interval between the current request time and the initial request time is determined.

[0071] In step S14, the access request is processed according to the comparison result between the time interval and the preset time.

[0072] Compare the time interval with the preset time to obtain a comparison result, and use the processing method corresponding to the comparison result to process the access request. For example, when the time interval is less than or equal to the preset time, the access request is processed using a counter control method. When the time interval is greater than the preset time, the access request is processed using a token bucket method.

[0073] The data processing method provided by this exemplary embodiment obtains the target processing identifier in the access request and the current request time of the access request, obtains the initial request time of the first access request corresponding to the target processing identifier, determines the time interval between the current request time and the initial request time, and processes the access request according to the comparison result of the time interval and the preset time. Since the access request is processed based on the comparison result of the time interval and the preset time using the corresponding processing method, the problem of rejecting the access request because the control flow is not reached when the processing starts but there is no token in the token bucket is solved, thereby improving the accuracy of the access request processing.

[0074] Figure 2 is a flow chart showing a data processing method according to an exemplary embodiment. Figure 2 As shown, the data processing method is used in electronic devices such as servers and includes the following steps.

[0075] In step S21, the target processing identifier in the access request and the current request time of the access request are obtained.

[0076] In step S22, the request time of the first access request corresponding to the target processing identifier is obtained as the initial request time.

[0077] In step S23, the time interval between the current request time and the initial request time is determined.

[0078] In step S24, when the time interval is less than or equal to the preset time, the access request is processed according to the number of requests between the initial request time and the current request time.

[0079] If the time interval between the current request time and the initial request time is less than or equal to the preset time, it means that the target token bucket may not be ready yet. In order to avoid rejecting the access request due to failure to obtain the token in the target token bucket when the target control flow is not reached at this time, the number of requests between the initial request time and the current request time can be obtained. The access request can be processed according to the number of requests between the initial request time and the current request time, such as releasing the access request or rejecting the access request.

[0080] In an exemplary embodiment, the access request is processed based on the number of requests between the initial request time and the current request time, including: if the number of requests is greater than or equal to the target control flow corresponding to the target processing identifier, the access request is rejected, and the target control flow is the control flow corresponding to the target processing identifier.

[0081] A counter can be used to record the number of requests between the initial request time and the current request time. The counter can record the number of released access requests in an incrementing manner. When an access request is received, if the time interval between the current request time and the initial request time is less than or equal to the preset time, the number of requests between the initial request time and the current request time recorded by the counter is obtained, and the number of requests is compared with the target control flow. If the number of requests is equal to the target control flow, it means that the number of currently released access requests has reached the target control flow, and the access request is rejected, that is, the access request is no longer allowed to access; if the number of requests is less than the target control flow, it means that the number of currently released access requests has not yet reached the target control flow, and the access request is released, that is, the access request is allowed to access, and the number of requests recorded by the counter is increased by 1.

[0082] Service performance can be guaranteed by rejecting access requests when the number of requests is greater than or equal to the target control flow corresponding to the target processing identifier.

[0083] In step S25, when the time interval is greater than the preset time, the access request is processed according to the target token bucket corresponding to the target processing identifier. The target token bucket is a pre-generated token bucket corresponding to the target processing identifier. After the target token bucket is generated, tokens are added according to the target control flow corresponding to the target processing identifier.

[0084] When the time interval between the current request and the initial request is greater than a preset time, the target token bucket corresponding to the target processing identifier is ready. Token bucket processing can be used. The access request is processed based on the target token bucket corresponding to the target processing identifier, such as granting or denying the access request. The capacity of the target token bucket is the target control flow corresponding to the target processing identifier.

[0085] In an exemplary embodiment, the access request is processed according to the target token bucket corresponding to the target processing identifier, including: if a token is obtained from the target token bucket, the access request is allowed to access; if a token cannot be obtained from the target token bucket, the access request is rejected.

[0086] When processing access requests using a token bucket approach, a token is retrieved from the target token bucket. If a token can be retrieved from the target token bucket, the access request is allowed. If a token cannot be retrieved from the target token bucket, the access request is denied. Using a token bucket approach ensures accurate processing of access requests, ensuring service performance.

[0087] This embodiment combines the number of requests and token buckets to process access requests. It does not require interaction with the database and can avoid performance losses caused by the interaction. In addition, the combination of the number of requests and token buckets can improve the accuracy of access request processing in the early stage of access request processing.

[0088] The data processing method provided by this exemplary embodiment processes the access request according to the number of requests between the initial request time and the current request time when the time interval between the current request time and the initial request time is less than or equal to the preset time, and processes the access request according to the target token bucket corresponding to the target processing identifier when the time interval is greater than the preset time. It combines the processing method based on the number of requests and the processing method based on the token bucket, adopts the processing method based on the number of requests within the preset time of starting the processing, and adopts the processing method based on the token bucket after the preset time when the tokens in the token bucket have been added. This solves the problem of rejecting the access request because the control flow is not reached when the processing starts but there are no tokens in the token bucket, thereby improving the accuracy of access request processing.

[0089] On the basis of the above technical solution, before obtaining the target processing identifier in the access request, it also includes: when the target service corresponding to the target processing identifier is started, obtaining configuration information, the configuration information including at least one processing identifier and the control flow corresponding to each processing identifier; generating a token bucket corresponding to each processing identifier respectively, and adding a token to the token bucket based on the control flow corresponding to the processing identifier.

[0090] The at least one processing identifier may include the target processing identifier or may not include the target processing identifier. When the at least one processing identifier does not include the target processing identifier, the target processing identifier is a processing identifier newly added after the target service is started.

[0091] When the target service corresponding to the target processing identifier is started, configuration information is obtained. The configuration information includes at least one processing identifier that requires access request processing and the control flow corresponding to each processing identifier. After obtaining the configuration information, a token bucket corresponding to each processing identifier is generated. After the token bucket is generated, tokens can be added to the token bucket at a corresponding rate based on the control flow corresponding to the processing identifier. For example, the configuration information includes two processing identifiers, namely the order details interface and the order list interface. The configuration information also includes a control flow of 10,000 corresponding to the order details interface and a control flow of 1,000 corresponding to the order list interface. When the target service is started, a token bucket corresponding to the order details interface and a token bucket corresponding to the order list interface can be generated. 10,000 tokens are added per second to the token bucket corresponding to the order details interface, and 1,000 tokens are added per second to the token bucket corresponding to the order list interface.

[0092] When the target service is started, a token bucket corresponding to each processing identifier is generated based on the configuration information, which realizes the pre-generation of the token bucket corresponding to the processing identifier based on the startup of the service, rather than temporarily generating the token bucket when the access request is received. This can avoid the problem of rejecting the first access request due to the generation of the token bucket when the access request is received, and can further improve the accuracy of access request processing.

[0093] Based on the above technical solution, the method also includes: when the time interval is less than or equal to the preset time, obtaining the target control flow corresponding to the target processing identifier; generating a target token bucket corresponding to the target processing identifier, and adding tokens to the target token bucket based on the target control flow.

[0094] In the absence of a counter corresponding to the target processing identifier, and if there is no target token bucket corresponding to the target processing identifier, this indicates that the target processing identifier was added after the target service was started or the configuration information changed, and that this is the first time a corresponding access request has been received since the addition or change. In this case, the target control flow corresponding to the target processing identifier can be obtained from the configuration information, a counter corresponding to the target processing identifier can be generated to record the number of requests, and a target token bucket corresponding to the target processing identifier can be generated to process access requests based on the target token bucket. After the target token bucket is generated, tokens are added to the target token bucket at a corresponding rate based on the target control flow, so that when the time interval between the current request time and the initial request time is less than or equal to a preset time, the target token bucket is generated in a timely manner, so that when the time interval is greater than the preset time, the access request can be accurately processed based on the token bucket. When the time interval is less than or equal to the preset time, the access request can be processed based on the number of requests recorded by the counter. This enables processing of access requests for the newly added target processing identifier using a processing method that combines a counter and a token bucket, thereby further improving the accuracy of access request processing.

[0095] On the basis of the above technical solution, the method further includes: if it is determined based on configuration information that the target control flow corresponding to the target processing identifier has changed, deleting the target token bucket.

[0096] The configuration information is monitored to determine whether the target control flow corresponding to the target processing identifier has changed. When it is determined based on the configuration information that the target control flow corresponding to the target processing identifier has changed, the target token bucket corresponding to the target processing identifier is deleted. Subsequently, a counter and a new token bucket corresponding to the target processing identifier can be generated. Within a preset time, the access request is processed based on the number of requests recorded by the counter. After the preset time, the access request is processed based on the new token bucket.

[0097] By promptly deleting the target token bucket when the target control flow corresponding to the target processing identifier determined based on the configuration information changes, the problem of processing errors caused by still using the original configuration information to process the access request after the configuration information is updated can be avoided.

[0098] Based on the above technical solution, the method further includes: if the access request does not include any processing identifier in the configuration information, allowing the access request to access.

[0099] When an access request is received, the access request is parsed. If the identifier of the target service under any processing dimension cannot be obtained from the access request, it means that the access request does not include any processing identifier in the configuration information, and the access request does not need to be processed. At this time, the access request is released, that is, the access request is allowed to access. The access request can be processed and a corresponding response can be given. In this way, access requests that do not need to be processed can be released in a timely manner.

[0100] Figure 3 is a flow chart showing a data processing method according to an exemplary embodiment. Figure 3 As shown, the data processing method is used in electronic devices such as servers and includes the following steps.

[0101] In step S31, when the target service is started, configuration information is obtained, where the configuration information includes at least one processing identifier and control flow corresponding to each processing identifier.

[0102] In step S32, a token bucket corresponding to each processing identifier is generated respectively, and tokens are added to the token bucket based on the control flow corresponding to the processing identifier.

[0103] In step S33, an access request is received.

[0104] In step S34, it is determined whether the access request contains a target processing identifier. If so, step S35 is executed; if not, step S312 is executed.

[0105] In step S35, it is determined whether there is a counter corresponding to the target processing identifier, and whether the time interval between the initial request time and the current request time is less than or equal to the preset time. If yes, step S36 is executed; if not, step S37 is executed.

[0106] In step S36, the access request is processed according to the number of requests between the initial request time and the current request time recorded by the counter, and then step S310 is executed.

[0107] In step S37, it is determined whether the target token bucket corresponding to the target processing identifier exists. If so, step S38 is executed; if not, step S39 is executed.

[0108] In step S38, the access request is processed based on the target token bucket, and then step S310 is executed.

[0109] In step S39, a counter corresponding to the target processing identifier is generated, and a target token bucket corresponding to the target processing identifier is generated, and then step S36 is executed.

[0110] When there is a target processing identifier in the access request, but there is no counter corresponding to the target processing identifier in the local cache, and there is no target token bucket corresponding to the target processing identifier, it means that the target processing identifier is a newly added processing identifier. At this time, a counter corresponding to the target processing identifier is generated, and a target token bucket corresponding to the target processing identifier is generated at the same time. For this access request, it is processed based on the number of requests recorded by the newly generated counter. When other access requests including the target processing identifier are received within the preset time, it is processed based on the number of requests recorded by the generated counter. When other access requests including the target processing identifier are received after the preset time, it is processed based on the generated target token bucket. This can avoid the problem of rejecting the first access request using only the token bucket, and can improve the accuracy of access request processing.

[0111] In step S310 , it is determined whether the access request needs to be rejected. If so, step S311 is executed; if not, step S312 is executed.

[0112] In step S311 , the access request is denied.

[0113] In step S312, the access request is allowed to access.

[0114] The data processing method provided by this exemplary embodiment loads configuration information when the target service is started by preheating, and generates a token bucket corresponding to each processing identifier based on the configuration information. This can avoid the problem of temporarily generating a token bucket when receiving the first access request, which leads to the rejection of the access request. Moreover, when an access request is received, the access request is processed in combination with the number of requests recorded by the counter and the token bucket. For target processing identifiers that have not been preheated, the access request can also be processed within a preset time based on the number of requests recorded by the counter, and the access request can be processed based on the token bucket after the preset time. This can avoid the problem of rejecting the first access request for target processing identifiers that have not been preheated, thereby improving the accuracy of access request processing.

[0115] Figure 4 FIG. 1 is a block diagram of a data processing device according to an exemplary embodiment. Figure 3 The device includes a processing identifier acquisition module 41, an initial request time acquisition module 42, a time interval determination module 43 and a request processing module 44.

[0116] The processing identifier acquisition module 41 is configured to acquire the target processing identifier in the access request and the current request time of the access request;

[0117] The initial request time acquisition module 42 is configured to acquire the request time of the first access request corresponding to the target processing identifier as the initial request time;

[0118] The time interval determination module 43 is configured to determine the time interval between the current request time and the initial request time;

[0119] The request processing module 44 is configured to process the access request according to a comparison result between the time interval and a preset time.

[0120] Optionally, the request processing module includes:

[0121] The first processing unit is configured to process the access request according to the target token bucket corresponding to the target processing identifier when the time interval is greater than the preset time. The target token bucket is a pre-generated token bucket corresponding to the target processing identifier. After the target token bucket is generated, tokens are added according to the target control flow corresponding to the target processing identifier.

[0122] Optionally, the device further includes:

[0123] a configuration acquisition module configured to acquire configuration information when the target service corresponding to the target processing identifier is started, the configuration information including at least one processing identifier and a control flow corresponding to each processing identifier;

[0124] The preheating module is configured to generate a token bucket corresponding to each of the processing identifiers respectively, and add tokens to the token bucket based on the control flow corresponding to the processing identifier.

[0125] Optionally, the device further includes:

[0126] a control flow acquisition module configured to acquire a target control flow corresponding to the target processing identifier when the time interval is less than or equal to the preset time;

[0127] The generating module is configured to generate a target token bucket corresponding to the target processing identifier, and add tokens to the target token bucket based on the target control flow.

[0128] Optionally, the device further includes:

[0129] The token bucket deletion module is configured to delete the target token bucket if it is determined based on the configuration information that the target control flow corresponding to the target processing identifier changes.

[0130] Optionally, the request processing module further includes:

[0131] The second processing unit is configured to process the access request according to the number of requests between the initial request time and the current request time when the time interval is less than or equal to the preset time.

[0132] Optionally, the second processing unit is configured to execute:

[0133] If the number of requests is greater than or equal to the target control flow corresponding to the target process identifier, the access request is rejected, and the target control flow is the control flow corresponding to the target process identifier.

[0134] Optionally, the device further includes:

[0135] The access request release module is configured to allow the access request to proceed if the access request does not include any processing identifier in the configuration information.

[0136] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0137] Figure 5 5 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 500 can be provided as a server. Figure 5 The electronic device 500 includes a processing component 522, which further includes one or more processors, and a memory resource represented by a memory 532 for storing instructions, such as applications, that can be executed by the processing component 522. The application stored in the memory 532 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 522 is configured to execute the instructions to perform the above-mentioned data processing method.

[0138] The electronic device 500 may further include a power supply component 526 configured to perform power management of the electronic device 500, a wired or wireless network interface 550 configured to connect the electronic device 500 to a network, and an input / output (I / O) interface 558. The electronic device 500 may operate based on an operating system stored in the memory 532, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0139] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 532 including instructions, which can be executed by the processing component 522 of the electronic device 500 to perform the above-mentioned data processing method. Alternatively, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0140] In an exemplary embodiment, a computer program product is further provided, comprising a computer program or computer instructions, wherein the computer program or computer instructions implement the above-mentioned data processing method when executed by a processor.

[0141] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.

[0142] It should be understood that the present invention is not limited to the exact construction described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A data processing method, characterized in that: include: Obtaining a target processing identifier in an access request and a current request time of the access request; Obtaining the request time of the first access request corresponding to the target processing identifier as the initial request time; Determining a time interval between the current request time and the initial request time; Processing the access request according to a comparison result between the time interval and a preset time; The processing of the access request according to the comparison result of the time interval and the preset time includes: When the time interval is greater than the preset time, the access request is processed according to the target token bucket corresponding to the target processing identifier, where the target token bucket is a pre-generated token bucket corresponding to the target processing identifier, and after the target token bucket is generated, tokens are added according to the target control flow corresponding to the target processing identifier; When the time interval is less than or equal to the preset time, the access request is processed according to the number of requests between the initial request time and the current request time.

2. The method according to claim 1, characterized in that Before obtaining the target processing identifier in the access request, the method further includes: When the target service corresponding to the target processing identifier is started, obtaining configuration information, the configuration information including at least one processing identifier and control flow corresponding to each processing identifier; A token bucket corresponding to each of the processing identifiers is generated respectively, and tokens are added to the token bucket based on the control flow corresponding to the processing identifier.

3. The method according to claim 1, characterized in that Also includes: When the time interval is less than or equal to the preset time, obtaining the target control flow corresponding to the target processing identifier; A target token bucket corresponding to the target processing identifier is generated, and tokens are added to the target token bucket based on the target control flow.

4. The method according to claim 1, wherein Also includes: If it is determined based on the configuration information that the target control flow corresponding to the target processing identifier has changed, the target token bucket is deleted.

5. The method according to claim 1, wherein The processing of the access request according to the number of requests between the initial request time and the current request time includes: If the number of requests is greater than or equal to the target control flow corresponding to the target process identifier, the access request is rejected, and the target control flow is the control flow corresponding to the target process identifier.

6. The method according to any one of claims 1 to 4, characterized in that Also includes: If the access request does not include any processing identifier in the configuration information, the access request is allowed to access.

7. A data processing device, characterized in that: include: a processing identifier acquisition module configured to acquire a target processing identifier in an access request and acquire a request time of the access request as a current request time; an initial request time acquisition module configured to acquire the request time of the first access request corresponding to the target processing identifier as the initial request time; a time interval determination module, configured to determine a time interval between the current request time and the initial request time; a request processing module configured to process the access request according to a comparison result between the time interval and a preset time; The request processing module includes: A first processing unit is configured to process the access request according to a target token bucket corresponding to the target processing identifier when the time interval is greater than the preset time, wherein the target token bucket is a pre-generated token bucket corresponding to the target processing identifier, and after the target token bucket is generated, tokens are added according to the target control flow corresponding to the target processing identifier; The second processing unit is configured to process the access request according to the number of requests between the initial request time and the current request time when the time interval is less than or equal to the preset time.

8. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the data processing method according to any one of claims 1 to 6. 9 . A computer-readable storage medium, wherein when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data processing method according to claim 1 .

Citation Information

Patent Citations

  • Flow limiting method and device based on Zuul, equipment and storage medium

    CN110380986A