Data flow limiting method and device, computer equipment and storage medium

CN119835228APending Publication Date: 2025-04-15CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411731221.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

[0005]有鉴于此,本公开提供了一种数据限流的方法、装置、计算机设备以及存储介质,以解决相关技术在限流技术上存在与redis交互过多,存在较多不必要的操作,且不支持业务级别的限流以及多维度下同时限流的问题

Benefits of technology

[0012] In the embodiment of the present disclosure, by acquiring service request data, obtaining flow restriction identification information based on the service request data, determining the service dimension for flow restriction based on the flow restriction identification information, obtaining corresponding configuration information based on the service dimension, and performing flow restriction control of the service request data based on the configuration information. In this way, the embodiment of the present disclosure fully utilizes the redis feature to reduce the frequency of interaction between the application and redis, so that the same system resource can be achieved based on simple interaction, and the hierarchical current limiting of the same system resource under different service dimensions is solved. The related technologies have too much interaction with redis in the current limiting technology, many unnecessary operations, and do not support service-level current limiting and simultaneous current limiting in multiple dimensions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119835228A_ABST
    Figure CN119835228A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a data flow limiting method and device, computer equipment and a storage medium. Acquiring current limiting identification information according to the service request data; determining a service dimension for current limiting according to the current limiting identification information; acquiring corresponding configuration information according to the service dimension; and performing current limiting control on the service request data according to the configuration information. According to the embodiment of the invention, the interaction frequency between the application and the redis is reduced by fully utilizing the redis characteristics, so that the hierarchical flow limiting of the same system resource under different service dimensions can be realized based on simple interaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method, apparatus, computer equipment and storage medium for limiting data flow. Background Art

[0002] In the business system, the server will receive requests and respond to the requests during operation. In the case of too many requests, in order to ensure the normal operation of the server, it is necessary to limit the flow of received requests, that is, limit the response to the requests.

[0003] The current common flow limiting method is to adjust the threshold value by judging whether there is existing flow limiting information in redis, such as reducing the threshold by one (where the threshold is the maximum number of flow limiting times in redis), and executing the ttl operation to obtain the validity period of the threshold. If the validity period is exceeded, execute the del command to delete the corresponding information in redis. It can be seen that in the process of adjusting the threshold and determining whether to limit the flow, it is necessary to interact with redis multiple times, and the use of multiple commands (such as setNx, decr, ttl, del, etc.), initialization of thresholds, and maintenance of validity periods are too complicated and unnecessary; at the same time, the relevant technology does not support business-level flow limiting and simultaneous flow limiting in multiple dimensions.

[0004] Therefore, the related technologies have the problem of excessive interaction with Redis in terms of current limiting technology, many unnecessary operations, and do not support business-level current limiting and simultaneous current limiting in multiple dimensions. Summary of the invention

[0005] In view of this, the present disclosure provides a method, apparatus, computer device and storage medium for data flow limiting to solve the problems in the related technology of flow limiting technology, such as excessive interaction with redis, many unnecessary operations, and no support for business-level flow limiting and simultaneous flow limiting in multiple dimensions.

[0006] In a first aspect, the present disclosure provides a method for limiting data flow, characterized in that it includes:

[0007] Get business request data;

[0008] Obtain current limiting identification information according to business request data;

[0009] Determine the business dimension for current limiting according to the current limiting identification information;

[0010] Obtain corresponding configuration information based on business dimensions;

[0011] Perform flow control on business request data based on configuration information.

[0012] In the disclosed embodiment, business request data is obtained; flow limiting identification information is obtained according to the business request data; the business dimension for flow limiting is determined according to the flow limiting identification information; corresponding configuration information is obtained according to the business dimension; and flow limiting control is performed on the business request data according to the configuration information. In this way, the disclosed embodiment makes full use of the characteristics of redis to reduce the frequency of interaction between the application and redis, so that hierarchical flow limiting of the same system resources in different business dimensions can be achieved based on simple interaction, which solves the problem that the related technology has too much interaction with redis in flow limiting technology, has many unnecessary operations, and does not support business-level flow limiting and simultaneous flow limiting in multiple dimensions.

[0013] In an optional implementation, obtaining the current limiting identification information according to the service request data includes:

[0014] Get the current arrival location information of the business request data;

