Service processing method, device, equipment, platform, medium and program product

By judging the failure record and cumulative duration of the second service request at the first node, and deciding whether to send a service request to the second node, the problem of poor service stability in the prior art is solved, and more efficient service response and node recovery are achieved.

CN115277847BActive Publication Date: 2025-01-07ALIBABA (CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210894063.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-27
Publication Date
2025-01-07
Estimated Expiration
2042-07-27

AI Technical Summary

Technical Problem

The existing service request processing methods lead to poor service stability when downstream service abnormalities, and cannot effectively avoid exception propagation and response delays.

Method used

After receiving the service request on the first node, it determines whether there is a record of failure of the second service request, and decides whether to send a service request to the second node based on the accumulated time. If the accumulated time is greater than or equal to the preset time, it will not be sent. The output request will be output. As a result, the exception request is truncated to improve the stability of service processing.

Benefits of technology

It effectively avoids exception propagation, reduces the number of requests to downstream nodes, improves node recovery efficiency and service response efficiency, and enhances the stability of service processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115277847B_ABST
    Figure CN115277847B_ABST
Patent Text Reader

Abstract

The present application provides a service processing method, device, equipment, platform, medium and program product. The method includes: a first node providing a first service receives a service request for the first service; when the first service depends on a second service, the first node determines whether there is a record of a failure of the second service request; if the first node determines that there is a record of a failure of the second service request, it determines whether the accumulated duration of the failure of the second service request is greater than or equal to a first preset duration; if the first node determines that the accumulated duration is greater than or equal to the first preset duration, it does not send a service request for the second service to the second node, and outputs the first request result of the first service. The present application improves the stability of service processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to data processing technology, and in particular to a service processing method, device, equipment, platform, medium and program product. Background Art

[0002] A user can trigger a service request through a user terminal. The node used to process the service request can respond to the service request and provide services to the user. In the existing service request processing process, the service can rely on downstream services. For services with dependencies, if the downstream service is abnormal, the service will also be abnormal. Therefore, the existing service processing method has the problem of poor stability. Summary of the invention

[0003] The present application provides a service processing method, apparatus, device, platform, medium and program product to improve the stability of service processing.

[0004] In a first aspect, the present application provides a service processing method, the method being applied to a first node providing a first service, the method comprising:

[0005] receiving a service request for the first service;

[0006] If the first service depends on the second service, determining whether there is a record of a request failure of the second service;

[0007] If it is determined that there is a record of the failure of the second service request, determining whether the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration;

[0008] If it is determined that the accumulated duration is greater than or equal to the first preset duration, no service request for the second service is sent to the second node, and the first request result for the first service is output.

[0009] Optionally, if it is determined that the accumulated duration is greater than or equal to a first preset duration, not sending a service request for the second service to the second node, and outputting a first request result for the first service, includes:

[0010] If it is determined that the accumulated duration is greater than or equal to the first preset duration, determining whether a trigger condition for requesting the second service again is met;

[0011] If it is determined that the trigger condition is not met, the service request for the second service is not sent to the second node, and the first request result is output.

[0012] Optionally, after determining whether a trigger condition for requesting the second service again is met, the method further includes:

[0013] If it is determined that the trigger condition is met, sending a service request for the second service to the second node;

[0014] If the second service request fails, outputting the first request result;

[0015] If the second service request is successful, the second request result of the first service is output, and the record of the failure of the second service request is cleared; wherein the second request result includes: the request result of the second service.

[0016] Optionally, the trigger condition includes: a random number allocated to the service request of the first service is less than a preset threshold;

[0017] Alternatively, the time from the last request for the second service is greater than or equal to a second preset time, and the second preset time is less than the first preset time;

[0018] Alternatively, the second node resumes processing of the service request for the second service.

[0019] Optionally, the trigger condition includes: a random number allocated to the service request of the first service is less than a preset threshold;

[0020] Before determining whether the triggering condition for requesting the second service again is met, the method further includes:

[0021] A random number is assigned to the service request of the first service.

[0022] Optionally, the preset threshold and / or the first preset duration is related to a service request frequency of the second node.

[0023] Optionally, the method further includes:

[0024] Configuration information is received, where the configuration information is used to configure the preset threshold and / or the first preset duration.

[0025] Optionally, after determining whether there is a record of failure of the second service request, the method further includes:

[0026] If it is determined that there is no record of failure of the second service request, sending a service request for the second service to the second node;

[0027] If the second service request fails, output the first request result and add a record of the failure of the second service request;

[0028] If the second service request is successful, the second request result of the first service is output; wherein the second request result includes: the request result of the second service.

[0029] Optionally, after determining whether the accumulated duration of the failure of the second service request is greater than or equal to a first preset duration, the method further includes:

[0030] If it is determined that the accumulated duration is less than the first preset duration, sending a service request for the second service to the second node;

[0031] If the second service request fails, outputting the first request result;

[0032] If the second service request is successful, the second request result of the first service is output, and the record of the failure of the second service request is cleared; wherein the second request result includes: the request result of the second service.

[0033] In a second aspect, the present application provides a service processing device, the device being applied to a first node providing a first service, the device comprising:

[0034] A receiving module, configured to receive a service request for the first service;

[0035] a determination module, configured to determine, when the first service depends on the second service, whether there is a record of a failure of the second service request; and, when it is determined that there is a record of a failure of the second service request, determine whether the accumulated duration of the failure of the second service request is greater than or equal to a first preset duration;

[0036] The processing module is used for not sending the service request of the second service to the second node and outputting the first request result of the first service when the determination module determines that the accumulated duration is greater than or equal to the first preset duration.

[0037] In a third aspect, the present application provides an electronic device, comprising: a processor and a memory; the processor is communicatively connected to the memory;

[0038] The memory stores computer-executable instructions;

[0039] The processor executes the computer-executable instructions stored in the memory to implement the method as described in any one of the first aspects.

[0040] In a fourth aspect, the present application provides a service processing platform, comprising: a first node for providing a first service, and a second node for providing a second service, wherein the first service depends on the second service;

[0041] The first node is used to execute the method as described in any one of the first aspects.

[0042] In a fifth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer execution instructions, and when the computer execution instructions are executed by a processor, they are used to implement the service processing method as described in any one of the first aspects.

[0043] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the service processing method described in any one of the first aspects.

[0044] The service processing method, device, equipment, platform, medium and program product provided by the present application, after receiving the service request of the first service, when the first service depends on the second service, by first determining whether there is a record of the failure of the second service request, the first node avoids directly sending the service request of the first service to the second node that may have an abnormality, thereby improving the efficiency of the first node outputting the first request result. When there is a record of the failure of the second service request, by determining whether the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration, it is determined that the second node is abnormal. When the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration, that is, when the second node is abnormal, the service request of the second service is not sent to the second node, which reduces the number of times the service request is sent to the second node, thereby reducing the number of requests that the second node needs to respond to, and improving the efficiency of the second node to restore the normal state, so that the second node can provide services to the first node as soon as possible, thereby improving the stability of service processing. By outputting the first request result of the first service when the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration, when an abnormality occurs in the downstream node of the first node, the request to the abnormal downstream node can be truncated, thereby improving the efficiency of the first node in responding to the service request of the first service and further improving the stability of service processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are 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 labor.

[0046] Figure 1 A schematic diagram of an application scenario of the service processing method;

[0047] Figure 2 A schematic diagram of an application scenario of a first node and a second node provided in this application;

[0048] Figure 3A schematic diagram of an application scenario of a first node provided in this application;

[0049] Figure 4 is a schematic diagram of the hardware structure of an electronic device 10 deployed with a first node;

[0050] Figure 5 A flowchart of a task processing method provided in this application;

[0051] Figure 6 A flowchart of another task processing method provided by this application;

[0052] Figure 7 A flowchart of another task processing method provided by this application;

[0053] Figure 8 A schematic diagram of the structure of a service processing device provided in this application.

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

[0055] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0056] The following first explains some of the noun concepts involved in this application:

