Access current limiting method, device, equipment, storage medium and computer program product

文档序号:1908209 发布日期:2021-11-30 浏览:16次 中文

阅读说明:本技术 访问限流方法、装置、设备、存储介质及计算机程序产品 (Access current limiting method, device, equipment, storage medium and computer program product ) 是由 陈录城 官祥臻 孙来超 刘杰 杨轩 张永庆 于 2021-09-09 设计创作,主要内容包括:本申请提供一种访问限流方法、装置、设备、存储介质及计算机程序产品。该方法包括:当检测到多个终端设备向访问接口发送的访问请求的数量超过第一预设值时,针对每一终端设备,在访问接口外拦截终端设备发送的目标访问请求;判断预设时间段内接收到目标访问请求的次数;若次数大于第二预设值,则将目标访问请求发送给访问接口。本申请能够提高用户访问接口的成功率。(The application provides an access current limiting method, device, equipment, storage medium and computer program product. The method comprises the following steps: when the number of access requests sent to an access interface by a plurality of terminal equipment is detected to exceed a first preset value, a target access request sent by the terminal equipment is intercepted outside the access interface aiming at each terminal equipment; judging the times of receiving the target access request in a preset time period; and if the times are greater than a second preset value, sending the target access request to an access interface. The method and the device can improve the success rate of the user to access the interface.)

1. An access throttling method, comprising:

when the fact that the number of access requests sent to an access interface by a plurality of terminal equipment exceeds a first preset value is detected, a target access request sent by the terminal equipment is intercepted outside the access interface aiming at each terminal equipment;

judging the times of receiving the target access request in a preset time period;

and if the times are greater than a second preset value, sending the target access request to the access interface.

2. The method of claim 1, wherein the determining the number of times the target access request is received within a preset time period comprises:

judging whether the target access request is a request for accessing the access interface for the non-first time;

and if the target access request is not a request for accessing the access interface for the first time, judging the times of receiving the target access request in a preset time period.

3. The method of claim 2, further comprising:

and if the target access request is a request for accessing the access interface for the first time, sending the target access request to the access interface.

4. The method of claim 1, further comprising:

and if the times are not greater than the second preset value, prohibiting the access interface from receiving the target access request.

5. The method of any of claims 1-3, wherein after sending the target access request to the access interface, the method further comprises:

and updating the number of times the target access request is received.

6. The method according to any one of claims 1-4, wherein intercepting a target access request sent by a user outside the access interface comprises:

acquiring interface configuration information of the access interface;

judging whether the interface configuration information comprises current limiting configuration information or not;

and if the interface configuration information comprises the current limiting configuration information, intercepting the target access request outside the access interface.

7. An access throttling device comprising:

the device comprises an interception module, a target access module and a target access module, wherein the interception module is used for intercepting a target access request sent by a terminal device outside an access interface aiming at each terminal device when the number of the access requests sent by a plurality of terminal devices to the access interface is detected to exceed a first preset value;

the judging module is used for judging the times of receiving the target access request in a preset time period;

and the sending module is used for sending the target access request to the access interface when the times are greater than a second preset value.

8. A server, comprising: a memory, a processor;

the memory for storing a computer program;

the processor is used for reading the computer program stored in the memory and executing the access current limiting method of any one of the claims 1 to 6 according to the computer program in the memory.

9. A computer-readable storage medium having computer-executable instructions stored thereon, which when executed by a processor, implement the method of access throttling of any of claims 1 to 6.

10. A computer program product comprising a computer program which, when executed by a processor, carries out the method of any one of claims 1 to 6.

Technical Field

The present application relates to communications technologies, and in particular, to a method, an apparatus, a device, a storage medium, and a computer program product for limiting access current.

Background

In internet applications, a sudden traffic flood often occurs, and the processing capacity of any system has an upper limit, and when the request amount exceeds the processing capacity of the system, queuing is usually caused, so that the response time is rapidly increased. If there is no restriction on the amount of resources occupied by the service, it may also be down because of excessive system resource occupancy. In order to ensure that a system can stably operate when a sudden request is encountered, buffering, throttling, or degrading are generally adopted in the industry, where throttling is a way of performing processing such as denial of service, queuing or waiting, degrading, and the like when the request traffic exceeds the bottleneck of the system.