[0015] When the location information is the target code location, the corresponding current limiting identification information is obtained, wherein the target code location is used to characterize that the current node is a current limiting function point, and the current limiting function point is defined by customizing annotations on the interface method corresponding to the target code location or by using a filter to extract the uniform resource locator of the business request data and obtain the current limiting information.

[0016] In the disclosed embodiment, by setting the flow-limiting identification information at the target code location, the access flow of the system is limited to avoid reaching the carrying capacity of the system and causing system abnormalities.

[0017] In an optional implementation, determining the service dimension for current limiting according to the current limiting identification information includes:

[0018] Parse the current limiting identification information and extract the preset parameters;

[0019] Determine the business dimension for current limiting based on preset parameters.

[0020] In the disclosed embodiment, the business dimension is determined by dynamic analysis of the request parameters, thereby achieving business-level current limiting at different granularities.

[0021] In an optional implementation, obtaining corresponding configuration information according to the business dimension includes:

[0022] Extract keyword information from preset parameters;

[0023] Classify the business dimensions according to the keyword information to obtain the classified business dimensions;

[0024] Obtain corresponding configuration information for each of the classified business dimensions.

[0025] In the embodiments of the present disclosure, the introduction of the current limiting function is achieved through a small amount of code, which reduces repetitive development work, and supports hierarchical current limiting of the same system resources by setting configuration information of different business dimensions.

[0026] In an optional implementation, the configuration information includes a flow limiting time window and a flow limiting threshold, and flow limiting control is performed on the service request data according to the configuration information, including:

[0027] Get the current system timestamp corresponding to when the service request data is received;

[0028] According to the current system timestamp and the current limiting time window, the time window identifier is obtained;

[0029] Combine the preset parameters in the current limiting identification information with the time window identification, and adjust the counter of the current limiting identification information corresponding to the current limiting time window in the database;

[0030] A current limiting strategy is determined based on the accumulated value of the counter and the current limiting threshold, wherein the current limiting strategy is used to perform current limiting control on the service request data.

[0031] In the disclosed embodiment, the accumulated value is obtained by adjusting the value of the counter, and the accumulated value is compared with the current limiting threshold to protect the scarce resources of the system and prevent them from being excessively occupied by malicious users.

[0032] In an optional implementation, comparing the time window identifier with a historical record of an existing time window identifier in a database and adjusting the counter includes:

[0033] If the time window identifier is not included in the historical record, the value corresponding to the counter is set to the target value;

[0034] When the historical record contains a time window identifier, the value corresponding to the counter is increased by a preset value.

[0035] In the embodiment of the present disclosure, multi-dimensional flow limiting control is implemented for the global process and personalized configuration of the account dimension, and the general configuration of other accounts, thereby completing hierarchical flow limiting in different dimensions.

[0036] In an optional implementation, determining a current limiting strategy according to the accumulated value of the counter and the current limiting threshold includes:

[0037] When the accumulated value is greater than the current limiting threshold, determining a first current limiting strategy, wherein the first current limiting strategy is used to limit the flow of service request data;

[0038] When the accumulated value is less than or equal to the current limiting threshold, a second current limiting strategy is determined, wherein the second current limiting strategy is used for not limiting the service request data.

[0039] In a second aspect, the present disclosure provides a device for limiting data flow, the device comprising:

[0040] A first acquisition module, used to acquire business request data;

[0041] The second acquisition module is used to obtain the current limiting identification information according to the service request data;

[0042] A determination module is used to determine the business dimension for current limiting according to the current limiting identification information;

[0043] The third acquisition module is used to acquire corresponding configuration information according to the business dimension;

[0044] The control module is used to perform flow control on business request data according to configuration information.

[0045] In a third aspect, the present disclosure provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the data flow limiting method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0046] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the data flow limiting method of the first aspect or any corresponding embodiment thereof.

[0047] In a fifth aspect, the present disclosure provides a computer program product, including computer instructions, where the computer instructions are used to enable a computer to execute the data flow limiting method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0049] Figure 1 is a flow chart of a method for limiting data flow according to an embodiment of the present disclosure;

[0050] Figure 2 This is a schematic diagram of the redis current limiting process according to an embodiment of the present disclosure;

[0051] Figure 3 It is a schematic diagram of the overall framework flow of the current limiting process according to an embodiment of the present disclosure;

