Control method for retry execution of distributed system, electronic equipment and distributed system

By receiving the feedback of the total number of retries from the downstream nodes on each node in the distributed system, the number of remaining retries is updated, and based on this, the decision is made whether to retry, and the total number of retries is fed back to the upstream node to solve the problem of retry in the distributed system. The problem of storms reduces the pressure on downstream nodes and ensures system stability.

CN118779081AActive Publication Date: 2024-10-15HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410968889.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-18
Publication Date
2024-10-15
Estimated Expiration
2044-07-18

AI Technical Summary

Technical Problem

In a distributed system, due to long request processing links, when a node fails to process a request, frequent retries lead to excessive pressure on the downstream nodes, causing a retry storm that exceeds their maximum processing capacity and leads to failure.

Method used

In a distributed system, each node receives the total number of retries fed back by downstream nodes, updates the remaining number of retries in the local information table, decides whether to retry based on the remaining number of retries, and feeds back the total number of retries to the upstream node. Coordinate the number of retries to avoid retry storms.

Benefits of technology

By coordinating the number of retries, the processing pressure on downstream nodes is reduced, retry storms are avoided, and the stable operation of the system is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779081A_ABST
    Figure CN118779081A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed system retry execution control method, electronic equipment and a distributed system, the method is applied to a first node, and the method comprises the following steps: receiving second feedback information sent by a second node; according to the second feedback information, updating the number of remaining retry times of the first request of the first information table of the first node; the remaining number of retry times is the remaining number of times that all nodes in the distributed system can reprocess the first request; in response to failure of processing the first request by the first node, re-executing the local task corresponding to the first request under the condition that the remaining re-times of the first request is greater than zero; updating the remaining number of retry times of the first request in the first information table and sending the first request to the second node, so that the second node updates a second information table according to the received first request and processes the first request; and sending first feedback information to the third node under the condition that the remaining number of retimes of the first request is equal to zero.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a control method, device and electronic device for executing retry in a distributed system. Background Art

[0002] In a distributed system, due to the long request processing link, it often happens that a node fails to process a request, so the request needs to be processed again, that is, retried.

[0003] However, there are many nodes involved in the distributed system, and each upstream node retries, which can easily put a lot of pressure on the downstream nodes, causing a retry storm, exceeding the maximum processing capacity of the downstream nodes and causing them to fail.

[0004] Therefore, there is an urgent need for a technical solution that can control retries in a distributed system. Summary of the invention

[0005] In view of the above problems, the present application provides a control method, electronic device and distributed system for executing retries in a distributed system, so as to control the execution retries of each node in the distributed system, so as to avoid retry storms and reduce the processing pressure of nodes. The specific scheme is as follows:

[0006] A first aspect of the present application provides a control method for executing a retry in a distributed system, which is applied to a first node, where the first node is any node in the distributed system, and the method includes:

[0007] receiving second feedback information sent by a second node; the second node is a downstream node adjacent to the first node in the distributed nodes; the second feedback information includes a total number of retries of the second node and its downstream nodes for the first request;

[0008] According to the second feedback information, update the first information table of the first node, where the first information table at least includes the remaining number of retries of the first request; the remaining number of retries is the remaining number of times that all nodes in the distributed system can reprocess the first request;

[0009] In response to the first node failing to process the first request, determining whether a remaining number of retries of the first request in the first information table is greater than or equal to zero;

[0010] In the case where the remaining number of retries of the first request is greater than zero, re-execute the local task corresponding to the first request; update the remaining number of retries of the first request in the first information table and send the first request to the second node; the first request carries at least the remaining number of retries of the first request, so that the second node updates the second information table of the second node according to the received first request and processes the first request, and the second information table contains at least the remaining number of retries of the first request;

[0011] When the remaining number of retries for the first request is equal to zero, first feedback information is sent to a third node, wherein the first feedback information includes the total number of retries of the first node and its downstream nodes for the first request; the third node is an upstream node adjacent to the first node in the distributed system.

[0012] In a possible implementation, the method also includes: receiving a second request sent by the third node, the second request carrying at least the remaining retry times of the second request; updating the remaining retry times of the second request in the first information table according to the remaining retry times of the second request; and processing the second request.

[0013] In one possible implementation, when the first request is different from the second request, the execution order between the first request and the second request is determined based on a first priority of the first request and a second priority of the second request; the first priority of the first request is related to the remaining number of retries of the first request; and the second priority of the second request is related to the remaining number of retries of the second request.

[0014] In a possible implementation, the first information table also includes the number of retries of the first request and the number of retries of the second request; the number of retries of the first request is the number of times all nodes in the distributed system have retried to process the first request; the number of retries of the second request is the number of times all nodes in the distributed system have retried to process the second request; wherein, the first priority of the first request is obtained based on the remaining number of retries and the number of retries of the first request, and the second priority of the second request is obtained based on the remaining number of retries and the number of retries of the second request.

[0015] In a possible implementation, the first priority of the first request is carried in the first request; the second priority of the second request is carried in the second request;

[0016] or,

[0017] The first priority of the first request is obtained based on the remaining number of retries of the first request in the first information table; the second priority of the second request is obtained based on the remaining number of retries of the second request in the first information table.

[0018] In a possible implementation, the second request further carries at least one retry parameter of the second request; the retry parameter includes: a retry timeout timestamp, a retry condition, and a retry interval duration;

[0019] Wherein, the first node is prohibited from retrying to process the second request when the current time is greater than the retry timeout timestamp;

[0020] The first node retries processing the second request at least when the retry condition is satisfied;

[0021] The first node retries processing the second request after an interval of the retry interval.

[0022] In a possible implementation, before sending the first request to the second node, the method further includes:

[0023] determining, according to a request type of the first request, whether the second node can perform a retry for the first request;

[0024] If the second node is capable of performing a retry, setting a retry attribute of the second node for the first request to a first attribute; the first attribute is used to instruct the second node to retry processing the first request if processing of the first request fails;

[0025] If the second node cannot perform a retry, the retry attribute of the second node for the first request is set to a second attribute; the second attribute is used to instruct the second node not to retry processing the first request if processing of the first request fails.

[0026] In a possible implementation, updating the remaining number of retries of the first request in the first information table includes:

[0027] The remaining number of retries of the first request in the first information table is subtracted from the number of times the first node retries to process the first request.

[0028] A second aspect of the present application provides a distributed system, comprising at least: a first node, a second node and a third node; wherein:

[0029] The first node receives second feedback information sent by the second node; the second node is a downstream node adjacent to the first node in the distributed nodes; the second feedback information includes a total number of retries of the second node and its downstream nodes for the first request;

[0030] The first node updates a first information table of the first node according to the second feedback information, wherein the first information table at least includes a remaining number of retries of the first request; the remaining number of retries is a remaining number of times that all nodes in the distributed system can reprocess the first request;

[0031] In response to the first node failing to process the first request, determining, by the first node, whether a remaining number of retries of the first request in the first information table is greater than or equal to zero;

[0032] In the case where the remaining number of retries of the first request is greater than zero, the first node re-executes the local task corresponding to the first request; updates the remaining number of retries of the first request in the first information table and sends the first request to the second node; the first request carries at least the remaining number of retries of the first request, so that the second node updates the second information table of the second node according to the received first request and processes the first request, and the second information table contains at least the remaining number of retries of the first request;

[0033] When the remaining number of retries for the first request is equal to zero, the first node sends first feedback information to a third node, the first feedback information including the total number of retries of the first node and its downstream nodes for the first request; the third node is an upstream node adjacent to the first node in the distributed system.