[0057] Queries per second (QPS): QPS can be used to characterize how much traffic a server can handle within a preset time. Generally, the larger the QPS, the better the server performance, and the more traffic the server can handle within a preset time. The smaller the QPS, the worse the server performance, and the less traffic the server can handle within a preset time.

[0058] Downstream service: For example, if service A depends on service B, service B is the downstream service of service A. Service A depends on service B, which means that service A is provided based on the data provided by service B.

[0059] Function as a service (FaaS): FaaS refers to a technology that implements a function through a function or code block. FaaS can improve the efficiency of front-end devices in providing services.

[0060] With the development of science and technology, more and more services can be provided through an application. Take a mobile phone or tablet computer with a map navigation application installed as an example. Figure 1 The following is a schematic diagram of an application scenario of the service processing method. Figure 1 As shown, the map navigation application, in addition to providing map data to users, can also provide services such as taxi hailing, ticket booking, and hotel booking.

[0061] The user can trigger a service request for any of the above services through a terminal device. For example, Figure 1 As shown, the user can trigger a taxi service request through the terminal device by clicking the control corresponding to the taxi service. The terminal device can respond to the taxi service request and interact with the node corresponding to the taxi service to obtain the relevant data required to provide the taxi service. Figure 1 As shown, the node corresponding to the taxi service can obtain the vehicle information of the taxi platform A provided by the node corresponding to the taxi platform A, and the vehicle information of the taxi platform B provided by the node corresponding to the taxi platform B. The terminal device can, for example, interact with the node corresponding to the taxi service through the node corresponding to the map navigation application to obtain the vehicle information of the taxi platform A and the vehicle information of the taxi platform B, and display them.

[0062] In the existing service processing method, the above-mentioned taxi service corresponding node needs to feedback the vehicle information to the map navigation application corresponding node after obtaining all the data required to provide the taxi service. In other words, the taxi service corresponding node needs to feedback the vehicle information to the map navigation application corresponding node only after obtaining the vehicle information of taxi platform A provided by the taxi platform A corresponding node and obtaining the vehicle information of taxi platform B provided by the taxi platform B corresponding node.

