Current limiting method and device

By receiving the current limiting status data reported by the gateway, dynamically adjusting the current limiting parameters of the client, solving the high failure rate caused by the current limit of the back-end gateway in the prior art, and achieving more efficient current limiting management and service quality improvement.

CN119996323APending Publication Date: 2025-05-13SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510192174.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-20
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the existing network traffic management, the backend gateway current limit leads to a high failure rate of client requests, especially in modern artificial intelligence applications, where a simple flow limiting method affects service quality.

Method used

By receiving the current limiting state data reported by the gateway, a new current limiting parameter is determined based on the current limiting state data, including the allowed semaphore, and in response to the client's timing read request, the new current limiting parameter is returned to the client, so that it can limit the current according to the new parameters.

Benefits of technology

It realizes dynamic configuration management of current limit parameters, improves the success rate of client requests, supports differentiated current limiting strategies, optimizes high-frequency request processing, and improves the service quality of artificial intelligence services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119996323A_ABST
    Figure CN119996323A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a flow limiting method, which is applied to a configuration server, and comprises the following steps: receiving flow limiting state data reported by a gateway; determining a new current limiting parameter based on the current limiting state data, wherein the current limiting parameter at least comprises an allowed semaphore; and in response to a request of reading the current limiting parameter regularly by the client, returning the new current limiting parameter to the client, so that the client carries out current limiting according to the new current limiting parameter. According to the technical scheme provided by the embodiment of the invention, the flow limiting parameters can be uniformly issued through the configuration server, and active flow limiting of the client is realized based on a semaphore mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of network technology, and in particular, to a current limiting method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] In existing network traffic management, backend gateways usually limit requests to prevent server overload. However, when the backend gateway triggers the limit, the client's request may be rejected, resulting in a lower success rate for business requests. Especially in modern artificial intelligence applications, client requests are characterized by high frequency and high number of requests. Simply limiting the flow through the backend gateway will seriously affect the service quality.

[0003] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention

[0004] The embodiments of the present application provide a current limiting method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.

[0005] One aspect of an embodiment of the present application provides a current limiting method, which is applied to a configuration server, and the method includes: Receive the current limiting status data reported by the gateway; Determine new current limiting parameters based on the current limiting state data, wherein the current limiting parameters at least include an allowed signal amount; In response to a request from the client to periodically read the current limiting parameters, the new current limiting parameters are returned to the client, so that the client performs current limiting according to the new current limiting parameters.

[0006] Optionally, in a case where the current limiting state data corresponds to a state in which the server load increases, reducing the allowed signal amount based on the current limiting state data; When the current limiting status data corresponds to a state in which the server load is reduced, the allowed signal quantity is increased based on the current limiting status data.

[0007] Optionally, the determining a new current limiting parameter based on the current limiting state data further includes: Determine the current service type; A new current limiting parameter is determined based on the service type and the current limiting status data.

[0008] Another aspect of the embodiments of the present application provides a current limiting device, the device comprising: A receiving module is used to receive the current limiting status data reported by the gateway; A determination module, configured to determine new current limiting parameters based on the current limiting state data, wherein the current limiting parameters at least include an allowed signal amount; The returning module is used to respond to the client's request to read the current limiting parameters regularly and return the new current limiting parameters to the client, so that the client performs current limiting according to the new current limiting parameters.

[0009] Another aspect of an embodiment of the present application provides a current limiting method, which is applied to a client, and the method includes: Obtaining a current limiting parameter from a configuration server at a regular interval, wherein the current limiting parameter at least includes an allowed signal amount; Counting the remaining semaphores according to the client's request for resources, the release of resources, and the allowed semaphores; When the remaining semaphore is greater than zero, the current request of the client is allowed.

[0010] Optionally, the method further comprises: When the remaining semaphore is equal to zero, blocking the current request of the client and placing the current request in a waiting queue; When the remaining semaphore is greater than zero, the request is taken out from the waiting queue and continues to be executed until the remaining semaphore is equal to zero or all the requests in the waiting queue are executed.

