Traffic limiting method and device, equipment and storage medium

By performing traffic restriction processing based on the device type of access request, the problem of access denial in the token bucket algorithm is solved, and the flexibility and accuracy of traffic restriction is improved.

CN119254702AActive Publication Date: 2025-01-03CHINA CONSTRUCTION BANK +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411418230.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-01-03
Estimated Expiration
2044-10-11

AI Technical Summary

Technical Problem

When the existing token bucket algorithm is restricted, users who are already in the service state are denied access, resulting in poor flexibility in traffic limits.

Method used

After receiving the access request, it is determined whether traffic restrictions are required based on the current access volume, and the device type is determined based on the access request, thereby determining the processing method of the access request, including service processing or cache processing, which improves the flexibility of traffic restrictions.

Benefits of technology

Improves flexibility in traffic limits, ensuring more precise control of traffic under high access volumes, and avoids access denials due to missing tokens.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254702A_ABST
    Figure CN119254702A_ABST
Patent Text Reader

Abstract

The invention provides a traffic limiting method and device, equipment and a storage medium. Relates to the technical field of computers. The method comprises the following steps: receiving a first access request sent by first equipment, wherein the first access request is used for requesting to access a target system; determining the current access amount of the target system according to the access request; if the current access amount is larger than or equal to a first threshold value, the device type of the first device is determined according to the first access request, the device type is a first type or a second type, the first type is used for indicating that the first device has accessed the target system within a preset duration before the current moment, and the second type is used for indicating that the first device has accessed the target system; the second type is used for indicating that the first equipment does not access the target system within a preset duration before the current moment; and processing the first access request according to the device type of the first device. And the flexibility of flow limitation is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a flow restriction method, device, equipment and storage medium. Background Art

[0002] With the rapid development of the Internet, the scale and demand of users are also growing rapidly. In some scenarios, it is necessary to limit traffic to ensure the normal operation of the server. For example, when the number of user visits is too high at a certain moment, it may cause the server to crash.

[0003] In the related art, a token bucket algorithm is usually used to limit the flow of access devices. The token bucket algorithm can generate tokens in a preset token bucket (a logical container for storing tokens). Only when there are tokens in the token bucket will the system issue tokens to the access device; the server will allow the access request of the access device only after confirming that the access device holds the token, otherwise the request will be rejected, thereby achieving the effect of flow limitation.

[0004] However, in the above method, when there is no token in the token bucket, users who are already in the service state may be denied access, resulting in poor flexibility in traffic restriction. Summary of the invention

[0005] The present application provides a flow restriction method, apparatus, device and storage medium to solve the problem of poor accuracy in determining user types.

[0006] In a first aspect, the present application provides a traffic limiting method, which is applied to a first server, and the method includes:

[0007] receiving a first access request sent by a first device, where the first access request is used to request access to a target system;

[0008] Determining the current access volume of the target system according to the access request;

[0009] If the current access amount is greater than or equal to a first threshold, determining a device type of the first device according to the first access request, the device type being a first type or a second type, the first type being used to indicate that the first device has accessed the target system within a preset time period before a current moment, and the second type being used to indicate that the first device has not accessed the target system within a preset time period before a current moment;

[0010] The first access request is processed according to the device type of the first device.

[0011] In a possible design, determining, according to the first access request, a device type of the first device includes:

[0012] Determining whether the first access request includes a first access token;

[0013] If yes, determining a device type of the first device according to the first access token and a token list corresponding to the first server;

[0014] If not, it is determined that the device type of the first device is the second type.

[0015] In one possible design, determining the device type of the first device according to the first access token and the token list corresponding to the first server includes:

[0016] Determining whether the token list includes the first access token;

[0017] If yes, obtaining the token expiration time of the first access token, and determining the device type of the first device according to the token expiration time and the current time;

[0018] If not, historical access information is obtained in the first access request, and the device type of the first device is determined according to the historical access information.

[0019] In a possible design, determining the device type of the first device according to the token expiration time and the current time includes:

[0020] If the token expiration time is after the current time, determining that the device type of the first device is the first type;

[0021] If the token expiration time is before the current time, it is determined that the device type of the first device is the second type.