[0034] The third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the control method for a distributed system to perform a retry according to the first aspect or any implementation of the first aspect.

[0035] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0036] The memory is used to store computer programs;

[0037] The processor is used to execute the computer program so that the electronic device can implement the control method for retrying of a distributed system according to the first aspect or any implementation of the first aspect.

[0038] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can be enabled to perform a retry control method in a distributed system of the above-mentioned first aspect or any implementation of the first aspect.

[0039] By means of the above technical scheme, the present application provides a control method, electronic device and distributed system for executing retries in a distributed system, in which the total number of retries fed back by the downstream node is received at any node, so as to update the remaining number of retries for the request in the local information table. If the feedback processing of the downstream node fails, whether to retry is determined based on whether the remaining number of retries is greater than zero, that is, if the remaining number of retries is greater than zero, then the node is allowed to retry, that is, the task corresponding to the request is re-executed and the remaining number of retries is updated to the downstream node, and if the remaining number of retries reaches zero, then no retry is performed and the total number of retries is fed back to the upstream node, so that the upstream node updates the remaining number of retries in the same way. It can be seen that the present application updates the remaining number of retries based on the total number of retries fed back by the downstream node on each node in the distributed system and determines whether to retry accordingly, and also feeds back the total number of retries to the upstream node, thereby continuously updating the remaining number of retries through coordination between the upstream and downstream nodes to achieve control of the number of retries, avoid retry storms on the downstream nodes, and reduce the processing pressure of the downstream nodes. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments 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.

[0041] Figure 1 A schematic diagram of a system architecture disclosed in this application;

[0042] Figure 2 Schematic diagram of the hardware structure of the terminal 100 in this application;

[0043] Figure 3 Schematic diagram of the hardware structure of the server 200 in this application;

[0044] Figure 4 This is another schematic diagram of the system architecture disclosed in this application;

[0045] Figure 5 A schematic diagram of a flow chart of a method for controlling execution retry of a distributed system provided in an embodiment of the present application;

[0046] Figure 6Another schematic diagram of a flow chart of a method for controlling execution retry of a distributed system provided in an embodiment of the present application;

[0047] Figure 7 Another schematic diagram of a flow chart of a method for controlling execution retry of a distributed system provided in an embodiment of the present application;

[0048] Figure 8 A schematic diagram of the structure of a control device for executing retry in a distributed system provided in an embodiment of the present application;

[0049] Fig. 9 A schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application;

[0050] Fig.10 A schematic diagram of the structure of a distributed system suitable for implementing an embodiment of the present application;

[0051] Fig.11 This is a flow chart of the retry control implemented in each module of the distributed system in this application. DETAILED DESCRIPTION

[0052] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0053] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0054] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0055] The present application can be applied in the field of data processing. Taking the processing of video data as an example, multiple application scenarios of the product will be introduced below.

[0056] See also Figure 1 , Figure 1A schematic diagram of a system architecture is shown. The system may include a terminal 100 and a server 200. Each server 200 serves as a node to form a distributed system. The server 200 may include one or more servers ( Figure 1 The example includes one server. The server 200 can provide the method provided in the embodiment of the present application to one or more terminals 100.

[0057] Among them, a video application may be installed on the terminal 100, and the above application may provide an interface. The terminal 100 may receive the operation input by the user on the interface and generate a corresponding request, and send the above request to the server 200. The server 200 may obtain a processing result based on the received instruction, and return the processing result to the terminal 100. For example, a video acquisition request is generated on the terminal 100, and the video acquisition request is sent to a server 200 in the distributed system. The server 200 and other servers 200 jointly process the request through cascading to obtain video data, and return the video data to the terminal 100 as a processing result.

[0058] Next describe Figure 1 The product form of the mid-terminal 100;

[0059] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any limitation on this.

[0060] Figure 2 An optional hardware structure diagram of the terminal 100 is shown.

[0061] refer to Figure 2 As shown, the terminal 100 may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), an earphone jack 163 (optional), a processor 170, an external interface 180, a power supply 190 and other components. Those skilled in the art will appreciate that Figure 2 These are merely examples of terminals or multi-function devices and do not constitute limitations on the terminals or multi-function devices, which may include more or fewer components than those shown in the figures, or combinations of certain components, or different components.

[0062] The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the portable multifunctional device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can collect the user's touch operations on or near it (such as the user's operation on or near the touch screen using any suitable object such as fingers, joints, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute the command sent by the processor 170; the touch signal at least includes the touch point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal 100 and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0063] Among them, the input device 132 can receive input data and the like.

[0064] The display unit 140 may be used to display information input by the user or provided to the user, various menus of the terminal 100, interactive interfaces, file display and / or playback of any multimedia file. In an embodiment of the present application, the display unit 140 may be used to display the interface of a video application, processing results such as video data, etc.

[0065] The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.

[0066] The processor 170 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal 100. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal 100 and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.

[0067] The memory 120 may be used to store software codes related to the video application, the processor 170 may execute the execution steps of the video application, and may also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to implement corresponding functions.

[0068] The radio frequency unit 110 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.

[0069] In this embodiment of the present application, the RF unit 110 may send a request to the server 200 and receive a processing result sent by the server 200 .

[0070] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.

[0071] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.

[0072] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to communicate with other devices, or to connect a charger to charge the terminal 100 .

[0073] Although not shown, the terminal 100 may also include a flashlight, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied in the following embodiments. Figure 2 In the terminal 100 shown.

[0074] Next describe Figure 1 The product form of the server 200;

[0075] Figure 3 A schematic diagram of the structure of a server 200 is provided, such as Figure 3 As shown, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.

[0076] The bus 201 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0077] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0078] The memory 204 may include a volatile memory, such as a random access memory (RAM). The memory 204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard drive (HDD), or a solid state drive (SSD).

[0079] Among them, the memory 204 can be used to store software codes related to the control method for the distributed system to perform retry, the processor 202 can execute the steps of the control method for the distributed system of the chip to perform retry, and can also schedule other units to implement corresponding functions.

[0080] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processor (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.

[0081] refer to Figure 4 , Figure 4 Another schematic diagram of system architecture is shown, and the system may include a terminal 100 and a server 200. Among them, multiple microservices are deployed in the server 200, and each microservice is used as a node to form a distributed system. Figure 4 The specific structures of the terminal 100 and the server 200 can refer to the above content.

[0082] For example, a distributed system for video data processing is deployed on a server in the cloud. The distributed system contains multiple nodes, each of which is implemented through a microservice. Each microservice is used to perform corresponding local tasks. Based on this, multiple microservices form a cascade call to implement video data processing, such as video data screening or playlist generation.

[0083] For example, a video acquisition request is generated on the terminal 100 and sent to a microservice in the distributed system on the server 200. The microservice and other microservices jointly process the request through cascading to obtain video data, and return the video data to the terminal 100 as a processing result.

[0084] Based on the above system architecture, the technical solution of this application is described below:

[0085] In a distributed system, due to the long request processing link, it is common for a node to fail to process a request, and the request needs to be processed again. However, there are many nodes involved in a distributed system, and if each upstream node retries, it is easy to put a lot of pressure on the downstream node, causing a retry storm, which exceeds the maximum processing capacity of the downstream node and causes it to fail.

[0086] For example, if a request passes through four nodes A->B->C->D, and each node is configured with three retries, if the load on node D is too high and an error occurs when processing the request, node C will fail after the retry and return a failure message to B. B will also fail in the retry and return a failure message to A, which will continue to retry. Therefore, nodes A, B, and C will all retry, and node D will eventually receive 3x3x3=27 requests. If the maximum processing capacity of D is 1000 requests per second, and the number of failed requests per second is 100, then it will retry 2700 times per second, far exceeding D's processing capacity!

[0087] In order to solve the above problems, an embodiment of the present application provides a control method for executing retries in a distributed system. The control method for executing retries in a distributed system in an embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0088] Reference Figure 5 , Figure 5 A flow chart of a method for controlling execution retry of a distributed system provided in an embodiment of the present application is provided. The method can be applied to a first node in a distributed system. The first node is any node in the distributed system, such as Figure 1 Any server shown in or Figure 4 Specifically, the method in this embodiment may include the following steps:

[0089] Step 501: A first node receives second feedback information sent by a second node.

[0090] The second node is a downstream node adjacent to the first node in the distributed system. The second feedback information includes the total number of retries of the second node and its downstream nodes for the first request.

[0091] For example, a distributed system includes four nodes: A, B, C, and D. The execution order is: A->B->C->D, where B is the downstream node of A and B is the upstream node of C. Taking the first node as node B, node B receives the second feedback information sent by node C, which at least includes the sum of the number of retries of node C and node D for the first request, that is, the total number of retries.

[0092] It should be noted that the first request is sent by the requesting end to the starting node of the distributed system. For example, the terminal 100 sends a video acquisition request to the node A in the distributed system.

[0093] Step 502: The first node updates the first information table of the first node according to the second feedback information.

[0094] The first information table at least includes the remaining number of retries of the first request, and the remaining number of retries is the remaining number of times that all nodes in the distributed system can retry to process the first request.

[0095] It should be noted that the distributed system is configured with a maximum number of retries, and the remaining number of retries is less than or equal to the maximum number of retries, that is, the initial value of the remaining number of retries is the maximum number of retries. After any node retries to process the first request, the remaining number of retries will be reduced by one.

[0096] Based on this, the first node records the remaining number of retries of the first request through the first information table. After receiving the second feedback information from the downstream node such as the second node each time, the remaining number of retries in the first information table is updated according to the total number of retries of the downstream node in the second feedback information.

[0097] Specifically, the first node may subtract the total number of retries in the second feedback information from the remaining number of retries of the first request in the first information table, and use the obtained number as the updated remaining number of retries of the first request in the first information table.

[0098] The total number of retries in the second feedback information can be obtained in the following way:

[0099] The number of times the downstream node of the second node retries to process the first request is added to the number of times the second node retries to process the first request.

[0100] It should be noted that the number of times the second node retries to process the first request refers to the number of times the second node retries to process the first request after receiving the message of failure to process the first request from the downstream node for the first time. After the second node sends the second feedback information to the first node, the number of times the second node retries to process the first request is reset to zero. Afterwards, if the first node retries to process the first request so that the second node receives the first request again and executes the task corresponding to the first request, if the second node receives the message of failure to process the first request from the downstream node, then the second node starts the first retry to process the first request, and the number of retries is 1. If the second node receives the message of failure to process the first request from the downstream node, then the second node starts the second retry to process the first request, and the number of retries is 2, and so on.

[0101] For example, a distributed system includes four nodes: A, B, C, and D. Node B receives the second feedback information sent by node C. The second feedback information includes: after node B sends a video acquisition request to node C, the total number of retries of node C and node D to retry the first request is 5, and node B deducts 5 from the remaining number of retries of the video acquisition request in its local information table. Finally, the remaining number of retries of the video acquisition request in the local information table of node B is 5, indicating that each node in the subsequent distributed system has only 5 opportunities to retry the video acquisition request. In addition, node C sets its total number of retries to 0. If node B retries to process the video acquisition request, the remaining number of retries is 4. During this period, node C needs to be called to send the video acquisition request to node C. Then, after receiving the video acquisition request, node C also calls node D to process the first request. If node C fails to execute the task of executing the video acquisition request (such as node C receives feedback information that node D failed to process the video acquisition request) and receives feedback information that node D has retried 0 times, the remaining number of retries in the local information table of node C remains unchanged (because the number of D retries is 0), but the video acquisition request is retried. At this time, the total number of retries of node C is 1 (the number of times node C retries) plus 0 (the number of times node D retries). After the retry processing of the video acquisition request is completed, node C feeds back the total number of retries 1 and the request processing result of node C's retry processing of the video acquisition request to node B. Then node C clears the total number of retries, and node B updates the remaining number of retries to 3.

[0102] Step 503: Determine whether the first node fails to process the first request. If not, that is, the first node successfully processes the first request, and execute step 504. If yes, in response to the first node failing to process the first request, execute step 505.

[0103] Wherein, the first node processing the first request includes: the first node executing the local task corresponding to the first request, and the first node calling the second node, and the second node processing the first request. Correspondingly, the first node failing to process the first request includes: the first node failing to execute the local task corresponding to the first request, and / or, the second feedback information indicates that the second node failed to process the first request. Correspondingly, the second node failing to process the first request includes: the second node failing to execute the local task corresponding to the first request, and / or, the feedback information sent by the downstream node of the second node indicates that the downstream node failed to process the first request.

[0104] Step 504: Send third feedback information to the third node.

[0105] The third feedback information includes the total number of retries of the first node and its downstream nodes for the first request and the request processing result of the first node processing the first request. The request processing result of the first node processing the first request is obtained by the first node continuing to execute the local task corresponding to the first request according to the request processing result in the second feedback information. The request processing result in the second feedback information is obtained by the second node executing the local task corresponding to the first request according to the request processing result in the feedback information sent by its downstream node.

[0106] It should be noted that after receiving the third feedback information sent by the first node, the third node continues to execute the local task corresponding to the first request according to the request processing result in the third feedback information, and so on, until the starting node in the distributed system successfully processes the first request and sends the corresponding request processing result to the request end of the first request.

[0107] For example, taking a distributed system including four nodes: A, B, C, and D as an example, node B receives the second feedback information sent by node C, and the second feedback information includes the total number of retries of node C and its downstream nodes for the video acquisition request. Node B updates the remaining number of retries of the video acquisition request in the local information table of node B according to the total number of retries in the second feedback information. If the second feedback information indicates that the second node successfully processes the first request, node B continues to execute the local task corresponding to the video acquisition request according to the request processing result in the second feedback information. If node B successfully executes the local task, it can be determined that node B successfully processes the video acquisition request. At this time, node B generates third feedback information and adds the total number of retries of node B and its downstream nodes for the video acquisition request and the request processing result of node B processing the video acquisition request. Therefore, after receiving the third feedback information, node A continues to execute the local task corresponding to the video acquisition request according to the request processing result in the third feedback information. If node A successfully executes the local task, node A can obtain the request processing result of the video acquisition request, such as the acquired video data, and send the request processing result to the terminal 100 corresponding to the video acquisition request.

[0108] Step 505: Determine whether the remaining number of retries of the first request in the first information table is greater than or equal to zero. If it is equal to zero, execute step 506; if it is greater than zero, execute step 507.

[0109] Step 506: Send the first feedback information to the third node.

[0110] The first feedback information includes the total number of retries of the first node and its downstream nodes for the first request. The third node is an upstream node adjacent to the first node in the distributed system.

[0111] That is to say, if the remaining number of retries of the first request is zero, it means that the first node can no longer retry to process the first request. At this time, the first node feeds back the total number of retries of the first node and its downstream nodes for the first request to the upstream node, i.e., the third node. The third node updates the remaining number of retries of the first request in the third information table of the third node based on the total number of retries.