[0011] Optionally, the counting of the remaining semaphores according to the client's request, release, and the allowed semaphores includes: Using the allowed semaphore as the initial remaining semaphore; When the client requests once, the remaining semaphore is reduced by 1; When the client releases once, the remaining semaphore is increased by 1.

[0012] Another aspect of the embodiments of the present application provides a current limiting device, the device comprising: A timing module, used for obtaining a current limiting parameter from a configuration server at a regular interval, wherein the current limiting parameter at least includes an allowed signal amount; A statistics module, used for counting the remaining semaphores according to the client's request for resources, the release of resources and the allowed semaphores; The processing module is used to allow the current request of the client when the remaining semaphore is greater than zero.

[0013] Another aspect of an embodiment of the present application provides a computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein: the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described above.

[0014] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.

[0015] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.

[0016] The above technical solution adopted in the embodiment of the present application may have the following advantages: By receiving the current limiting status data reported by the gateway, new current limiting parameters are determined based on the current limiting status data, and the current limiting parameters at least include the allowed signal quantity. In response to the client's request to read the current limiting parameters at a regular interval, the new current limiting parameters are returned to the client, so that the client can limit the current according to the new current limiting parameters. The current limiting parameters can be uniformly sent down by the configuration server to achieve unified management of current limiting. At the same time, by determining the current limiting parameters according to the current limiting status data reported by the gateway, dynamic configuration management of current limiting can be achieved. In addition, the client can actively limit the current on the client side according to the allowed signal quantity, thereby improving the success rate of client requests. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0018] Figure 1 The operating environment diagram of the current limiting method according to the first embodiment of the present application is schematically shown; Figure 2 The flowchart of the current limiting method according to the first embodiment of the present application is schematically shown; Figure 3 Schematically shows Figure 2 Flow chart of sub-steps of step S202; Figure 4 Schematically shows Figure 2 Another sub-step flow chart of step S202; Figure 5The schematic diagram shows an example of the principle of the current limiting method according to the first embodiment of the present application; Figure 6 A block diagram of a current limiting device according to Embodiment 2 of the present application is schematically shown; Figure 7 The flowchart of the current limiting method according to the third embodiment of the present application is schematically shown; Figure 8 Schematically shows Figure 7 Flow chart of sub-steps of step S602; Fig. 9 The newly added process of the current limiting method according to the third embodiment of the present application is schematically shown; Fig.10 A schematic diagram shows an example of the principle of the client performing current limiting according to the signal quantity in the current limiting method according to the third embodiment of the present application; Fig.11 A block diagram of a current limiting device according to the second embodiment of the present application is schematically shown; and Fig.12 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0020] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0021] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.

[0022] First, the following terms are explained: Semaphore: is a synchronization mechanism used to control access to shared resources. It is essentially a counter used to coordinate access to shared data by multiple processes or threads.

[0023] Digital human: a digital human image close to human image created using digital technology.

[0024] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below: In the existing network traffic management, the backend gateway will limit the flow when there is too much traffic to prevent the server from overloading. However, when the backend gateway limits the flow, the client will continue to make requests according to its own needs because it is not aware that the backend gateway has limited the flow. At this time, the client's requests that exceed the flow limit will be rejected, resulting in a lower success rate for business requests. For example, if the number of requests limited to the client is 10, all requests from the client that exceed 10 will be directly rejected and fail. Especially in modern artificial intelligence applications, such as digital humans and voice cloning, the client's requests are characterized by a large number of times and high frequency. Simply limiting the flow through the backend gateway will seriously affect the quality of service.

[0025] In summary, the applicant understands that the current current limiting method still has the following defects: 1. The client lacks an active current limiting mechanism and completely relies on the backend gateway for current limiting, resulting in a high failure rate of requests; 2. Unable to dynamically adjust the requested traffic according to the server load; 3. Lack of unified current limiting configuration management makes it difficult to perform refined control based on the characteristics of different AI services; 4. Insufficient support for high-frequency request scenarios, which seriously affects the service quality of high-frequency request scenarios.