[0063] However, when using the existing service processing method to handle the user's service request, if the corresponding node of the above-mentioned taxi platform A, or the corresponding node of the taxi platform B is in an abnormal state such as busy or faulty, and is unable to provide vehicle information to the corresponding node of the taxi service in time, the corresponding node of the taxi service will not be able to feedback any vehicle information to the corresponding node of the map navigation application, and further cause the corresponding node of the map navigation application to be unable to provide taxi service to the terminal device.

[0064] Therefore, the existing service processing method has the problem of poor stability.

[0065] Considering that the reason why the above-mentioned problems exist in the existing service processing methods is that if any downstream service node (for example, the node corresponding to the above-mentioned taxi-hailing platform A, or the node corresponding to the taxi-hailing platform B) has an abnormality, the upstream service node (for example, the node corresponding to the taxi service) will be unable to provide services. This application proposes a method in which the upstream service can also output the service request result when the downstream service node is abnormal, so as to improve the stability of service processing.

[0066] The execution subject of the service processing method provided in the present application may be the first node that provides the first service. The node corresponding to the second service (that is, the downstream service of the first service) on which the first service depends may be the second node. Exemplarily, taking the above-mentioned taxi service as the first service, the first node may be the node corresponding to the taxi service, the second service may be the vehicle information providing taxi platform A and the vehicle information providing taxi platform B, and the second node may be the corresponding node of taxi platform A and the corresponding node of taxi platform B. It should be understood that the taxi service, map navigation service, etc. in the aforementioned examples are only one possible implementation method provided by the present application, and the present application does not limit the specific content of the first service and the second service.

[0067] In addition, it should be understood that the present application does not limit the form of the first node and the second node. In some embodiments, the first node and the second node may also be deployed in a cloud environment. Figure 2 A schematic diagram of an application scenario of a first node and a second node provided in this application, such as Figure 2 As shown, in one embodiment, the first node and the second node may all be deployed in a cloud environment. A cloud environment is an entity that uses basic resources to provide cloud services to users in a cloud computing model. The cloud environment includes a cloud data center and a cloud service platform. The cloud data center includes a large number of basic resources (including computing resources, storage resources, and network resources) owned by a cloud service provider. The computing resources included in the cloud data center may be a large number of electronic devices (such as servers). For example, taking the example that the computing resources included in the cloud data center are servers running virtual machines, the first node and the second node may be independently deployed on servers or virtual machines in the cloud data center, respectively. The first node and the second node may also be distributedly deployed on multiple servers in the cloud data center, or distributedly deployed on multiple virtual machines in the cloud data center, or distributedly deployed on servers and virtual machines in the cloud data center. As Figure 2 As shown, the cloud environment can provide a first service to users by using a first node deployed in a cloud data center, and provide a second service to users by using a second node.

[0068] Taking the first node as an example, Figure 3Schematic diagram of an application scenario of a first node provided by the present application. The deployment of the first node and the second node provided by the present application is relatively flexible. In another embodiment, the first node or the second node provided by the present application can also be distributed and deployed in different environments. The first node or the second node provided by the present application can be logically divided into multiple parts, each of which has different functions. For example, taking the first node as an example, Figure 3 As shown, each part of the first node can be deployed in any two or three of the terminal electronic device (located on the user side), the edge environment and the cloud environment. The terminal electronic device located on the user side may include, for example, at least one of the following: a terminal server, a smart phone, a laptop, a tablet computer, a personal desktop computer, etc. The edge environment is an environment that includes a collection of edge electronic devices that are close to the terminal electronic device. The edge electronic devices include: edge servers, edge stations with computing power, etc. The various parts of the first node deployed in different environments or devices work together to provide the first service to the user. It should be understood that this application does not restrictively divide which parts of the first node are deployed in what environment. In actual application, it can be adaptively deployed according to the computing power of the terminal electronic device, the resource possession of the edge environment and the cloud environment, or the specific application requirements. Figure 3 This is a schematic diagram of an application scenario in which the first node is deployed in an edge environment and a cloud environment as an example.

[0069] The first node and the second node may also be deployed separately on an electronic device in any environment (for example, deployed separately on an edge server in an edge environment). For example, still taking the first node as an example, Figure 4 is a schematic diagram of the hardware structure of an electronic device 10 deployed with a first node, Figure 4 The electronic device 10 shown includes a memory 11, a processor 12, and a communication interface 13. The memory 11, the processor 12, and the communication interface 13 are communicatively connected to each other. For example, the memory 11, the processor 12, and the communication interface 13 can be communicatively connected by a network connection. Alternatively, the electronic device 10 may further include a bus 14. The memory 11, the processor 12, and the communication interface 13 are communicatively connected to each other via the bus 14. Figure 4 The electronic device 10 is a memory 11 , a processor 12 , and a communication interface 13 that are communicatively connected to each other via a bus 14 .