[0052] Figure 4 is a structural block diagram of a data flow limiting device according to an embodiment of the present disclosure;

[0053] Figure 5 It is a schematic diagram of the hardware structure of the computer device of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0055] When system resources are scarce, it is necessary to limit the flow of these resources. The common way to limit flow at present is to interact with redis, combine commands such as setNx, decr, ttl, del, and maintain the initialization threshold and validity period to achieve flow limiting operations. However, too much interaction with redis will result in many unnecessary operations, and the current related technologies do not support business-level flow limiting and simultaneous flow limiting in multiple dimensions.

[0056] In order to solve the above problems, according to an embodiment of the present disclosure, a method embodiment of data flow limiting is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0057] In this embodiment, a method for limiting data flow is provided, such as Figure 1 As shown, Figure 1 : is a flow chart of a method for limiting data flow according to an embodiment of the present disclosure. The method can be applied to a server side. The method flow includes the following steps:

[0058] Step S101, obtaining service request data;

[0059] Step S102, obtaining current limiting identification information according to the service request data;

[0060] Step S103, determining the service dimension for current limiting according to the current limiting identification information;

[0061] Step S104, obtaining corresponding configuration information according to the business dimension;

[0062] Step S105: performing flow control on the service request data according to the configuration information.

[0063] Optionally, in the disclosed embodiment, the user can send some service requests to the server through the terminal, such as requesting data encryption and decryption, obtaining permission information, etc. The server determines whether the system resources corresponding to the service request data are sufficient. If not, current limiting is required. At this time, current limiting identification information can be obtained according to the obtained service request data, and then the corresponding current limiting service dimension is obtained based on the current limiting identification information. The service dimension can be an account dimension, a system dimension, etc.

[0064] Each type of business dimension is configured with corresponding configuration information in advance. These configuration information are the basis for limiting the flow of request data. Then, the flow of business request data is controlled according to the configuration information. It should be noted that the control here includes limiting the flow of business request data and not limiting the flow of business request data.

[0065] In the disclosed embodiment, business request data is obtained; flow limiting identification information is obtained according to the business request data; the business dimension for flow limiting is determined according to the flow limiting identification information; corresponding configuration information is obtained according to the business dimension; and flow limiting control is performed on the business request data according to the configuration information. In this way, the disclosed embodiment makes full use of the characteristics of redis to reduce the frequency of interaction between the application and redis, so that hierarchical flow limiting of the same system resources in different business dimensions can be achieved based on simple interaction, which solves the problem that the related technology has too much interaction with redis in flow limiting technology, has many unnecessary operations, and does not support business-level flow limiting and simultaneous flow limiting in multiple dimensions.

[0066] In some optional implementations, obtaining the current limiting identification information according to the service request data includes:

[0067] Get the current arrival location information of the business request data;

[0068] When the location information is the target code location, the corresponding current limiting identification information is obtained, wherein the target code location is used to characterize that the current node is a current limiting function point, and the current limiting function point is defined by customizing annotations on the interface method corresponding to the target code location or by using a filter to extract the uniform resource locator of the business request data and obtain the current limiting information.

[0069] Optionally, in the embodiment of the present disclosure, current limiting function points are marked at some code locations. If current limiting in multiple dimensions is required, it is marked multiple times.

[0070] When the server detects that the current arrival location information of the business request data is the marked target code location (i.e., the location of the current limiting function point), the current limiting identification information set at the target code location is obtained. It should be noted that the marking method of the current limiting identification information can be adopted in a variety of ways, as long as the current limiting identification information can be obtained during operation, such as using custom annotations or filters to obtain the current limiting identification information, wherein the custom annotation acts on the specified interface method (such as the interface method corresponding to the target code location) and takes effect on the method. The filter is a more general uniform resource locator (URL) for extracting business request data. If the current limiting information of the URL is configured, the current limiting identification information is directly obtained.

[0071] In the disclosed embodiment, by setting the flow-limiting identification information at the target code location, the access flow of the system is limited to avoid reaching the carrying capacity of the system and causing system abnormalities.

[0072] In some optional implementations, determining the service dimension for current limiting according to the current limiting identification information includes:

[0073] Parse the current limiting identification information and extract the preset parameters;