[0026] To this end, the embodiment of the present application provides a current limiting technical solution. In this technical solution: 1. The semaphore mechanism is used to implement active client current limiting to improve the success rate of requests; 2. The current limiting parameters are uniformly issued by the configuration server, and dynamic configuration management of current limiting is implemented; 3. In combination with the characteristics of artificial intelligence services, differentiated current limiting strategies are supported to improve service quality; 4. The processing mechanism of high-frequency requests is optimized to ensure the service quality of artificial intelligence services. See below for details.

[0027] Finally, for ease of understanding, an exemplary operating environment is provided below.

[0028] like Figure 1 As shown, the environment diagram includes a service platform 2, a network 4, and a client 6, wherein: The service platform 2 may include a gateway and a configuration server, and may be specifically composed of a single or multiple computing devices. The multiple computing devices may include virtualized computing instances. Virtualized computing instances may include virtual machines, such as simulations of computer systems, operating systems, servers, etc. The computing device may load the virtual machine based on a virtual image and / or other data defining specific software (e.g., operating system, dedicated application, server) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing devices. A hypervisor may be implemented to manage the use of different virtual machines on the same computing device.

[0029] The service platform 2 may be configured to communicate with the client 6 or the like via a network 4. The network 4 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network 4 may include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof, and the like, or wireless links, such as cellular links, satellite links, Wi-Fi links, and the like.

[0030] Service platform 2 can provide storage, reading, writing, querying, deleting and other services, such as providing artificial intelligence services to clients.

[0031] The client 6 may be an electronic device running an operating system such as Windows, Android™ or iOS, such as a smart phone, a tablet device, a laptop computer, a virtual reality device, a gaming device, a set-top box, a vehicle terminal, or a smart TV. Based on the above operating system, various applications may be run, such as an application running an artificial intelligence service.

[0032] The client 6 may provide / configure a user access page for manipulating the service platform 2 or uploading an object, etc.

[0033] It should be noted that the above devices are exemplary, and the number and type of devices are adjustable in different scenarios or according to different needs.

[0034] The technical solutions of the present application are described below through multiple embodiments. It should be noted that these embodiments can be implemented in a variety of different forms and should not be construed as being limited to the embodiments described here.

[0035] Embodiment 1 Figure 2 The flowchart of the current limiting method according to the first embodiment of the present application is schematically shown. It should be noted that the current limiting method of the embodiment of the present application is applied to the configuration server, that is, the execution subject of the current limiting method of the embodiment of the present application can be the configuration server in the service platform.

[0036] like Figure 2 As shown, the current limiting method may include steps S200 to S204, wherein: Step S200, receiving the current limiting status data reported by the gateway.

[0037] Step S202: determining new current limiting parameters based on the current limiting state data, where the current limiting parameters at least include the allowed signal quantity.

[0038] Step S204, in response to the client's request to periodically read the current limiting parameters, the new current limiting parameters are returned to the client, so that the client performs current limiting according to the new current limiting parameters.

[0039] The current limiting method provided in this embodiment receives the current limiting status data reported by the gateway, determines new current limiting parameters based on the current limiting status data, and the current limiting parameters at least include the allowed signal quantity. In response to the client's request to read the current limiting parameters at a regular interval, the new current limiting parameters are returned to the client, so that the client performs current limiting according to the new current limiting parameters. The current limiting parameters can be uniformly sent down by the configuration server to achieve unified management of current limiting. At the same time, by determining the current limiting parameters according to the current limiting status data reported by the gateway, dynamic configuration management of current limiting can be achieved. In addition, the client can implement active current limiting at the client according to the allowed signal quantity, thereby improving the success rate of client requests.

[0040] The following combination Figure 2 , each step in steps S200~S204 and other optional steps are explained in detail.

[0041] Step S200 , receive the current limiting status data reported by the gateway.

[0042] The current limiting status data can represent status data related to the server load, such as the status of load increase or decrease, which can specifically include CPU load, memory load, disk load and network load, and the status data can be the status data of CPU, memory, disk and network, etc. Specifically, the gateway can be pre-configured to report the current limiting status data when the load meets certain conditions. Among them, the load condition can be that the load increases to a certain set value or the increase ratio exceeds a certain threshold, or the load decreases to a certain set value or the decrease ratio exceeds a certain threshold. For example, the gateway can be pre-configured to report the current limiting status data when the network load increases to 1000, then when the network load increases to 1000, the gateway reports the current limiting status data, wherein the current limiting status data may include status data related to indicating that the current network load has increased to 1000.