[0112] For example, taking a distributed system including four nodes: A, B, C, and D as an example, node B receives the second feedback information sent by node C, and the second feedback information includes the total number of retries of node C and its downstream nodes for the video acquisition request. Node B updates the remaining number of retries of the video acquisition request in the local information table of node B according to the total number of retries in the second feedback information. If the second feedback information indicates that the second node successfully processes the first request but node B fails to execute the local task corresponding to the video acquisition request according to the request processing result in the second feedback information, or if the second feedback information indicates that the second node fails to process the first request, then node B is ready to retry processing the first request. At this time, first determine The remaining number of retries of the video acquisition request in the local information table is greater than zero or equal to zero. If the remaining number of retries is equal to zero, it indicates that node B can no longer retry to process the first request. At this time, node B sends a first feedback message to node A. The first feedback message includes the total number of retries of node B and its downstream nodes for the video acquisition request. Node A updates the remaining number of retries of the video acquisition request in the local information table of node A according to the total number of retries in the first feedback message. Since node B fails to process the video acquisition request, node A determines that there is no chance to retry processing the first request based on the remaining number of retries. At this time, the processing of the video acquisition request is terminated, and the information of the processing failure is fed back to terminal 100.

[0113] It should be noted that the third node may be a starting node for processing the first request in the distributed system.

[0114] If the first node is the starting node for processing the first request in the distributed system, when the first node determines that the remaining number of retries is equal to zero, the first node will no longer execute step 506 because the first node has no upstream node.

[0115] Step 507: Re-execute the local task corresponding to the first request.

[0116] Step 508: Update the remaining number of retries of the first request in the first information table.

[0117] For example, the number of times the first node retries to process the first request is subtracted from the number of remaining retries of the first request in the first information table. For example, after each re-execution of the local task corresponding to the first request, the number of remaining retries of the first request in the first information table is reduced by one.

[0118] Step 509: Send the first request to the second node.

[0119] The first request sent to the second node carries at least the remaining number of retries of the first request. That is, after the remaining number of retries of the first request in the first information table is updated, the remaining number of retries of the first request in the first information table is added to the first request, and the first request is sent to the second node, so that the second node updates the second information table of the second node according to the received first request and processes the first request.

[0120] The second information table at least includes the remaining number of retries of the first request. Specifically, the second node replaces the remaining number of retries of the first request in the second information table with the remaining number of retries of the first request carried in the received first request.

[0121] For example, taking a distributed system including four nodes: A, B, C, and D as an example, node B receives the second feedback information sent by node C, and the second feedback information includes the total number of retries of node C and its downstream nodes for the video acquisition request. Node B updates the remaining number of retries of the video acquisition request in the local information table of node B according to the total number of retries in the second feedback information. If the second feedback information indicates that the second node successfully processes the first request but node B fails to execute the local task corresponding to the video acquisition request according to the request processing result in the second feedback information, or if the second feedback information indicates that the second node fails to process the first request, then node B is ready to retry processing the first request. At this time, first determine whether the remaining number of retries of the video acquisition request in the local information table is greater than zero or equal to zero. If the remaining number of retries is greater than zero, it indicates that node B can still retry to process the video acquisition request. At this time, node B re-executes the local task of the video acquisition request, reduces the remaining number of retries of the video acquisition request in the local information table by one, and sends a video acquisition request carrying the remaining number of retries to call node C and its downstream nodes to process the video acquisition request. Node C updates the remaining number of retries of the video acquisition request in the local information table according to the received video acquisition request. The remaining number of retries of the video acquisition request in the local information table is used for node C to retry judgment when processing the video acquisition request fails, until node C successfully processes the video acquisition request and sends the second feedback information to node B, or until the number of times node C retries to process the video acquisition request and fails makes the remaining number of retries zero.

[0122] By means of the above technical solution, in a control method for executing retries in a distributed system provided by an embodiment of the present application, the total number of retries fed back by the downstream node is received on any node, so as to update the remaining number of retries for the request in the local information table. If the feedback processing of the downstream node fails, whether to retry is determined based on whether the remaining number of retries is greater than zero, that is, if the remaining number of retries is greater than zero, then the node is allowed to retry, that is, the task corresponding to the request is re-executed and the remaining number of retries is updated to the downstream node. If the remaining number of retries reaches zero, then no retry is performed and the total number of retries is fed back to the upstream node, so that the upstream node updates the remaining number of retries in the same way. It can be seen that in this embodiment, the remaining number of retries is updated on each node in the distributed system based on the total number of retries fed back by the downstream node and determines whether to retry accordingly, and the total number of retries is also fed back to the upstream node, thereby continuously updating the remaining number of retries through coordination between the upstream and downstream nodes to achieve control of the number of retries, avoid retry storms on the downstream nodes, and reduce the processing pressure of the downstream nodes.

[0123] In one implementation, the first node may also perform the following processing, such as Figure 6 As shown in:

[0124] Step 510: The first node receives the second request sent by the third node.

[0125] The second request at least carries the remaining number of retries of the second request. The second request may be the same as the first request, or the second request may not be the same as the first request.

[0126] It should be noted that the second request may be a request sent by the third node to the first node when the third node processes the second request for the first time, or may be a request sent by the third node to the first node when the third node retries to process the second request.

[0127] Step 511: The first node updates the remaining number of retries of the second request in the first information table according to the remaining number of retries of the second request.

[0128] Specifically, the first node replaces the remaining retry times of the second request in the first information table with the remaining retry times of the second request carried in the received second request.

[0129] Step 512: The first node processes the second request.

[0130] The first node processing the second request includes: the first node executing a local task corresponding to the second request, and the first node calling the second node, and the second node processing the second request.

[0131] For example, taking a distributed system containing four nodes: A, B, C, and D as an example, node B receives a video acquisition request sent by node A, and node B updates the remaining retry times of the video acquisition request in the local information table according to the remaining retry times carried by the received video acquisition request, and processes the video acquisition request. The remaining retry times of the video acquisition request in the local information table are used for retry judgment by node B when processing the video acquisition request fails, until node B successfully processes the video acquisition request and sends corresponding feedback information to node A, or until node B retries the video acquisition request so many times that the remaining retry times are zero.

[0132] For another example, taking a distributed system containing four nodes: A, B, C, and D, node B receives a list acquisition request (different from a video acquisition request) sent by node A. Node B updates the remaining retry times of the list acquisition request in the local information table according to the remaining retry times carried by the received list acquisition request, and processes the list acquisition request. The remaining retry times of the list acquisition request in the local information table are used for retry judgment when node B fails to process the list acquisition request, until node B successfully processes the list acquisition request and sends corresponding feedback information to node A, or until node B retries the list acquisition request so many times that the remaining retry times are zero.

[0133] Based on the above implementation, when the first request is different from the second request, the execution order between the first request and the second request is determined based on the first priority of the first request and the second priority of the second request.

[0134] The first priority of the first request is related to the remaining number of retries of the first request; the second priority of the second request is related to the remaining number of retries of the second request.

[0135] That is, if there are multiple requests to be processed on the first node, the execution order of each request can be determined according to the priority of each request. Requests with higher priorities are processed by the first node first.

[0136] Specifically, the first information table also includes the number of retries of the first request and the number of retries of the second request. The number of retries of the first request is the number of times all nodes in the distributed system have retried to process the first request; the number of retries of the second request is the number of times all nodes in the distributed system have retried to process the second request.