The current limiting components of the existing network requests are forward current limiting, that is, current limiting is started after the flow exceeds a certain amount, so that the speed of concurrent requests in a time window is limited, and a communication system is protected. However, in the above method, the user has a low success rate for accessing the interface because all requests are rate limited within the time window.

Disclosure of Invention

The application provides an access current limiting method, device, equipment, storage medium and computer program product, which can improve the success rate of a user access interface while ensuring the stable operation of a system.

In a first aspect, the present application provides an access throttling method, including:

when the number of access requests sent to an access interface by a plurality of terminal equipment is detected to exceed a first preset value, a target access request sent by the terminal equipment is intercepted outside the access interface aiming at each terminal equipment;

judging the times of receiving the target access request in a preset time period;

and if the times are greater than a second preset value, sending the target access request to an access interface.

In a possible implementation manner, the determining the number of times of receiving the target access request within a preset time period includes:

judging whether the target access request is a request for accessing the access interface for the first time or not;

and if the target access request is not a request for accessing the access interface for the first time, judging the times of receiving the target access request in a preset time period.

In one possible implementation, the method further includes:

and if the times are not greater than the second preset value, the access interface is prohibited from receiving the target access request.

In one possible implementation, after sending the target access request to the access interface, the method further includes:

the number of times the target access request is received is updated.

In one possible implementation manner, intercepting a target access request sent by a user outside an access interface includes:

acquiring interface configuration information of an access interface;

judging whether the interface configuration information comprises current limiting configuration information or not;

if the interface configuration information comprises the current limiting configuration information, intercepting a target access request outside the access interface.

In a second aspect, the present application provides an access restriction apparatus comprising:

the intercepting module is used for intercepting a target access request sent by the terminal equipment outside the access interface aiming at each terminal equipment when detecting that the number of the access requests sent by the plurality of terminal equipment to the access interface exceeds a first preset value;

the judging module is used for judging the times of receiving the target access request in a preset time period;

and the sending module is used for sending the target access request to the access interface when the times are greater than a second preset value.

In a possible implementation manner, the determining module is specifically configured to:

judging whether the target access request is a request for accessing the access interface for the first time or not;

and if the target access request is not a request for accessing the access interface for the first time, judging the times of receiving the target access request in a preset time period.

In a possible implementation manner, the sending module is further configured to:

and if the target access request is a request for accessing the access interface for the first time, sending the target access request to the access interface.

In one possible implementation, the apparatus further includes: a processing module;

and the processing module is used for forbidding the access interface to receive the target access request when the times are not more than the second preset value.

In one possible implementation, the apparatus further includes: an update module;

and the updating module is used for updating the times of receiving the target access requests.

In a possible implementation manner, the intercepting module is specifically configured to:

acquiring interface configuration information of an access interface;

judging whether the interface configuration information comprises current limiting configuration information or not;

if the interface configuration information comprises the current limiting configuration information, intercepting a target access request outside the access interface.

In a third aspect, an embodiment of the present application further provides a server, where the server may include a processor and a memory; wherein the content of the first and second substances,

a memory for storing a computer program.

And a processor configured to read the computer program stored in the memory, and execute the access throttling method in any one of the possible implementation manners of the first aspect according to the computer program in the memory.

In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when a processor executes the computer-executable instructions, the access throttling method in any one of the possible implementation manners of the first aspect is implemented.

In a fifth aspect, an embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the access throttling method according to any one of the possible implementation manners of the first aspect is implemented.

According to the access current limiting method, device, equipment, storage medium and computer program product provided by the embodiment of the application, when the number of access requests sent to the access interface by a plurality of terminal equipment is detected to exceed a first preset value, a target access request sent by the terminal equipment is intercepted outside the access interface for each terminal equipment, then the number of times of receiving the target access request in a preset time period is judged, and if the number of times is greater than a second preset value, the target access request is sent to the access interface. In the scene of concurrent access requests in a large batch, a current limiting component is arranged outside an access interface for each terminal device, a target access request sent by the terminal device is intercepted through a current limiting method, the target access request exceeds a second preset value within preset time, the fact that a user urgently needs to access the access interface is indicated, and at the moment, the current limiting component releases the access request to call the access interface. Therefore, the problem that the system starts to limit the current and rejects all access requests due to frequent sending of the access requests by individuals can be avoided, and the success rate of user access is improved on the premise that the system stably operates.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. The attached drawings are as follows:

fig. 1 is a system architecture diagram of an access throttling method according to an embodiment of the present application;

fig. 2 is a schematic flowchart of an access throttling method according to an embodiment of the present disclosure;

FIG. 3 is a diagram illustrating a process of a server intercepting a target access request outside an access interface;

fig. 4 is a schematic diagram illustrating a process of receiving an access request through a sliding window according to an embodiment of the present application;

fig. 5 is a schematic flowchart of a method for limiting current for an access interface according to an embodiment of the present disclosure;

fig. 6 is a schematic structural diagram of an access current limiting device according to an embodiment of the present disclosure;

fig. 7 is a schematic structural diagram of a server according to an embodiment of the present application.

With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.

Detailed Description

Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

In order to help those skilled in the art to better understand the technical solutions of the present application, the related matters related to the technical solutions of the present application will be described below.

Current limiting: refers to limiting the rate of data traffic. The method is a network traffic management technology of a computer network, so that part or all of data packets are delayed to be in accordance with network traffic rules required by users.

A current limiting component: refers to a component that includes some sort of current limiting method or rule that limits how often the interface accesses to relieve server stress.

The access current limiting method provided by the embodiment of the application can be applied to a scene that a high-concurrency service system needs to perform current limiting due to a large number of frequent requests. Under a high concurrency scene, the speed of the concurrent request in a time window can be limited in a current limiting mode, so that the purpose of protecting the system is achieved.

The existing current limiting methods mainly include a leaky bucket method, a token bucket method, a counter method, a sliding window method, and the like. The bucket leakage method is characterized in that the capacity of the server for processing requests is assumed to be one bucket, when a request comes, the request is firstly put into a wooden bucket, and the server is used for processing the request and taking out the request from the wooden bucket at a fixed speed to perform corresponding processing. If the barrel is full, i.e., the processing power of the server is reached, the newly arrived request is denied service. In the face of bursty traffic, the leaky bucket algorithm has a problem of a large number of request failures. The token bucket method adds tokens into the barrel at a constant rate, and when the barrel is full, tokens are not added. The service, upon receiving the request, attempts to remove a token from the barrel and, if a token is available, continues to execute subsequent business logic. If the token is not obtained, directly returning an error code or a page with an access frequency exceeding the limit, and the like, and not continuously executing subsequent business logic. The counter algorithm has the idea that the requests are counted in a fixed time window, the requests are compared with a threshold value to judge whether current limitation is needed or not, once a time critical point is reached, the counter is cleared, and the defect of time critical point exists, so that the system is broken down due to instantaneous double flow. The sliding window method divides a large time window into a plurality of small windows, slides one small window backwards in each large window, and ensures that the flow in the large window does not exceed the maximum value so as to realize current limiting.

However, in any of the above current limiting methods, current limiting is performed after the number of access requests exceeds the processing capability of the server, and in the current limiting process, the server will refuse to receive all access requests sent by all users, which results in a low success rate of accessing the service interface by the user, and poor user experience.

Taking the example that a user needs to check the logistics state information in an order list of a shopping Application (APP) in a shopping system, when the user accesses the order list of the user through a terminal device, if a logistics order number is already added to the order, but a background has not yet refreshed the logistics state of the order, the terminal device calls a third-party logistics interface to refresh the logistics state. In the process, when the access frequency of the user is too frequent, the sent access request is limited by the third-party interface, and the access requests sent by all users are denied for service in a period of time thereafter, so that the logistics states of all users cannot be inquired and refreshed, the success rate of the user accessing the service interface is low, and poor user experience is brought to the user. In view of this, embodiments of the present application provide an access throttling method, an access throttling device, an access throttling apparatus, a storage medium, and a computer program product.

In the access current limiting method provided by the embodiment of the application, when multiple users use the terminal devices and send access requests to the access interface, the access requests of each terminal device are limited. And counting the times of receiving the target access request in the sliding window within a preset time period, allowing to call an access interface when the times are more than a preset value, and otherwise executing access current limitation.