[0043] Step S202 , based on the current limiting state data, new current limiting parameters are determined, and the current limiting parameters at least include the allowed signal quantity.

[0044] Among them, the allowed semaphore can refer to the maximum number of requests that the client is allowed to process simultaneously; in addition to the allowed semaphore, the current limiting parameters can also include parameters such as the maximum number of requests in the time window, the request rate, and the priority strategy, which can be configured according to actual needs.

[0045] Specifically, when the current limiting status data indicates that the server load has increased, when determining new current limiting parameters based on the current limiting status data, the new current limiting parameters may be relatively tight current limiting parameters, thereby preventing the server from being overloaded; when the current limiting status data indicates that the server load has decreased, when determining new current limiting parameters based on the current limiting status data, the new current limiting parameters may be relatively loose current limiting parameters, thereby being able to meet more requests from the client.

[0046] In an optional embodiment, if Figure 3 As shown, step S202 may further include: Step S300: When the current limiting state data corresponds to a state in which the server load increases, the allowed signal quantity is reduced based on the current limiting state data.

[0047] Step S302: when the current limiting state data corresponds to a state in which the server load is reduced, the allowed signal quantity is increased based on the current limiting state data.

[0048] The amount of allowed signals can be reduced or increased based on the current limiting status data, and can be reduced or increased according to a preset ratio or a predetermined value. For example, when reducing the amount of allowed signals, it can be reduced by half the ratio, and when increasing the amount of allowed signals, it can be increased by doubling the ratio. Optionally, the amount of allowed signals can also be reduced or increased according to the current limiting status data, that is, the amount of reduction or increase is related to the current limiting status data. For example, when the current limiting status data indicates that the increase in the server load is more serious, the amount of allowed signals is reduced by a larger ratio or a larger value; when the current limiting status data indicates that the increase in the server load is still within the controllable range, the amount of allowed signals is reduced by a smaller ratio or a smaller value.

[0049] In this embodiment, when the current limiting status data corresponds to a state in which the server load increases, the amount of allowed signals is reduced based on the current limiting status data; when the current limiting status data corresponds to a state in which the server load decreases, the amount of allowed signals is increased based on the current limiting status data. The current limiting parameters can be dynamically adjusted according to the server load, so that the current limiting parameters of the client are adapted to the server load, thereby realizing dynamic configuration management of the current limiting.

[0050] In an optional embodiment, if Figure 4 As shown, step S202 may further include: Step S400, determining the current service type.

[0051] Step S402: Determine new current limiting parameters based on the service type and current limiting status data.

[0052] Specifically, the configuration server can determine the current service type based on the relevant information of the current request, for example, the current service type can be determined based on the request header of the current request. The service type may include general services and artificial intelligence services, wherein the general services and artificial intelligence services may be further subdivided, for example, artificial intelligence services may be further subdivided into artificial intelligence services such as digital humans and voice cloning. The configuration server may pre-set rules or policies on how to determine new current limiting parameters based on the service type and current limiting status data, and after determining the service type, adopt corresponding rules or policies to determine new current limiting parameters based on the service type and current limiting status data. For example, the rules or policies may be that when the current limiting status data is the same, the current limiting parameters corresponding to the artificial intelligence service are relatively tight, and the current limiting parameters corresponding to the general service are relatively loose. Optionally, the configuration platform may also pre-train a machine learning model that can automatically determine new current limiting parameters based on different service types and different current limiting status data to further improve the intelligence of current limiting parameter determination.

[0053] In this embodiment, by determining the current service type and determining new current limiting parameters based on the service type and current limiting status data, different current limiting parameters can be calculated according to different service types, thereby supporting differentiated current limiting strategies, making the current limiting parameters meet the needs of different service types, and improving service quality.

[0054] Step S204 In response to the client's request to read the current limiting parameters at a regular interval, the new current limiting parameters are returned to the client so that the client performs current limiting according to the new current limiting parameters.

