Server and delay processing method
By determining the time interval based on the load parameters on the server side and controlling the retry frequency of the terminal device, the problem of excessive server load and slow request processing speed in the Internet TV industry is solved, and the user experience is improved.
Patent Information
- Application Number
- CN202311132681.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2024-10-22
AI Technical Summary
In the Internet TV industry, terminal devices need to obtain a large amount of resources from the server when starting up, causing the server load to be too high and triggering an avalanche effect; the traditional retry backoff mechanism may cause slow request processing when the server load is not large, affecting the user experience. .
The server obtains the load parameters by receiving the request from the terminal device. When the load parameter is greater than or equal to the threshold, it determines the corresponding time interval, carries the time interval information in the response message, and requires the terminal device to resend the request after a delay to avoid The problem of slow request processing when the server load is too high.
It effectively improves the server's processing speed of terminal device requests, reduces delays, improves user experience, and ensures that terminal devices complete processing services in a shorter period of time.
Smart Images

Figure CN118828067A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of Internet technology, and more specifically, to a server and a delay processing method. Background Art
[0002] In the Internet TV industry, after the terminal device is turned on, it needs to obtain a large amount of resources from the server in order to work properly. In many business scenarios, a large number of terminal devices will initiate a very high number of resource access requests to the server in a short period of time, which will cause the server to be overloaded and cause an avalanche effect.
[0003] In order to solve the above problems, the traditional solution is that for a request, if the current request fails, the terminal device will start a retry backoff mechanism. The specific retry backoff mechanism is to re-initiate a request to the server after an exponential delay.
[0004] However, although the above-mentioned retry backoff mechanism can effectively reduce the load pressure of the server in a short period of time, when the load pressure of the server itself is not particularly large, it may cause the server to process the request of the terminal device slowly, resulting in the terminal device taking a long time to complete the service processing, and the user experience is poor. Summary of the invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present application provide a server and a delay processing method, which can avoid the problem of slow processing speed of the server for requests from terminal devices when the load pressure of the server itself is not particularly large.
[0006] In a first aspect, an embodiment of the present application provides a server, the server comprising:
[0007] The communicator is configured to: receive a target request sent by a terminal device;
[0008] The controller is configured to: obtain a target load parameter of a server based on a target request; determine a first time interval based on the target load parameter when the target load parameter is greater than or equal to a parameter threshold, the first time interval being positively correlated with the target load parameter; determine the first time interval as a target time interval; and return a response message corresponding to the target request to a terminal device, the response message carrying target information including a target time interval, so that after receiving the response message, the terminal device sends the next request to the server after a delay of the target time interval.
[0009] In a second aspect, an embodiment of the present application provides a delay processing method, which is applied to a server, and the method includes:
[0010] Receive a target request sent by a terminal device; based on the target request, obtain a target load parameter of the server; when the target load parameter is greater than or equal to a parameter threshold, determine a first time interval based on the target load parameter, the first time interval being positively correlated with the target load parameter; determine the first time interval as the target time interval; return a response message corresponding to the target request to the terminal device, the response message carries target information, and the target information includes a target time interval, so that after receiving the response message, the terminal device sends the next request to the server after a delay of the target time interval.
[0011] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, including: a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the delay processing method shown in the second aspect is implemented.
[0012] In a fourth aspect, an embodiment of the present application provides a computer program product, including: when the computer program product runs on a computer, the computer implements the delay processing method shown in the second aspect.
[0013] The technical solution provided by the embodiment of the present application has the following advantages over the prior art: In the embodiment of the present application, the server includes: a communicator configured to: receive a target request sent by a terminal device; a controller configured to: obtain a target load parameter of the server based on the target request; when the target load parameter is greater than or equal to a parameter threshold, determine a first time interval based on the target load parameter, the first time interval is positively correlated with the target load parameter; determine the first time interval as the target time interval; return a response message corresponding to the target request to the terminal device, the response message carries target information, the target information includes the target time interval, so that the terminal device sends the next request to the server after delaying the target time interval after receiving the response message. In this solution, the server receives a target request sent by a terminal device, obtains the target load parameter of the server based on the target request; when the target load parameter is greater than or equal to a parameter threshold, determine a first time interval based on the target load parameter, the first time interval is positively correlated with the target load parameter; determine the first time interval as the target time interval; return a response message corresponding to the target request to the terminal device, the response message carries target information, the target information includes the target time interval, so that the terminal device sends the next request to the server after delaying the target time interval after receiving the response message. In this way, the time interval is determined based on the load on the server side, thereby avoiding the problem of slow processing of requests from the server to the terminal device caused by the retry backoff mechanism when the load pressure on the server itself is not particularly large. The server's processing speed for requests sent by the terminal device is improved, allowing the terminal device to complete business processing in a shorter time, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the implementation methods in the embodiments of the present application or the related technologies, the following is a brief introduction to the drawings required for use in the embodiments or the related technology descriptions. Obviously, the drawings described below are some embodiments of the present application, and a person skilled in the art can also obtain other drawings based on these drawings.
[0015] Figure 1 An operation scenario between a terminal device and a control device according to some embodiments is shown;
[0016] Figure 2 shows a hardware configuration block diagram of a control device 100 according to some embodiments;
[0017] Figure 3 shows a hardware configuration block diagram of a terminal device 200 according to some embodiments;
[0018] Figure 4 shows a software configuration diagram in a terminal device 200 according to some embodiments;
[0019] Figure 5 One of the flowcharts of the delay processing method according to some embodiments is shown;
[0020] Figure 6 A second flowchart of a delay processing method according to some embodiments is shown;
[0021] Figure 7 A third schematic diagram showing the process of the delay processing method according to some embodiments;
[0022] Figure 8 A fourth flowchart of a delay processing method according to some embodiments is shown;
[0023] Fig. 9 FIG5 shows a fifth flow chart of a delay processing method according to some embodiments;
[0024] Fig.10 FIG6 shows a sixth flow chart of a delay processing method according to some embodiments;
[0025] Fig.11 FIG7 shows a seventh flow chart of a delay processing method according to some embodiments;
[0026] Fig.12 FIG8 shows an eighth flow chart of a delay processing method according to some embodiments;
[0027] Fig.13 FIG9 shows a ninth flow chart of a delay processing method according to some embodiments;
[0028] Fig.14 FIG10 shows a flowchart of a delay processing method according to some embodiments;
[0029] Fig.15 FIG11 shows a flow chart of a delay processing method according to some embodiments;
[0030] Fig.16 FIG. 12 shows a flowchart of a delay processing method according to some embodiments. DETAILED DESCRIPTION
[0031] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0032] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0033] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.
[0034] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0035] The terminal device provided in the embodiments of the present application may have various implementation forms, for example, it may be a television, a smart television, a laser projection device, a monitor, an electronic bulletin board, an electronic table, a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, etc.
[0036] Figure 1 FIG. 1 is a schematic diagram of an operation scenario between a terminal device and a control device according to an embodiment, wherein the control device includes an intelligent device or a control apparatus. Figure 1 As shown, the user can operate the terminal device 200 through the smart device 300 or the control apparatus 100 .
[0037] In some embodiments, the control device 100 may be a remote controller, and the communication between the remote controller and the terminal device includes infrared protocol communication or Bluetooth protocol communication, and other short-range communication methods, and the terminal device 200 is controlled wirelessly or wired. The user can input user commands through buttons on the remote controller, voice input, control panel input, etc. to control the terminal device 200.
[0038] In some embodiments, a smart device 300 (such as a mobile terminal, a tablet computer, a computer, a laptop computer, etc.) may also be used to control the terminal device 200. For example, the terminal device 200 is controlled using an application running on the smart device.
[0039] In some embodiments, the terminal device may not use the above-mentioned smart device or control device to receive instructions, but may receive user control through touch or gestures.
[0040] In some embodiments, the terminal device 200 can also be controlled in a manner other than the control device 100 and the smart device 300. For example, the user's voice command control can be directly received through a module for obtaining voice commands configured inside the terminal device 200, or the user's voice command control can be received through a voice control device set outside the terminal device 200.
[0041] In some embodiments, the terminal device 200 also communicates data with the server 400. The terminal device 200 may be allowed to communicate via a local area network (LAN), a wireless local area network (WLAN), and other networks. The server 400 may provide various content and interactions to the terminal device 200. The server 400 may be a cluster or multiple clusters, and may include one or more types of servers.
[0042] Figure 2 Schematically shows a block diagram of a configuration of the control device 100 according to an exemplary embodiment. Figure 2 As shown, the control device 100 includes a controller 110, a communication interface 130, a user input / output interface 140, an external memory, and a power supply. The control device 100 can receive input operation instructions from the user, and convert the operation instructions into instructions that the terminal device 200 can recognize and respond to, playing the role of an interactive intermediary between the user and the terminal device 200.
[0043] like Figure 3 The terminal device 200 includes at least one of a tuner and demodulator 210, a communicator 220, a detector 230, an external device interface 240, a controller 250, a display 260, an audio output interface 270, a user interface 280, an external memory, and a power supply.
[0044] In some embodiments, the controller includes a processor, a video processor, an audio processor, a graphics processor, a RAM, a ROM, and a first interface to an nth interface for input / output.
[0045] The display 260 includes a display screen component for presenting images, and a driving component for driving image display, which is used to receive image signals output from the controller, and display video content, image content, and menu control interface components and user control UI interface.
[0046] The display 260 may be a liquid crystal display, an OLED display, or a projection display, and may also be a projection device and a projection screen.
[0047] The communicator 220 is a component for communicating with an external device or server according to various communication protocol types. For example, the communicator may include at least one of a Wifi module, a Bluetooth module, a wired Ethernet module, and other network communication protocol chips or near field communication protocol chips, and an infrared receiver. The terminal device 200 can establish transmission and reception of control signals and data signals with the external control device 100 or the server 400 through the communicator 220.
[0048] The user interface 280 can be used to receive control signals from the control device 100 (such as an infrared remote controller, etc.). It can also be used to directly receive user input operation instructions and convert the operation instructions into instructions that the terminal device 200 can recognize and respond to. In this case, it can be called a user input interface.
[0049] The detector 230 is used to collect signals from the external environment or the external interaction. For example, the detector 230 includes a light receiver, a sensor for collecting the intensity of ambient light; or, the detector 230 includes an image collector, such as a camera, which can be used to collect external environment scenes, user attributes or user interaction gestures; or, the detector 230 includes a sound collector, such as a microphone, etc., for receiving external sounds.
[0050] The external device interface 240 may include, but is not limited to, any one or more of the following interfaces: a high-definition multimedia interface (HDMI), an analog or digital high-definition component input interface (component), a composite video input interface (CVBS), a USB input interface (USB), an RGB port, etc. It may also be a composite input / output interface formed by the above multiple interfaces.
[0051] The tuner-demodulator 210 receives broadcast television signals via wired or wireless reception, and demodulates audio and video signals, such as EPG data signals, from a plurality of wireless or wired broadcast television signals.
[0052] In some embodiments, the controller 250 and the tuner-demodulator 210 may be located in different separate devices, that is, the tuner-demodulator 210 may also be located in an external device of the main device where the controller 250 is located, such as an external set-top box.
[0053] The controller 250 controls the operation of the terminal device and responds to the user's operation through various software control programs stored in the memory (internal memory or external memory). The controller 250 controls the overall operation of the terminal device 200. For example, in response to receiving a user command for selecting a UI object to be displayed on the display 260, the controller 250 can perform an operation related to the object selected by the user command.
[0054] In some embodiments, the controller includes a central processing unit (CPU), a video processor, an audio processor, a graphics processing unit (GPU), and at least one of a random access memory (RAM), a read-only memory (ROM), a first interface to an nth interface for input / output, a communication bus, etc.
[0055] Among them, RAM, also called main memory, is an internal memory that directly exchanges data with the controller. It can be read and written at any time (except when refreshed), and it is very fast. It is usually used as a temporary data storage medium for operating systems or other running programs. The biggest difference between it and ROM is the volatility of data, that is, once the power is cut off, the stored data will be lost. RAM is used in computers and digital systems to temporarily store programs, data and intermediate results. ROM works in a non-destructive read-out mode and can only read but not write information. Once the information is written, it is fixed, and even if the power is cut off, the information will not be lost, so it is also called fixed memory.
[0056] The user may input a user command through a graphical user interface (GUI) displayed on the display 260, and the user input interface receives the user input command through the graphical user interface (GUI). Alternatively, the user may input a user command through a specific sound or gesture, and the user input interface recognizes the sound or gesture through a sensor to receive the user input command.
[0057] "User interface" is the medium interface for interaction and information exchange between applications or operating systems and users. It realizes the conversion between the internal form of information and the form acceptable to users. The commonly used form of user interface is the Graphical User Interface (GUI), which refers to the user interface related to computer operation displayed in a graphical way. It can be an icon, window, control or other interface element displayed on the display screen of a terminal device, where the control can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets and other visual interface elements.
[0058] like Figure 4 As shown, Figure 4 FIG. 1 is a schematic diagram of software configuration in a terminal device 200 according to one or more embodiments of the present disclosure. Figure 4 As shown in FIG. 1 , the system is divided into four layers, from top to bottom, namely, the application layer (Applications) (referred to as the "application layer"), the application framework layer (Application Framework) (referred to as the "framework layer"), the Android runtime (Androidruntime) and the system library layer (referred to as the "system runtime library layer"), and the kernel layer. The kernel layer includes at least one of the following drivers: audio driver, display driver, Bluetooth driver, camera driver, WIFI driver, USB driver, HDMI driver, sensor driver (such as fingerprint sensor, temperature sensor, pressure sensor, etc.), and power driver, etc.
[0059] When the terminal device 200 is started, multiple threads will be started in order to display the home page content of the user interface as quickly as possible, and some threads will send requests to the server to obtain the required data from the server. Among them, some of these requests have dependencies, and some do not. For those with dependencies, the request will not be started until the dependent request returns the result. Requests that do not have dependencies will be made in parallel. In many scenarios, for example, a large number of terminal devices are started at the same time in a short period of time, or the terminal devices are started repeatedly, and the server receives a large number of requests from the terminal devices in a short period of time, resulting in excessive load on the server, causing an avalanche effect.
[0060] In order to solve the above technical problems, a traditional solution is: for a request, if the current request fails, the terminal device will start a retry backoff mechanism. The specific retry backoff mechanism is to re-initiate a request to the server after an exponential delay.
[0061] However, although the above-mentioned retry backoff mechanism can effectively reduce the load pressure of the server in a short period of time, when the load pressure of the server itself is not particularly large, it may cause the server to process the request of the terminal device slowly, resulting in the terminal device taking a long time to complete the service processing, and the user experience is poor.
[0062] In response to the above technical problems, an embodiment of the present application provides a server, wherein the server can implement the delay processing method provided by the embodiment of the present application or the functional module or functional entity in the server can implement the delay processing method provided by the embodiment of the present application.
[0063] The server provided in the embodiment of the present application includes:
[0064] The communicator is configured to: receive a target request sent by a terminal device;
[0065] The controller is configured to: obtain a target load parameter of a server based on a target request; determine a first time interval based on the target load parameter when the target load parameter is greater than or equal to a parameter threshold, the first time interval being positively correlated with the target load parameter; determine the first time interval as a target time interval; and return a response message corresponding to the target request to a terminal device, the response message carrying target information including a target time interval, so that after receiving the response message, the terminal device sends the next request to the server after a delay of the target time interval.
[0066] In an embodiment of the present application, the server receives a target request sent by a terminal device, and based on the target request, obtains the target load parameter of the server; when the target load parameter is greater than or equal to the parameter threshold, determines a first time interval based on the target load parameter, and the first time interval is positively correlated with the target load parameter; determines the first time interval as the target time interval; returns a response message corresponding to the target request to the terminal device, the response message carries target information, and the target information includes the target time interval, so that after receiving the response message, the terminal device sends the next request to the server after a delay of the target time interval. In this way, the time interval is determined based on the load on the server side, thereby avoiding the problem of the server's slow processing speed of the request to the terminal device caused by the retry backoff mechanism when the load pressure of the server itself is not particularly large, and improving the server's processing speed of the request sent by the terminal device, so that the terminal device can complete the processing of the service in a shorter time, thereby improving the user experience.
[0067] In some embodiments of the present application, the target load parameter is the target load occupancy rate of the current system moment, the parameter threshold is the occupancy rate threshold, and the target load occupancy rate is determined according to at least one of the following: the current CPU (Central Processing Unit) occupancy rate, the current memory occupancy rate, and the current network resource occupancy rate; the controller is specifically configured as follows:
[0068] When the target load occupancy rate is greater than or equal to the occupancy rate threshold, the first time interval is determined based on a first formula, where the first formula is:
[0069]
[0070] Among them, d is the first time interval when the load occupancy is x, d1 is the time interval when the load occupancy is m1, d2 is the time interval when the load occupancy is m2, among which x is the target load occupancy, m1 is the occupancy threshold, m2 is the maximum occupancy, m2 is greater than m1, and d2 is greater than d1.
[0071] In an embodiment of the present application, the server receives a target request sent by a terminal device, and based on the target request, obtains the target load occupancy rate of the server at the current system moment; when the target load occupancy rate is greater than or equal to the occupancy rate threshold, determines a first time interval based on a first formula, and the first time interval is positively correlated with the target load occupancy rate at the current system moment; determines the first time interval as the target time interval; returns a response message corresponding to the target request to the terminal device, the response message carries target information, and the target information includes the target time interval, so that the terminal device sends the next request to the server after delaying the target time interval after receiving the response message. In this way, the time interval is determined based on the target load occupancy rate of the server at the current system moment, thereby avoiding the problem of the server's slow processing speed of the request to the terminal device caused by the retry backoff mechanism when the load pressure of the server itself is not particularly large, and improving the server's processing speed of the request sent by the terminal device, so that the terminal device can complete the processing of the service in a shorter time, thereby improving the user experience.
[0072] In some embodiments of the present application, the controller is specifically configured to: when the target load occupancy rate is greater than or equal to an occupancy rate threshold, obtain a first device quantity, where the first device quantity is the number of devices corresponding to the service requests received by the server within a first preset time period; when the first device quantity is less than the first quantity threshold, determine the first time interval based on a first formula.
[0073] In some embodiments of the present application, the controller is specifically configured to: take a first preset time duration as an observation period, and determine the number of devices corresponding to the service requests received by the server within the first preset time duration at intervals of the first preset time duration; determine the number of devices corresponding to the service requests received by the server within the most recent observation period as the first number of devices.
[0074] In the embodiment of the present application, the first preset duration is used as the observation period, and the number of devices corresponding to the service requests received by the server within the first preset duration is determined every first preset duration; the number of devices corresponding to the service requests received by the server within the most recent observation period is determined as the first number of devices. In this way, the number of devices corresponding to the service requests received by the server within the first preset duration is determined once every first preset duration, so that the frequency of calculating the number of devices can be reduced, thereby reducing the load on the server caused by the calculation of the number of devices.
[0075] In some embodiments of the present application, the first number of devices is the number of devices corresponding to the service requests received by the server within a first preset time period before the current system time.
[0076] In some embodiments of the application, the controller is specifically configured to: obtain the first system time corresponding to the last request sent by N terminal devices; determine the first number of system times corresponding to the last service request sent by N terminal devices within a first preset time period before the current system time, and determine the first number as the first device number.
[0077] Exemplarily, if the system times of the last service request sent to the server by N terminal devices (terminal device 1, terminal device 2, terminal device 3...terminal device n) are T1, T2, T3...Tn respectively; when the communicator receives the target request sent by terminal device 3, the current system time T3' is recorded; the system time T3 corresponding to the last service request sent to the server by terminal device 3 is updated to T3'; the first number of T1, T2, T3'...Tn within the first preset time length T before T3' is determined, that is, the first number of T1, T2, T3'...Tn between T3'-T and T3' is determined, and the first number is determined as the first number of devices. For example, if T1, T2, T3'...Tn are between T3'-T and T3', there are T3', Tn and T2, then the first number of devices is equal to 3.
[0078] In the embodiment of the present application, the first system time corresponding to the last request sent by N terminal devices is obtained; the first number of the system time corresponding to the last service request sent by the N terminal devices is determined within the first preset time before the current system time, and the first number is determined as the first device number. In this way, starting from the current time, the number of devices corresponding to the service request received by the server within the first preset time before the current system time is determined; in this way, the determined first device number can more accurately reflect the device load status of the server at the current system time.
[0079] In an embodiment of the present application, the controller is specifically configured to: when the target load occupancy rate is greater than or equal to the occupancy rate threshold, obtain the first number of devices, the first number of devices being the number of devices corresponding to the service request received by the server within the first preset time length; when the first number of devices is less than the first number threshold, determine the first time interval based on the first formula. It should be understood that when the first number of devices is less than the first number threshold, it means that a large number of devices may not be started at the same time in a short period of time, causing the target load occupancy rate to be greater than or equal to the occupancy rate threshold. In this way, the first time interval is determined based on the first formula when the reason for excluding the target load occupancy rate being greater than or equal to the occupancy rate threshold is: when a large number of devices are started at the same time in a short period of time. In this way, the first time interval obtained is closer to the request interval time required by the server, thereby avoiding the problem of the server's slow processing speed of the request to the terminal device caused by the retry backoff mechanism when the load pressure of the server itself is not particularly large, and improving the server's processing speed of the request sent by the terminal device, so that the terminal device completes the processing business in a shorter time, and improves the user experience.
[0080] In some embodiments of the present application, the controller is further configured to: after obtaining the first device quantity, when the first device quantity is greater than or equal to the first quantity threshold, determine the second time interval based on the second formula; determine the second time interval as the target time interval; the second time interval is greater than the time interval determined based on the first formula when the load occupancy rate is the target load occupancy rate.
[0081] Among them, the second formula is:
[0082]
[0083] Wherein, c is the second time interval, y is the first device quantity, b is the first quantity threshold, and k is a constant greater than 0.
[0084] In an embodiment of the present application, the controller is specifically configured to: after obtaining the number of first devices, when the number of first devices is greater than or equal to the first number threshold, determine the second time interval based on the second formula; and determine the second time interval as the target time interval. It should be understood that when the number of first devices is greater than or equal to the first number threshold, it may be explained that a large number of devices are started at the same time in a short period of time, causing the target load occupancy rate to be greater than or equal to the occupancy threshold. In this way, the reason for determining that the target load occupancy rate is greater than or equal to the occupancy threshold is: when a large number of devices are started at the same time in a short period of time, determine the second time interval based on the second formula; and determine the second time interval as the target time interval. In this way, the target time interval obtained is closer to the request interval required by the server, thereby avoiding the problem of the slow processing speed of the server's request to the terminal device caused by the retry backoff mechanism when the load pressure of the server itself is not particularly large, and improving the server's processing speed of the request sent by the terminal device, so that the terminal device completes the processing business in a shorter time, and improves the user experience.
[0085] In some embodiments of the present application, the controller is specifically configured to: obtain a target device ID (Identity) of the terminal device and a target Uniform Resource Locator URL (Uniform Resource Locator) corresponding to a target request when the number of first devices is less than a first number threshold; determine a first time interval based on a first formula when the target device ID is different from a device ID corresponding to any request received by the server within a second preset time period, and / or the target URL is different from a URL corresponding to any request received by the server within a second preset time period.
[0086] In the embodiment of the present application, the controller is specifically configured to: when the number of the first devices is less than the first number threshold, obtain the target device id of the terminal device and the target uniform resource locator URL corresponding to the target request; when the target device id is different from the device id corresponding to any request received by the server within the second preset time period, and / or the target URL is different from the URL corresponding to any request received by the server within the second preset time period, determine the first time interval based on the first formula. It should be understood that when the target device id is different from the device id corresponding to any request received by the server within the second preset time period, and / or the target URL is different from the URL corresponding to any request received by the server within the second preset time period, it means that the target load occupancy rate may not be greater than or equal to the occupancy rate threshold due to repeated startup of the terminal device. In this way, when the reason for excluding the target load occupancy rate being greater than or equal to the occupancy rate threshold is: the terminal device is repeatedly started and a large number of devices are started simultaneously in a short period of time, the first time interval is determined based on the first formula. In this way, the first time interval obtained is closer to the request interval time required by the server, thereby avoiding the problem of slow processing speed of the server for requests from terminal devices caused by the retry backoff mechanism when the load pressure on the server itself is not particularly large. The server's processing speed for requests sent by the terminal device is improved, and the terminal device completes the service processing in a shorter time, thereby improving the user experience.
[0087] In some embodiments of the present application, the controller is further configured to: after obtaining the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request, determine a third time interval based on a third formula when the target device ID is the same as the device ID corresponding to the first request received by the server within a second preset time period, and the target URL is the same as the URL corresponding to the first request; determine the third time interval as the target time interval; the third time interval is greater than the time interval determined based on the first formula when the load occupancy rate is the target load occupancy rate.
[0088] Among them, the third formula is:
[0089] t = t1 + t0 - t2 + 1;
[0090] Wherein, t is the third time interval, t1 is the current system time, t0 is the second preset duration, and t2 is the system time when the server receives the first request.
[0091] In an embodiment of the present application, the controller is specifically configured to: after obtaining the target device id of the terminal device and the target uniform resource locator URL corresponding to the target request, when the target device id is the same as the device id corresponding to the first request received by the server within the second preset time period, and the target URL is the same as the URL corresponding to the first request, determine the third time interval based on the third formula; and determine the third time interval as the target time interval. It should be understood that when the target device id is the same as the device id corresponding to the first request received by the server within the second preset time period, and the target URL is the same as the URL corresponding to the first request, it means that the terminal device may be repeatedly started, causing the target load occupancy rate to be greater than or equal to the occupancy rate threshold. In this way, when determining that the target load occupancy rate is greater than or equal to the occupancy rate threshold, the reason is: when the terminal device is repeatedly started, determine the third time interval based on the third formula; and determine the third time interval as the target time interval. In this way, the target time interval obtained is closer to the request interval required by the server, thereby avoiding the problem of the server's slow processing speed of the request to the terminal device caused by the retry backoff mechanism when the load pressure of the server itself is not particularly large, and improving the server's processing speed of the request sent by the terminal device, so that the terminal device completes the processing business in a shorter time, and improves the user experience.
[0092] In some embodiments of the present application, the third formula is:
[0093] t=(t1+t0-t2+1)(x-m1)
[0094] Among them, t is the third time interval, t1 is the current system time, t0 is the second preset duration, t2 is the system time when the server receives the first request, x is the target load occupancy rate, and m1 is the occupancy rate threshold.
[0095] In some embodiments of the present application, the controller is further configured to: after obtaining the target load parameters of the server based on the target request, when the target load occupancy rate is less than the occupancy rate threshold, obtain the second number of devices, the second number of devices being the number of devices corresponding to the service requests received by the server within a third preset time period; when the second number of devices is greater than or equal to the second number threshold, determine a fourth time interval based on a fourth formula; determine the fourth time interval as the target time interval; the fourth time interval is less than d1.
[0096] Among them, the fourth formula is:
[0097]
[0098] Wherein, c′ is the fourth time interval, y′ is the second device quantity, b′ is the second quantity threshold, and k′ is a constant greater than 0.
[0099] The process of determining the number of the second devices may refer to the process of determining the number of the first devices in the above embodiment, which will not be described in detail here.
[0100] In an embodiment of the present application, the controller is specifically configured as follows: after obtaining the target load parameter of the server based on the target request, when the target load occupancy rate is less than the occupancy rate threshold, obtaining the second device number, the second device number being the number of devices corresponding to the service request received by the server within the third preset time length; when the second device number is greater than or equal to the second number threshold, determining the fourth time interval based on the fourth formula; and determining the fourth time interval as the target time interval. It should be understood that, under normal circumstances, the second device number is less than the second number threshold, and when the second device number is greater than or equal to the second number threshold, it indicates that there may be an abnormality on the terminal device side, for example, a large number of terminal devices are started at the same time in a short period of time. In order to avoid an abnormality on the terminal device side, which causes an excessively high load on the server and thus causes an avalanche effect, it is necessary to delay the time for the terminal device side to send the request in advance when an abnormality is detected on the terminal device side, so as to avoid an avalanche effect on the server. Therefore, this solution can prevent the server from being overloaded in advance when an abnormality occurs on the terminal device side.
[0101] In some embodiments of the present application, the target load parameter is the number of third devices, the parameter threshold is the third number threshold, and the third number of devices is the number of devices corresponding to the service request received by the server within a fourth preset time period; the controller is specifically configured to: when the number of third devices is greater than or equal to the third number threshold, determine the first time interval based on the fifth formula, and the fifth formula is:
[0102]
[0103] Wherein, c″ is the first time interval, y″ is the third number of devices, b″ is the third number threshold, and k″ is a constant greater than 0.
[0104] The process of determining the number of the third devices may refer to the process of determining the number of the first devices in the above embodiment, which will not be described in detail here.
[0105] In some embodiments of the present application, the controller is further configured to: after obtaining the target load parameter of the server based on the target request, when the target load parameter is less than the parameter threshold, obtain the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request; when the target device ID is the same as the device ID corresponding to the second request received by the server within the fifth preset time period, and the target URL is the same as the URL corresponding to the second request, determine the fifth time interval based on the sixth formula; determine the fifth time interval as the target time interval; the fifth time interval is less than the time interval when the target load parameter is the parameter threshold.
[0106] Among them, the sixth formula is:
[0107] t′=t′1+t′0-t′2+1
[0108] Wherein, t′ is the fifth time interval, t′1 is the current system time, t′0 is the fifth preset duration, and t′2 is the system time when the server receives the second request.
[0109] In the embodiment of the present application, the controller is further configured to: after obtaining the target load parameter of the server based on the target request, when the target load occupancy rate is less than the occupancy rate threshold, obtain the target device id of the terminal device and the target uniform resource locator URL corresponding to the target request; when the target device id is the same as the device id corresponding to the second request received by the server within the fifth preset time period, and the target URL is the same as the URL corresponding to the second request, determine the fifth time interval based on the sixth formula; and determine the fifth time interval as the target time interval. It should be understood that the target device id corresponding to the target request received by the server is the same as the device id corresponding to the second request, and the target URL is different from the URL corresponding to the second request, indicating that they are different requests sent by the same device; the target device id corresponding to the target request received by the server is different from the device id corresponding to the second request, and the target URL is the same as the URL corresponding to the second request, indicating that they are the same request sent by different devices; the target device id corresponding to the target request received by the server is different from the device id corresponding to the second request, and the target URL is different from the URL corresponding to the second request, indicating that they are different requests sent by different devices. When the terminal device is started normally, the above three situations are normal. However, if the target device ID corresponding to the target request received by the server is the same as the device ID corresponding to the second request, and the target URL is the same as the URL corresponding to the second request, it means that the terminal device is abnormal and there may be a situation where the terminal device is repeatedly started. In order to avoid abnormalities on the terminal device side, which leads to excessive load on the server and causes an avalanche effect, it is necessary to delay the time for the terminal device to send the request in advance when an abnormality is detected on the terminal device side to avoid an avalanche effect on the server. Therefore, this solution can prevent abnormal conditions on the terminal device side from causing excessive load on the server in advance.
[0110] In some embodiments of the present application, the controller is further configured to:
[0111] Based on the target request, obtain the target load occupancy rate of the server at the current system moment, the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request, and the fifth device quantity, where the fifth device quantity is the number of devices corresponding to the service request received by the server within an eighth preset time period before the current system moment;
[0112] When the target load occupancy rate is less than the occupancy rate threshold, the seventh time interval is determined to be equal to 0; when the target load occupancy rate is greater than or equal to the occupancy rate threshold, the seventh time interval is determined based on the eighth formula.
[0113] Among them, the eighth formula is:
[0114]
[0115] Among them, d′ is the seventh time interval when the load occupancy is x′, d′1 is the time interval when the load occupancy is m′1, and d′2 is the time interval when the load occupancy is m′2, wherein x′ is the target load occupancy, m′1 is the occupancy threshold, m′2 is the maximum occupancy, m′2 is greater than m′1, and d′2 is greater than d′1.
[0116] When the target device id is different from the device id corresponding to any request received by the server within the ninth preset time period, and / or the target URL is different from the URL corresponding to any request received by the server within the ninth preset time period, the eighth time interval is determined to be equal to 0; when the target device id is the same as the device id corresponding to the fourth request received by the server within the ninth preset time period, and the target URL is the same as the URL corresponding to the fourth request, the eighth time interval is determined based on the ninth formula.
[0117] Among them, the ninth formula is:
[0118] t′′′=t′′′1′+t′′′0-t′′′2+1;
[0119] Among them, t''' is the eighth time interval, t'''1 is the current system time, t'''0 is the ninth preset duration, and t'''2 is the system time when the server receives the fourth request.
[0120] When the number of the fifth devices is less than the fifth number threshold, the ninth time interval is determined to be equal to 0; when the number of the fifth devices is greater than or equal to the fifth number threshold, the ninth time interval is determined based on the tenth formula.
[0121] Among them, the tenth formula is:
[0122]
[0123] Wherein, c''' is the ninth time interval, y''' is the fifth number of devices, b''' is the fifth number threshold, and k''' is a constant greater than 0.
[0124] Based on the seventh time interval, the eighth time interval, and the ninth time interval, a target time interval is determined.
[0125] In some embodiments of the present application, when the seventh time interval, the eighth time interval, and the ninth time interval are all not equal to 0, any one of the seventh time interval, the eighth time interval, and the ninth time interval is determined as the target time interval.
[0126] In some embodiments of the present application, the time interval with the largest value among the seventh time interval, the eighth time interval and the ninth time interval is determined as the target time interval.
[0127] In some embodiments of the present application, an average value of the seventh time interval, the eighth time interval, and the ninth time interval is determined as the target time interval.
[0128] In some embodiments of the present application, the controller is further configured to:
[0129] When the target load occupancy rate is greater than or equal to the occupancy rate threshold, the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request, as well as the sixth device quantity are obtained. The sixth device quantity is the number of devices corresponding to the service request received by the server within the tenth preset time period.
[0130] When the sixth device quantity is greater than or equal to the sixth quantity threshold, a tenth time interval is determined based on an eleventh formula.
[0131] Among them, the eleventh formula is:
[0132]
[0133] Wherein, c"" is the tenth time interval, y"" is the sixth number of devices, b"" is the sixth number threshold, and k"" is a constant greater than 0.
[0134] When the target device ID is the same as the device ID corresponding to the fifth request received by the server within the eleventh preset time period, and the target URL is the same as the URL corresponding to the fifth request, the eleventh time interval is determined based on the twelfth formula.
[0135] Among them, the twelfth formula is:
[0136] t″″=t″″1+t″″0-t″″2+1;
[0137] Among them, t″″ is the eleventh time interval, t″″1 is the current system time, t″″0 is the eleventh preset duration, and t″″2 is the system time when the server receives the fifth request.
[0138] Based on the tenth time interval and the eleventh time interval, a target request interval is determined.
[0139] In some embodiments of the present application, the controller is further configured to: after obtaining the target load parameters of the server based on the target request, when the target load occupancy rate is less than the occupancy rate threshold, determine that the first time interval is equal to 0.
[0140] In some embodiments of the present application, the target information is carried in the header of the response message.
[0141] Specifically, a header is added to the original message formulated by the HyperText Transfer Protocol Http (HyperText Transfer Protocol), and the target information is written into the header. In this way, the target information can be sent to the terminal device on the basis of being compatible with the original business logic.
[0142] In some embodiments of the present application, the target information also includes the current system time and a time error threshold, so that when the difference between the system time when the terminal device receives the response message and the current system time is less than or equal to the time error threshold, the terminal device sends the next request to the server after a delay of the target time interval.
[0143] In the embodiment of the present application, the current system time and the time error threshold are added to the target information, so that when the difference between the system time when the terminal device receives the response message and the current system time is less than or equal to the time error threshold, the terminal device sends the next request to the server after the target time interval is delayed. In this way, the security of the system can be increased, and it is avoided that in some cases, the server resends the target time interval sent to the terminal device, so that the terminal device sends the next request to the server after the target time interval is delayed. In this way, the problem of the server processing the request of the terminal device slowly when the load pressure of the server itself is not particularly large can be avoided, and the processing speed of the server to the request sent by the terminal device is improved, so that the terminal device completes the processing business in a shorter time, and improves the user experience.
[0144] In some embodiments of the present application, the controller is also configured to: generate first verification information based on the current system time, time error threshold, target time interval and preset key information before returning a response message corresponding to the target request to the terminal device; the target information also includes the first verification information, so that when the difference between the system time of the terminal device when receiving the response message and the current system time is less than or equal to the time error threshold, and the second verification information matches the first verification information, the next request is sent to the server after a delay of the target time interval; the second verification information is generated by the terminal device based on the current system time, time error threshold, target time interval and preset key information.
[0145] In the embodiment of the present application, the controller is further configured to: before returning a response message corresponding to the target request to the terminal device, generate first verification information based on the current system time, the time error threshold, the target time interval and the preset key information; the target information also includes the first verification information, so that when the difference between the system time of the terminal device when receiving the response message and the current system time is less than or equal to the time error threshold, and the second verification information matches the first verification information, the terminal device sends the next request to the server after delaying the target time interval. In this way, the security of the system can be increased to avoid illegal attacks.
[0146] like Figure 5 As shown, a delay processing method is provided in an embodiment of the present application, which is applied to a server and may specifically include the following S501 to S502.
[0147] S501: Receive a target request sent by a terminal device.
[0148] S502: Based on the target request, obtain the target load parameters of the server.
[0149] S503: When the target load parameter is greater than or equal to the parameter threshold, determine a first time interval based on the target load parameter, where the first time interval is positively correlated with the target load parameter.
[0150] In some embodiments of the present application, the target load parameter of the server is the target load occupancy rate at the current system moment, and the parameter threshold is the occupancy rate threshold. The target load occupancy rate is determined based on at least one of the following: current CPU (Central Processing Unit) occupancy rate, current memory occupancy rate, and current network resource occupancy rate.
[0151] Combination Figure 5 ,like Figure 6 As shown, the above S502 can be specifically implemented through the following S502a.
[0152] S502a: Based on the target request, obtain the target load occupancy rate of the server at the current system moment.
[0153] The above S503 can be specifically implemented through the following S503a.
[0154] S503a: When the target load occupancy rate is greater than or equal to the occupancy rate threshold, determine a first time interval based on a first formula, where the first formula is:
[0155]
[0156] Among them, d is the first time interval when the load occupancy is x, d1 is the time interval when the load occupancy is m1, d2 is the time interval when the load occupancy is m2, among which x is the target load occupancy, m1 is the occupancy threshold, m2 is the maximum occupancy, m2 is greater than m1, and d2 is greater than d1.
[0157] In some embodiments of the present application, the target load parameter of the server is the third number of devices, and the parameter threshold is the third number threshold, where the third number of devices is the number of devices corresponding to the service requests received by the server within a fourth preset time period before the current system time.
[0158] Combination Figure 5 ,like Figure 7 As shown, the above S502 can be specifically implemented through the following S502b.
[0159] S502b. Based on the target request, obtain a third number of devices of the server, where the third number of devices is the number of devices corresponding to the service requests received by the server within a fourth preset time period before the current system time.
[0160] The above S503 can be specifically implemented through the following S503b.
[0161] S503b: When the number of the third devices is greater than or equal to the third number threshold, determine the first time interval based on the fifth formula, where the fifth formula is:
[0162]
[0163] Wherein, c″ is the first time interval, y″ is the third number of devices, b″ is the third number threshold, and k″ is a constant greater than 0.
[0164] S504: Determine the first time interval as the target time interval.
[0165] S505. Return a response message corresponding to the target request to the terminal device. The response message carries target information, and the target information includes a target time interval, so that after receiving the response message, the terminal device sends the next request to the server after a delay of the target time interval.
[0166] In some embodiments of the present application, Figure 8 As shown, after S502a, the delay processing method provided in the embodiment of the present application further includes:
[0167] like Figure 8 As shown, an embodiment of the present application provides a delay processing method, which may specifically include the following S506 to S507.
[0168] S506. When the target load occupancy rate is greater than or equal to the occupancy rate threshold, obtain a first number of devices, where the first number of devices is the number of devices corresponding to the service requests received by the server within a first preset time period.
[0169] S507: When the number of first devices is less than a first number threshold, determine a first time interval based on a first formula.
[0170] In some embodiments of the present application, Fig. 9 As shown, after obtaining the first device quantity in step S506, the delay processing method provided in the embodiment of the present application may further include the following S508 to S509.
[0171] S508: When the number of first devices is greater than or equal to a first number threshold, determine a second time interval based on a second formula.
[0172] Among them, the second formula is:
[0173]
[0174] Wherein, c is the second time interval, y is the first device quantity, b is the first quantity threshold, and k is a constant greater than 0.
[0175] S509: Determine a second time interval as the target time interval, where the second time interval is greater than the time interval determined based on the first formula when the load occupancy rate is the target load occupancy rate.
[0176] In some embodiments of the present application, Fig.10 As shown, after obtaining the first device quantity in step S506, the delay processing method provided in the embodiment of the present application may further include the following S510 to S511.
[0177] S510: When the number of first devices is less than a first number threshold, obtain a target device ID of the terminal device and a target uniform resource locator URL corresponding to the target request.
[0178] S511. When the target device ID is different from the device ID corresponding to any request received by the server within the second preset time period, and / or the target URL is different from the URL corresponding to any request received by the server within the second preset time period, determine the first time interval based on the first formula.
[0179] In some embodiments of the present application, Fig.11 As shown, after obtaining the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request in step S510, the delay processing method provided in the embodiment of the present application may also include the following S512 to S513.
[0180] S512: When the target device ID is the same as the device ID corresponding to the first request received by the server within the second preset time period, and the target URL is the same as the URL corresponding to the first request, determine a third time interval based on a third formula.
[0181] Among them, the third formula is:
[0182] t=t1+t0-t2+1
[0183] Wherein, t is the third time interval, t1 is the current system time, t0 is the second preset duration, and t2 is the system time when the server receives the first request.
[0184] In some embodiments of the present application, the third formula may also be:
[0185] t=(t1+t0-t2+1)(x-m1)
[0186] Among them, t is the third time interval, t1 is the current system time, t0 is the second preset duration, t2 is the system time when the server receives the first request, x is the target load occupancy rate, and m1 is the occupancy rate threshold.
[0187] S513: Determine a third time interval as the target time interval, where the third time interval is greater than the time interval determined based on the first formula when the load occupancy rate is the target load occupancy rate.
[0188] In some embodiments of the present application, Fig.12 As shown, after S502a, the delay processing method provided in the embodiment of the present application may further include the following S514 to S516.
[0189] S514. When the target load occupancy rate is less than the occupancy rate threshold, obtain the second number of devices, where the second number of devices is the number of devices corresponding to the service requests received by the server within a third preset time period before the current system time.
[0190] S515: When the number of the second devices is greater than or equal to the second number threshold, determine a fourth time interval based on a fourth formula, and the fourth time interval is less than d1.
[0191] Among them, the fourth formula is:
[0192]
[0193] Wherein, c′ is the fourth time interval, y′ is the second device quantity, b′ is the second quantity threshold, and k′ is a constant greater than 0.
[0194] S516: Determine the fourth time interval as the target time interval.
[0195] In some embodiments of the present application, Fig.13 As shown, after obtaining the number of second devices in S514, the delay processing method provided in the embodiment of the present application may also include the following S517 to S520.
[0196] S517: When the number of the second devices is less than the second number threshold, obtain the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request.
[0197] S518. When the target device ID is the same as the device ID corresponding to the third request received by the server within the sixth preset time period, and the target URL is the same as the URL corresponding to the second request, determine the sixth time interval based on the seventh formula.
[0198] Among them, the seventh formula is:
[0199] t″=t″1+t″0-t″2+1;
[0200] Where t″ is the sixth time interval, t″1 is the current system time, and t″ ″ is the sixth preset time length, and t″2 is the system time when the server receives the third request.
[0201] S519: Determine the sixth time interval as the target time interval.
[0202] S520: When the target device ID is different from the device ID corresponding to any request received by the server within the second preset time period, and / or the target URL is different from the URL corresponding to any request received by the server within the second preset time period, determine that the target time interval is equal to 0.
[0203] In some embodiments of the present application, Fig.14 As shown, after S502, the delay processing method provided in the embodiment of the present application also includes the following S521 to S523.
[0204] S521. When the target load parameter is less than the parameter threshold, obtain the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request.
[0205] In some embodiments of the present application, the target load parameter of the server is the target load occupancy rate at the current system moment, and the parameter threshold is the occupancy rate threshold. The target load occupancy rate is determined based on at least one of the following: current CPU (Central Processing Unit) occupancy rate, current memory occupancy rate, and current network resource occupancy rate.
[0206] In some embodiments of the present application, the target load parameter of the server is the fourth number of devices, the parameter threshold is the fourth number threshold, and the fourth number of devices is the number of devices corresponding to the service requests received by the server within the seventh preset time period before the current system time.
[0207] S522: when the target device ID is the same as the device ID corresponding to the second request received by the server within the fifth preset time period, and the target URL is the same as the URL corresponding to the second request, determine the fifth time interval based on the sixth formula;
[0208] Among them, the sixth formula is:
[0209] t′=t′1+t′0-t′2+1
[0210] Wherein, t′ is the fifth time interval, t′1 is the current system time, t′0 is the fifth preset duration, and t′2 is the system time when the server receives the second request.
[0211] S523: Determine the fifth time interval as the target time interval.
[0212] In some embodiments of the present application, Fig.15 As shown, after S501, the delay processing method provided in the embodiment of the present application also includes the following S524 to S528.
[0213] S524. Based on the target request, obtain the target load occupancy rate of the server at the current system moment, the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request, and the fifth number of devices, which is the number of devices corresponding to the service requests received by the server within the eighth preset time period before the current system moment.
[0214] S525. When the target load occupancy rate is less than the occupancy rate threshold, determine that the seventh time interval is equal to 0; when the target load occupancy rate is greater than or equal to the occupancy rate threshold, determine the seventh time interval based on the eighth formula.
[0215] Among them, the eighth formula is:
[0216]
[0217] Among them, d′ is the seventh time interval when the load occupancy is x′, d′1 is the time interval when the load occupancy is m′1, and d′2 is the time interval when the load occupancy is m′2, wherein x′ is the target load occupancy, m′1 is the occupancy threshold, m′2 is the maximum occupancy, m′2 is greater than m′1, and d′2 is greater than d′1.
[0218] S526. When the target device ID is different from the device ID corresponding to any request received by the server within the ninth preset time period, and / or the target URL is different from the URL corresponding to any request received by the server within the ninth preset time period, determine that the eighth time interval is equal to 0; when the target device ID is the same as the device ID corresponding to the fourth request received by the server within the ninth preset time period, and the target URL is the same as the URL corresponding to the fourth request, determine the eighth time interval based on the ninth formula.
[0219] Among them, the ninth formula is:
[0220] t″′=t″′1+t″′0-t″′2+1;
[0221] Among them, t″′ is the eighth time interval, t″′1 is the current system time, t″′0 is the ninth preset time length, and t″′2 is the system time when the server receives the fourth request.
[0222] S527: When the number of the fifth devices is less than the fifth number threshold, determine that the ninth time interval is equal to 0; when the number of the fifth devices is greater than or equal to the fifth number threshold, determine the ninth time interval based on the tenth formula.
[0223] Among them, the tenth formula is:
[0224]
[0225] Wherein, c″′ is the ninth time interval, y″′ is the fifth number of devices, b″′ is the fifth number threshold, and k″′ is a constant greater than 0.
[0226] S528. Determine a target time interval based on the seventh time interval, the eighth time interval, and the ninth time interval.
[0227] In some embodiments of the present application, when the seventh time interval, the eighth time interval, and the ninth time interval are all not equal to 0, any one of the seventh time interval, the eighth time interval, and the ninth time interval is determined as the target time interval.
[0228] In some embodiments of the present application, the time interval with the largest value among the seventh time interval, the eighth time interval and the ninth time interval is determined as the target time interval.
[0229] In some embodiments of the present application, an average value of the seventh time interval, the eighth time interval, and the ninth time interval is determined as the target time interval.
[0230] In some embodiments of the present application, Fig.16 As shown, after S502a, the delay processing method provided in the embodiment of the present application also includes the following S529 to S532.
[0231] S529. When the target load occupancy rate is greater than or equal to the occupancy rate threshold, obtain the target device ID of the terminal device, the target uniform resource locator URL corresponding to the target request, and the sixth device quantity, which is the number of devices corresponding to the service request received by the server within the tenth preset time period.
[0232] S530: When the sixth device quantity is greater than or equal to the sixth quantity threshold, determine a tenth time interval based on the eleventh formula.
[0233] Among them, the eleventh formula is:
[0234]
[0235] Wherein, c"" is the tenth time interval, y"" is the sixth number of devices, b"" is the sixth number threshold, and k"" is a constant greater than 0.
[0236] S531. When the target device ID is the same as the device ID corresponding to the fifth request received by the server within the eleventh preset time period, and the target URL is the same as the URL corresponding to the fifth request, determine the eleventh time interval based on the twelfth formula.
[0237] Among them, the twelfth formula is:
[0238] t″″=t″″1+t″″0-t″″2+1;
[0239] Among them, t″″ is the eleventh time interval, t″″1 is the current system time, t″″0 is the eleventh preset duration, and t″″2 is the system time when the server receives the fifth request.
[0240] S532: Determine a target request interval based on the tenth time interval and the eleventh time interval.
[0241] In some embodiments of the present application, the target information is carried in the header of the response message.
[0242] In some embodiments of the present application, the target information also includes the current system time and a time error threshold, so that when the difference between the system time when the terminal device receives the response message and the current system time is less than or equal to the time error threshold, the terminal device sends the next request to the server after a delay of the target time interval.
[0243] In some embodiments of the present application, the controller is also configured to: generate first verification information based on the current system time, time error threshold, target time interval and preset key information before returning a response message corresponding to the target request to the terminal device; the target information also includes the first verification information, so that when the difference between the system time of the terminal device when receiving the response message and the current system time is less than or equal to the time error threshold, and the second verification information matches the first verification information, the next request is sent to the server after a delay of the target time interval; the second verification information is generated by the terminal device based on the current system time, time error threshold, target time interval and preset key information.
[0244] In order to explain this solution in more detail, the above exemplary method is combined with Figures 5 to 16 To explain, it is understandable that Figures 5 to 16 The steps involved in the actual implementation may include more steps, or fewer steps, and the order of these steps may also be different, so as to achieve the delay processing method provided in the embodiment of the present application. The specific description of the delay processing provided in the embodiment of the present application can refer to the relevant description of the above-mentioned server, and the same or similar technical effects can be achieved, which will not be repeated here.
[0245] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned playback record management method are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0246] The computer readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0247] The present invention provides a computer program product, comprising: when the computer program product is run on a computer, the computer is enabled to implement the above-mentioned delay processing method.
[0248] 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.
[0249] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.
Claims
1. A server, It is characterized in that include: The communicator is configured to: receive a target request sent by a terminal device; The controller is configured to: obtain a target load parameter of the server based on the target request; In a case where the target load parameter is greater than or equal to a parameter threshold, determining a first time interval based on the target load parameter, wherein the first time interval is positively correlated with the target load parameter; determining the first time interval as a target time interval; A response message corresponding to the target request is returned to the terminal device, wherein the response message carries target information, and the target information includes the target time interval, so that after receiving the response message, the terminal device sends the next request to the server after a delay of the target time interval.
2. The server according to claim 1, It is characterized in that The target load parameter is the target load occupancy rate of the current system moment, the parameter threshold is the occupancy rate threshold, and the target load occupancy rate is determined according to at least one of the following: the current CPU occupancy rate, the current memory occupancy rate, and the current network resource occupancy rate; the controller is specifically configured as follows: When the target load occupancy rate is greater than or equal to the occupancy rate threshold, the first time interval is determined based on a first formula, where the first formula is: Wherein, d is the first time interval when the load occupancy rate is x, d 1 For the load occupancy rate m 1 The time interval, d 2 For the load occupancy rate m 2 time interval, where x is the target load occupancy rate, m 1 is the occupancy threshold, m 2 is the maximum occupancy rate, m 2 Greater than m 1 , d 2 Greater than d 1 .
3. The server according to claim 2, It is characterized in that The controller is specifically configured as follows: When the target load occupancy rate is greater than or equal to the occupancy rate threshold, obtaining a first number of devices, where the first number of devices is the number of devices corresponding to the service request received by the server within a first preset time period before the current system time; When the number of the first devices is less than a first number threshold, the first time interval is determined based on the first formula.
4. The server according to claim 3, It is characterized in that The controller is further configured to: After acquiring the first number of devices, if the first number of devices is greater than or equal to a first number threshold, determining a second time interval based on a second formula; determining the second time interval as the target time interval; Wherein, the second formula is: Wherein, c is the second time interval, y is the number of the first devices, b is the first number threshold, and k is a constant greater than 0.
5. The server according to claim 3, It is characterized in that The controller is specifically configured as follows: When the number of the first devices is less than the first number threshold, obtaining a target device ID of the terminal device and a target uniform resource locator URL corresponding to the target request; When the target device ID is different from the device ID corresponding to any request received by the server within the second preset time period, and / or the target URL is different from the URL corresponding to any request received by the server within the second preset time period, the first time interval is determined based on the first formula.
6. The server according to claim 5, It is characterized in that The controller is further configured to: After acquiring the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request, when the target device ID is the same as the device ID corresponding to the first request received by the server within the second preset time period, and the target URL is the same as the URL corresponding to the first request, determining a third time interval based on a third formula; determining the third time interval as the target time interval; Wherein, the third formula is: t=t 1 +t 0 -t 2 +1; Wherein, t is the third time interval, t 1 is the current system time, t 0 is the second preset time length, t 2 The system time when the server receives the first request.
7. The server according to claim 2, It is characterized in that The controller is further configured to: after acquiring the target load parameter of the server based on the target request, if the target load occupancy rate is less than the occupancy rate threshold, acquire a second number of devices, where the second number of devices is the number of devices corresponding to the service request received by the server within a third preset time period before the current system time; When the number of the second devices is greater than or equal to a second number threshold, determining a fourth time interval based on a fourth formula; determining the fourth time interval as the target time interval; Wherein, the fourth formula is: Wherein, c′ is the fourth time interval, y′ is the number of the second devices, b′ is the second number threshold, and k′ is a constant greater than 0.
8. The server according to claim 1, It is characterized in that The target load parameter is the third number of devices, the parameter threshold is the third number threshold, and the third number of devices is the number of devices corresponding to the service request received by the server within a fourth preset time before the current system time; the controller is specifically configured as follows: When the number of the third devices is greater than or equal to the third number threshold, the first time interval is determined based on a fifth formula, where the fifth formula is: Wherein, c″ is the first time interval, y″ is the third number of devices, b″ is the third number threshold, and k″ is a constant greater than 0.
9. The server according to claim 1, It is characterized in that The controller is further configured to: after obtaining the target load parameter of the server based on the target request, if the target load parameter is less than the parameter threshold, obtain the target device ID of the terminal device and the target uniform resource locator URL corresponding to the target request; When the target device ID is the same as the device ID corresponding to the second request received by the server within the fifth preset time period, and the target URL is the same as the URL corresponding to the second request, determining the fifth time interval based on the sixth formula; determining the fifth time interval as the target time interval; Wherein, the sixth formula is: t′=t′ 1 +t′ 0 -t′ 2 +1 Wherein, t' is the fifth time interval, t' 1 is the current system time, t′ 0 is the fifth preset duration, t′ 2 The system time when the server receives the second request.
10. The server according to any one of claims 1 to 9, It is characterized in that The target information also includes the current system time and a time error threshold, so that when the difference between the system time when the terminal device receives the response message and the current system time is less than or equal to the time error threshold, the terminal device sends the next request to the server after a delay of the target time interval; The controller is further configured to: Before returning a response message corresponding to the target request to the terminal device, generating first verification information based on the current system time, the time error threshold, the target time interval and preset key information; The target information also includes the first verification information, so that when the difference between the system time when the terminal device receives the response message and the current system time is less than or equal to the time error threshold, and the second verification information matches the first verification information, the terminal device sends the next request to the server after delaying the target time interval; the second verification information is generated by the terminal device based on the current system time, the time error threshold, the target time interval and the preset key information.
11. A delay processing method, It is characterized in that Applicable to servers, including: Receiving a target request sent by a terminal device; Based on the target request, obtaining a target load parameter of the server; In a case where the target load parameter is greater than or equal to a parameter threshold, determining a first time interval based on the target load parameter, wherein the first time interval is positively correlated with the target load parameter; determining the first time interval as a target time interval; A response message corresponding to the target request is returned to the terminal device, wherein the response message carries target information, and the target information includes the target time interval, so that after receiving the response message, the terminal device sends the next request to the server after a delay of the target time interval.