By the method, the defects of a leaky bucket and a token bucket in the prior art can be overcome, and a large number of access request impacts in a short time can be resisted. The access requests are limited by the times of the access requests in a preset time period, so that stable and efficient flow control is provided for the access requests in a network, and the success rate of a user access interface is improved.

Fig. 1 is a system architecture diagram of an access throttling method according to an embodiment of the present application, and as shown in fig. 1, the system includes a terminal device 11, a terminal device 12, a terminal device 13, and a server 15. Network 14 provides a communication link medium between terminal device 11, terminal device 12, terminal device 13, and server 15. The user may interact with the server 15 via the network 14 using the terminal device 11, the terminal device 12, the terminal device 13 to receive or send messages or the like.

Illustratively, a user can log in an application operation interface on each terminal device through the terminal device 11, the terminal device 12 or the terminal device 13 to send various instructions or information to each terminal device, and each terminal device sends an access request to the server 15 based on the instructions or information sent by the user.

If the server 15 receives the access requests sent by the terminal device 11, the terminal device 12, or the terminal device 13 simultaneously within the preset time period, and the number of the access requests exceeds a first preset value, the server 15 will intercept the access requests sent by each terminal device before the access requests are sent to the access interface. After the interception, the server 15 will determine the number of times of receiving the access request sent by each terminal device within the preset time period. If the number of times that the terminal device 11 sends the access request exceeds the second preset value, it indicates that the user corresponding to the terminal device 11 needs to access the access interface urgently, and at this time, the target access request is sent to the access interface. And the server intercepts the access requests sent by the terminal equipment of which the times of the access requests do not exceed a second preset value, so that the purpose of current limitation is achieved.

It should be understood that the number of users, terminal devices 11, terminal devices 12, terminal devices 13, networks 14 and servers 15 in the above system architecture is merely exemplary, and that a greater or lesser number is within the scope of the present application. Also, in the above system, the terminal devices 11, 12, 13 may be, for example, a personal computer, a server, a tablet, a mobile phone, a PDA, a notebook, or any other computing device with a networking function. The server 15 may be implemented by a server or a group of servers with greater processing power and greater security. And the network 14 used therebetween may include various types of wired and wireless networks such as, but not limited to: the internet, local area networks, WIFI, WLAN, cellular communication networks (GPRS, CDMA, 2G/3G/4G/5G cellular networks), satellite communication networks, and so forth.

The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.

Fig. 2 is a schematic flowchart of an access throttling method according to an embodiment of the present disclosure, where the access throttling method may be implemented by any device that executes the access throttling method, and the device may be implemented by software and/or hardware. In this embodiment, the apparatus may be integrated in the server 15 as shown in fig. 1. As shown in fig. 2, an access throttling method provided in an embodiment of the present application includes the following steps:

step 201: when the fact that the number of the access requests sent to the access interface by the plurality of terminal devices exceeds a first preset value is detected, a target access request sent by the terminal device is intercepted outside the access interface for each terminal device.

In this embodiment, in a preset time period, if a plurality of terminal devices simultaneously send access requests to the access interface, that is, if the number of the access requests sent by the plurality of terminal devices to the access interface exceeds a first preset value, in order to prevent a system from being crashed, a current limiting operation is usually required at this time. The first preset value may be set according to the number of access requests that can be processed by the server, and for a specific value of the first preset value, the embodiment of the present application is not limited herein.

For each terminal device, the server intercepts the target access request sent by the terminal device before sending the target access request to the access interface. Where interception is typically to prevent direct calls to the access interface for newly generated access requests using added current limiting methods or rules.

Specifically, when a user sends an access request to call an access interface through a terminal device, a server receives a target access request sent by the terminal device, and intercepts the target access request outside the access interface. Fig. 3 is a schematic diagram of a server intercepting a target access request outside an access interface, and as shown in fig. 3, when the server receives access requests sent by a plurality of users using terminal devices at the same time, the server creates an isolated sliding window for each terminal device with different id. Meanwhile, the access request in the sliding window passes through the current limiting component, and the current limiting component judges whether the target access request is passed through according to an internal access current limiting method and rules so as to call the access interface. The current limiting component comprises a set access current limiting method and rules.

