Request processing method, request processing device and electronic device

By setting thresholds and request control policies in the server's request queue, the problems of server traffic pressure and excessive load of third-party servers during peak business are solved, and the system stability and response speed are improved.

CN116360970BActive Publication Date: 2025-03-21BYD CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111628962.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2025-03-21
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

During peak business periods, the server receives a large number of requests, resulting in insufficient memory resources, slow response, and may cause excessive load on third-party servers, resulting in the interface being disabled.

Method used

By setting a threshold in the first request queue, the identification of the target request is added to the queue only when the number of request identifications is less than the first threshold, and the execution time of the target request is determined based on the preset request control strategy to limit the amount of request concurrency and execution frequency within the same time period.

Benefits of technology

It effectively reduces the traffic pressure of servers during peak business hours, avoids the problem of excessive load on third-party servers, and ensures system stability and response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116360970B_ABST
    Figure CN116360970B_ABST
Patent Text Reader

Abstract

The present application discloses a request processing method, a request processing device and an electronic device. The method includes: in response to a first request queue satisfying a preset condition, adding a target request identifier of a target request to the first request queue, the preset condition being that the number of request identifiers in the first request queue is less than a preset first threshold; after the target request identifier is added to the first request queue, determining the execution time of the target request based on a preset request control strategy, the request control strategy including that the number of requests executed within the same preset time period is less than a preset second threshold; after the target request is executed, removing the target request identifier from the first request queue. Through the scheme of the present application, the traffic pressure of the server during business peak periods can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a request processing method, a request processing device, an electronic device, and a computer-readable storage medium. Background Art

[0002] In some scenarios, a large number of requests will flood into the server, causing insufficient server memory resources and slow response to requests. If the incoming requests are requests to obtain data from a third-party server, it may even cause the third-party server to be overloaded and the third-party interface to be disabled. Summary of the invention

[0003] In view of this, the present application provides a request processing method, a request processing device, an electronic device and a computer-readable storage medium, which can reduce the traffic pressure of the server during business peak periods.

[0004] In a first aspect, the present application provides a request processing method, comprising:

[0005] In response to the first request queue satisfying a preset condition, adding the target request identifier of the target request to the first request queue, wherein the preset condition is that the number of request identifiers in the first request queue is less than a preset first threshold;

[0006] After the target request identifier is added to the first request queue, determining the execution time of the target request based on a preset request control strategy, wherein the request control strategy includes that the number of requests executed within the same preset time period is less than a preset second threshold;

[0007] When the target request is executed, the target request identifier is removed from the first request queue.

[0008] In a second aspect, the present application provides a request processing device, including:

[0009] A first adding module, configured to add a target request identifier of a target request to the first request queue in response to the first request queue satisfying a preset condition, wherein the preset condition is that the number of request identifiers in the first request queue is less than a preset first threshold;

[0010] A first determination module, configured to determine the execution time of the target request based on a preset request control strategy after the target request identifier is added to the first request queue, wherein the request control strategy includes that the number of requests executed within the same preset time period is less than a preset second threshold;

[0011] The first removing module is used to remove the target request identifier from the first request queue after executing the target request.

[0012] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of the first aspect when executing the computer program.

[0013] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method of the first aspect is implemented.

[0014] As can be seen from the above, the request processing method provided by the present application, in the face of a large number of requests influx, will only add the target request identifier of the target request (any request in a large number of requests) to the first request queue when the number of request identifiers in the first request queue is less than the first threshold, thereby limiting the concurrent number of requests of the server at the same time to below the first threshold. Then, based on the policy that the number of requests executed in the same preset time period should be less than the second threshold, the execution time of the target request is set, limiting the frequency of the server executing the request. In this way, the traffic pressure of the server during business peak periods can be reduced.

[0015] It can be understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0017] Figure 1 It is a schematic diagram of the implementation environment of the request processing method provided in the embodiment of the present application;