[0055] Specifically, the client can send a request to read the current limiting parameters to the configuration server according to a pre-configured timing; when the configuration server receives the request from the client to read the current limiting parameters, it returns the new current limiting parameters to the client, so that the client performs corresponding current limiting according to the new current limiting parameters.

[0056] Please refer to Figure 5 , which is a principle example diagram of the current limiting method of the embodiment of the present application. As shown in the figure, it can be divided into an initialization phase and a request processing phase: 1. Initialization phase: 1. The client pulls the initial current limiting configuration from the configuration server; 2. Configure the server to return the current limiting parameters to the client, where the number of semaphores allowed for the client is 10.

[0057] 2. Request processing stage: 1. The client makes a resource request, and the number of semaphores allowed to the client changes to 9 due to the request; 2. In the case of a normal response, the gateway returns a success result, and the client releases the semaphore. At this time, the semaphore allowed by the client returns to 10; 3. When current limiting is triggered, the gateway reports the current limiting status data to the configuration server, and the configuration server calculates new current limiting parameters based on the current limiting status data reported by the gateway; 4. The client periodically pulls the configured current limiting parameters from the configuration server, and the configuration returns the new current limiting parameters. At this time, the semaphore allowed for the client is 5, so the semaphore is updated to 5, and the client's request current limiting is performed based on the semaphore of 5.

[0058] In this example, the server can be configured to uniformly send down the current limiting parameters to achieve unified configuration management of current limiting; the gateway reports the current limiting status, and the configuration server calculates new current limiting parameters according to the current limiting status reported by the gateway, and dynamic configuration management of current limiting can be performed according to the current limiting status reported by the gateway.

[0059] Embodiment 2 Figure 6 The block diagram of the current limiting device according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Figure 6 As shown, the apparatus 500 may include: a receiving module 510, a determining module 520 and a returning module 530, wherein: The receiving module 510 is used to receive the current limiting status data reported by the gateway; A determination module 520, configured to determine new current limiting parameters based on the current limiting state data, wherein the current limiting parameters at least include an allowed signal amount; The returning module 530 is used to return the new current limiting parameters to the client in response to the client's request to read the current limiting parameters regularly, so that the client performs current limiting according to the new current limiting parameters.

[0060] In an optional embodiment, the determination module 520 is further configured to: In a case where the current limiting state data corresponds to a state where the server load increases, reducing the allowed signal amount based on the current limiting state data; When the current limiting status data corresponds to a state in which the server load is reduced, the allowed signal quantity is increased based on the current limiting status data.

[0061] In an optional embodiment, the determination module 520 is further configured to: Determine the current service type; A new current limiting parameter is determined based on the service type and the current limiting status data.

[0062] Embodiment 3 Figure 7 The flowchart of the current limiting method according to the third embodiment of the present application is schematically shown. It should be noted that the current limiting method of the embodiment of the present application is applied to the client, that is, the execution subject of the current limiting method of the embodiment of the present application can be the client.

[0063] like Figure 7 As shown, the current limiting method may include steps S600 to S604: Step S600: obtaining the current limiting parameters from the configuration server at a regular interval, where the current limiting parameters at least include the allowed signal quantity.

[0064] The allowed semaphore may refer to the maximum number of requests that the client is allowed to process simultaneously; in addition to the allowed semaphore, the current limiting parameters may also include parameters such as the maximum number of requests within the time window, the request rate, and the priority strategy.

[0065] When the client is initialized, it can pull the initial current limiting parameters from the configuration server. Then, it obtains the current limiting parameters from the configuration server according to the pre-configured timing. For example, it obtains the current limiting parameters from the configuration server every 5 minutes.

[0066] Step S602: Count the remaining semaphores based on the client's request for resources, the release of resources, and the allowed semaphores.

[0067] The remaining semaphore may refer to the semaphore currently allowed to remain for the client.

[0068] Specifically, the client can set the initial remaining semaphore according to the allowed semaphores. When the client requests resources, the client subtracts the corresponding number of resource requests from the current remaining semaphore; when the client releases resources, the client adds the corresponding number of released resources to the current remaining semaphore.