[0137] For example, taking the number of retries of the first request as an example, after the first node receives the second feedback information sent by the second node, in addition to updating the remaining number of retries of the first request in the first information table, the number of retries of the first request in the first information table may also be updated. For example, the remaining number of retries of the first request in the first information table is deducted from the total number of retries in the second feedback information, and the number of retries of the first request in the first information table is increased by the total number of retries in the second feedback information. Similarly, the number of retries of the second request in the first information table is updated in the same manner.

[0138] It should be noted that, when the remaining number of retries of the first request of the first node is greater than zero, the first node updates the remaining number of retries of the first request in the first information table and also updates the number of retries of the first request in the first information table. In addition, the first request sent by the first node to the second node carries not only the remaining number of retries of the first request but also the number of retries of the first request, so that the second node updates the remaining number of retries of the first request and the number of retries of the first request in the second information table according to the received first request. If the second node retries to process the first request, then after updating the remaining number of retries of the first request and the number of retries of the first request in the second information table, the updated remaining number of retries of the first request and the number of retries of the first request are carried to the downstream node sent to the second node, and so on, until the first request is successfully processed or the remaining number of retries is zero.

[0139] Among them, the second node updates the remaining retry times of the first request and the number of retries of the first request in the second information table, specifically: deduct the number of times the second node retries to process the first request from the remaining retry times of the first request, and add the number of times the second node retries to process the first request to the number of retries of the first request.

[0140] Based on this, the first priority of the first request is obtained based on the remaining number of retries and the number of retries completed of the first request, and the second priority of the second request is obtained based on the remaining number of retries and the number of retries completed of the second request.

[0141] For example, the remaining number of retries of the first request is added to the number of retries that have been attempted to obtain the maximum number of retries for the first request, and the remaining number of retries of the first request is divided by the maximum number of retries to obtain the first ratio of the first request; the remaining number of retries of the second request is added to the number of retries that have been attempted to obtain the maximum number of retries for the second request, and the remaining number of retries of the second request is divided by the maximum number of retries to obtain the second ratio of the second request; based on this, if the first ratio is greater than the second ratio, then the first priority is higher than the second priority; if the first ratio is less than the second ratio, then the second priority is higher than the first priority. In other words, the greater the proportion of the remaining number of retries in the maximum number of retries, the higher the priority of the request.

[0142] For example, taking a distributed system including four nodes: A, B, C, and D as an example, node B receives the second feedback information sent by node C, and the second feedback information includes the total number of retries of node C and its downstream nodes for the video acquisition request. Node B updates the remaining number of retries and the number of retries of the video acquisition request in the local information table of node B according to the total number of retries in the second feedback information. If the second feedback information indicates that the second node successfully processes the first request but node B fails to execute the local task corresponding to the video acquisition request according to the request processing result in the second feedback information, or if the second feedback information indicates that the second node fails to process the first request, then node B is ready to retry processing the first request. At this time, first determine whether the remaining number of retries of the video acquisition request in the local information table is greater than zero or equal to zero. If the remaining number of retries is greater than zero, it indicates that node B still The video acquisition request can be retried. At this time, node B re-executes the local task of the video acquisition request, subtracts one from the remaining retry times of the video acquisition request in the local information table and adds one to the number of retries already made of the video acquisition request in the local information table, and sends a video acquisition request carrying the remaining retry times and the number of retries already made to call node C and its downstream nodes to process the video acquisition request. Node C updates the remaining retry times and the number of retries already made of the video acquisition request in the local information table according to the received video acquisition request. The remaining retry times of the video acquisition request in the local information table are used for retry judgment by node C when processing the video acquisition request fails, until node C successfully processes the video acquisition request and sends a second feedback information to node B (node ​​B updates the local information table again), or until node C retries the video acquisition request so many times that the remaining retry times are zero.

[0143] In one implementation, the first priority of the first request may be carried in the first request, and the first node may obtain the first priority of the first request from the first request after receiving the first request; the second priority of the second request may be carried in the second request, and the first node may obtain the second priority of the second request from the second request after receiving the second request.

[0144] Furthermore, when the first node sends a first request to the second node, the first node determines the first priority of the first request by using the remaining retry times of the first request in the updated first information table, carries the first priority in the first request and sends it to the second node; when the first node sends a second request to the second node, the first node determines the second priority of the second request by using the remaining retry times of the second request in the updated first information table, carries the second priority in the second request and sends it to the second node.

[0145] In another implementation, the first priority of the first request is obtained based on the remaining number of retries of the first request in the first information table, and the second priority of the second request is obtained based on the remaining number of retries of the second request in the first information table. For example, after the first node updates the remaining number of retries and the number of retries of the first request in the first information table, it uses the remaining number of retries and the number of retries of the first request in the first information table to calculate the first ratio; after the first node updates the remaining number of retries and the number of retries of the second request in the first information table, it uses the remaining number of retries and the number of retries of the second request in the first information table to calculate the second ratio, thereby determining the first priority of the first request and the second priority of the second request.

[0146] In one implementation, the second request also carries at least one retry parameter of the second request; the retry parameter includes: a retry timeout timestamp, a retry condition, and a retry interval duration;

[0147] Among them, the first node is prohibited from retrying to process the second request when the current time is greater than the retry timeout timestamp. Specifically, after receiving the second request, the first node first updates the retry timeout timestamp carried in the second request when sending the second request to the second node. Specifically, the second node deducts the time taken by the first node to process the second request from the retry timeout timestamp in the second request to prompt the second node to process the second request before the retry timeout timestamp in the received second request. If the second node finds that the current time has exceeded the retry timeout timestamp when retrying to process the second request, it indicates that the processing has timed out, and the second request will not be retried at this time.

[0148] The first node retries to process the second request at least when the retry condition is met. The retry condition may be: the error code of the second request is a specific error code, or the error level of the second request is a specific error level. For example, the retry condition is: the HTTP return code corresponding to the second request is 503 or 504.

[0149] The first node retries to process the second request after the retry interval. For example, when the first node retries to process the second request, it does not start the retry immediately, but waits for the interval time before retrying to process the second request.

[0150] In one implementation, the first node may perform the following processing before step 509: Figure 7 As shown in:

[0151] Step 513: Determine whether the second node can retry the first request according to the request type of the first request. If the second node can retry the first request, execute step 514; if the second node cannot retry the first request, execute step 515.

[0152] The request type of the first request is determined based on the business function implemented by the first request.

[0153] Step 514: Set the retry attribute of the second node for the first request to the first attribute.

[0154] The first attribute is used to instruct the second node to retry processing the first request if processing the first request fails. Specifically, the second node retries processing the first request according to the remaining number of retries of the first request in the updated second information table.

[0155] Specifically, the retry attribute is configured in the first request, so that the first node carries the first attribute in the first request to provide it to the second node.

[0156] Step 515: Set the retry attribute of the second node for the first request to the second attribute.

[0157] The second attribute is used to indicate that the second node does not retry processing the first request if the processing of the first request fails. That is, even if the second node fails to process the first request, the second node does not retry processing the first request, but the second node sends corresponding feedback information to the upstream node, i.e., the first node, and the first node retries processing the first request.

[0158] Specifically, the retry attribute is configured in the first request, so that the first node carries the second attribute in the first request to provide to the second node.

[0159] That is, the first node can instruct the downstream second node whether to retry processing the first request based on the request type of the first request, thereby meeting the actual needs of the business function.