[0018] Figure 2 is a flowchart of the implementation of the request processing method provided in the embodiment of the present application;

[0019] Figure 3 is a structural block diagram of a request processing device provided in an embodiment of the present application;

[0020] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0022] The request processing method provided in this application can be applied to Figure 1 In the scene shown. Figure 1 In the process, the service terminal and the server establish a wireless communication connection through a network to achieve mutual communication. The network may include but is not limited to a wide area network, a metropolitan area network or a local area network.

[0023] The business terminal can be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The server can be a single server or a server cluster, which is not limited here.

[0024] In one scenario, the business terminal includes an application (Application, APP), and the user can send a request to the server through the APP on the business terminal. The server includes a first request queue and a database. For the request received from the business terminal, the server can add the request information of the request to the first request queue, or store the request information in the database, depending on the specific situation. After the server executes the request, it can return the response of the request to the business terminal.

[0025] The following describes a request processing method provided in an embodiment of the present application. Figure 2 , the request processing method can be applied to an electronic device, including:

[0026] Step 201: In response to a first request queue satisfying a preset condition, a target request identifier of a target request is added to the first request queue.

[0027] Step 202: After the target request identifier is added to the first request queue, the execution time of the target request is determined based on a preset request control policy.

[0028] Step 203: After the target request is executed, the target request identifier is removed from the first request queue.

[0029] In the embodiment of the present application, the electronic device executing the request processing method provided by the present application may be Figure 1 The business terminal in Figure 1When the electronic device is a service terminal, the target request may be directly generated by the user operating the APP on the service terminal. When the electronic device is a server, the target request may be received from the service terminal.

[0030] In some scenarios, the business terminal generates a large number of requests at the same time and sends these requests to the server. After receiving these requests, the server can take each of the requests as the target request in turn, and then execute the request processing method provided by the present application. Among them, the preset condition is that the number of request identifiers in the first request queue is less than the preset first threshold. If the first request queue meets the preset condition at the current moment, the server can add the identifier of the target request (recorded as the target request identifier) ​​to the first request queue. After the target request identifier is added to the first request identifier, the server can determine the execution time for the target request, so that when the execution time is reached, the server executes the target request. For example, the target request is used to call a third-party interface to obtain data from a third-party server. Then, when the execution time of the target request is reached, the server calls the third-party interface to request data from the third-party server. Among them, the request identifier can be represented by any one of numbers, letters and symbols or a combination of the three, and the form of the request identifier is not limited here.

[0031] Specifically, the server can determine the execution time of the target request based on a preset request control strategy, and the request control strategy includes: the number of requests executed within the same preset time period is less than a preset second threshold. Among them, the length of the preset time period can be set as needed, for example, each second can be used as a preset time period. Based on this example, the request control strategy includes: the number of requests executed by the server per second does not exceed the second threshold. In order to maintain the first request queue, when the execution of the target request is completed, the target request identifier can be removed from the first request queue. Thereby, the request identifier of the next target request can be added to the first request queue, so that the number of request identifiers in the first request queue does not reach the first threshold and the preset conditions can no longer be met.

[0032] In some embodiments, the above steps determine the execution time of the target request based on a preset request control policy, including:

[0033] Determines the number of requests whose execution time was within the current time period.

[0034] If the number of requests whose execution time is within the current time period is less than the second threshold, the time within the current time period is determined as the execution time of the target request.

[0035] If the number of requests whose execution time is within the current time period is greater than or equal to the second threshold, the process returns to the step of determining the number of requests whose execution time is within the current time period.

[0036] In the embodiment of the present application, the current time period is the preset time period to which the current moment belongs, and the current moment refers to the moment when the server executes the step of determining the number of requests whose execution time is within the current time period. For each request whose request identifier is added to the first request queue, the execution time must be determined in the manner of this embodiment. Therefore, before the current moment, some requests have already determined the execution time. If the number of requests whose execution time is within the current time period is less than the second threshold, any time within the current time period can be determined as the execution time of the target request. If the number of requests whose execution time is within the current time period is not greater than the second threshold, the execution step can be returned to: determining the number of requests whose execution time is within the current time period.