[0070] The memory 11 may be a read-only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 11 may store programs (i.e., computer executable instructions). When the program stored in the memory 11 is executed by the processor 12, the processor 12 and the communication interface 13 are used to execute the service processing method provided in the present application. In other words, the processor 12 executes the computer executable instructions stored in the memory 11 to implement the service processing method provided in the present application.

[0071] The processor 12 may be a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), a graphics processing unit (GPU), or one or more integrated circuits.

[0072] The processor 12 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, the function of the first node of the present application may be completed by the hardware integrated logic circuit or software instructions in the processor 12. The above-mentioned processor 12 may also be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and may implement or execute the methods, steps and logic block diagrams disclosed in the following embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the following embodiments of the present application may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 11, and the processor 12 reads the information in the memory 11, and completes the function of the first node of the present application in combination with its hardware.

[0073] The communication interface 13 uses a transceiver module such as, but not limited to, a transceiver to implement communication between the electronic device 10 and other devices or a communication network. For example, a data set can be acquired through the communication interface 13 .

[0074] When the electronic device 10 includes the bus 14 , the bus 14 may include a path for transmitting information between various components of the electronic device 10 (eg, the memory 11 , the processor 12 , and the communication interface 13 ).

[0075] The technical solution of the present application is described in detail below in conjunction with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0076] Figure 5 A flowchart of a task processing method provided in this application. Figure 5 As shown, the method comprises the following steps:

[0077] S101: Receive a service request for a first service.

[0078] Exemplarily, taking the case where a user triggers the first service request through a user terminal such as a mobile phone or a computer, the first node may receive a service request from the user terminal. In some embodiments, taking the intelligent driving scenario as an example, the first node may also receive a service request from a vehicle in an intelligent driving state. In some embodiments, the first node may also receive a service request from an upstream node of the first node (that is, a node that provides services based on the first node).

[0079] S102: If the first service depends on the second service, determine whether there is a record of a failed request for the second service.

[0080] Optionally, the record of the failure of the second service request may be a record of the first node's previous failure in requesting the second service from the second node. Alternatively, the second node may feedback information of the failure of the second service request to the first node when responding to the failure of the second service request, and the first node may generate a record of the failure of the second service request based on the information.

[0081] It should be understood that the present application does not limit the number of second services that the first service depends on. Taking the example of a first service depending on multiple second services, optionally, the first node may store, for example, the identifier of each second service that the first service depends on. After receiving the service request of the first service, the first node may determine whether there is a record of a second service request failure for each second service based on the identifier of each second service and the identifier of the second service for which there is a record of a service request failure.

[0082] If the first service does not depend on the second service, optionally, the first node can directly obtain data required for providing the first service according to the service request of the first service, and provide the first service based on the data. Exemplarily, the data required for providing the first service is stored in the first node, or in a database.

[0083] S103: If it is determined that there is a record of the failure of the second service request, determine whether the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration.

[0084] If the first node determines that there is a record of the failure of the second service request, it means that the second node may have an abnormality before that caused the failure of the second service request. Then the first node can determine whether the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration to further determine whether the second node has an abnormality.

[0085] Optionally, the first node may obtain the accumulated duration of the second service request failure by, for example, using the time when the second service request failure was most recently determined and the time difference when the second service request failure was first determined.

[0086] Exemplarily, the first preset duration may be pre-stored in the first node by a user.

[0087] S104: When the accumulated duration is greater than or equal to the first preset duration, do not send a service request for the second service to the second node, and output a first request result for the first service.

[0088] If the first node determines that the accumulated duration is greater than or equal to the first preset duration, it indicates that the second node is abnormal. Therefore, the first node may not send a service request for the second service to the second node. Through the above method, the number of times the service request is sent to the second node can be reduced, thereby reducing the number of requests that the second node needs to respond to, and improving the efficiency of the second node returning to normal.

[0089] Exemplarily, taking the first service's dependence on multiple second services as an example, the above-mentioned first request result may include, for example, at least one of the following: data provided by a second node that does not have a second service request failure record, data provided by a second node whose cumulative duration of second service request failure is less than a first preset duration, and data provided by the first node for the first service service request, etc. Taking the first service's dependence on one second service as an example, the above-mentioned first request result may include, for example, data provided by the first node for the first service service request. In some embodiments, the above-mentioned first request result may also include, for example: prompt information used to characterize the failure of the second service request.

[0090] Taking the example of a user triggering a service request for the aforementioned first service through a user terminal such as a mobile phone or a computer, the first node can output the first request result to the user terminal. Taking the example of a first node receiving a service request for the first service from a vehicle in an intelligent driving state, the first node can output the first request result to the vehicle in the intelligent driving state. Taking the example of a first node receiving a service request for the first service from an upstream node of the first node, the first node can output the first request result to the upstream node.