[0074] Determine the business dimension for current limiting based on preset parameters.

[0075] Optionally, the current limiting identification information is very concise, and is a fixed string or a string containing preset parameters, where the preset parameters usually refer to dynamic parameters. If the current limiting identification information contains preset parameters, the corresponding preset parameter part is replaced with the request parameters through the context of the request, and the business dimension for current limiting can be obtained according to the preset parameters. For example, if the dynamic parameter is an account identifier, the business dimension for current limiting is the account dimension. This step is to convert the current request into one or more current limiting identification information when the request occurs, which is used to compare the current limiting configuration based on the current limiting identification information. That is, the relationship between the current limiting identification information, business dimension, and current limiting configuration information is: current limiting identification information → business dimension → current limiting configuration information.

[0076] In the disclosed embodiment, the business dimension is determined by dynamic analysis of the request parameters, thereby achieving business-level current limiting at different granularities.

[0077] In some optional implementations, obtaining corresponding configuration information according to the business dimension includes:

[0078] Extract keyword information from preset parameters;

[0079] Classify the business dimensions according to the keyword information to obtain the classified business dimensions;

[0080] Obtain corresponding configuration information for each of the classified business dimensions.

[0081] Optionally, the disclosed embodiment can process the existing personalized current limiting configuration and the general current limiting configuration separately. Specifically, keyword information is extracted from the preset parameters, wherein the keyword information can characterize whether the current current limiting configuration is personalized or general, and then the corresponding business dimensions are obtained, and then the corresponding configuration information is obtained respectively.

[0082] Assume that a system resource is scarce and needs to be limited, and define the following current limiting rules:

[0083] 1. Each account can only be operated 20 times every 30 minutes;

[0084] 2. An individual account (assuming it is 1001) can only be operated 10 times every 40 minutes;

[0085] 3. There is no limit on the number of accounts in the entire system, and a total of 10,000 operations can be performed per hour.

[0086] The corresponding configuration information is as follows:

[0087]

[0088] Among them, res_xx_limit_${userId} means to implement wildcard for accounts without personalized configuration, that is, there is no need to configure all accounts except account 1001, which reduces a lot of configuration. The current limiting time window and current limiting threshold also support real-time adjustment.

[0089] The corresponding current limiting identification information is as follows:

[0090] @RateLimit(key={“res_xx_limit_${userId}”,”res_xx_limit”})

[0091] Execution process:

[0092] According to the current request information, obtain the current limiting identification information key, dynamically parse the current limiting identification information, and obtain the preset parameters. For example, for user 1001: based on the analysis of the current limiting identification information, res_xx_limit_1001 and res_xx_limit, as well as the original res_xx_limit_${userId}, the preset parameters here are res_xx_limit_1001, res_xx_limit, res_xx_limit_${userId}, and the keyword information is extracted from these preset parameters: 1001, res_xx_limit, userId. For user 1002: based on the analysis of the current limiting identification information, res_xx_limit_1002 and res_xx_limit, as well as the original res_xx_limit_${userId}, the preset parameters here are res_xx_limit_1002, res_xx_limit, res_xx_limit_${userId}, and the keyword information is extracted from these preset parameters: 1002, res_xx_limit, userId.

[0093] The original res_xx_limit_${userId} is used as a wildcard to obtain the current limiting information when the resolved current limiting identifier has no configuration information.

[0094] The business dimensions can be classified based on the above keyword information. That is, the business dimensions represented by the above res_xx_limit_1001, res_xx_limit_1002, and res_xx_limit_${userId} are account dimensions, and the business dimension represented by res_xx_limit is a system dimension.

[0095] At the same time, res_xx_limit_1001, res_xx_limit, res_xx_limit_1002, and res_xx_limit_${userId} here can be called current limiting identifier key_2.

[0096] Then read the key_2 configuration information: the configuration information of user 1001 is: according to res_xx_limit_1001, the account dimension flow limit time window is 2400 (seconds) and the flow limit threshold is 10; according to res_xx_limit, the system dimension flow limit time window is 3600 (seconds) and the flow limit threshold is 10000. The configuration information of user 1002 is: according to the flow limit identifier res_xx_limit_1002, no configuration can be found, so the original res_xx_limit_${userId} configuration is used to downgrade and the account dimension flow limit time window is 1800 (seconds) and the flow limit threshold is 20. At the same time, according to res_xx_limit, the system dimension flow limit time window is 3600 (seconds) and the flow limit threshold is 10000.