[0037] For example, assume that each second is taken as a preset time period, the current moment belongs to the first second, and the second threshold is 3. In one case, at the current moment, it is determined that there are 2 requests with execution time within the first second, which is less than the second threshold. Therefore, the current moment can be determined as the execution time of the target request, and then the target request can be executed immediately, or any time within the first second and after the current moment can be determined as the execution time of the target request. In another case, at the current moment, it is determined that there are 3 requests with execution time within the first second, which is not less than the second threshold. Therefore, the step of determining the number of requests with execution time within the current time period can be continued. Until the current moment reaches the second second, the number of requests with execution time within the second second is determined to be 0, which is less than the second threshold. Therefore, any time within the second second can be determined as the execution time of the target request. In this way, the execution frequency of the request can be effectively controlled so that the number of requests executed in each preset time period does not exceed the second threshold.

[0038] In some embodiments, the above steps determine the number of requests whose execution time is within the current time period, including: obtaining each request information in the second request queue; and determining the number of requests whose execution time is within the current time period based on each request information.

[0039] After the above step of determining the time within the current time period as the execution time of the target request, the method further includes: adding the request information of the target request to the second request queue.

[0040] Among them, the request information includes a request identifier and an execution time of the corresponding request. The second request queue includes zero, one or more request information, and each request information corresponds to a request. That is, for any request information, the request identifier in the request information is used to uniquely identify a request, and the execution time in the request information is the execution time of the request. After the server obtains each request information in the second request queue, the number of requests whose execution time is within the current time period can be determined according to the execution time in each request information. For example, the second request queue includes three request information, namely, request information 1 (including request identifier 1 and execution time 1), request information 2 (including request identifier 2 and execution time 2), and request information 3 (including request identifier 3 and execution time 3). Assuming that the current moment belongs to the first second, execution time 1 and execution time 2 both fall within the first second, and execution time 3 falls within the second second, then it can be determined that the number of requests whose execution time is within the current time period is 2. After determining the execution time of the target request, the request information of the target request, that is, the request identifier and execution time of the target request, can be added to the second request queue.

[0041] In some embodiments, the request processing method provided by the present application also includes: when the time length of time that the request information of the target request is added to the second request queue reaches a preset first timeout length, removing the request information of the target request from the second request queue.

[0042] In an embodiment of the present application, in order to prevent the backlog of request information in the second request queue, a corresponding overtime duration can be set for each request information, and then the overtime duration corresponding to the request information of the target request can be used as the first overtime duration, or the same overtime duration can be set for each request information, and the overtime duration can be used as the first overtime duration. In an example, different overtime durations can be set for each type of request according to the type of request, for example, a longer overtime duration can be set for a type of request that takes a long time to execute, and a shorter overtime duration can be set for a type of request that takes a short time to execute. Starting from the moment when the target request information joins the second request queue, when the time when the request information of the target request is added to the second request queue reaches the preset first overtime duration, the request information of the target request can be removed from the second request queue. It should be noted that since the number of requests whose execution time is within the current time period needs to be counted through the second request queue, in order to ensure the accuracy of the number statistics, the first overtime duration can be set to be greater than the duration of the preset time period. For example, each second can be used as a preset time period, that is, the duration of the preset time period is 1 second, based on which, the first timeout duration should be greater than 1 second, for example, the first timeout duration can be 2 seconds. In this way, when counting the number of requests whose execution time is within the current time period, it is possible to avoid missing the request information in the second request queue from being removed.

[0043] In some embodiments, the request processing method provided by the present application further includes: if the first request queue does not meet the preset conditions, the target request is discarded. The preset conditions in the embodiments of the present application can refer to the description above and will not be repeated here. If the first request queue does not meet the preset conditions, it indicates that the server is already working at a high load. At this time, in order to reduce the traffic pressure of the server, the target request can be directly discarded and no longer processed.