[0091] In this embodiment, after receiving the service request of the first service, when the first service depends on the second service, the first node avoids directly sending the service request of the first service to the second node that may have an abnormality by first determining whether there is a record of the failure of the second service request, thereby improving the efficiency of the first node outputting the first request result. When there is a record of the failure of the second service request, by determining whether the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration, it is determined that the second node is abnormal. When the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration, that is, when the second node is abnormal, the service request of the second service is not sent to the second node, the number of times the service request is sent to the second node is reduced, and the number of requests that the second node needs to respond to is reduced, and the efficiency of the second node returning to normal state is improved, so that the second node can provide services to the first node as soon as possible, thereby improving the stability of service processing. By outputting the first request result of the first service when the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration, when the downstream node of the first node is abnormal, the request to the abnormal downstream node can be truncated, improving the efficiency of the first node responding to the service request of the first service, and further improving the stability of service processing.

[0092] After the above step S102, if the first node determines that there is no record of failure of the second service request, it means that the second node has no abnormality before and can provide services to the first node normally. Therefore, optionally, the first node can send a service request for the second service to the second node. Through the above method, the first node can send a service request for the second service to the second node to try to obtain data provided by the second node.

[0093] After the first node sends a service request for the second service to the second node, if the second service request fails, the first node may optionally output the first request result and add a record of the failure of the second service request. By outputting the first request result, the efficiency of the first node in responding to the service request for the first service can be improved, and the stability of the service processing can be further improved. By adding a record of the failure of the second service request, the first node can determine whether to send a service request for the second service to the second node based on the record of the failure of the second service request after receiving the service request for the first service next time, thereby further improving the stability of the service processing.

[0094] If the second service request is successful, the first node may output the second request result of the first service. The second request result may include: the request result of the second service. Optionally, after obtaining the request result of the second service, the first node may directly use the request result of the second service as the second request result of the first service and output it. Alternatively, after obtaining the request result of the second service, the first node may also process the data in the request result of the second service to obtain the second request result of the first service.

[0095] After the above step S103, if the first node determines that the accumulated duration of the failure of the second service request is less than the above first preset duration, it means that the second node may not be abnormal. The above record of the failure of the second service request may be due to the influence of network fluctuations between the first node and the second node. Therefore, optionally, the first node may send a service request for the second service to the second node.

[0096] After the first node sends a service request for the second service to the second node, if the second service request fails, the first node may optionally output the first request result. By outputting the first request result, the efficiency of the first node in responding to the service request for the first service can be improved, and the stability of the service processing can be further improved. In addition, the first node may also record the time when the second service request failed, so that the first node can determine the cumulative duration of the second service request failure based on the time when the second service request failed the next time it receives the service request for the first service.

[0097] If the second service request is successful, it means that there is no abnormality in the second node or the abnormality has been resolved, then the first node can output the second request result of the first service and clear the record of the failure of the second service request. The second request result may include: the request result of the second service. In some embodiments, by clearing the record of the failure of the second service request, the first node can determine that there is no record of the failure of the second service request, and then directly send the service request of the second service to the second node, thereby improving the efficiency of the first node in obtaining the request result of the second service, and then improving the efficiency of outputting the second request result of the first service.

[0098] In this embodiment, by sending a service request for the second service to the second node when the accumulated duration of the failure of the second service request is less than the first preset duration, the first node can obtain and output the request result of the second service when the second service request succeeds. Through the above method, the first node can output the second request result of the first service including the request result of the second service, which improves the accuracy of the first node's response to the service request of the first service and improves the intelligence of service processing.

[0099] The following is a detailed description of how the first node does not send a service request for the second service to the second node and outputs a first request result for the first service when the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration:

[0100] As a possible implementation, when the first node determines that the accumulated duration is greater than or equal to the first preset duration, the first node may first determine whether a trigger condition for requesting the second service again is met. Then, if the first node determines that the trigger condition is not met, the service request for the second service is not sent to the second node, and the first request result is output.

[0101] In this implementation, by not sending a service request for the second service to the second node when the trigger condition is not met, the number of times the service request is sent to the second node is further reduced, thereby reducing the number of requests that the second node needs to respond to, that is, reducing the pressure on the second node to process data, thereby improving the efficiency of the second node to return to normal state, so that the second node can provide services to the first node as soon as possible, thereby further improving the stability of service processing.

[0102] If the first node determines that the above trigger condition is met, optionally, the first node may send a service request for the second service to the second node. If the second service request fails, the first node may output the first request result. If the second service request succeeds, the first node may output the second request result of the first service "including the request result of the second service" and clear the record of the failure of the second service request. The technical effect of this implementation is similar to the technical effect of outputting the second request result of the first service described in the aforementioned embodiment, and will not be repeated here.

[0103] The trigger conditions are described below by way of example:

[0104] As a first possible implementation manner, the trigger condition may include: a random number allocated to the service request of the first service is less than a preset threshold.

[0105] Optionally, the first node may determine that the trigger condition for requesting the second service again is met when the random number is less than a preset threshold 1; and determine that the trigger condition for requesting the second service again is not met when the random number is greater than or equal to the preset threshold 1. Exemplarily, taking the range of the random number as 0-1 as an example, the value of the preset threshold 1 may be 0.1, for example. At this time, the first node has a probability of 0.1 of meeting the trigger condition for requesting the second service again.