[0160] It should be noted that, when the first node processes the second request, in the process of sending the second request to the second node to call the second node to process the second request, before the first node sends the second request to the second node, it can also determine whether the second node can perform a retry for the second request according to the request type of the second request. If the second node can perform a retry for the second request, the retry attribute of the second node for the second request is set to the first attribute, and the first attribute indicates that the second node will retry the second request if the processing of the second request fails. If the second node cannot perform a retry for the second request, the retry attribute of the second node for the second request is set to the second attribute, and the second attribute indicates that the second node will not retry the processing of the second request if the processing of the second request fails. Based on this, the first attribute or the second attribute is carried in the second request. After the second request is sent to the second node, the second node retries the processing of the second request according to the first attribute if the processing of the second request fails, or the second node does not retry the processing of the second request according to the second attribute if the processing of the second request fails.

[0161] That is to say, whether it is the case of retrying the request or processing the request for the first time, before sending the request to the downstream node, the retry attribute of the downstream node for the request will be set to indicate whether the downstream node should retry the request if the request fails, so as to meet the actual needs of the business function corresponding to the request.

[0162] In another implementation, the first node may also determine whether the second node can retry the first request according to the request type of the first request before step 509. If the second node can retry the first request, step 509 is performed; if the second node cannot retry the first request, the remaining number of retries of the first request carried in the first request is set to zero, so as to notify all downstream nodes to update the remaining number of retries of the first request in the local information table to zero, thereby preventing the downstream nodes from retrying the first request.

[0163] That is, the first node can instruct all downstream nodes whether to retry processing the first request based on the request type of the first request, thereby meeting the actual needs of the business function.

[0164] A control method for executing a retry in a distributed system provided in an embodiment of the present application is introduced above. A device for executing the control method for executing a retry in a distributed system is introduced below.

[0165] See also Figure 8 , Figure 8A schematic diagram of the structure of a control device for performing retry in a distributed system provided in an embodiment of the present application. The device is deployed at a first node of the distributed system, and the first node is any node in the distributed system. The device may include the following units:

[0166] A feedback receiving unit 801 is configured to receive second feedback information sent by a second node; the second node is a downstream node adjacent to the first node in the distributed nodes; the second feedback information includes a total number of retries of the second node and its downstream nodes for the first request;

[0167] An information updating unit 802 is configured to update a first information table of the first node according to the second feedback information, wherein the first information table at least includes a remaining number of retries of the first request; the remaining number of retries is a remaining number of times that all nodes in the distributed system can reprocess the first request;

[0168] a remaining judgment unit 803, configured to judge, in response to the first node failing to process the first request, whether the remaining number of retries of the first request in the first information table is greater than or equal to zero; trigger the retry processing unit 804 if the remaining number of retries of the first request is greater than zero, and trigger the upward feedback unit 805 if the remaining number of retries of the first request is equal to zero;

[0169] The retry processing unit 804 is used to re-execute the local task corresponding to the first request; update the remaining retry times of the first request in the first information table and send the first request to the second node; the first request carries at least the remaining retry times of the first request, so that the second node updates the second information table of the second node according to the received first request and processes the first request, and the second information table contains at least the remaining retry times of the first request;

[0170] The upward feedback unit 805 is used to send first feedback information to a third node, where the first feedback information includes the total number of retries of the first node and its downstream nodes for the first request; the third node is an upstream node adjacent to the first node in the distributed system.

[0171] It can be seen that in this embodiment, each node in the distributed system updates the remaining number of retries based on the total number of retries fed back by the downstream node and determines whether to retry accordingly, and also feeds back the total number of retries to the upstream node. The remaining number of retries is continuously updated through coordination between the upstream and downstream nodes to achieve control of the number of retries, avoid retry storms on the downstream nodes, and reduce the processing pressure on the downstream nodes.

[0172] In one implementation, the feedback receiving unit 801 is further configured to: receive a second request sent by the third node, where the second request carries at least a remaining number of retries of the second request;

[0173] The information updating unit 802 is further configured to: update the remaining retry times of the second request in the first information table according to the remaining retry times of the second request;

[0174] The retry processing unit 804 is further configured to: process the second request.

[0175] In one implementation, when the first request is different from the second request, an execution order between the first request and the second request is determined based on a first priority of the first request and a second priority of the second request;

[0176] The first priority of the first request is related to the remaining number of retries of the first request; the second priority of the second request is related to the remaining number of retries of the second request.

[0177] In one implementation, the first information table further includes the number of retries of the first request and the number of retries of the second request; the number of retries of the first request is the number of times all nodes in the distributed system have retried to process the first request; the number of retries of the second request is the number of times all nodes in the distributed system have retried to process the second request;

[0178] The first priority of the first request is obtained based on the remaining number of retries and the number of retries completed of the first request, and the second priority of the second request is obtained based on the remaining number of retries and the number of retries completed of the second request.

[0179] In one implementation, the first priority of the first request is carried in the first request; the second priority of the second request is carried in the second request;

[0180] or,

[0181] The first priority of the first request is obtained based on the remaining number of retries of the first request in the first information table; the second priority of the second request is obtained based on the remaining number of retries of the second request in the first information table.

[0182] In one implementation, the second request also carries at least one retry parameter of the second request; the retry parameter includes: a retry timeout timestamp, a retry condition, and a retry interval duration;

[0183] Wherein, the first node is prohibited from retrying to process the second request when the current time is greater than the retry timeout timestamp;

[0184] The first node retries processing the second request at least when the retry condition is satisfied;

[0185] The first node retries processing the second request after an interval of the retry interval.

[0186] In one implementation, before the retry processing unit 804 sends the first request to the second node, it is also used to: determine whether the second node can perform a retry for the first request based on the request type of the first request; if the second node can perform a retry, set the retry attribute of the second node for the first request to a first attribute; the first attribute is used to instruct the second node to retry processing the first request if the processing of the first request fails; if the second node cannot perform a retry, set the retry attribute of the second node for the first request to a second attribute; the second attribute is used to instruct the second node not to retry processing the first request if the processing of the first request fails.

[0187] In one implementation, when updating the remaining number of retries of the first request in the first information table, the retry processing unit 804 is specifically configured to: reduce the remaining number of retries of the first request in the first information table by one.

[0188] It should be noted that the specific implementation of each unit in this embodiment can refer to the corresponding content in the previous text and will not be described in detail here.

[0189] The present application also provides an electronic device in an embodiment. Fig. 9 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to a fixed terminal such as a desktop computer or a server. Fig. 9 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0190] like Fig. 9As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage device 908 into a random access memory (RAM) 903. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 903. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0191] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a memory card, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig. 9 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0192] Fig. 9 The electronic device shown can be deployed as a node in a distributed system. The electronic device, as a first node, executes a computer program in a memory through a processor to implement any of the distributed system retry control methods provided in the embodiments of the present application.

[0193] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any of the distributed system retry control methods provided in the embodiments of the present application.

[0194] A computer storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When one or more computer programs are executed by an electronic device, the electronic device can implement any of the distributed system retry control methods provided in the embodiments of the present application.

[0195] The present application also provides a distributed system. Fig.10 As shown, the distributed system at least includes a first node 1001, a second node 1002 and a third node 1003, each of which can be Fig. 9 The electronic equipment shown (such as Figure 1 The server 200 in the distributed system shown in FIG. 1 ), or each node can be Figure 8 The device shown (such as Figure 4 Microservices in a distributed system on the server 200 shown in FIG. 1 ). Specifically:

[0196] The first node 1001 receives second feedback information sent by the second node 1002; the second node 1002 is a downstream node adjacent to the first node 1001 in the distributed nodes; the second feedback information includes the total number of retries of the second node 1002 and its downstream nodes for the first request;