[0044] In other embodiments, if the first request queue does not meet the preset condition, the target request may be stored in a database, and then the first request queue is repeatedly judged to see whether it meets the preset condition. When the first request queue meets the preset condition, the target request is taken out of the database, and the step of adding the target request identifier of the target request to the first request queue and subsequent steps are performed. By storing the target request in a database, it is possible to avoid a backlog of a large number of requests consuming too much memory resources.

[0045] In some embodiments, some requests may encounter some conditions during the execution process, causing the request to be unable to be executed for a long time. For example, the request is used to obtain data from a third-party server, but due to problems with the third-party server, the data cannot be obtained. Based on this, the request processing method provided by the present application also includes: when the time the target request identifier is added to the first request queue reaches a preset second timeout period, the target request identifier is removed from the first request queue.

[0046] In an embodiment of the present application, a corresponding timeout period can be set for the request identifier in the first request queue. Specifically, starting from the moment when the target request identifier joins the first request queue, when the time when the target request identifier joins the first request queue reaches a preset second timeout period, the target request identifier is removed from the first request queue. In this way, the possibility of a backlog of request identifiers in the first request queue can be reduced.

[0047] In some embodiments, the request processing method provided by the present application further includes:

[0048] Get configuration information.

[0049] Determine the corresponding target concurrency limit and target request frequency limit based on the time range to which the current moment belongs.

[0050] Use the target concurrency limit as the first threshold.

[0051] A target request frequency limit is used as the second threshold.

[0052] Among them, the configuration information includes multiple time ranges, and the concurrency limit and request frequency limit corresponding to each time range. For example, the administrator of the server can set the configuration information in the configuration file in advance. Among them, the concurrency limit is the maximum concurrency that the server can withstand set by the administrator according to the specific situation of the server, and the request frequency limit is the maximum request frequency specified by the administrator according to the specific business, for example, the maximum frequency of calling a third-party interface specified by a third-party server. It should be understood that in the computer field, there are usually business peaks and business troughs. During the business peak, the number of requests pouring into the server is large, while during the business trough, the number of requests that the server needs to process is small. Therefore, in order to enable the server to avoid the business peak, reduce the backlog of request data in the queue and cause waste of system resources, and obtain more request opportunities during the trough period, so that the request data can be processed more efficiently in a specific period of time, the embodiment of the present application can determine the corresponding target concurrency limit and target request frequency limit according to the time range to which the current moment belongs. The time range can be accurate to minutes, hours or days. For example, each hour can be used as a time range, such as 8:00 to 9:00 is one time range, and 9:00 to 10:00 is another time range. After the server determines the time range to which the current moment belongs, it can use the concurrency limit corresponding to the time range as the target concurrency limit, and the request frequency limit corresponding to the time range as the target request frequency limit. Finally, the target concurrency limit can be used as the first threshold, and the target request frequency limit can be used as the second threshold.

[0053] As can be seen from the above, the request processing method provided by the present application, in the face of a large number of requests influx, will only add the target request identifier of the target request (any request in a large number of requests) to the first request queue when the number of request identifiers in the first request queue is less than the first threshold, thereby limiting the concurrent number of requests of the server at the same time to below the first threshold. Then, based on the policy that the number of requests executed in the same preset time period should be less than the second threshold, the execution time of the target request is set, limiting the frequency of the server executing the request. In this way, the traffic pressure of the server during business peak periods can be reduced.

[0054] Corresponding to the request processing method provided above, the embodiment of the present application also provides a request processing device, which is applied to an electronic device. Figure 3 As shown, the request processing device 300 in the embodiment of the present application includes:

[0055] A first adding module 301 is configured to add a target request identifier of a target request to the first request queue in response to the first request queue satisfying a preset condition, wherein the preset condition is that the number of request identifiers in the first request queue is less than a preset first threshold;