[0022] In a possible design, determining the device type of the first device according to the historical access information includes:

[0023] Determining the last time the first device accessed the target system according to the historical access information;

[0024] If the time difference between the access time and the current time is greater than or equal to a preset time length, determining that the device type of the first device is the second type;

[0025] If the time difference between the access time and the current time is less than the preset duration, the second server accessed by the first device when it last accessed the target system is determined in the historical access information, and a switching request is sent to the second server, wherein the switching request is used to request the second server to process the first access request.

[0026] In one possible design, processing the first access request according to a device type of the first device includes:

[0027] Obtaining the remaining access volume corresponding to the target system;

[0028] If the remaining access amount is greater than 0, performing service processing on the first access request so that the first device accesses the target system;

[0029] If the remaining access amount is equal to 0, the first access request is cached according to the device type of the first device to restrict the first device from accessing the target system.

[0030] In a possible design, caching the first access request according to the device type of the first device includes:

[0031] If the device type of the first device is the first type, adding the first access request to a first queue, the first queue being used to store access requests sent by devices of the first type and restricting access to the target system;

[0032] If the device type of the first device is the second type, the first access request is added to a second queue, where the second queue is used to store access requests sent by devices of the second type and which restrict access to the target system.

[0033] In one possible design, the method further includes:

[0034] When the remaining access quantity switches from 0 to N, determining a first number M of access requests existing in the first queue, where N is a positive integer and M is an integer;

[0035] If the M is greater than or equal to the N, controlling the terminal devices corresponding to the first N access requests to access the target system;

[0036] If the M is smaller than the N, the terminal devices corresponding to the M access requests in the first queue are controlled to access the target system, and the terminal devices corresponding to the first NM access requests in the second queue are controlled to access the target system.

[0037] In a second aspect, the present application provides a flow restriction device, including: a receiving module, a first determining module, a second determining module and a processing module, wherein:

[0038] The receiving module is used to receive a first access request sent by a first device, where the first access request is used to request access to a target system;

[0039] The first determination module is used to determine the current access volume of the target system according to the access request;

[0040] The second determination module is used to determine, if the current access amount is greater than or equal to a first threshold, a device type of the first device according to the first access request, the device type being a first type or a second type, the first type being used to indicate that the first device has accessed the target system within a preset time period before a current moment, and the second type being used to indicate that the first device has not accessed the target system within a preset time period before a current moment;

[0041] The processing module is used for processing the first access request according to the device type of the first device.

[0042] In a possible design, the second determining module is specifically used to:

[0043] Determining whether the first access request includes a first access token;

[0044] If yes, determining the device type of the first device according to the first access token and the token list corresponding to the first server;

[0045] If not, it is determined that the device type of the first device is the second type.

[0046] In a possible design, the second determining module is specifically used to:

[0047] Determining whether the token list includes the first access token;

[0048] If yes, obtaining the token expiration time of the first access token, and determining the device type of the first device according to the token expiration time and the current time;

[0049] If not, historical access information is obtained in the first access request, and the device type of the first device is determined according to the historical access information.

[0050] In a possible design, the second determining module is specifically used to:

[0051] If the token expiration time is after the current time, determining that the device type of the first device is the first type;

[0052] If the token expiration time is before the current time, it is determined that the device type of the first device is the second type.

[0053] In a possible design, the second determining module is specifically used to:

[0054] Determining the last time the first device accessed the target system according to the historical access information;

[0055] If the time difference between the access time and the current time is greater than or equal to a preset time length, determining that the device type of the first device is the second type;

[0056] If the time difference between the access time and the current time is less than the preset duration, the second server accessed by the first device when it last accessed the target system is determined in the historical access information, and a switching request is sent to the second server, wherein the switching request is used to request the second server to process the first access request.

[0057] In a possible design, the processing module is specifically used for:

[0058] Obtaining the remaining access volume corresponding to the target system;

[0059] If the remaining access amount is greater than 0, performing service processing on the first access request so that the first device accesses the target system;

[0060] If the remaining access amount is equal to 0, the first access request is cached according to the device type of the first device to restrict the first device from accessing the target system.