[0097] In the embodiments of the present disclosure, the introduction of the current limiting function is achieved through a small amount of code, which reduces repetitive development work, and supports hierarchical current limiting of the same system resources by setting configuration information of different business dimensions.

[0098] In some optional implementations, the configuration information includes a flow limiting time window and a flow limiting threshold, and flow limiting control is performed on the service request data according to the configuration information, including:

[0099] Get the current system timestamp corresponding to when the service request data is received;

[0100] According to the current system timestamp and the current limiting time window, the time window identifier is obtained;

[0101] Combine the preset parameters in the current limiting identification information with the time window identification, and adjust the counter of the current limiting identification information corresponding to the current limiting time window in the database;

[0102] A current limiting strategy is determined based on the accumulated value of the counter and the current limiting threshold, wherein the current limiting strategy is used to perform current limiting control on the service request data.

[0103] Optionally, in order to determine in redis that the same business request data is requested multiple times in the same current limiting time window, the server needs to obtain the current system timestamp corresponding to the time when the business request data is received, and then divide the current system timestamp (milliseconds) by the current limiting time window (milliseconds) and round it up. The rounded value will not change within the current time window and can be used as a unique identifier for the time window. Here, the rounded value is called the time window identifier, for example, the time window identifier is 700111.

[0104] Then operate redis, combine the time window identifier 700111 obtained in the previous step with the preset parameters in the current limiting identifier information (such as res_xx_limit_1001) as key_3 (i.e. res_xx_limit_1001_700111), compare it with the existing historical records containing the time window identifier under the same current limiting time window in the redis database, execute the incr command, and obtain the cumulative value of the counter.

[0105] Then, the current limiting strategy is determined based on the numerical comparison result between the accumulated value of the counter and the current limiting threshold.

[0106] In the disclosed embodiment, the accumulated value is obtained by adjusting the value of the counter, and the accumulated value is compared with the current limiting threshold to protect the scarce resources of the system and prevent them from being excessively occupied by malicious users.

[0107] In some optional implementations, comparing the time window identifier with a historical record of an existing time window identifier in a database and adjusting the counter includes:

[0108] If the time window identifier is not included in the historical record, the value corresponding to the counter is set to the target value;

[0109] When the historical record contains a time window identifier, the value corresponding to the counter is increased by a preset value.

[0110] Alternatively, if Figure 2 After executing the incr command, with key_3 as the key, if the time window identifier 700111 does not exist in the redis historical records, the value corresponding to the counter is set to the target value, such as setting its value to 1; if the time window identifier 700111 exists in the redis historical records, the counter is increased by a preset value, such as one.

[0111] At the same time, if Figure 2 If the value returned by the incr operation is 1, it indicates that it is set for the first time. Then, the expire operation is performed on the service request data corresponding to the time window identifier, and its expiration time is set equal to the current limiting time window size.

[0112] If the value of incr is greater than the current limiting threshold in the configuration information, it means that the current limiting has been reached, and the first current limiting strategy is executed to limit the current, and the result is not allowed to pass (i.e., current limiting); otherwise, the second current limiting strategy is executed without current limiting, and the result is allowed to pass (i.e., no current limiting).

[0113] Based on the above embodiments, examples are given:

[0114] For user 1001:

[0115] (1) After reading, it is found that res_xx_limit_1001 has a limited flow configuration, the flow limit time window is 2400s, and the flow limit threshold is 10 times;

[0116] (2) Take the current millisecond timestamp, divide it by 2400000 (the number of milliseconds in the time window), and round it to get the value, which is assumed to be 700111;

[0117] (3) Execute the incr command, where the key is res_xx_limit_1001_700111. After execution, the result of incr is obtained, which is assumed to be N.

[0118] ① If N=1, execute the expire command additionally to set the key expiration time to 2400 seconds;

[0119] ②If N>10, it returns that the current limit has been reached;

[0120] ③If N<=10, it means there is no restriction.

[0121] Repeat the previous steps 1 to 3 for the res_xx_limit of the system dimension. You only need to change the flow control time window to 3600000 and the flow control threshold to 10000. This is equivalent to maintaining a shared flow control threshold in all account dimensions. Specifically:

[0122] (1) After reading, it is found that res_xx_limit is the current limit in the system dimension, the current limit time window is 3600s, and the current limit threshold is 10000 times;

[0123] (2) Take the current millisecond timestamp, divide it by 3600000 (the number of milliseconds in the current limiting time window), and round it to the integer value, which is assumed to be 75600;

[0124] (3) Execute the incr command, where the key is res_xx_limit_75600. After execution, the result of incr is obtained, which is assumed to be N.

[0125] ① If N=1, execute the expire command additionally to set the key expiration time to 3600 seconds;

[0126] ②If N>10000, it returns that the current limit has been reached;

[0127] ③If N<=10000, it means there is no limit.

[0128] For user 1002:

[0129] (1) After reading, it is found that res_xx_limit_1002 has no current limit configuration, so it is obtained again based on the key value res_xx_limit_${userId} before parsing. At this time, the current limit time window is 1800s and the threshold is 20 times;

[0130] (2) Take the current millisecond timestamp, divide it by 1800000 (the number of milliseconds in the current limiting time window), and round it to the integer value, which is assumed to be 944332;

[0131] (3) Execute the incr command, where the key is res_xx_limit_1002_944332. After execution, the result of incr is obtained, which is assumed to be N.

[0132] ① If N=1, execute the expire command additionally to set the key expiration time to 1800 seconds;

[0133] ②If N>20, it returns that the current limit has been reached;

[0134] ③If N<=20, it means there is no restriction.

[0135] Repeat the previous steps 1 to 3 for res_xx_limit in the system dimension, and only need to change the current limiting time window to 3600s and the current limiting threshold to 10000. Please refer to the above current limiting process under the system dimension, which will not be repeated here.

[0136] In the embodiment of the present disclosure, multi-dimensional flow limiting control is implemented for the global process and personalized configuration of the account dimension, and the general configuration of other accounts, thereby completing hierarchical flow limiting in different dimensions.

[0137] In some optional embodiments, such as Figure 3 , Figure 3 This is a schematic diagram of the overall framework of the current limiting process according to an embodiment of the present disclosure. Specifically:

[0138] Read the current limiting identification information key;

[0139] Parse key and get key_2;

[0140] Read the current limiting configuration information of key_2; during the reading process, if the configuration information exists, concatenate the time window identifier to obtain key_3; if the configuration information does not exist, continue reading, if the configuration information is read, concatenate the time window identifier to obtain key_3, otherwise no current limiting is performed;

[0141] After getting key_3, execute Figure 2 The redis current limiting process.

[0142] In this embodiment, a device for data flow limiting is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0143] This embodiment provides a data flow limiting device, such as Figure 4 As shown, including:

[0144] A first acquisition module 401 is used to acquire service request data;

[0145] The second acquisition module 402 is used to acquire the current limiting identification information according to the service request data;

[0146] A determination module 403 is used to determine the service dimension for current limiting according to the current limiting identification information;

[0147] The third acquisition module 404 is used to acquire corresponding configuration information according to the business dimension;

[0148] The control module 405 is used to perform flow control on the service request data according to the configuration information.

[0149] In some optional embodiments, the second acquisition module 402 is used to obtain the location information of the current arrival of the business request data; when the location information is the target code location, the corresponding current limiting identification information is obtained, wherein the target code location is used to characterize that the current node is a current limiting function point, and the current limiting function point is defined by customizing annotations on the interface method corresponding to the target code location or by using a filter to extract the uniform resource locator of the business request data and obtain the current limiting information.

[0150] In some optional implementations, the determination module 403 is used to parse the current limiting identification information and extract preset parameters; and determine the business dimension for current limiting according to the preset parameters.

[0151] In some optional implementations, the third acquisition module 404 is used to extract keyword information from preset parameters; classify the business dimensions according to the keyword information to obtain classified business dimensions; and obtain corresponding configuration information for the classified business dimensions.