[0056] A first determination module 302 is used to determine the execution time of the target request based on a preset request control strategy after the target request identifier is added to the first request queue, wherein the request control strategy includes that the number of requests executed within the same preset time period is less than a preset second threshold;

[0057] The first removing module 303 is used to remove the target request identifier from the first request queue after executing the target request.

[0058] Optionally, the first determining module 302 includes:

[0059] A first determining unit, configured to determine the number of requests whose execution time is within a current time period, where the current time period is a preset time period to which the current moment belongs;

[0060] a second determining unit, configured to determine the time within the current time period as the execution time of the target request if the number of requests whose execution time is within the current time period is less than the second threshold;

[0061] The return execution unit is used to return to the step of determining the number of requests whose execution time is within the current time period if the number of requests whose execution time is within the current time period is greater than or equal to the second threshold.

[0062] Optionally, the request processing device 300 is further configured to add the request information of the target request to a second request queue.

[0063] Accordingly, the first determining unit includes:

[0064] A first acquisition unit, used to acquire each request information in the second request queue, wherein the request information includes a request identifier and an execution time of the corresponding request;

[0065] The third determining unit is used to determine the number of requests whose execution time is within the current time period according to the above-mentioned request information.

[0066] Optionally, the request processing device 300 is also used to remove the request information of the target request from the second request queue when the time length of time that the request information of the target request is added to the second request queue reaches a preset first time length, wherein the first time length is greater than the time length of the preset time period.

[0067] Optionally, the request processing device 300 is further used to discard the target request if the first request queue does not meet the preset conditions; or, if the first request queue does not meet the preset conditions, repeatedly determine whether the first request queue meets the preset conditions.

[0068] Optionally, the request processing device 300 is further configured to remove the target request identifier from the first request queue when the time duration for which the target request identifier is added to the first request queue reaches a preset second timeout duration.

[0069] Optionally, the request processing device 300 is also used to obtain configuration information, which includes multiple time ranges and a concurrency limit and a request frequency limit corresponding to each time range; determine the corresponding target concurrency limit and target request frequency limit according to the time range to which the current moment belongs; use the target concurrency limit as the first threshold; and use the target request frequency limit as the second threshold.

[0070] As can be seen from the above, the request processing method provided by the present application, in the face of a large number of requests influx, will only add the target request identifier of the target request (any request in a large number of requests) to the first request queue when the number of request identifiers in the first request queue is less than the first threshold, thereby limiting the concurrent number of requests of the server at the same time to below the first threshold. Then, based on the policy that the number of requests executed in the same preset time period should be less than the second threshold, the execution time of the target request is set, limiting the frequency of the server executing the request. In this way, the traffic pressure of the server during business peak periods can be reduced.

[0071] Corresponding to the request processing method provided above, the present application embodiment also provides an electronic device, see Figure 4 The electronic device 4 in the embodiment of the present application includes: a memory 401, one or more processors 402 ( Figure 4 Only one is shown in the figure) and a computer program stored in the memory 401 and executable on the processor. Among them: the memory 401 is used to store software programs and units, and the processor 402 executes various functional applications and data processing by running the software programs and units stored in the memory 401. Specifically, the processor 402 implements the following steps when running the above-mentioned computer program stored in the memory 401:

[0072] In response to the first request queue satisfying a preset condition, adding the target request identifier of the target request to the first request queue, wherein the preset condition is that the number of request identifiers in the first request queue is less than a preset first threshold;

[0073] After the target request identifier is added to the first request queue, determining the execution time of the target request based on a preset request control strategy, wherein the request control strategy includes that the number of requests executed within the same preset time period is less than a preset second threshold;

[0074] When the target request is executed, the target request identifier is removed from the first request queue.

[0075] The electronic device mentioned above may be a desktop computer, a notebook computer, a PDA, a cloud server or other computing device and server.