[0061] In a possible design, the processing module is specifically used for:

[0062] If the device type of the first device is the first type, adding the first access request to a first queue, the first queue being used to store access requests sent by devices of the first type and restricting access to the target system;

[0063] If the device type of the first device is the second type, the first access request is added to a second queue, where the second queue is used to store access requests sent by devices of the second type and which restrict access to the target system.

[0064] In a possible design, the processing module further includes a third determining module, a first control module and a second control module:

[0065] The third determination module is used to determine a first number M of access requests existing in the first queue when the remaining access quantity switches from 0 to N, where N is a positive integer and M is an integer;

[0066] The first control module is used to control the terminal devices corresponding to the first N access requests to access the target system if M is greater than or equal to N;

[0067] The second control module is used to, if M is less than N, control the terminal devices corresponding to the M access requests in the first queue to access the target system, and control the terminal devices corresponding to the first NM access requests in the second queue to access the target system.

[0068] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer execution instructions; at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the traffic limiting method as described in the first aspect above and various possible designs of the first aspect.

[0069] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the traffic limiting method as described in the first aspect and various possible designs of the first aspect are implemented.

[0070] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the traffic limiting method as described in the first aspect and various possible designs of the first aspect.

[0071] The traffic limiting method, apparatus, device and storage medium provided in the present application determine whether traffic limiting is required based on the current access volume after the server obtains an access request. If the current access volume is greater than or equal to a first threshold, it indicates that traffic limiting is required. The device type of the access device can be determined based on the access request, and the processing method of the access request can be determined based on the device type of the access device, thereby improving the flexibility of traffic limiting. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] 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 present application.

[0073] Figure 1 A schematic diagram of the system architecture provided for an embodiment of the present application;

[0074] Figure 2 A flow chart of a flow limiting method provided in an embodiment of the present application;

[0075] Figure 3 A schematic diagram of a visual operation window of a target system provided in an embodiment of the present application;

[0076] Figure 4 A schematic diagram of the process of determining the device type provided in an embodiment of the present application;

[0077] Figure 5 A schematic diagram of a process of processing an access request provided in an embodiment of the present application;

[0078] Figure 6 A schematic diagram of the structure of a flow restriction device provided in an embodiment of the present application;

[0079] Figure 7 A schematic diagram of the structure of another flow restriction device provided in an embodiment of the present application;

[0080] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0081] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0082] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0083] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved shall comply with the provisions of relevant laws and regulations and shall not violate public order and good morals.

[0084] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0085] For ease of understanding, the following Figure 1 , the system architecture applicable to the embodiments of the present application is described.

[0086] Figure 1 This is a schematic diagram of the system architecture provided by the embodiment of this application. Figure 1 , including a terminal device 101 and a server 102. The terminal device 101 may be a local device of a user, and the user may send an access request to the server through the terminal device. The server 102 may receive the access request sent by the terminal device 101 and provide services to the terminal device 101.

[0087] In the related art, a token bucket algorithm is usually used to limit the flow of access devices. The token bucket algorithm can generate tokens in a preset token bucket. Only when there are tokens in the token bucket will the token be issued to the access device. After the server recognizes that the access device carries the token, it will allow the access device to access. Otherwise, the access request of the access device will be rejected, thereby achieving the effect of flow restriction. However, in the above method, when there is no token in the token bucket, users who are already in the service state may also be denied access, resulting in poor flexibility of flow restriction.

[0088] In response to the above technical problems, in an embodiment of the present application, after the server obtains an access request, it determines whether traffic restriction is required based on the current access volume. If the current access volume is greater than or equal to the first threshold, it indicates that traffic restriction is required. The device type of the access device can be determined based on the access request, and the processing method of the access request can be determined based on the device type of the access device, thereby improving the flexibility of traffic restriction.

[0089] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0090] Figure 2 A flow chart of a flow restriction method provided in an embodiment of the present application. Figure 2 As shown, the method may include the following steps:

[0091] S201. Receive a first access request sent by a first device.

[0092] The execution subject of the embodiment of the present application may be a server, or a flow limiting device arranged in the server. The flow limiting device may be implemented by software, or by a combination of software and hardware.