[0106] Optionally, the random number assigned to the service request for the first service may be generated for other devices other than the first node and sent to the first node. Alternatively, the first node may also assign a random number to the service request for the first service before determining whether the trigger condition for requesting the second service again is met. By the first node itself assigning a random number to the service request for the first service, the efficiency of the first node in deciding whether to send the service request for the second service to the second node based on the random number is improved.

[0107] Optionally, the above-mentioned preset threshold value can be, for example, pre-stored in the first node by a user. Alternatively, the first node can also receive configuration information. Among them, the configuration information can be used to configure a preset threshold value, or a first preset duration, or to configure a preset threshold value and a first preset duration. It should be understood that the present application does not limit how the first node receives the configuration information. Exemplarily, the first node can receive the above-mentioned configuration information input by the user, for example, through a graphical user interface (Graphical User Interface, GUI) or an application programming interface (Application Programming Interface, API).

[0108] In some embodiments, the preset threshold and / or the first preset duration may be related to the service request frequency of the second node. The service request frequency of the second node mentioned here is characterized by the QPS of the second node, for example. Taking the preset threshold being related to the service request frequency of the second node as an example, because the node with a larger QPS can handle more traffic within the preset time, therefore, the preset threshold may be positively correlated with the service request frequency of the second node. Taking the first preset duration being related to the service request frequency of the second node as an example, because the node with a larger QPS can handle more traffic within the preset time, therefore, the first preset duration may be negatively correlated with the service request frequency of the second node.

[0109] In this implementation, based on a preset threshold value and / or a first preset duration related to the service request frequency of the second node, the timing of sending the service request for the second service to the second node is determined, so that the service request for the second service is sent to the second node according to the performance of the second node. In other words, the number of times the service request for the second service is sent to the second node is related to the performance of the second node, which reduces the probability of anomalies in the second node, thereby further improving the stability of service processing.

[0110] In some embodiments, the first node may also determine that the trigger condition for requesting the second service again is met when the random number is greater than or equal to a preset threshold 2; and determine that the trigger condition for requesting the second service again is not met when the random number is less than the preset threshold 2. Exemplarily, still taking the range of the random number as 0-1 as an example, assuming that the value of the preset threshold 2 is 0.9, at this time, the first node has a probability of 0.1 of meeting the trigger condition for requesting the second service again.

[0111] As a second possible implementation, the trigger condition may include: the time from the last request for the second service is greater than or equal to a second preset time, wherein the second preset time is less than the first preset time.

[0112] In this implementation, the first node may meet the trigger condition once every second preset duration. Therefore, the first node may send a service request for the second service to the second node every second preset duration. The second preset duration may be pre-stored in the first node by the user. Alternatively, the above configuration information may also be used to configure the second preset duration. In some embodiments, the second preset duration may also be related to the QPS of the second node.

[0113] As a third possible implementation manner, the trigger condition may include: the second node resumes processing of a service request for the second service.

[0114] Optionally, the first node may, for example, periodically send a health check request to the second node after determining that the aforementioned cumulative duration is greater than or equal to the first preset duration. Optionally, the health check request may be used to request the second node to provide feedback on whether the second node has currently restored the processing of the service request of the second service. Optionally, the health check request is a piece of data with less content to reduce the pressure on the second node to respond to the health check request.

[0115] Exemplarily, if the first node determines that the feedback information of the second node is used to characterize the processing of the service request of the second service that is currently restored, the first node can determine that the trigger condition is met. If the first node determines that the feedback information of the second node is used to characterize the processing of the service request of the second service that is currently not restored, the first node can determine that the trigger condition is not met.

[0116] In this embodiment, through the trigger conditions under the above various implementation methods, the first node does not send the service request of the second service to the second node when the above trigger conditions are not met. Through the above method, the number of times the first node sends the service request of the second service to the second node is reduced, thereby reducing the processing pressure of the second node. By reducing the processing pressure of the second node when an abnormality occurs in the second node, the efficiency of the second node in restoring the service request of the second service is improved, and the stability of service processing is further improved.

[0117] For example, taking the example of dividing the interaction process between the first node and the second node into a monitoring state and a working state, Figure 6 A flowchart of another task processing method provided by this application. Figure 6 As shown, service A is the first service provided by the first node, and service B is the second service that the first service depends on.

[0118] In the monitoring state, the user can send a service request for the first service to the first node through the user terminal. After receiving the service request for the first service, the first node can send a service request for the second service to the second node. If the request times out, the second node can feedback information about the failure of the second service request, and then the first node can create a record of the failure of the second service request, and feedback the result of the first request for the first service to the user terminal.

[0119] Then, the first node may enter the working state when it is determined that the accumulated time duration of the second service request failure is greater than or equal to the first preset time duration.