[0069] In an optional embodiment, if Figure 8 As shown, step S602 may further include: Step S700: taking the allowed semaphore as the initial remaining semaphore.

[0070] Step S702: when the client requests once, the remaining semaphore is reduced by 1.

[0071] Step S704: when the client releases once, the remaining semaphore is increased by 1.

[0072] For example, if the client is allowed 10 semaphores, the initial remaining semaphore can be considered to be 10. When the client requests once, the remaining semaphore is subtracted by 1, and the remaining semaphore is 9; when the client releases the resource, the remaining semaphore is increased by 1, and the remaining semaphore is 10.

[0073] In this embodiment, by taking the allowed semaphore as the initial remaining semaphore, when the client requests once, the remaining semaphore is subtracted by 1, and when the client releases once, the remaining semaphore is added by 1, so that the client can effectively implement active current limiting based on the semaphore.

[0074] Step S604: When the remaining semaphore is greater than zero, the current request of the client is allowed.

[0075] Specifically, when sending a request, the client can judge the remaining semaphore, and if the remaining semaphore is greater than zero, the current request of the client is allowed. If the remaining semaphore is equal to zero, the current request of the client is blocked.

[0076] The current limiting method provided in the embodiment of the present application obtains the current limiting parameters from the configuration server at a regular interval, and the current limiting parameters include at least the allowed semaphores. The remaining semaphores are counted according to the client's request for resources, the release of resources and the allowed semaphores. When the remaining semaphores are greater than zero, the client's current request is allowed. Active current limiting can be implemented on the client side to avoid failure due to directly sending the request to the server, thereby improving the success rate of the request.

[0077] In an optional embodiment, if Fig. 9 As shown, the current limiting method in the embodiment of the present application may also include: Step S800: When the remaining semaphore is equal to zero, the current request of the client is blocked and the current request is put into a waiting queue.

[0078] Step S802: When the remaining semaphore is greater than zero, the request is taken out from the waiting queue and the execution continues until the remaining semaphore is equal to zero or all the requests in the waiting queue are executed.

[0079] Specifically, when sending a request, the client judges the remaining semaphore. If the remaining semaphore is zero, the current request of the client is blocked and the current request is placed in a waiting queue. As the client releases resources and the remaining semaphore becomes greater than zero again, the request is taken out of the waiting queue and continues to be executed. After executing a request in the waiting queue, the remaining semaphore is reduced by 1 until the remaining semaphore is equal to zero again or all requests in the waiting queue are executed. When the remaining semaphore is equal to zero again, the client is waited for to release the resources, and when the remaining semaphore is greater than zero again, the request is taken out of the waiting queue and continues to be executed.

[0080] Please refer to Fig.10 , which is an example diagram of the principle of client current limiting based on semaphore. As shown in the figure, when the client sends a request, the remaining semaphore is first confirmed. If the remaining semaphore is greater than 0, the client is allowed to access the resource; when the client releases the resource, the remaining semaphore is increased by 1; if the remaining semaphore is equal to 0, the client is blocked from accessing the resource and waits until the resource is available.

[0081] In this embodiment, by blocking the current request of the client when the remaining semaphore is equal to zero, the current request is placed in a waiting queue, and when the remaining semaphore is greater than zero, the request is taken out of the waiting queue and continued to be executed until the remaining semaphore is equal to zero or all requests in the waiting queue are executed. This can achieve client-side current limiting while ensuring that requests that exceed the current limiting part will not be sent directly to the server and fail, thereby improving the success rate of the requests.

[0082] Embodiment 4 Fig.11 The block diagram of the current limiting device according to the fourth embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig.11 As shown, the device 900 may include: a timing module 910, a statistics module 920 and a processing module 930, wherein: A timing module 910 is used to obtain a current limiting parameter from a configuration server at a regular interval, wherein the current limiting parameter at least includes an allowed signal amount; A statistics module 920, configured to count the remaining semaphores according to the client's request for resources, the release of resources, and the allowed semaphores; The processing module 930 is used to allow the current request of the client when the remaining semaphore is greater than zero.