[0197] The first node 1001 updates the first information table of the first node 1001 according to the second feedback information, where the first information table at least includes the remaining number of retries of the first request; the remaining number of retries is the remaining number of times that all nodes in the distributed system can reprocess the first request;

[0198] In response to the first node 1001 failing to process the first request, the first node 1001 determines whether the remaining number of retries for the first request in the first information table is greater than or equal to zero;

[0199] In the case where the remaining number of retries of the first request is greater than zero, the first node 1001 re-executes the local task corresponding to the first request; updates the remaining number of retries of the first request in the first information table and sends the first request to the second node 1002; the first request carries at least the remaining number of retries of the first request, so that the second node 1002 updates the second information table of the second node 1002 according to the received first request and processes the first request, and the second information table contains at least the remaining number of retries of the first request;

[0200] When the remaining number of retries of the first request is equal to zero, the first node 1001 sends first feedback information to the third node 1003, and the first feedback information includes the total number of retries of the first node 1001 and its downstream nodes for the first request; the third node 1003 is the upstream node adjacent to the first node 1001 in the distributed system.

[0201] The following is an example of a distributed system provided in an embodiment of the present application:

[0202] First, in the process of processing requests in a distributed system, the node carries some retry policy information in the request metadata. Each node retries according to the retry policy information, and at the same time, it makes corrections based on the retry result (i.e. feedback information) fed back by the downstream node, and feeds back the final retry result (i.e. feedback information, which may also include the request processing result) to the upstream node to ensure that the entire link meets the request retry policy.

[0203] The retry policy information in the request meta-information includes: the number of possible retries (i.e. the remaining number of retries mentioned above), the retry timeout timestamp, the retry condition, the retry interval, the retry priority factor (i.e. the priority mentioned above), etc. The details are as follows:

[0204] The number of retries refers to the number of retries allowed. The starting node that initiates the request sets the initial number of retries (i.e. the maximum number of retries). The number of retries for the entire link (i.e. the sum of the number of retries that all nodes in the entire link can make) must be less than or equal to the initial number of retries (set when the request is initiated).

[0205] The retry condition means that a retry is possible only for certain error codes and certain error levels;

[0206] Retry timeout timestamp means that the retry must be completed before this timestamp, otherwise the retry will not be performed;

[0207] The retry priority factor is: the number of possible retries divided by the maximum number of retries. Of course, it can also be adjusted by the node itself. The retry priority factor decreases as the number of retries increases. The larger the factor, the higher the retry priority level. Based on this, when the node load is high, requests with a larger retry factor will be prioritized, and the factor will decrease as the number of retries increases.

[0208] Secondly, each node creates a requested retry information table in its memory (i.e., the local information table mentioned above). This table stores the requested retry information, including: the number of possible retries, the number of retries completed, the retry conditions, the retry timeout timestamp, etc.

[0209] Initialization of retry information in the retry information table: The starting node sets the retry policy information described above in the request meta information, and sets different retry attributes of the downstream node according to different request types to indicate whether the downstream node can perform a retry.

[0210] Retry result in the response (request result): The node must carry the number of retries in the request result meta-information (the number of retries here refers to the total number of retries mentioned above, that is, the sum of the number of retries performed by all downstream nodes). After the node processes the request, whether it succeeds or not, it must feedback the retry result to the upstream node. For example, if the node has retried twice, then it should tell the upstream node in the result (that is, the feedback information mentioned above) that it has retried twice.

[0211] Unloading information: After receiving the request, the node parses the retry policy information from the request meta-information and stores it in the request retry information table, which is called unloading information.

[0212] Retry policy information is passed to downstream nodes: When the current node calls a downstream node, the retry policy information of the request is carried in the request and passed to the downstream node.

[0213] If the node wants the downstream node to retry: the number of retries in the request at this time is the updated number of retries based on the total number of retries. The revised number of retries is passed to the downstream node. In order to try to retry at the upstream node closest to the failed node, the transmission of feedback information and the length of the retry link can be reduced. Therefore, the retry strategy information must be passed to each node in the link.

[0214] If this node does not want the downstream node to retry, but wants to retry itself, the number of retries sent to the downstream node will be set to 0. For example, the retry attribute of the downstream node is set to the second attribute to indicate that the downstream node does not retry the request, but the local retry information table needs to be updated to facilitate the subsequent transmission of the retry policy information to its downstream node.

[0215] Feedback information of retry results: After a node processes a request, whether it succeeds or fails, or after a retry, it must return the request processing result to the upstream node. The feedback information includes the total number of retries and the request processing result, such as the obtained video data or video list.

[0216] The upstream node modifies the retry strategy information of this node's request based on the feedback information from the downstream node: the requested retry count in the retry information table is updated. The retry count in the table is the retry count in the table minus the total retry count in the feedback information, and the retried count in the table is the retried count in the table plus the total retry count of the downstream. If the result of the retry count minus the total retry count is greater than 0, the current node continues to initiate retries to the downstream node and passes the updated retry count to the downstream; if the retry count minus the total retry count is equal to 0, the current result will no longer be retried, and the updated total retry count (the current node's retry count plus the downstream node's retry count) will be directly returned to the upstream node, and then the upstream node will make a judgment.

[0217] Priority: If the node load is high, you can prioritize different requests based on the request retry priority factor, and process the higher priority requests first. If a request is retried multiple times, the request priority factor will decrease after each retry. If a request fails after multiple retries, the probability of its retry success will gradually decrease. Therefore, in extreme cases, you should give priority to requests with fewer retries to ensure that such requests are retried first.

[0218] It can be seen that this embodiment can control the retry strategy through the forward call chain of the request, and adjust the retry strategy in combination with the chain returned by the request. At the same time, in the end case, the retry priority factor can improve the success rate of the request while protecting the node. This front-end and back-end coordination control scheme controls the number and time of retries by the upstream node, and makes corrections in combination with the feedback of the downstream node, which solves the problem of the inability to coordinate strategies between nodes and avoids the downstream node exceeding its maximum processing capacity.

[0219] refer to Fig.11 As shown in Figure 1, the distributed system includes M1 module, M2 module, M3 module and M4 module. Assume that the maximum number of retries set for a certain request is 10 times, the retry timeout timestamp is 20240513101010, the retry condition is that the retry is performed only when the HTTP return code is 503 and 504, and the retry interval is 1 second.

[0220] The M1 module is the initiator of the request and belongs to the starting node. It is responsible for initializing the retry policy information and adding a field identifier prefixed with "mg-x-retry-" to the request meta-information to describe the retry policy information of this request, including the initial number of retries (such as 10 times), retry timeout timestamp, retry conditions, retry interval duration, retry priority factor and other information.

[0221] The M2 module will unload this information, that is, parse the retry policy information from the request meta information and store it in the request retry information table. The retry information table contains:

[0222] Number of retries = 10;

[0223] Number of retries = 0 (assuming no retries have been made yet);

[0224] Retry conditions: Retry when the request error code is 503 or 504.

[0225] Retry timeout: If the current node needs some extra time to process the error request, for example, 1 second, the retry timeout passed down from the upstream will be subtracted by 1 second.

[0226] Re-priority factor, if there has been no retry, the priority is 10 / 10=1, if there has been one retry, the priority is 9 / 10, and the numerator is reduced by 1 for each retry. The smaller the value, the lower the priority. If the node load is high, the request with a higher priority will be selected for retry.