[0120] In the working state, the first node may send a service request for the second service to the second node when the generated random number is less than a preset threshold (e.g., a preset percentage). If the second service request still fails, the first node may output the first request result to the user terminal, and continue to perform the operation of determining whether the random number is less than the preset percentage, and send a service request for the second service to the second node when the random number is less than the preset percentage, until the second service request succeeds.

[0121] Taking the trigger condition as an example, the random number Z allocated to the service request of the first service is less than the preset threshold value Y. Figure 7 A flowchart of another task processing method provided by this application is shown below. Figure 7 As shown, the method comprises the following steps:

[0122] Step 1: A first node receives a service request for a first service.

[0123] Step 2: When the first service depends on the second service, determine whether there is a record of a failed request for the second service.

[0124] If yes, execute step 3. If no, execute step 6 to send a service request of the second service to the second node.

[0125] Step 3: Determine whether the accumulated duration X of the second service request failure is greater than or equal to the first preset duration.

[0126] The unit of the cumulative duration X may be seconds.

[0127] If the accumulated duration is greater than or equal to the first preset duration, execute step 4. If the accumulated duration is less than the first preset duration, execute step 6 to send a service request for the second service to the second node.

[0128] Step 4: Get a random number Z.

[0129] Step 5: Determine whether the random number Z is less than a preset threshold Y.

[0130] For example, if the range of the random number Z is 0-1, then Y may be a preset percentage, such as 0.1 (ie, 10%).

[0131] If the random number Z is less than the preset threshold Y, execute step 6. If the random number Z is greater than the preset threshold Y, do not send the service request of the second service to the second node (also called truncated downstream request), and output the first request result of the first service.

[0132] Step 6: Send a service request for the second service to the second node.

[0133] Step 7: Determine whether the second service request is successful.

[0134] If successful, proceed to step 8. If unsuccessful, proceed to step 9.

[0135] Step 8: Output the result of the second request of the first service, and clear the record of the failed second service request.

[0136] The second request result may include: a request result for the second service.

[0137] Step 9: Add a record of the second service request failure.

[0138] In this embodiment, the first node can also output the first request result of the first service when an abnormality occurs in the downstream node (that is, the above-mentioned second node). By truncation processing of the second node with an abnormality, the first node can quickly respond to the service request of the first service, thereby improving the stability of service processing. When an abnormality occurs in the second node, the first node determines whether to send a service request for the second service to the second node based on the size relationship between the random number and the preset threshold, thereby improving the intelligence of service processing and reducing the processing pressure of the second node.

[0139] Figure 8 This is a schematic diagram of the structure of a service processing device provided by this application. Figure 8 As shown, the device includes: a receiving module 21, a determining module 22, and a processing module 23. Among them,

[0140] A receiving module 21, configured to receive a service request for the first service;

[0141] The determination module 22 is used to determine whether there is a record of failure of a second service request when the first service depends on the second service, and when it is determined that there is a record of failure of the second service request, determine whether the accumulated duration of the failure of the second service request is greater than or equal to a first preset duration.

[0142] The processing module 23 is used to not send the service request of the second service to the second node when it is determined that the accumulated duration is greater than or equal to the first preset duration, and output the first request result of the first service.

[0143] Optionally, the processing module 23 is specifically used to determine whether a trigger condition for requesting the second service again is met when it is determined that the accumulated duration is greater than or equal to a first preset duration; when it is determined that the trigger condition is not met, not sending a service request for the second service to the second node, and outputting the first request result.

[0144] Optionally, the device may further include a sending module 24, which is used to send a service request for the second service to the second node after determining whether the trigger condition for requesting the second service again is met, when the trigger condition is determined to be met; Optionally, the processing module 23 is also used to output the first request result when the second service request fails; when the second service request succeeds, output the second request result of the first service, and clear the record of the failure of the second service request. Wherein, the second request result includes: the request result of the second service.

[0145] Optionally, the trigger condition includes: a random number assigned to the service request for the first service is less than a preset threshold; or, the time since the last request for the second service is greater than or equal to a second preset time, and the second preset time is less than the first preset time; or, the second node resumes processing of the service request for the second service.

[0146] Optionally, taking the trigger condition including: a random number assigned to the service request for the first service being less than a preset threshold as an example, optionally, the processing module 23 is also used to assign a random number to the service request for the first service before determining whether the trigger condition for requesting the second service again is met.

[0147] Optionally, the preset threshold and / or the first preset duration is related to a service request frequency of the second node.

[0148] Optionally, the receiving module 21 is further configured to receive configuration information, wherein the configuration information is used to configure the preset threshold and / or the first preset duration.

[0149] Optionally, the sending module 24 is further configured to, after determining whether there is a record of the failure of the second service request, send the service request of the second service to the second node when it is determined that there is no record of the failure of the second service request. Optionally, the processing module 23 is further configured to output the first request result and add the record of the failure of the second service request when the second service request fails; and output the second request result of the first service when the second service request succeeds. The second request result includes: the request result of the second service.