The sliding window is that a period of time window is divided into a plurality of small lattices with equal time intervals, a counter is maintained in each small lattice, and one small lattice is moved backwards every other small lattice time.

The isolated sliding window means that each terminal device with different ids contains mutually independent sliding windows, namely, the sliding windows of other id terminal devices are prevented from being completely consumed to occupy the sliding window of the id terminal device. Each sliding window stores access requests received by the server from the terminal device, and the number of access requests that can be accepted by the sliding window is constant, for example, a time window is 60 s.

The access request received by the server is stored in the sliding window shown in fig. 3. In order to provide a thorough understanding of the process of receiving an access request by a sliding window, the process of receiving an access request by a sliding window shown in fig. 3 will be described with reference to the embodiment shown in fig. 4.

In some embodiments of the present application, a time window is set, and generally, the time window is divided into time periods with equal time intervals, and the length of the sliding window is the same as the length of the time window, and in the time window, the number of times of the access request of the access interface cannot exceed the threshold of the server processing request. For example, in the process 40 for receiving an access request by a sliding window in fig. 4, a dashed box 401 represents a sliding window, a solid box 402 represents a small time unit, a small time unit 403 filled with oblique lines represents that an access request is received in the time unit, and an arrow 404 represents the moving direction of the sliding window. The time window is divided into a plurality of equally spaced small time units, the length of one small time unit is N, and the sliding window moves forwards one small time unit every other small time unit N. Meanwhile, the number of processing requests in a sliding window is constant, and access requests of which the number is more than that of processing access requests in a sliding window can be subjected to access flow limitation. For example, the size of a time window is set to 60 seconds, the time window is divided into 4 small time units, each small time unit is 15 seconds, and the number of access requests of any 60-second sliding window to access the interface cannot be greater than 1000 requests. If 1000 requests come in concurrently, within the first 60 second time window, when 1000 access requests are burst in a 15 second small time unit, when the threshold for server processing has been exceeded, the new access request that occurs will be denied service, queued, or waiting; after 15 seconds the sliding window moves forward by a small grid and new 1000 requests can be received again.

Further, 1000 requests can also be split, batched into a sliding window. For example, in the first 60 second window, 400 access requests are entered in a 15 second hour unit, and 600 access requests are entered in a 45 second hour unit, then the 400 access requests can be received again by moving the sliding window one hour after 15 seconds. By analogy, the process of receiving a new request by the sliding window can be realized.

For example, intercepting a target access request sent by a terminal device outside an access interface may be, when it is detected that the terminal device sends the target access request to the access interface, acquiring interface configuration information of the access interface, and determining whether the interface configuration information includes current limiting configuration information, and if the interface configuration information includes the current limiting configuration information, intercepting the target access request outside the access interface.

Before intercepting a target access request sent by a terminal device outside an access interface, configuration information of the access interface needs to be acquired first, and whether the configuration information of the access interface contains current-limiting configuration information is judged, so that whether access current limiting is executed or not is determined.

Specifically, the process of whether the access interface needs to be restricted or not will be described with reference to fig. 5. The specific process is as follows:

step 501: interface configuration information of the access interface is obtained.

Step 502: and judging whether the access interface configuration information comprises current limiting configuration information.

Step 503: and if the access interface configuration information comprises the current limiting configuration information, intercepting the target access request outside the access interface.

Step 504: and if the access interface configuration information does not include the current limiting configuration information, intercepting the target access request.

Specifically, the configuration information in the access interface is the configuration contained in the access interface, for example: the access interface configuration information includes current limit configuration information. Before intercepting a target access request outside an access interface, whether the access interface contains current limiting configuration information needs to be judged, and if the access interface contains the current limiting configuration information, the target access request sent by terminal equipment is intercepted outside the access interface aiming at each terminal user.

In this embodiment, before applying for intercepting an access request, whether the configuration information of the access interface includes the current limiting configuration information is checked, and whether the access interface includes the current limiting method can be determined in advance, so that the stability of the system is ensured.

Step 202: and judging the times of receiving the target access request in a preset time period.