[0076] It should be understood that in the embodiment of the present application, the processor 402 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0077] The memory 401 may include a read-only memory and a random access memory, and provide instructions and data to the processor 402. A part or all of the memory 401 may also include a non-volatile random access memory. For example, the memory 401 may also store information of a device category.

[0078] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0079] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0080] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of external device software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0081] In the 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 system embodiments described above are merely schematic. For example, the division of the above modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components 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 units, which can be electrical, mechanical or other forms.

[0082] The units described above as separate components may or may not be physically separated, and the components shown as units 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 units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0083] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the associated hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The above-mentioned computer-readable storage medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer-readable memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the above-mentioned computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media does not include electrical carrier signals and telecommunication signals.

[0084] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. 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 make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A request processing method, characterized in that: include: In response to the first request queue satisfying a preset condition, adding the target request identifier of the target request to the first request queue, wherein the preset condition is that the number of request identifiers in the first request queue is less than a preset first threshold; After the target request identifier is added to the first request queue, determining the execution time of the target request based on a preset request control strategy, wherein the request control strategy includes that the number of requests executed within the same preset time period is less than a preset second threshold; Add the request information of the target request to a second request queue; when the time duration of the request information of the target request being added to the second request queue reaches a preset first overtime duration, remove the request information of the target request from the second request queue, wherein the first overtime duration is greater than the duration of the preset time period; the first overtime duration is determined based on the type of the target request; When the target request is executed, the target request identifier is removed from the first request queue.

2. The request processing method according to claim 1, characterized in that: The determining the execution time of the target request based on a preset request control strategy includes: Determine the number of requests whose execution time is within a current time period, where the current time period is a preset time period to which the current moment belongs; If the number of requests whose execution time is within the current time period is less than the second threshold, determining the time within the current time period as the execution time of the target request; If the number of requests whose execution time is within the current time period is greater than or equal to the second threshold, the method returns to the step of determining the number of requests whose execution time is within the current time period.

3. The request processing method according to claim 2, characterized in that: The determining the number of requests whose execution times are within the current time period includes: Acquire each request information in the second request queue, wherein the request information includes a request identifier and an execution time of the corresponding request; The number of requests whose execution times are within the current time period is determined according to the respective request information.

4. The request processing method according to claim 1, characterized in that: The request processing method further includes: If the first request queue does not meet the preset condition, discarding the target request; Alternatively, if the first request queue does not meet the preset condition, it is repeatedly determined whether the first request queue meets the preset condition.

5. The request processing method according to claim 1, characterized in that: The request processing method further includes: When the time duration that the target request identifier is added to the first request queue reaches a preset second timeout duration, the target request identifier is removed from the first request queue.

6. The request processing method according to claim 1, characterized in that: The request processing method further includes: Obtain configuration information, where the configuration information includes multiple time ranges, and a concurrency limit and a request frequency limit corresponding to each time range; Determine the corresponding target concurrency limit and target request frequency limit based on the time range of the current moment; Taking the target concurrent volume limit as the first threshold; The target request frequency limit is used as the second threshold.

7. A request processing device, characterized in that: include: A first adding module, configured to add a target request identifier of a target request to the first request queue in response to the first request queue satisfying a preset condition, wherein the preset condition is that the number of request identifiers in the first request queue is less than a preset first threshold; A first determination module, configured to determine, after the target request identifier is added to the first request queue, an execution time of the target request based on a preset request control strategy, wherein the request control strategy includes that the number of requests executed within the same preset time period is less than a preset second threshold; The first determining module is further configured to add the request information of the target request to a second request queue; A first removal module, configured to remove the request information of the target request from the second request queue when the time duration for which the request information of the target request is added to the second request queue reaches a preset first overtime duration, wherein the first overtime duration is greater than the duration of the preset time period; The first removing module is further configured to remove the target request identifier from the first request queue when the target request is executed.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Traffic access control method and device, electronic equipment and storage medium

    CN112804300A

  • Data operation method and device, electronic equipment and computer readable medium

    CN113760991A