[0093] The first device may refer to a user's terminal device, such as a user's computer, mobile phone, tablet, or other device.

[0094] A target system may be provided in the first device, and a visual operation interface of the target system may have a "login" control. A user may generate a first access request by clicking the "login" control, and the first access request is used to request access to the target system.

[0095] Next, combine Figure 3 ,Through specific examples, the visual operation window of the target system is explained.

[0096] Figure 3 For a schematic diagram of a visual operation window of a target system provided in an embodiment of the present application, see Figure 3 , including a username input module, a password input module and a "login" control of the target system. The user can enter the username field information in the username input module and the password field information in the password input module. The user can generate a first access request by clicking the "login" control.

[0097] S202: Determine the current access volume of the target system according to the access request.

[0098] All access requests within a preset period are obtained, and the number of all access requests within the preset period is determined as the current access volume. The preset period may be a period between any preset time before the current moment and the current moment, and the access request may come from other devices, and the access request is used to request access to the target system.

[0099] For example, assuming that the preset time period is the period between the moment one second before the current moment and the current moment, and a total of 100 access requests sent by access devices are received within the preset time period, then the current access amount is 100.

[0100] S203: If the current access volume is greater than or equal to the first threshold, determine the device type of the first device according to the first access request.

[0101] The device type may be a first type or a second type, wherein the first type is used to indicate that the first device has accessed the target system within a preset time period before the current moment, and the second type is used to indicate that the first device has not accessed the target system within a preset time period before the current moment.

[0102] The device type of the first device can be determined in the following manner: obtain the current time, which may refer to the time when the server receives the first access request; determine whether the first device has accessed the target system within a preset time period before the current time, and if so, determine that the device type of the first device is the first type; if not, determine that the device type of the first device is the second type.

[0103] For example, assuming the preset time length is 5 minutes, if the first device has accessed the target system within 5 minutes before the current moment, the device type of the first device is the first type; if the first device has not accessed the target system within 5 minutes before the current moment, the device type of the first device is the second type.

[0104] The first threshold may be a value set in advance in the server, used to determine whether traffic restriction is required, for example, the first threshold may be 1000. The preset duration may be a value set in advance in the server, used to determine the device type, for example, the preset duration may be 3 minutes.

[0105] S204: Process the first access request according to the device type of the first device.

[0106] The first access request can be processed in the following manner: obtaining the remaining access amount corresponding to the target system; if the remaining access amount is greater than 0, performing business processing on the first access request to enable the first device to access the target system; if the remaining access amount is equal to 0, caching the first access request according to the device type of the first device to limit the first device's access to the target system.

[0107] The remaining visits can be determined in the following manner: based on the first threshold, the maximum current limit value can be determined, and the maximum current limit value can be the first threshold divided by the first preset ratio; based on the maximum current limit value and the current visits, the remaining visits can be determined, and the remaining visits can be the difference between the maximum current limit value and the current visits.

[0108] For example, assuming that the first threshold is 80, the first preset ratio is 80%, and the current number of visits is 90, the maximum flow limit value can be determined to be 100. Based on the maximum flow limit value and the current number of visits, the remaining number of visits can be determined to be 10.

[0109] Among them, the remaining access volume may refer to the access volume that the first server can currently carry, that is, if the remaining access volume is greater than 0, it means that the first server can still support business processing for the first device; if the remaining access volume is equal to 0, it means that the first server is currently unable to perform business processing for the first device, and the first access request of the first device needs to be cached.

[0110] In an embodiment of the present application, when a first access request sent by a first device is received, it can be determined whether traffic limitation is required based on the current access volume. If the current access volume is greater than or equal to the first threshold, traffic limitation is required. Based on the first access request, the device type of the first device can be determined, and the device type can be a first type or a second type. Based on the device type of the first device, the first access request can be processed, and based on the device type of the first device that sends the first access request, the processing method of the access request can be determined, thereby improving the flexibility of traffic limitation.

[0111] Based on any of the above embodiments, Figure 4 , the process of determining the device type ( Figure 2 S203) in the embodiment is described in detail.