Wherein the predetermined time period typically comprises a sliding time window.

For example, when the user accesses the interface through the terminal device, the server may determine the number of times the target access request is received within the preset time period after receiving the target access request sent by the terminal device. The number of times that the server receives the target access request in the preset time period may also be understood as the number of times that the terminal device sends the target access request to the server in the preset time period. The server may obtain the number of times of the target access request locally, or may obtain the number of times of the target access request from the current limiting server.

Furthermore, in order to improve the access success rate of each user, after intercepting the target access request, the server may further determine whether the target access request is a request for accessing the interface for a non-first time, and if the target access request is a request for accessing the interface for a non-first time, determine the number of times of receiving the target access request within a preset time period; and if the target access request is a request for accessing the access interface for the first time, sending the target access request to the access interface.

Specifically, if the user sends a target access request through the terminal device to access the access interface for the first time, the server creates an independent sliding window corresponding to the user, the request needs to pass through the current limiting component before accessing the access interface, and the current limiting component can directly pass through the target access request according to a current limiting method or rule added in the current limiting component, so that the target access request accesses the access interface once. And in a next set time window, if the user continues to send the access request through the terminal equipment, the access request of the user is a request for accessing the access interface for a non-first time. Firstly, directly refusing the request if the sliding window has insufficient request processing capacity; and if the sliding window has enough request processing capacity, receiving the request and starting a counter to count the times of requesting to access the interface within the preset time.

Furthermore, after counting the number of times of requesting to access the access interface within the preset time in the sliding window, the current limiting component can judge whether to release the target access request access interface according to the counted number of times.

In this embodiment, it is determined whether the received target access request is a request for accessing the access interface for the first time, and the access interface can be successfully accessed by each user under the condition that multiple users concurrently request, so that the problem that one user frequently sends access requests to block the system, which results in the current limitation of the system and rejects all access requests is avoided, the access success rate of the user is further improved, and the user experience is improved.

Step 203: and if the times are greater than a second preset value, sending the target access request to an access interface.

The second preset value refers to the maximum number of times of accessing the interface, which is set by the current limiting method or the rule included in the current limiting component in the preset time period, and the value may be set according to actual conditions or experience, and the specific value of the second preset value is not limited herein.

Illustratively, the server receives and processes the access request sent by the terminal device, and the capability of the server to process concurrent access requests is measured by the throughput rate, so any server has a threshold of its capability of processing concurrent access requests. In order to ensure stable operation of the system and ensure that each user can successfully access the access interface under the condition of concurrent access requests in large batch, a second preset value in the sliding window can be set according to a current limiting method or rule set in the current limiting assembly.

Furthermore, when the user does not request the access interface for the first time, the number of times of receiving the target access request in a preset time period is counted, and when the number of times of receiving the target access request in the preset time period exceeds a second preset value, the current limiting component executes a release rule, so that the target access request accesses the primary access interface, namely the server sends the target access request to the access interface, and meanwhile, the number of times of receiving the target access request in the sliding window is reset or updated, so that the situation that the user does not call the access interface repeatedly to cause system current limiting after successfully accessing the access interface can be ensured, the access success rate of each user is further improved, and system resources are saved.

And when the number of times of receiving the target access request in a period of sliding window time is not more than a second preset value, prohibiting the access interface from receiving the target access request, namely intercepting the access of the target access request to the access interface, executing a degradation method, and adding 1 to the number of times of receiving the target access request. It should be noted that, if the number of times of the target access request requesting for accessing the interface does not exceed the second preset value after the set time of the sliding window is exceeded, the access request in the sliding window is deleted.

The degradation method is that the access request is designated to be in different levels, different processing is executed when the access request faces different abnormal levels, and according to the service mode: service may be denied, delayed, or sometimes randomized.

Furthermore, the used sliding window always exists in the system resource, and in order to protect the system resource, the unnecessary sliding window must be destroyed. For example, when it is determined that a sliding window has not been used for a long time, a custom event is sent to the custom spring event listener, and the listener is responsible for removing the sliding window instance.