[0152] In some optional embodiments, the configuration information includes a current limiting time window and a current limiting threshold, and a control module 405 is used to obtain the current system timestamp corresponding to when the business request data is received; obtain the time window identifier based on the current system timestamp and the current limiting time window; combine the preset parameters in the current limiting identifier information with the time window identifier, and adjust the counter of the current limiting identifier information corresponding to the current limiting time window in the database; determine the current limiting strategy based on the accumulated value of the counter and the current limiting threshold, wherein the current limiting strategy is used to perform current limiting control on the business request data.

[0153] In some optional embodiments, the control module 405 is also used to set the value corresponding to the counter to the target value when the historical record does not contain a time window identifier; when the historical record contains a time window identifier, increase the value corresponding to the counter by a preset value.

[0154] In some optional embodiments, the control module 405 is also used to determine a first flow limiting strategy when the cumulative value is greater than a flow limiting threshold, wherein the first flow limiting strategy is used to limit the flow of business request data; and to determine a second flow limiting strategy when the cumulative value is less than or equal to the flow limiting threshold, wherein the second flow limiting strategy is used not to limit the flow of business request data.

[0155] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0156] The data current limiting device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0157] The present disclosure also provides a computer device having the above Figure 4 The data shown is a current limiting device.

[0158] See also Figure 5 , Figure 5 is a schematic diagram of a computer device provided by an optional embodiment of the present disclosure, such as Figure 5As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.

[0159] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0160] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0161] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0162] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0163] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0164] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0165] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.

[0166] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for limiting data flow, characterized in that: The method comprises: Get business request data; Acquire current limiting identification information according to the service request data; Determining the service dimension for current limiting according to the current limiting identification information; Acquire corresponding configuration information according to the business dimension; The service request data is subjected to flow limiting control according to the configuration information.

2. The method according to claim 1, characterized in that The obtaining the current limiting identification information according to the service request data includes: Obtaining the location information of the current arrival of the service request data; When the location information is a target code location, the corresponding current limiting identification information is obtained, wherein the target code location is used to characterize that the current node is a current limiting function point, and the current limiting function point is defined by customizing an annotation or filter on the interface method corresponding to the target code location to extract the uniform resource locator of the business request data and obtain the current limiting information.

3. The method according to claim 1, characterized in that The determining the service dimension for current limiting according to the current limiting identification information includes: Parsing the current limiting identification information to extract preset parameters; The business dimension for current limiting is determined according to the preset parameters.

4. The method according to claim 3, characterized in that The acquiring corresponding configuration information according to the business dimension includes: Extracting keyword information from the preset parameters; Classifying the business dimensions according to the keyword information to obtain classified business dimensions; The corresponding configuration information is obtained for each of the classified business dimensions.

5. The method according to claim 4, characterized in that The configuration information includes a flow limiting time window and a flow limiting threshold, and the flow limiting control of the service request data according to the configuration information includes: Obtaining a current system timestamp corresponding to when the service request data is received; Obtaining a time window identifier according to the current system timestamp and the current limiting time window; Combine the current limiting identification information with the time window identification, and adjust the counter of the current limiting identification information corresponding to the current limiting time window in the database; A current limiting strategy is determined according to the accumulated value of the counter and the current limiting threshold, wherein the current limiting strategy is used to perform current limiting control on the service request data.

6. The method according to claim 5, characterized in that The step of comparing the time window identifier with a historical record of an existing time window identifier in a database and adjusting a counter includes: When the time window identifier is not included in the historical record, setting the value corresponding to the counter to the target value; When the historical record contains the time window identifier, the value corresponding to the counter is increased by a preset value.

7. The method according to claim 6, characterized in that The determining of the current limiting strategy according to the accumulated value of the counter and the current limiting threshold comprises: When the accumulated value is greater than the current limiting threshold, determining a first current limiting strategy, wherein the first current limiting strategy is used to limit the current of the service request data; When the accumulated value is less than or equal to the current limiting threshold, a second current limiting strategy is determined, wherein the second current limiting strategy is used for not limiting the current of the service request data.

8. A data flow limiting device, characterized in that: The device comprises: A first acquisition module, used to acquire business request data; A second acquisition module is used to acquire current limiting identification information according to the service request data; A determination module, used to determine a service dimension for current limiting according to the current limiting identification information; A third acquisition module is used to acquire corresponding configuration information according to the business dimension; A control module is used to perform flow limiting control on the service request data according to the configuration information.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the data flow limiting method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data flow limiting method according to any one of claims 1 to 7.