[0112] Figure 4 This is a schematic diagram of the process of determining the device type provided in the embodiment of the present application. Figure 4 , the method may include:

[0113] S401: Obtain a first access request.

[0114] It should be noted that the execution process of the above S401 can refer to S201 and will not be repeated here.

[0115] S402: Determine whether the first access request includes a first access token.

[0116] The first access request may include a first access token. The first access token may refer to a digital certificate distributed by the server to the first device when the first device has accessed the target system. After identifying the first access token, the server may provide services to the device.

[0117] The first access token may be used to indicate whether the first device has accessed the target system, that is, if the first access request includes the first access token, it indicates that the first device has accessed the target system.

[0118] If yes, execute S403.

[0119] If not, execute S409.

[0120] S403: Obtain a token list corresponding to the first server, and determine whether the token list includes the first access token.

[0121] The token list may refer to a collection of multiple tokens, and the first server may store the distributed access tokens in the token list of the first server. The token list of the first server may be stored in the storage space of the first server.

[0122] If yes, execute S404.

[0123] If not, execute S405.

[0124] S404: Obtain the token expiration time of the first access token, and determine whether the token expiration time is after the current time.

[0125] The token expiration time can be determined by the following method: obtaining the token validity period of the first access token, and determining the token expiration time according to the generation time of the first access token and the token validity period. The token validity period can be a value preset in the server in advance, for example, 3 minutes.

[0126] The current time may refer to the time when the first server receives the first access request. If the current time is after the expiration time, the first access token will be regarded as an invalid token.

[0127] If yes, execute S408.

[0128] If not, execute S409.

[0129] S405: Obtain historical access information in the first access request, and determine the last time the first device accessed the target system based on the historical access information.

[0130] The historical access information may refer to the record of the first device's historical access to the target system, and may include the server information and access time of the first device's historical access to the target system. According to the historical access information, the access time of the first device's last access to the target system may be obtained.

[0131] S406: Determine whether the time difference between the access time and the current time is greater than or equal to a preset time length.

[0132] For example, assuming that the access time is 16:25 on March 18, 2024, and the current time is the access time 16:29 on March 18, 2024, and the preset duration is 3 minutes, then the time difference between the current access time and the current time is 4 minutes, which is greater than the preset duration.

[0133] If yes, execute S409.

[0134] If not, execute S407.

[0135] S407: Determine in the historical access information the second server accessed by the first device when it last accessed the target system, and send a switching request to the second server.

[0136] The second server may be determined in the following manner: based on the historical access information, the server information of the last time the first device accessed the target system may be determined, and based on the server information, the second server accessed during the last access to the target system may be determined.

[0137] After the first server determines the second server accessed by the first device when it last accessed the target system, it can generate a switching request and send the switching request to the second server. The switching request can be used to request the second server to process the first access request, wherein the switching request may include the first access request of the first device.

[0138] S408: Determine that the device type of the first device is the first type.

[0139] The first type is used to indicate that the first device has accessed the target system within a preset time period before the current moment.

[0140] S409: Determine that the device type of the first device is the second type.

[0141] The second type is used to indicate that the first device has not accessed the target system within a preset time period before the current moment.

[0142] In an embodiment of the present application, when traffic restriction is performed, it is necessary to determine the device type of the first device. According to the first access request of the first device, it can be determined whether the first access token is included. If the first access token is not included, the device type of the first device is determined to be the first type; if the first access token is included, it is determined whether the first access token belongs to the token list of the first server. If the first access token belongs to the token list of the first server and the token expiration time of the first access token is after the current time, the device type of the first device is determined to be the first type. If the first access token belongs to the token list of the first server and the token expiration time of the first access token is before the current time, the device type of the first device is determined to be The type is the second type; if the first access token does not belong to the token list of the first server, then the last time the first device accessed the target system is determined based on the historical access information, and it is determined whether the time difference between the access time and the current time is greater than or equal to the preset duration. If so, it is determined that the device type of the first device is the second type. If not, the second server visited by the first device when it last visited the target system is determined in the historical access information, and a switching request is sent to the second server to ensure that the access device that has visited the target system within the preset duration can continue to obtain services. The processing method of the access request is determined according to the device type of the first device that sends the first access request, thereby improving the flexibility of traffic restriction.