According to the access current limiting method, device, equipment, storage medium and computer program product provided by the embodiment of the application, when the number of access requests sent to the access interface by a plurality of terminal equipment is detected to exceed a first preset value, a target access request sent by the terminal equipment is intercepted outside the access interface for each terminal equipment, then the number of times of receiving the target access request in a preset time period is judged, and if the number of times is greater than a second preset value, the target access request is sent to the access interface. In the scene of concurrent access requests in a large batch, a current limiting component is arranged outside an access interface for each terminal device, a target access request sent by the terminal device is intercepted through a current limiting method, the target access request exceeds a second preset value within preset time, the fact that a user urgently needs to access the access interface is indicated, and at the moment, the current limiting component releases the access request to call the access interface. Therefore, the problem that the system starts to limit the current and rejects all access requests due to frequent sending of the access requests by individuals can be avoided, and the success rate of user access is improved on the premise that the system stably operates.

Fig. 6 is a schematic structural diagram of an access current limiting device 60 according to an embodiment of the present application, and for example, referring to fig. 6, the access current limiting device 60 may include:

the intercepting module 601 is configured to intercept, for each terminal device, a target access request sent by the terminal device outside an access interface when it is detected that the number of access requests sent by multiple terminal devices to the access interface exceeds a first preset value;

a determining module 602, configured to determine the number of times that a target access request is received within a preset time period;

a sending module 603, configured to send the target access request to the access interface when the number of times is greater than the second preset value.

In a possible implementation manner, the determining module 602 is specifically configured to:

judging whether the target access request is a request for accessing the access interface for the first time or not;

and if the target access request is not a request for accessing the access interface for the first time, judging the times of receiving the target access request in a preset time period.

In a possible implementation manner, the sending module 603 is specifically configured to:

and if the target access request is a request for accessing the access interface for the first time, sending the target access request to the access interface.

In one possible implementation, the apparatus further includes: a processing module 604;

and the processing module 604 is configured to prohibit the access interface from receiving the target access request when the number of times is not greater than the second preset value.

In one possible implementation, the apparatus further includes: an update module 605;

an update module 605 for updating the number of times the target access request is received.

In a possible implementation manner, the intercepting module 601 is specifically configured to:

acquiring interface configuration information of an access interface;

judging whether the interface configuration information comprises current limiting configuration information or not;

if the interface configuration information comprises the current limiting configuration information, intercepting a target access request outside the access interface.

The access current limiting device 60 provided in this embodiment of the present application may implement the technical solution of the access current limiting method in any of the above embodiments, and its implementation principle and beneficial effects are similar to those of the access current limiting method, and reference may be made to the implementation principle and beneficial effects of the access current limiting method, which are not described herein again.

Fig. 7 is a schematic structural diagram of a server 70 according to an embodiment of the present application, and for example, please refer to fig. 7, the server may include a processor 701 and a memory 702. Wherein the content of the first and second substances,

a memory 702 for storing a computer program.

The processor 701 is configured to read the computer program stored in the memory 702, and execute the technical solution of the access throttling method in any of the embodiments according to the computer program in the memory 702.

Alternatively, the memory 702 may be separate or integrated with the processor 701. When the memory 702 is a separate device from the processor 701, the server may further include: a bus for connecting the memory 702 and the processor 701.

Optionally, this embodiment further includes: a communication interface, which may be connected to the processor 701 via a bus. The processor 701 may control the communication interface to implement the functions of acquisition and transmission of the server described above.

The server shown in the embodiment of the present application may execute the technical solution of the access current limiting method in any embodiment, and the implementation principle and the beneficial effect of the server are similar to those of the access current limiting method, and reference may be made to the implementation principle and the beneficial effect of the access current limiting method, which is not described herein again.

The embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the technical solution for implementing the access current limiting method in any of the above embodiments is implemented, and the implementation principle and the beneficial effect of the computer program are similar to those of the access current limiting method, and reference may be made to the implementation principle and the beneficial effect of the access current limiting method, which are not described herein again.

In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.

Units described as separate parts may or may not be physically separate, and parts shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment. In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.

The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present application.

It should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.

The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile storage NVM, such as at least one disk memory, and may also be a usb disk, a removable hard disk, a read-only memory, a magnetic or optical disk, etc.

The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.

The computer-readable storage medium may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.

Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:通信方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!