[0227] The M3 module loads the retry information to be passed to the downstream node and encapsulates the retry policy information into the metadata of the request sent to the downstream node. The number of retries at this time should be equal to the number of retries in the request retry table. The number of retries in the table is determined based on the updated number of retries of the upstream node. The updated number of retries of the upstream node is: the original number of retries in the upstream node table minus the number of retries of the upstream node (it can also be the maximum number of retries minus the updated number of retries in the table). If the node does not want the downstream node to retry, the number of retries is set to 0, indicating that the downstream node cannot retry.

[0228] M4 module: After the downstream node processes the request, it will feedback the retry result information. After receiving this information, the current node will correct the information in the request retry information table. For example, if the downstream node has retried 3 times, then add 3 times to the number of times this request has been retried in the table. If the maximum number of retries in the table minus the number of retries is greater than 0, and the request error code returned by the downstream node is equal to 503 or 504, then continue to retry.

[0229] The following example takes a request passing through four nodes: A, B, C, and D:

[0230] Assume that when the request is initialized, the maximum number of retries is set to 5.

[0231] Based on the link A->B->C->D, node D does not allow retries. In nodes A, B, and C, the number of retries that can be made in the request retry table of each node is 5, and the number of retries that have been made is 0.

[0232] Assuming that node D fails, a 503 error is returned to node C.

[0233] The request of node C will fail. Node C will retry 5 times in a row. If all of them fail, the retry results of the total 5 retries will be returned to node B.

[0234] Node B receives a total of 5 retries, checks its own table and finds that it can retry 5 times, updates the number of retries to 0, that is, 5 minus 5 is 0, then node B will not retry again, and B feeds back the information that it has retried 5 times to A;

[0235] Node A receives a total of 5 retries, queries its own table and finds that 5 retries are possible, updates the number of possible retries to 0, that is, 5 minus 5 is 0, then node A will no longer retry and returns the result of request processing failure to the initiator of the request (i.e., the requesting end, such as terminal 100).

[0236] If node A does not want the downstream node to retry, the first time the request is passed to node B, the number of times the request can be retried is set to 0. Then neither node B nor node C will retry. When the request to node D fails, node C will pass the failure information to node B, and node B will continue to pass it to node A. After node A receives the request failure information, it checks the table and finds that the number of times that can be retried is 5 times, and the number of times that have been retried is 0 times, so it will retry and increase the number of times that have been retried in the table by 1.

[0237] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0238] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0239] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0240] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A control method for executing retry in a distributed system, It is characterized in that Applied to a first node, where the first node is any node in the distributed system, the method includes: receiving second feedback information sent by a second node; the second node is a downstream node adjacent to the first node in the distributed nodes; the second feedback information includes a total number of retries of the second node and its downstream nodes for the first request; According to the second feedback information, update the first information table of the first node, where the first information table at least includes the remaining number of retries of the first request; the remaining number of retries is the remaining number of times that all nodes in the distributed system can reprocess the first request; In response to the first node failing to process the first request, determining whether a remaining number of retries of the first request in the first information table is greater than or equal to zero; In the case where the remaining number of retries of the first request is greater than zero, re-execute the local task corresponding to the first request; update the remaining number of retries of the first request in the first information table and send the first request to the second node; the first request carries at least the remaining number of retries of the first request, so that the second node updates the second information table of the second node according to the received first request and processes the first request, and the second information table contains at least the remaining number of retries of the first request; When the remaining number of retries for the first request is equal to zero, first feedback information is sent to a third node, wherein the first feedback information includes the total number of retries of the first node and its downstream nodes for the first request; the third node is an upstream node adjacent to the first node in the distributed system.

2. The method according to claim 1, It is characterized in that The method further comprises: receiving a second request sent by the third node, where the second request carries at least a remaining number of retries of the second request; According to the remaining number of retries of the second request, updating the remaining number of retries of the second request in the first information table; The second request is processed.

3. The method according to claim 2, It is characterized in that In the case where the first request is different from the second request, an execution order between the first request and the second request is determined based on a first priority of the first request and a second priority of the second request; The first priority of the first request is related to the remaining number of retries of the first request; the second priority of the second request is related to the remaining number of retries of the second request.

4. The method according to claim 3, It is characterized in that The first information table also includes the number of retries of the first request and the number of retries of the second request; the number of retries of the first request is the number of times all nodes in the distributed system have retried to process the first request; the number of retries of the second request is the number of times all nodes in the distributed system have retried to process the second request; The first priority of the first request is obtained based on the remaining number of retries and the number of retries completed of the first request, and the second priority of the second request is obtained based on the remaining number of retries and the number of retries completed of the second request.

5. The method according to claim 3, It is characterized in that The first priority of the first request is carried in the first request; the second priority of the second request is carried in the second request; or, The first priority of the first request is obtained based on the remaining number of retries of the first request in the first information table; the second priority of the second request is obtained based on the remaining number of retries of the second request in the first information table.

6. The method according to claim 2, It is characterized in that The second request also carries at least one retry parameter of the second request; the retry parameter includes: a retry timeout timestamp, a retry condition, and a retry interval duration; Wherein, the first node is prohibited from retrying to process the second request when the current time is greater than the retry timeout timestamp; The first node retries processing the second request at least when the retry condition is satisfied; The first node retries processing the second request after an interval of the retry interval.

7. The method according to claim 1 or 2, It is characterized in that Before sending the first request to the second node, the method further includes: determining, according to a request type of the first request, whether the second node can perform a retry for the first request; If the second node is capable of performing a retry, setting a retry attribute of the second node for the first request to a first attribute; the first attribute is used to instruct the second node to retry processing the first request if processing of the first request fails; If the second node cannot perform a retry, the retry attribute of the second node for the first request is set to a second attribute; the second attribute is used to instruct the second node not to retry processing the first request if processing of the first request fails.

8. The method according to claim 1 or 2, It is characterized in that Updating the remaining number of retries of the first request in the first information table includes: The remaining number of retries of the first request in the first information table is subtracted from the number of times the first node retries to process the first request.

9. A distributed system, It is characterized in that At least including: a first node, a second node and a third node; wherein: The first node receives second feedback information sent by the second node; the second node is a downstream node adjacent to the first node in the distributed nodes; the second feedback information includes a total number of retries of the second node and its downstream nodes for the first request; The first node updates a first information table of the first node according to the second feedback information, wherein the first information table at least includes a remaining number of retries of the first request; the remaining number of retries is a remaining number of times that all nodes in the distributed system can reprocess the first request; In response to the first node failing to process the first request, determining, by the first node, whether a remaining number of retries of the first request in the first information table is greater than or equal to zero; In the case where the remaining number of retries of the first request is greater than zero, the first node re-executes the local task corresponding to the first request; updates the remaining number of retries of the first request in the first information table and sends the first request to the second node; the first request carries at least the remaining number of retries of the first request, so that the second node updates the second information table of the second node according to the received first request and processes the first request, and the second information table contains at least the remaining number of retries of the first request; When the remaining number of retries for the first request is equal to zero, the first node sends first feedback information to a third node, wherein the first feedback information includes the total number of retries of the first node and its downstream nodes for the first request; the third node is an upstream node adjacent to the first node in the distributed system.

10. An electronic device, deployed as a first node in a distributed system, It is characterized in that The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the control method for performing retry in a distributed system as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Distributed transaction processing method, device and system

    CN106502769A

  • Distributed system background retry method and device

    CN110764881A

  • Request processing method, system and device and storage medium

    CN116208604A

  • Distributed scheduling method and system based on ffmpeg

    CN117632518A

  • Task processing method and apparatus, and node

    WO2024109003A1