[0083] In an optional embodiment, the device 900 is further used for: When the remaining semaphore is equal to zero, blocking the current request of the client and placing the current request in a waiting queue; When the remaining semaphore is greater than zero, the request is taken out from the waiting queue and continues to be executed until the remaining semaphore is equal to zero or all the requests in the waiting queue are executed.

[0084] In an optional embodiment, the statistics module 920 is further configured to: Using the allowed semaphore as the initial remaining semaphore; When the client requests once, the remaining semaphore is reduced by 1; When the client releases once, the remaining semaphore is increased by 1.

[0085] Embodiment 5 Fig.12 The hardware architecture diagram of a computer device 10000 suitable for implementing the current limiting method according to the fifth embodiment of the present application is schematically shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.12 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them: The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computer device 10000, such as a hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 can also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as the program code of the current limiting method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.

[0086] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.

[0087] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0088] It should be pointed out that Fig.12 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0089] In this embodiment, the current limiting method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.

[0090] Embodiment 6 An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the current limiting method in the embodiment are implemented.

[0091] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Of course, the computer-readable storage medium may also include both an internal storage unit of a computer device and an external storage device thereof. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on a computer device, such as the program code of the current limiting method in the embodiment, etc. In addition, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.

[0092] Embodiment 7 An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.

[0093] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0094] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A current limiting method, characterized in that: Applied to configuring a server, the method comprises: Receive the current limiting status data reported by the gateway; Determine new current limiting parameters based on the current limiting state data, wherein the current limiting parameters at least include an allowed signal amount; In response to a request from the client to periodically read the current limiting parameters, the new current limiting parameters are returned to the client, so that the client performs current limiting according to the new current limiting parameters.

2. The method according to claim 1, characterized in that The determining of a new current limiting parameter based on the current limiting state data comprises: In a case where the current limiting state data corresponds to a state where the server load increases, reducing the allowed signal amount based on the current limiting state data; When the current limiting status data corresponds to a state in which the server load is reduced, the allowed signal quantity is increased based on the current limiting status data.

3. The method according to claim 2, characterized in that The determining of a new current limiting parameter based on the current limiting state data further includes: Determine the current service type; A new current limiting parameter is determined based on the service type and the current limiting status data.

4. A current limiting device, characterized in that: The device comprises: A receiving module is used to receive the current limiting status data reported by the gateway; A determination module, configured to determine new current limiting parameters based on the current limiting state data, wherein the current limiting parameters at least include an allowed signal amount; The returning module is used to respond to a request from the client to periodically read the current limiting parameters and return the new current limiting parameters to the client, so that the client performs current limiting according to the new current limiting parameters.

5. A current limiting method, characterized in that: Applied to a client, the method comprises: Obtaining a current limiting parameter from a configuration server at a regular interval, wherein the current limiting parameter at least includes an allowed signal amount; Counting the remaining semaphores according to the client's request for resources, the release of resources, and the allowed semaphores; When the remaining semaphore is greater than zero, the current request of the client is allowed.

6. The method according to claim 5, characterized in that The method further comprises: When the remaining semaphore is equal to zero, blocking the current request of the client and placing the current request in a waiting queue; When the remaining semaphore is greater than zero, the request is taken out from the waiting queue and continues to be executed until the remaining semaphore is equal to zero or all the requests in the waiting queue are executed.

7. The method according to claim 5, characterized in that The counting of the remaining semaphores according to the client's request, release and the allowed semaphores includes: Using the allowed semaphore as the initial remaining semaphore; When the client requests once, the remaining semaphore is reduced by 1; When the client releases once, the remaining semaphore is increased by 1.

8. A current limiting device, characterized in that: The device comprises: A timing module, used for obtaining a current limiting parameter from a configuration server at a regular interval, wherein the current limiting parameter at least includes an allowed signal amount; A statistics module, used for counting the remaining semaphores according to the client's request for resources, the release of resources and the allowed semaphores; The processing module is used to allow the current request of the client when the remaining semaphore is greater than zero.

9. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 3 or claims 5 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 3 or claims 5 to 7 is implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 3 or claims 5 to 7 are implemented.