[0150] Optionally, the sending module 24 is further configured to, after determining whether the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration, send the service request of the second service to the second node when it is determined that the accumulated duration is less than the first preset duration. Optionally, the processing module 23 is further configured to output the first request result when the second service request fails; and output the second request result of the first service when the second service request succeeds, and clear the record of the failure of the second service request. The second request result includes: the request result of the second service.

[0151] The service processing device provided in this application is used to execute the aforementioned service processing method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0152] The present application also provides a Figure 4 In the electronic device 10 shown, the processor 12 in the electronic device 10 reads a group of computer instructions stored in the memory 11 to execute the aforementioned service processing method.

[0153] The present application also provides a service processing platform. The service processing platform may include: a first node for providing a first service, and a second node for providing a second service. As mentioned above, the first service depends on the second service. The first node may be used to execute the method described in any of the above embodiments.

[0154] The present application also provides a computer-readable storage medium, which may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes. Specifically, the computer-readable storage medium stores program instructions, and the program instructions are used for the methods in the above embodiments.

[0155] The present application also provides a computer program product, which includes a computer program, which can be stored in a readable storage medium. At least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device implements the service processing method provided by the various embodiments described above.

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

Claims

1. A service processing method, characterized in that: The method is applied to a first node providing a first service, and the method includes: receiving a service request for the first service; If the first service depends on the second service, determining whether there is a record of a request failure of the second service; If it is determined that there is a record of the failure of the second service request, determining whether the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration; If it is determined that the accumulated duration is greater than or equal to the first preset duration, the service request for the second service is not sent to the second node, and the first request result of the first service is output; when the first service depends on multiple second services, the first request result at least includes: data provided by the second node for which there is no record of failure of the second service request.

2. The method according to claim 1, characterized in that If it is determined that the accumulated duration is greater than or equal to the first preset duration, not sending the service request for the second service to the second node, and outputting the first request result for the first service, includes: If it is determined that the accumulated duration is greater than or equal to the first preset duration, determining whether a trigger condition for requesting the second service again is met; If it is determined that the trigger condition is not met, the service request for the second service is not sent to the second node, and the first request result is output.

3. The method according to claim 2, characterized in that After determining whether the triggering condition for requesting the second service again is met, the method further includes: If it is determined that the trigger condition is met, sending a service request for the second service to the second node; If the second service request fails, outputting the first request result; If the second service request is successful, the second request result of the first service is output, and the record of the failure of the second service request is cleared; wherein the second request result includes: the request result of the second service.

4. The method according to claim 2, characterized in that: The trigger condition includes: the random number allocated to the service request of the first service is less than a preset threshold; Alternatively, the time from the last request for the second service is greater than or equal to a second preset time, and the second preset time is less than the first preset time; Alternatively, the second node resumes processing of the service request for the second service.

5. The method according to claim 4, characterized in that The trigger condition includes: the random number allocated to the service request of the first service is less than a preset threshold; Before determining whether the triggering condition for requesting the second service again is met, the method further includes: A random number is assigned to the service request for the first service.

6. The method according to claim 4 or 5, characterized in that: The preset threshold and / or the first preset duration is related to the service request frequency of the second node.

7. The method according to claim 4 or 5, characterized in that: The method further comprises: Configuration information is received, where the configuration information is used to configure the preset threshold and / or the first preset duration.

8. The method according to any one of claims 1 to 5, characterized in that: After determining whether there is a record of the second service request failing, the method further includes: If it is determined that there is no record of failure of the second service request, sending a service request for the second service to the second node; If the second service request fails, output the first request result and add a record of the failure of the second service request; If the second service request is successful, the second request result of the first service is output; wherein the second request result includes: the request result of the second service.

9. The method according to any one of claims 1 to 5, characterized in that: After determining whether the accumulated duration of the failure of the second service request is greater than or equal to the first preset duration, the method further includes: If it is determined that the accumulated duration is less than the first preset duration, sending a service request for the second service to the second node; If the second service request fails, outputting the first request result; If the second service request is successful, the second request result of the first service is output, and the record of the failure of the second service request is cleared; wherein the second request result includes: the request result of the second service.

10. A service processing device, characterized in that: The device is applied to a first node providing a first service, and the device includes: A receiving module, configured to receive a service request for the first service; a determination module, configured to determine, when the first service depends on the second service, whether there is a record of a failure of the second service request; and, when it is determined that there is a record of a failure of the second service request, determine whether the accumulated duration of the failure of the second service request is greater than or equal to a first preset duration; A processing module, used for not sending a service request for the second service to the second node and outputting a first request result for the first service when the determination module determines that the accumulated duration is greater than or equal to a first preset duration; when the first service depends on multiple second services, the first request result at least includes: data provided by the second node for which there is no record of failure of the second service request.

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

12. A service processing platform, characterized in that: include: a first node for providing a first service, and a second node for providing a second service, the first service being dependent on the second service; The first node is used to execute the method according to any one of claims 1-9.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the service processing method according to any one of claims 1 to 9.

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

Citation Information

Patent Citations

  • API calling method and device, storage medium and electronic equipment

    CN110995780A