Client control methods, devices, systems, electronic equipment and storage media
By introducing a management terminal into the client control system to receive registration requests and send rate limiting rules and parameters, the problem of cluster rate limiting management is solved, and effective resource allocation and performance protection of the cluster are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-23
- Publication Date
- 2026-04-03
AI Technical Summary
How to effectively manage cluster rate limiting to ensure the value of different services in terms of resource allocation and protection of downstream services with weaker performance.
By introducing a management terminal into the client control system, the system receives registration requests from clients, stores registration information, sends preset rate limiting rules and target rate limiting parameters, and the client determines and executes rate limiting operations based on the target rate limiting parameters, thereby achieving centralized management and allocation of cluster rate limiting.
It enables the management of rate limiting rules for different clients, dynamically adjusts rate limiting operations, and improves the effectiveness and efficiency of cluster rate limiting.
Smart Images

Figure CN116319577B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a client control method, apparatus, system, electronic device, and storage medium. Background Technology
[0002] Service rate limiting is a method used to restrict the flow of traffic or limit the number of requests when service resources are insufficient to handle a large number of requests, in order to ensure that limited resources can provide normal service. Conventional service rate limiting is divided into single-machine rate limiting and cluster rate limiting, with cluster rate limiting referring to rate limiting across multiple devices.
[0003] In many business scenarios, cluster rate limiting is highly valuable, such as allocating resources to different services, preventing a single service from consuming excessive resources, and protecting weaker downstream services. Therefore, how to manage cluster rate limiting has become a pressing issue. Summary of the Invention
[0004] The purpose of this invention is to provide a client control method, device, system, electronic device, and storage medium to manage cluster rate limiting. The specific technical solution is as follows:
[0005] In a first aspect of the present invention, a client control method is provided, applied to a management terminal in a client control system, the method comprising:
[0006] Receive a registration request from a client in the client control system, and store the client's registration information based on the registration request;
[0007] Upon receiving a rule retrieval request from the client, a preset rate limiting rule corresponding to the client is sent to the client, and a target rate limiting parameter is sent to the client based on the registration information. This allows the client to determine the preset rate limiting rule as the target rate limiting rule if it determines that the client meets the preset rate limiting rule based on the target rate limiting parameter, and to perform rate limiting operations based on the target rate limiting rule. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule.
[0008] In another aspect of this invention, a client control method is also provided, applied to a client in a client control system, the method comprising:
[0009] A rule retrieval request is sent to the management terminal in the client control system to receive the preset rate limiting rule and target rate limiting parameter corresponding to the client issued by the management terminal; the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule.
[0010] If the client is determined to meet the preset rate limiting rule based on the target rate limiting parameters, the preset rate limiting rule is determined as the target rate limiting rule;
[0011] Rate limiting operations are performed based on the target rate limiting rules.
[0012] In another aspect of the present invention, a client control device is also provided, disposed at the management terminal of a client control system, the device comprising:
[0013] The registration receiving module is used to receive the registration request from the client in the client control system and store the registration information of the client based on the registration request;
[0014] The rule sending module is configured to, upon receiving a rule retrieval request from the client, send a preset rate limiting rule corresponding to the client, and send a target rate limiting parameter to the client based on the registration information, so that the client, upon determining that it meets the preset rate limiting rule based on the target rate limiting parameter, determines the preset rate limiting rule as the target rate limiting rule and performs rate limiting operation based on the target rate limiting rule; wherein, the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule.
[0015] In another aspect of the present invention, a client control device is also provided, wherein a client is disposed in a client control system, the device comprising:
[0016] The request sending module is used to send a rule acquisition request to the management terminal in the client control system, so as to receive the preset rate limiting rule and target rate limiting parameter corresponding to the client issued by the management terminal; the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule;
[0017] The target rule determination module is used to determine the preset rate limiting rule as the target rate limiting rule when it is determined that the client meets the preset rate limiting rule based on the target rate limiting parameters.
[0018] The rate limiting module is used to perform rate limiting operations based on the target rate limiting rules.
[0019] In another aspect of the present invention, a client control system is also provided, the client control system including a management terminal and a client;
[0020] The management terminal is used to receive the registration request from the client and store the client's registration information based on the registration request; upon receiving the client's rule retrieval request, it sends the client a preset rate limiting rule corresponding to the client, and sends the client a target rate limiting parameter based on the registration information;
[0021] The client is configured to send a rule acquisition request to the management terminal to receive a preset rate limiting rule and a target rate limiting parameter corresponding to the client issued by the management terminal. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. If it is determined that the client meets the preset rate limiting rule based on the target rate limiting parameter, the preset rate limiting rule is determined as the target rate limiting rule. Rate limiting operation is performed based on the target rate limiting rule.
[0022] In another aspect of the present invention, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.
[0023] Memory, used to store computer programs;
[0024] The processor, when executing a program stored in memory, implements any of the client control methods described above.
[0025] In another aspect of the present invention, a computer-readable storage medium is also provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform any of the client control methods described above.
[0026] In another aspect of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the client control methods described above.
[0027] This invention provides a client control method that receives a registration request from a client in a client control system and stores the client's registration information based on the registration request. Upon receiving a rule retrieval request from the client, the method sends a preset rate limiting rule corresponding to the client and a target rate limiting parameter based on the registration information to the client. This allows the client to determine the preset rate limiting rule as the target rate limiting rule if it meets the preset rate limiting rule based on the target rate limiting parameter, and then executes rate limiting operations based on the target rate limiting rule. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. In this invention, by setting up a management terminal in the client control system, registered clients can be centrally managed. The management terminal can also issue rate limiting rules to clients, allowing for centralized management and allocation of all preset rate limiting rules. Furthermore, by sending the corresponding preset rate limiting rule to the client upon receiving a rule retrieval request, different rate limiting rules can be applied to different clients, thus enabling rate limiting management for multiple clients. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0029] Figure 1 This is a flowchart illustrating the steps of a client control method according to an embodiment of the present invention;
[0030] Figure 2 This is a flowchart illustrating the steps of another client control method in an embodiment of the present invention;
[0031] Figure 3 This is a block diagram of a client control device according to an embodiment of the present invention;
[0032] Figure 4 This is a block diagram of another client control device in an embodiment of the present invention;
[0033] Figure 5 This is a client control system according to an embodiment of the present invention;
[0034] Figure 6 This is an interactive schematic diagram of a client control system according to an embodiment of the present invention;
[0035] Figure 7 This is a block diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0036] The technical solutions of the present invention will now be described with reference to the accompanying drawings in the embodiments of the present invention.
[0037] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.
[0038] Figure 1 This is a flowchart illustrating the steps of a client control method according to an embodiment of the present invention. This method can be applied to the management terminal in a client control system, such as... Figure 1 As shown, the method includes:
[0039] Step 101: Receive the registration request from the client in the client control system, and store the registration information of the client based on the registration request;
[0040] Step 102: Upon receiving the rule retrieval request from the client, send a preset rate limiting rule corresponding to the client, and send a target rate limiting parameter to the client based on the registration information, so that if the client determines that it meets the preset rate limiting rule based on the target rate limiting parameter, it determines the preset rate limiting rule as the target rate limiting rule and performs rate limiting operation based on the target rate limiting rule; wherein, the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule.
[0041] The aforementioned client control system may include a management terminal and clients. The clients can be terminals used to provide business services to business partners, such as servers. Correspondingly, the management terminal is a device used to manage the clients in the client control system. Specifically, the number of clients in the aforementioned client control system can be one or more; this embodiment of the invention does not limit this. When multiple clients exist in the client control system, these multiple clients can form a cluster.
[0042] The aforementioned registration request refers to a registration request initiated by the client carrying registration information. In this case, the management terminal acts as a registration center, and only clients that have registered can be managed by the management terminal. Specifically, the registration information may include the client's service instance information, such as the number of service instances the client can provide, or information such as the client's operating performance. The specific details can be set according to actual needs, and this embodiment of the invention does not impose any restrictions on this.
[0043] Furthermore, the aforementioned rule retrieval request can be a request initiated when the client has a rate-limiting requirement. It refers to a request to obtain the rate-limiting rules corresponding to the client. These preset rate-limiting rules can be pre-configured on the management end. Specifically, multiple different rate-limiting rules can be pre-set on the management end. A rate-limiting rule refers to the rules followed when performing rate-limiting operations, and it can include execution conditions, rate-limiting thresholds or rate-limiting data, and rate-limiting methods. Execution conditions can be understood as the basis for determining whether to perform rate-limiting operations. For example, one rate-limiting rule can be set to determine whether to perform rate-limiting based on the client's central processing unit (CPU) utilization, and another rate-limiting rule can be set to determine whether to perform rate-limiting based on the client's system system's queuings per second (QPS). Specifically, the management end can be further divided into a registration center and a configuration center. The registration center can be used to receive client registration requests and store client registration information. Correspondingly, the configuration center can be used to set different preset rate-limiting rules, etc.
[0044] Furthermore, when different rate limiting rules are pre-set in the management terminal, corresponding clients can be set for different rate limiting rules, so that different clients can use different rate limiting rules. Specifically, clients can be grouped according to different models in the client control system, and a rate limiting rule can be set for clients belonging to the same group. Accordingly, the rate limiting rules corresponding to clients in different groups are different. Of course, other setting methods are also possible, and specific settings can be made according to actual needs. This embodiment of the invention does not limit this. Furthermore, this embodiment of the invention can be applied to different scenarios according to actual rate limiting needs. For example, it can be applied to balanced traffic scenarios, that is, so that each client is loaded with the same traffic and each client can use the same rate limiting rule. Of course, it can also be applied to unbalanced traffic scenarios, that is, so that different clients can be loaded with different traffic and, accordingly, different clients can use different rate limiting rules.
[0045] The aforementioned preset rate limiting rule corresponding to the client can be one or more. The rate limiting parameters can be parameters related to the client's performance, thus determining the client's current operating status based on these parameters. The target rate limiting parameters refer to the rate limiting parameters corresponding to each preset rate limiting rule; specifically, they can be parameters required by that rule, such as CPU utilization or QPS. When there are multiple preset rate limiting rules corresponding to the client, there are also multiple target rate limiting parameters, each corresponding to a different preset rate limiting rule.
[0046] Furthermore, after receiving the target rate limiting parameters and preset rate limiting rules issued by the management terminal, the client can determine whether the preset rate limiting rules are met based on the target rate limiting parameters. If the rate limiting rules are met, the client can perform rate limiting operations according to the target rate limiting rules.
[0047] In summary, the client control method provided in this embodiment of the invention receives a registration request from a client in the client control system and stores the client's registration information based on the registration request. Upon receiving a rule retrieval request from the client, the method sends a preset rate limiting rule corresponding to the client and a target rate limiting parameter to the client based on the registration information. This allows the client to determine the preset rate limiting rule as the target rate limiting rule if it meets the preset rate limiting rule based on the target rate limiting parameter, and then executes rate limiting operations based on the target rate limiting rule. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. In this embodiment of the invention, by setting up a management terminal in the client control system, registered clients in the client control system can be centrally managed. Simultaneously, by issuing rate limiting rules to clients through the management terminal, all preset rate limiting rules can be centrally managed and allocated at the management terminal. Furthermore, by sending the corresponding preset rate limiting rule to the client upon receiving a rule retrieval request, different rate limiting rules can be applied to different clients, thereby enabling rate limiting management for multiple clients, i.e., cluster rate limiting.
[0048] Optionally, when there are at least two clients in the client control system, the embodiments of the present invention may further include the following steps:
[0049] Step 111: Based on the target rate limiting rules corresponding to each client, obtain the system rate limiting parameters of the client control system.
[0050] Step 112: If the system rate limiting parameters meet the system rate limiting rules, send a rate limiting adjustment instruction to each client so that each client adjusts the target rate limiting rules based on the rate limiting adjustment instruction and performs rate limiting operation according to the adjusted target rate limiting rules until the adjusted system rate limiting parameters no longer meet the system rate limiting rules; the system rate limiting rules are preset for the client control system.
[0051] The aforementioned system rate limiting parameters refer to the rate limiting parameters of the entire client control system. These can typically be the sum or average of the rate limiting parameters for all clients in the system, and can be the system's QPS value or total CPU utilization, etc. Specifically, when there are at least two clients in the client control system, each client will often perform rate limiting operations according to its own corresponding target rate limiting rules. After the rate limiting operations are performed, the rate limiting parameters of each client will often change, and correspondingly, the system's rate limiting parameters will also change. In this case, the aforementioned system rate limiting parameters can be obtained from the rate limiting parameters of each client after the rate limiting operations are performed.
[0052] Specifically, taking the total CPU utilization as the system rate limiting parameter as an example, step 111 can be performed by having each client execute rate limiting operations according to its corresponding target rate limiting rules, obtaining the CPU utilization of each client, and then calculating the average of the CPU utilization of all clients to obtain the total CPU utilization. It is understood that the above calculation method varies depending on the system rate limiting parameter, and the specific calculation method can be set independently; this embodiment of the invention does not impose any limitations on this.
[0053] The aforementioned system rate limiting rules can be pre-set and may include the overall rate limiting target of the system, which usually corresponds to the aforementioned system rate limiting parameters. The aforementioned overall rate limiting target can be understood as the rate limiting threshold of the system. Thus, in this embodiment of the invention, when the aforementioned system rate limiting parameter is greater than the overall rate limiting target in the system rate limiting rules, it is determined that the system rate limiting parameter meets the system rate limiting rules. Correspondingly, when the system rate limiting parameter is not greater than the aforementioned overall rate limiting target, it is determined that the system rate limiting parameter does not meet the system rate limiting rules.
[0054] Furthermore, if the system rate limiting parameters meet the system rate limiting rules, it indicates that after all clients in the current system have performed rate limiting operations, the current client control system has not reached the overall rate limiting target. At this time, the system as a whole still needs to perform further rate limiting, so rate limiting adjustment instructions can be issued to each client separately.
[0055] Specifically, the aforementioned rate limiting adjustment instruction may include the difference between the overall rate limiting target and the aforementioned system rate limiting parameters. Upon receiving the instruction, any client can further reduce the single-machine rate limiting target specified in the target rate limiting rules based on the difference carried in the instruction. That is, the rate limiting threshold or rate limiting data contained in the target rate limiting rules for any client is further reduced, causing the operating parameters of any client corresponding to the aforementioned system rate limiting parameters to decrease. This, in turn, reduces the overall system rate limiting parameters until the system rate limiting parameters no longer meet the aforementioned system rate limiting rules. At this point, it indicates that the current system rate limiting parameters have reached the overall rate limiting target, and no further rate limiting of the system is required.
[0056] In this embodiment of the invention, when there are at least two clients in the client control system, the system rate limiting parameters of the client control system are obtained based on the target rate limiting rules corresponding to each client. If the system rate limiting parameters do not meet the system rate limiting rules, a rate limiting adjustment command is sent to each client, so that each client adjusts the target rate limiting rules based on the rate limiting adjustment command and performs rate limiting operations according to the adjusted target rate limiting rules until the adjusted system rate limiting parameters meet the system rate limiting rules. The system rate limiting rules are preset for the client control system. In this embodiment of the invention, when there are at least two clients, by obtaining the system rate limiting parameters, and when the system rate limiting parameters meet the system rate limiting rules, it indicates that the current system needs further rate limiting. By having each client adjust the target rate limiting rules before performing rate limiting operations, the system rate limiting target can be transformed into a single-machine rate limiting target for each client. This satisfies the rate limiting requirements of each client and further satisfies the overall rate limiting requirements of the system, further improving the effect of cluster rate limiting.
[0057] Optionally, the rule retrieval request carries the client's identifier, and the operation of sending the preset rate limiting rule corresponding to the client to the client in step 102 above can specifically include the following steps in this embodiment of the invention:
[0058] Step 121: Based on the client's identifier, select the preset rate limiting rule that matches the identifier from all preset rate limiting rules, use it as the preset rate limiting rule corresponding to the client, and send it to the client.
[0059] The aforementioned identifiers can be pre-generated for different clients during client registration. Different clients can have different identifiers. Correspondingly, all the aforementioned preset rate limiting rules can also be distinguished by rule identifiers. Rule identifiers can be generated when different preset rate limiting rules are configured on the management side. Different rule identifiers can be used to distinguish the applicable clients.
[0060] Accordingly, the aforementioned preset rate limiting rule that matches the identifier refers to the rate limiting rule that can be applied to the client configured with the identifier. Specifically, the matching can be that the rule identifier and the client identifier are the same, or that there is a preset correspondence between the rule identifier and the client identifier. In particular, different methods can be adopted to establish a correspondence between different clients and different rate limiting rules according to actual needs. This embodiment of the invention does not limit this.
[0061] In this embodiment of the invention, the rule acquisition request carries the client's identifier. Based on the client's identifier, a preset rate limiting rule matching the identifier is selected from all preset rate limiting rules and used as the preset rate limiting rule corresponding to the client, and then sent to the client. In this way, selecting the preset rate limiting rule corresponding to the client from all preset rate limiting rules using the client's identifier improves the efficiency of acquiring the preset rate limiting rule corresponding to the client, thereby further improving the efficiency of sending rate limiting rules to the client.
[0062] Figure 2 This is a flowchart illustrating another client control method in an embodiment of the present invention. This method can be applied to the client in a client control system, such as... Figure 2 As shown, the method includes:
[0063] Step 201: Send a rule acquisition request to the management terminal in the client control system to receive the preset rate limiting rule and target rate limiting parameter corresponding to the client issued by the management terminal; the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule.
[0064] Step 202: If the client meets the preset rate limiting rule based on the target rate limiting parameter, the preset rate limiting rule is determined as the target rate limiting rule.
[0065] Step 203: Perform rate limiting operation based on the target rate limiting rule.
[0066] The aforementioned rule acquisition request can be generated and sent to the management terminal when the client has a rate limiting requirement. The rate limiting requirement can be preset, either when the client starts up and it is determined that the client needs to perform rate limiting operation, or when the client starts up for a specified time or receives a specified number of business requests and it is determined that there is a rate limiting requirement. The specific settings can be customized according to the actual situation, and this embodiment of the invention does not impose any restrictions on this.
[0067] Furthermore, if it is determined that the client has a rate limiting requirement, a rule retrieval request can be sent to the management terminal in the client control system. The rule retrieval request can carry the client's identifier, so that the management terminal can obtain the preset rate limiting rule and target rate limiting parameters corresponding to the client from all preset rate limiting rules through the identifier, and send them to the client.
[0068] The target rate limiting parameters mentioned above can be client CPU utilization or QPS values, which can be used to characterize the current processing volume of the client. It is understood that a higher CPU utilization or QPS value indicates a larger current processing volume of the client, and correspondingly, a greater client load. Furthermore, the target rate limiting parameters or preset rate limiting rules may also include rate limiting parameter thresholds. If the current processing volume of the client exceeds the aforementioned rate limiting parameter threshold, it indicates that the client load has exceeded the maximum threshold. In this case, it can be determined that the target rate limiting parameters meet the preset rate limiting rules, and rate limiting operations need to be performed. Conversely, if the current processing volume is not greater than the aforementioned rate limiting parameter threshold, it indicates that the client load has not yet reached the maximum threshold, and rate limiting operations are not required. Of course, the above description only illustrates one judgment method. Different judgment methods can be implemented according to actual needs and different rate limiting parameters and rules. This embodiment of the invention does not impose any limitations on this.
[0069] The aforementioned rate limiting parameter threshold can also be calculated using parameters carried in the target rate limiting parameter or the preset rate limiting rule. For example, taking the existence of a preset rate limiting rule based on the QPS value as an example, the target rate limiting parameter received from the management terminal can include the total QPS value of the client control system and the number of online service instances. The service instance corresponds to the client, and usually one client corresponds to one service instance. Accordingly, the number of online service instances can represent the number of clients that can be put into business services in the current system. Furthermore, in this embodiment of the invention, the rate limiting data of each client can be obtained by dividing the total QPS value by the number of online service instances, which is the aforementioned rate limiting parameter threshold. This rate limiting data can represent the maximum processing capacity per second of each client.
[0070] Furthermore, since there can be multiple preset rules corresponding to the client, this embodiment of the invention can determine the preset rate limiting rule as the target rate limiting rule to be executed by the client when there is a target rate limiting parameter that satisfies any preset rate limiting rule, and perform rate limiting operation based on the target rate limiting rule. Specifically, the above rate limiting operation can be to forward or reject service requests that exceed the client's load, which can be set according to actual needs.
[0071] Optionally, in this embodiment of the invention, a rate limiting component can be set in each client in the client control system, so that the above steps 201 to 203 can be implemented by the rate limiting component in the client.
[0072] In this embodiment of the invention, a rule acquisition request is sent to the management terminal in the client control system to receive a preset rate limiting rule and a target rate limiting parameter corresponding to the client issued by the management terminal. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. If it is determined that the client meets the preset rate limiting rule based on the target rate limiting parameter, the preset rate limiting rule is determined as the target rate limiting rule. Rate limiting operation is performed based on the target rate limiting rule. In this way, the client in this embodiment of the invention can obtain the corresponding preset rate limiting rule and target rate limiting parameter from the management terminal, and determine whether the client needs to perform rate limiting operation according to the target rate limiting parameter and the preset rate limiting rule. This allows the client to implement different rate limiting operations based on different rate limiting rules and different rate limiting parameters, thereby achieving dynamic adjustment of rate limiting.
[0073] Optionally, the operation of determining the preset rate limiting rule as the target rate limiting rule in step 202 above may specifically include the following steps in this embodiment of the invention:
[0074] Step 211: If the client meets multiple preset rate limiting rules, send a priority acquisition request to the management terminal to receive the priorities of the multiple preset rate limiting rules returned by the management terminal.
[0075] Step 212: Determine the highest priority preset rate limiting rule among the multiple preset rate limiting rules as the target rate limiting rule.
[0076] In this embodiment of the invention, since the number of preset rate limiting rules corresponding to the client returned by the management terminal can be multiple, the client can sequentially use the target rate limiting parameters corresponding to each preset rate limiting rule to determine whether the client meets each preset rate limiting rule. If the client meets at least two preset rate limiting rules, the corresponding rate limiting operation can be performed according to the priority of the satisfied preset rate limiting rules.
[0077] The priorities of different preset rate limiting rules can be pre-configured in the management terminal. Specifically, the priorities can be divided according to the execution conditions of different rules. Each execution condition corresponds to a different running scenario of the client. Scenarios that have a greater impact on the client's running performance are designated as higher priority scenarios. Correspondingly, higher priority can be configured for the rate limiting rules corresponding to these running scenarios. This can be set according to actual needs. Accordingly, this embodiment of the invention can select the highest priority from multiple preset rate limiting rules satisfied by the client as the target rate limiting rule for that client.
[0078] In this embodiment of the invention, when the client meets multiple preset rate limiting rules, a priority acquisition request is sent to the management terminal to receive the priorities of the multiple preset rate limiting rules returned by the management terminal. The preset rate limiting rule with the highest priority among the multiple preset rate limiting rules is determined as the target rate limiting rule. In this way, by setting priorities for different preset rate limiting rules, the target rate limiting rule can be selected according to priority when the client meets multiple preset rate limiting rules, thereby realizing rate limiting based on actual needs.
[0079] Optionally, the step of performing rate limiting operation based on the target rate limiting rule in step 203 above may specifically include the following steps in this embodiment of the invention:
[0080] Step 221: Upon receiving a service request from a business party, send rate limiting information to the business party until the client fails to meet the target rate limiting rule, then respond to the service request.
[0081] In this embodiment, the aforementioned service provider refers to the user who initiates a service request to the client. When the client receives any service request from any service provider, since the client meets the target rate limiting rules at this time, it needs to perform rate limiting operations. Therefore, in this embodiment of the invention, the client does not need to respond to the service request at this time and can send rate limiting information to the service provider. The aforementioned rate limiting information can be in text form, and the information content can be "The current system is busy, please re-initiate the request later". Of course, it can also be other content or other forms, and this embodiment of the invention does not limit it.
[0082] Furthermore, the target rate limiting parameters of the client can be obtained in real time. When it is determined based on the current target rate limiting parameters that the client no longer meets the above target rate limiting rules, it indicates that the current load of the client has not reached the maximum load threshold and no rate limiting is required. At this time, the above service request can be responded to.
[0083] Optionally, when a client receives a service request from a business party, it can also forward the service request to the management end, so that the management end can allocate the service request to a client that has not performed rate limiting operations to respond, based on the rate limiting status of other clients in the client control system.
[0084] Optionally, in this embodiment of the invention, upon receiving a service request, the attribute identifier of the request can be further obtained. If the attribute identifier belongs to a pre-set target identifier, the service request is responded to. Conversely, if a service request is received whose attribute identifier does not belong to the aforementioned target identifier, no response is required. The attribute identifier can represent the importance level of the request, and correspondingly, the target identifier can be a relatively important level. Therefore, in this embodiment of the invention, the client can process more important requests even when performing rate limiting operations, preventing important requests from not receiving timely responses. The importance level can be determined based on information such as the service provider, the purpose of the request, or the request time; this embodiment of the invention does not impose such limitations.
[0085] Optionally, the above rate limiting operation can also be to determine the target number based on the number of currently received business requests according to a preset ratio, and select the target number of business requests from all business requests to respond to, while other requests are not responded to. The preset ratio can be set according to actual needs.
[0086] The embodiments of the present invention only illustrate a few ways to implement rate limiting operations. Of course, other implementation methods can also be set, and the embodiments of the present invention do not limit this.
[0087] Optionally, in this embodiment of the invention, after step 221 above, the client can also re-obtain the preset rate limiting rule corresponding to the client from the management terminal according to a preset period, and redetermine the target rate limiting rule according to the current state of the client, so as to update the target rate limiting rule.
[0088] In this embodiment of the invention, upon receiving a service request from a service provider, rate limiting information is sent to the service provider until the client fails to meet the target rate limiting rule, at which point the service request is responded to. In this way, by sending rate limiting information to the service provider that initiated the service request, the service provider can be promptly informed of the client's response status to the service request while the client performs rate limiting operations.
[0089] Figure 3 This is a block diagram of a client control device according to an embodiment of the present invention, which can be set in the management terminal of the client control system, such as... Figure 3 As shown, the device 30 may include:
[0090] The registration receiving module 301 is used to receive the registration request from the client in the client control system and store the registration information of the client based on the registration request;
[0091] The rule sending module 302 is configured to, upon receiving a rule retrieval request from the client, send a preset rate limiting rule corresponding to the client, and send a target rate limiting parameter to the client based on the registration information, so that the client, upon determining that it meets the preset rate limiting rule based on the target rate limiting parameter, determines the preset rate limiting rule as the target rate limiting rule and performs rate limiting operation based on the target rate limiting rule; wherein, the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule.
[0092] Optionally, if there are at least two clients in the client control system, the device 30 further includes:
[0093] The parameter acquisition module is used to acquire the system rate limiting parameters of the client control system based on the target rate limiting rules corresponding to each client.
[0094] The instruction sending module is used to send a rate limiting adjustment instruction to each of the clients when the system rate limiting parameters meet the system rate limiting rules, so that each client adjusts the target rate limiting rules based on the rate limiting adjustment instruction and performs rate limiting operation according to the adjusted target rate limiting rules until the adjusted system rate limiting parameters no longer meet the system rate limiting rules; the system rate limiting rules are preset for the client control system.
[0095] Optionally, the rule acquisition request carries the identifier of the client, and the rule sending module 302 is specifically used to: select a preset rate limiting rule that matches the identifier from all preset rate limiting rules based on the client's identifier, use it as the preset rate limiting rule corresponding to the client, and send it to the client.
[0096] In summary, the client control device provided in this embodiment of the invention receives a registration request from a client in the client control system and stores the client's registration information based on the registration request. Upon receiving a rule retrieval request from the client, it sends a preset rate limiting rule corresponding to the client and a target rate limiting parameter to the client based on the registration information. This allows the client to determine the preset rate limiting rule as the target rate limiting rule if it determines that the client meets the preset rate limiting rule based on the target rate limiting parameter, and then performs rate limiting operations based on the target rate limiting rule. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. In this embodiment of the invention, by setting a management terminal in the client control system, registered clients in the client control system can be centrally managed. Simultaneously, by issuing rate limiting rules to clients through the management terminal, all preset rate limiting rules can be centrally managed and allocated at the management terminal. Furthermore, by sending the corresponding preset rate limiting rule to the client upon receiving a rule retrieval request, different rate limiting rules can be applied to different clients, thereby achieving rate limiting management for multiple clients.
[0097] Figure 4 This is a block diagram of another client control device in an embodiment of the present invention, which can be set in the client of the client control system, such as... Figure 4 As shown, the device 40 may include:
[0098] The request sending module 401 is used to send a rule acquisition request to the management terminal in the client control system, so as to receive the preset rate limiting rule and target rate limiting parameter corresponding to the client issued by the management terminal; the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule;
[0099] The target rule determination module 402 is used to determine the preset rate limiting rule as the target rate limiting rule when it is determined that the client meets the preset rate limiting rule based on the target rate limiting parameters;
[0100] The rate limiting module 403 is used to perform rate limiting operations based on the target rate limiting rule.
[0101] Optionally, the target rule determination module 402 includes:
[0102] The priority acquisition submodule is used to send a priority acquisition request to the management terminal when the client meets multiple preset rate limiting rules, so as to receive the priorities of multiple preset rate limiting rules returned by the management terminal;
[0103] The determination submodule is used to determine the highest priority preset rate limiting rule among the multiple preset rate limiting rules as the target rate limiting rule.
[0104] Optionally, the rate limiting module 403 is specifically used to: upon receiving a service request from a service provider, send rate limiting information to the service provider, and respond to the service request when the client does not meet the target rate limiting rule.
[0105] Figure 5 As an embodiment of the present invention, such as a client control system, Figure 5 As shown, the system 50 may include: a management terminal 501 and a client terminal 502.
[0106] The management terminal 501 is used to receive the registration request from the client and store the registration information of the client based on the registration request; when receiving the rule retrieval request from the client, it sends the client a preset rate limiting rule corresponding to the client, and sends the target rate limiting parameter to the client based on the registration information.
[0107] The client 502 is configured to send a rule acquisition request to the management terminal to receive a preset rate limiting rule and a target rate limiting parameter corresponding to the client issued by the management terminal. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. If it is determined that the client meets the preset rate limiting rule based on the target rate limiting parameter, the preset rate limiting rule is determined as the target rate limiting rule. Rate limiting operation is performed based on the target rate limiting rule.
[0108] In summary, the client control system provided in this embodiment of the invention includes a management terminal that receives a registration request from the client and stores the client's registration information based on the registration request; upon receiving a rule retrieval request from the client, sends a preset rate limiting rule corresponding to the client to the client, and sends a target rate limiting parameter to the client based on the registration information; the client sends a rule retrieval request to the management terminal to receive the preset rate limiting rule and the target rate limiting parameter corresponding to the client issued by the management terminal, wherein the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule; if it is determined that the client meets the preset rate limiting rule based on the target rate limiting parameter, the preset rate limiting rule is determined as the target rate limiting rule; and rate limiting operation is performed based on the target rate limiting rule. In this embodiment of the invention, by setting up a management terminal in the client control system, registered clients can be centrally managed. The management terminal can also issue rate limiting rules to clients, enabling centralized management and allocation of all preset rate limiting rules. Furthermore, by sending the corresponding preset rate limiting rule to a client upon receiving a rule retrieval request, different rate limiting rules can be applied to different clients, thus achieving rate limiting management for multiple clients. Simultaneously, by obtaining the corresponding preset rate limiting rules and target rate limiting parameters from the management terminal, clients can determine whether rate limiting is required based on these parameters. This allows clients to implement different rate limiting operations based on different rules and parameters, achieving dynamic rate limiting adjustment.
[0109] Figure 6 This is an interactive schematic diagram of a client control system according to an embodiment of the present invention, such as... Figure 6 As shown, the registration center and configuration center represent different modules in the management terminal, which can be used to implement different functions. A1, A2, and A3 can be used to represent different clients in the client control system, and each client has a rate limiting component set.
[0110] like Figure 6As shown, the registration center receives registration information from each client. When a client has a rate-limiting requirement, it can send target rate-limiting parameters related to that client, which may include the number of online (service) instances. The configuration center can contain pre-set rate-limiting rules and cluster QPS values, which can be used as either system rate-limiting parameters or target rate-limiting parameters. Furthermore, the rate-limiting component can obtain rate-limiting data from the received pre-set rate-limiting rules and target rate-limiting parameters. If the client's load exceeds the rate-limiting data, it determines whether the client meets or hits the pre-set rate-limiting rules. In this case, rate-limiting operations can be performed, either rejecting the business request or forwarding the business request. Conversely, if the client does not hit the pre-set rate-limiting rules, no rate-limiting operation needs to be performed, and the business request can be responded to normally.
[0111] This invention also provides an electronic device, such as... Figure 7 As shown, it includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804. The processor 801, communication interface 802, and memory 803 communicate with each other via the communication bus 804.
[0112] Memory 803 is used to store computer programs;
[0113] When processor 801 executes a program stored in memory 803, it performs the following steps:
[0114] Receive a registration request from a client in the client control system, and store the client's registration information based on the registration request;
[0115] Upon receiving a rule retrieval request from the client, a preset rate limiting rule corresponding to the client is sent to the client, and a target rate limiting parameter is sent to the client based on the registration information. This allows the client to determine the preset rate limiting rule as the target rate limiting rule if it determines that the client meets the preset rate limiting rule based on the target rate limiting parameter, and to perform rate limiting operations based on the target rate limiting rule. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule.
[0116] Alternatively, when the processor 801 executes the program stored in the memory 803, it can also perform the following steps:
[0117] A rule retrieval request is sent to the management terminal in the client control system to receive the preset rate limiting rule and target rate limiting parameter corresponding to the client issued by the management terminal; the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule.
[0118] If the client is determined to meet the preset rate limiting rule based on the target rate limiting parameters, the preset rate limiting rule is determined as the target rate limiting rule;
[0119] Rate limiting operations are performed based on the target rate limiting rules.
[0120] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0121] The communication interface is used for communication between the aforementioned terminal and other devices.
[0122] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0123] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0124] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the client control methods described in the above embodiments.
[0125] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the client control methods described in the above embodiments.
[0126] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0127] It should be noted that, in this document, relational terms such as "first" and "first" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0128] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0129] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A client-side control method, applied to the management terminal of a client-side control system, characterized in that, The method includes: Receive a registration request from a client in the client control system, and store the client's registration information based on the registration request; Upon receiving a rule retrieval request from the client, a preset rate limiting rule corresponding to the client is sent to the client, and a target rate limiting parameter is sent to the client based on the registration information. This allows the client to determine the preset rate limiting rule as the target rate limiting rule if it meets the requirements based on the target rate limiting parameter, and to perform rate limiting operations based on the target rate limiting rule. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. The client's rule retrieval request is initiated when the client has a rate limiting requirement. The rate limiting operation involves forwarding service requests exceeding the client's load capacity, or rejecting service requests exceeding the client's load capacity.
2. The method according to claim 1, characterized in that, When there are at least two clients in the client control system, the method further includes: Based on the target rate limiting rules corresponding to each client, the system rate limiting parameters of the client control system are obtained; If the system rate limiting parameters meet the system rate limiting rules, a rate limiting adjustment instruction is sent to each client so that each client adjusts the target rate limiting rules based on the rate limiting adjustment instruction and performs rate limiting operations according to the adjusted target rate limiting rules until the adjusted system rate limiting parameters no longer meet the system rate limiting rules; the system rate limiting rules are preset for the client control system.
3. The method according to claim 2, characterized in that, The rule retrieval request carries the client's identifier, and sending the preset rate limiting rule corresponding to the client to the client includes: Based on the client's identifier, a preset rate limiting rule that matches the identifier is selected from all preset rate limiting rules and used as the preset rate limiting rule corresponding to the client, and then sent to the client.
4. A client-side control method, applied to a client in a client-side control system, characterized in that, The method includes: A rule retrieval request is sent to the management terminal in the client control system to receive the preset rate limiting rule and target rate limiting parameter corresponding to the client issued by the management terminal; the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. If the client is determined to meet the preset rate limiting rule based on the target rate limiting parameters, the preset rate limiting rule is determined as the target rate limiting rule; Perform rate limiting operations based on the target rate limiting rules; The rule retrieval request is initiated when the client has a rate limiting requirement; the rate limiting operation is to forward service requests that exceed the client's load, or to refuse to respond to service requests that exceed the client's load.
5. The method according to claim 4, characterized in that, The step of determining the preset rate limiting rule as the target rate limiting rule includes: If the client meets multiple preset rate limiting rules, it sends a priority acquisition request to the management terminal to receive the priorities of the multiple preset rate limiting rules returned by the management terminal. The preset rate limiting rule with the highest priority among the multiple preset rate limiting rules is determined as the target rate limiting rule.
6. The method according to claim 4, characterized in that, The process of performing rate limiting based on the target rate limiting rule includes: Upon receiving a service request from a business party, a rate limiting message is sent to the business party until the client fails to meet the target rate limiting rule, at which point the service request is responded to.
7. A client control device, installed at the management terminal of a client control system, characterized in that, The device includes: The registration receiving module is used to receive the registration request from the client in the client control system and store the registration information of the client based on the registration request; The rule sending module is configured to, upon receiving a rule retrieval request from the client, send a preset rate limiting rule corresponding to the client, and send a target rate limiting parameter to the client based on the registration information. This allows the client to determine the preset rate limiting rule as the target rate limiting rule if it meets the preset rate limiting rule based on the target rate limiting parameter, and to perform rate limiting operations based on the target rate limiting rule. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. The rule retrieval request is initiated when the client has a rate limiting requirement. The rate limiting operation involves forwarding service requests exceeding the client's load capacity, or rejecting service requests exceeding the client's load capacity.
8. A client control device, installed in a client control system, characterized in that, The device includes: The request sending module is used to send a rule acquisition request to the management terminal in the client control system, so as to receive the preset rate limiting rule and target rate limiting parameter corresponding to the client issued by the management terminal; the target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule; The target rule determination module is used to determine the preset rate limiting rule as the target rate limiting rule when it is determined that the client meets the preset rate limiting rule based on the target rate limiting parameters. The rate limiting module is used to perform rate limiting operations based on the target rate limiting rule; The rule retrieval request is initiated when the client has a rate limiting requirement; the rate limiting operation is to forward service requests that exceed the client's load, or to refuse to respond to service requests that exceed the client's load.
9. A client-side control system, characterized in that, The client control system includes a management terminal and a client; The management terminal is used to receive the registration request from the client and store the client's registration information based on the registration request; Upon receiving a rule retrieval request from the client, a preset rate limiting rule corresponding to the client is sent to the client, and a target rate limiting parameter is sent to the client based on the registration information; The client is configured to send a rule retrieval request to the management terminal to receive a preset rate limiting rule and a target rate limiting parameter corresponding to the client issued by the management terminal. The target rate limiting parameter is the rate limiting parameter corresponding to the client and the preset rate limiting rule. If the client meets the preset rate limiting rule based on the target rate limiting parameter, the preset rate limiting rule is determined as the target rate limiting rule. Rate limiting operation is performed based on the target rate limiting rule. The rule retrieval request is initiated when the client has a rate limiting requirement. The rate limiting operation is to forward service requests that exceed the client's load or to refuse to respond to service requests that exceed the client's load.
10. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method of any one of claims 1-6.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.
Citation Information
Patent Citations
System and equipment for distributed flow management
CN113411208A
Request processing method and device, computer equipment, storage medium and program product
CN115190177A
Cluster current limiting method and device, equipment and medium
CN115242718A