[0143] Based on any of the above embodiments, Figure 5 , the process of processing access requests ( Figure 2 S204 in the embodiment is described in detail.

[0144] Figure 5 A schematic diagram of the process of processing an access request provided by an embodiment of the present application. Figure 5 , the method may include:

[0145] S501: Obtain the remaining access volume corresponding to the target system.

[0146] It should be noted that the execution process of the above S501 can refer to S204, which will not be described in detail here.

[0147] S502: Determine whether the remaining number of visits is equal to 0.

[0148] If yes, execute S503.

[0149] If not, execute S506.

[0150] S503: Determine whether the device type of the first device is the first type.

[0151] If yes, execute S504.

[0152] If not, execute S505.

[0153] S504: Add the first access request to the first queue.

[0154] The first queue may be used to store access requests sent by devices of the first type and restricting access to the target system, and the first queue may be located in the storage space of the first server.

[0155] If the device type of the first device is the first type, the first access request is added to the first queue.

[0156] S505: Add the first access request to the second queue.

[0157] The second queue is used to store access requests sent by the second type of device and with restricted access to the target system. The second queue can be located in the storage space of the first server.

[0158] If the device type of the first device is the second type, the first access request is added to the first queue.

[0159] S506: Obtain the remaining access quantity N and the first quantity M of access requests existing in the first queue.

[0160] S507: Determine whether M is greater than or equal to N.

[0161] If yes, execute S508.

[0162] If not, execute S509.

[0163] S508: Control the terminal devices corresponding to the first N access requests to access the target system.

[0164] For example, assuming that the remaining access quantity N is 10 and the first quantity M of access requests in the first queue is 15, the first 10 access requests in the first queue are determined, and the terminal devices corresponding to the 10 access requests are controlled to access the target system.

[0165] S509: Control the terminal devices corresponding to the M access requests in the first queue to access the target system, and control the terminal devices corresponding to the first NM access requests in the second queue to access the target system.

[0166] For example, assuming that the remaining access quantity N is 10 and the first number M of access requests in the first queue is 5, the terminal devices corresponding to the 5 access requests in the first queue are controlled to access the target system, and the terminal devices corresponding to the first 5 access requests in the second queue are controlled to access the target system.

[0167] In the embodiment of the present application, when traffic restriction is required, the first access request can be processed according to the device type of the first device to obtain the remaining access amount corresponding to the target system. When the remaining access amount is equal to 0, the device type of the first device is determined. If the device type of the first device is the first type, the first access request is added to the first queue. If the device type of the first device is the second type, the first access request is added to the second queue. When the remaining access amount is greater than 0, the remaining access amount N and the first number M of access requests in the first queue are obtained to determine whether M is greater than or equal to N. If so, the terminal devices corresponding to the first N access requests are controlled to access the target system. If not, the terminal devices corresponding to the M access requests in the first queue are controlled to access the target system, and the terminal devices corresponding to the first NM access requests in the second queue are controlled to access the target system. According to the device type of the first device that sends the first access request, the processing method of the access request is determined, thereby improving the flexibility of traffic restriction.

[0168] Figure 6 This is a schematic diagram of the structure of a flow restriction device provided in an embodiment of the present application. Figure 6 The flow restriction device 10 includes: a receiving module 11, a first determining module 12, a second determining module 13 and a processing module 14, wherein:

[0169] The receiving module 11 is used to receive a first access request sent by a first device, where the first access request is used to request access to a target system;

[0170] The first determination module 12 is used to determine the current access volume of the target system according to the access request;

[0171] The second determination module 13 is used to determine, if the current access amount is greater than or equal to a first threshold, a device type of the first device according to the first access request, the device type being a first type or a second type, the first type being used to indicate that the first device has accessed the target system within a preset time period before a current moment, and the second type being used to indicate that the first device has not accessed the target system within a preset time period before a current moment;

[0172] The processing module 14 is configured to process the first access request according to the device type of the first device.

[0173] A flow restriction device provided in an embodiment of the present application can implement the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0174] In a possible design, the second determining module 13 is specifically configured to:

[0175] Determining whether the first access request includes a first access token;

[0176] If yes, determining the device type of the first device according to the first access token and the token list corresponding to the first server;

[0177] If not, it is determined that the device type of the first device is the second type.

[0178] In a possible design, the second determining module 13 is specifically configured to:

[0179] Determining whether the token list includes the first access token;

[0180] If yes, obtaining the token expiration time of the first access token, and determining the device type of the first device according to the token expiration time and the current time;

[0181] If not, historical access information is obtained in the first access request, and the device type of the first device is determined according to the historical access information.

[0182] In a possible design, the second determining module 13 is specifically configured to:

[0183] If the token expiration time is after the current time, determining that the device type of the first device is the first type;

[0184] If the token expiration time is before the current time, it is determined that the device type of the first device is the second type.

[0185] In a possible design, the second determining module 13 is specifically configured to:

[0186] Determining the last time the first device accessed the target system according to the historical access information;

[0187] If the time difference between the access time and the current time is greater than or equal to a preset time length, determining that the device type of the first device is the second type;

[0188] If the time difference between the access time and the current time is less than the preset duration, the second server accessed by the first device when it last accessed the target system is determined in the historical access information, and a switching request is sent to the second server, wherein the switching request is used to request the second server to process the first access request.

[0189] In a possible design, the processing module 14 is specifically used for:

[0190] Obtaining the remaining access volume corresponding to the target system;

[0191] If the remaining access amount is greater than 0, performing service processing on the first access request so that the first device accesses the target system;

[0192] If the remaining access amount is equal to 0, the first access request is cached according to the device type of the first device to restrict the first device from accessing the target system.

[0193] In a possible design, the processing module 14 is specifically used for:

[0194] If the device type of the first device is the first type, adding the first access request to a first queue, the first queue being used to store access requests sent by devices of the first type and restricting access to the target system;

[0195] If the device type of the first device is the second type, the first access request is added to a second queue, where the second queue is used to store access requests sent by devices of the second type and which restrict access to the target system.

[0196] Figure 7 A schematic diagram of the structure of another flow restriction device provided in an embodiment of the present application, in Figure 6 Based on the examples shown, see Figure 7 The processing module 14 further includes: a third determining module 15, a first control module 16 and a second control module 17, wherein:

[0197] The third determination module 15 is used to determine a first number M of access requests existing in the first queue when the remaining access quantity switches from 0 to N, where N is a positive integer and M is an integer;

[0198] The first control module 16 is used to control the terminal devices corresponding to the first N access requests to access the target system if M is greater than or equal to N;

[0199] The second control module 17 is used to control the terminal devices corresponding to the M access requests in the first queue to access the target system if M is less than N, and to control the terminal devices corresponding to the first NM access requests in the second queue to access the target system.

[0200] A flow restriction device provided in an embodiment of the present application can implement the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0201] Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device may include: a transceiver 111 , a processor 112 , and a memory 113 .

[0202] The processor 112 executes the computer-executable instructions stored in the memory, so that the processor 112 executes the scheme in the above embodiment. The processor 112 can be a general-purpose processor, including a central processing unit CPU, a network processor (network processor, NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0203] The memory 113 is connected to the processor 112 via a system bus and completes communication between them. The memory 113 is used to store computer program instructions.

[0204] The transceiver 111 may be used to obtain tasks to be executed and configuration information of the tasks to be executed.

[0205] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.

[0206] The electronic device provided in the embodiment of the present application may be the terminal device of the above embodiment.

[0207] An embodiment of the present application also provides a chip for running instructions, which is used to execute the technical solution of the traffic limiting method in the above embodiment.

[0208] An embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the traffic limiting method in the above embodiment.

[0209] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the traffic limitation method in the above embodiment can be implemented.

[0210] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0211] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.

[0212] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0213] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.

[0214] It should be understood that the above processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.

[0215] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0216] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0217] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, 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 disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0218] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.

[0219] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0220] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A flow limiting method, characterized in that: Applied to a first server, the method comprises: receiving a first access request sent by a first device, where the first access request is used to request access to a target system; Determining the current access volume of the target system according to the access request; If the current access amount is greater than or equal to a first threshold, determining a device type of the first device according to the first access request, the device type being a first type or a second type, the first type being used to indicate that the first device has accessed the target system within a preset time period before a current moment, and the second type being used to indicate that the first device has not accessed the target system within a preset time period before a current moment; The first access request is processed according to the device type of the first device.

2. The method according to claim 1, characterized in that Determining, according to the first access request, a device type of the first device, including: Determining whether the first access request includes a first access token; If yes, determining the device type of the first device according to the first access token and the token list corresponding to the first server; If not, it is determined that the device type of the first device is the second type.

3. The method according to claim 2, characterized in that Determining a device type of the first device according to the first access token and a token list corresponding to the first server includes: Determining whether the token list includes the first access token; If yes, obtaining the token expiration time of the first access token, and determining the device type of the first device according to the token expiration time and the current time; If not, historical access information is obtained in the first access request, and the device type of the first device is determined according to the historical access information.

4. The method according to claim 3, characterized in that Determining the device type of the first device according to the token expiration time and the current time includes: If the token expiration time is after the current time, determining that the device type of the first device is the first type; If the token expiration time is before the current time, it is determined that the device type of the first device is the second type.

5. The method according to claim 3, characterized in that: Determining the device type of the first device according to the historical access information includes: Determining the last time the first device accessed the target system according to the historical access information; If the time difference between the access time and the current time is greater than or equal to a preset time length, determining that the device type of the first device is the second type; If the time difference between the access time and the current time is less than the preset duration, the second server accessed by the first device when it last accessed the target system is determined in the historical access information, and a switching request is sent to the second server, wherein the switching request is used to request the second server to process the first access request.

6. The method according to any one of claims 1 to 5, characterized in that: Processing the first access request according to the device type of the first device includes: Obtaining the remaining access volume corresponding to the target system; If the remaining access amount is greater than 0, performing service processing on the first access request so that the first device accesses the target system; If the remaining access amount is equal to 0, the first access request is cached according to the device type of the first device to restrict the first device from accessing the target system.

7. The method according to claim 6, characterized in that The step of caching the first access request according to the device type of the first device includes: If the device type of the first device is the first type, adding the first access request to a first queue, the first queue being used to store access requests sent by devices of the first type and restricting access to the target system; If the device type of the first device is the second type, the first access request is added to a second queue, where the second queue is used to store access requests sent by devices of the second type and which restrict access to the target system.

8. The method according to claim 7, characterized in that The method further comprises: When the remaining access quantity switches from 0 to N, determining a first number M of access requests existing in the first queue, where N is a positive integer and M is an integer; If the M is greater than or equal to the N, controlling the terminal devices corresponding to the first N access requests to access the target system; If the M is smaller than the N, the terminal devices corresponding to the M access requests in the first queue are controlled to access the target system, and the terminal devices corresponding to the first NM access requests in the second queue are controlled to access the target system.

9. A flow restriction device, characterized in that: include: A receiving module, a first determining module, a second determining module and a processing module, wherein: The receiving module is used to receive a first access request sent by a first device, where the first access request is used to request access to a target system; The first determination module is used to determine the current access volume of the target system according to the access request; The second determination module is used to determine, if the current access amount is greater than or equal to a first threshold, a device type of the first device according to the first access request, the device type being a first type or a second type, the first type being used to indicate that the first device has accessed the target system within a preset time period before a current moment, and the second type being used to indicate that the first device has not accessed the target system within a preset time period before a current moment; The processing module is used for processing the first access request according to the device type of the first device.

10. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.

12. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 8 when being executed by a processor.

Citation Information

Patent Citations

  • Network access flow limiting control method and device and computer readable storage medium

    CN111030936A

  • Equipment identification method and device, equipment and readable storage medium

    CN113297253A

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

    CN113726683A

  • Interface access method and device, equipment and medium

    CN117574350A

  • Multi-step service authorization for indirect communication in a communication system

    WO2021094349A1