Distributed service link exception processing method and system and storage medium

By introducing offline task compensation service links into distributed service links, the data loss problem caused by avalanche diffusion of service links in the prior art is solved, and high availability and link consistency of service requests are achieved.

CN119254608APending Publication Date: 2025-01-03DUXIAOMAN TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411300558.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

In the prior art, when the service link is avalanche, it is difficult to ensure the high availability and consistency of distributed service links, especially the problem of data missing after circuit breaking and degradation has not been effectively solved.

Method used

By establishing an offline task compensation service link between the upstream service and the downstream service, the same service call logic is used to perform offline compensation processing on service requests with abnormal results, ensuring data integrity and link consistency.

Benefits of technology

It effectively solves the data loss problem caused by fuse degradation in the online service link, ensures high availability of service requests and link robustness, and ensures the consistency between offline task compensation processing and online request processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254608A_ABST
    Figure CN119254608A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a distributed service link exception processing method and system and a storage medium. The method comprises the following steps: an upstream service sends a service request to a downstream service; the downstream service processes the received service request and sends a processing result to the upstream service; if the processing result is abnormal, the upstream service thread pool calls an off-line task compensation service link to perform off-line compensation processing on the service request with the abnormal processing result, and sends an off-line compensation processing result to the upstream service; wherein the service calling logic of the offline task compensation service link comprises the service calling logic between the upstream service and the downstream service. According to the technical scheme provided by the embodiment of the invention, the problem of data missing caused by fusing degradation in an online service link can be effectively solved, the high availability of the service request and the robustness of the service link are ensured, and the consistency of offline task compensation processing and online request processing is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of Internet technology, and in particular to a distributed service link exception processing method, system, and storage medium. Background Art

[0002] In order to prevent the spread of service link avalanche, technicians have proposed many service fault tolerance solutions, such as isolation, timeout, current limiting, circuit breaking and degradation, etc. Specific implementation methods can include the fault tolerance component Hystrix and Alibaba's open source Sentinel.

[0003] Among them, Hystrix and Sentinel both focus on improving the service circuit breaker degradation strategy. For example, Hystrix downgrades based on the failure ratio, and Sentinel also supports the degradation of response time. Hystrix focuses more on using thread pools to isolate and protect services, while Sentinel only supports the use of marked semaphores to isolate services. The above solutions do not have a further processing mechanism for how to ensure the high availability of service links after service degradation. Summary of the invention

[0004] The embodiments of the present disclosure provide a distributed service link exception processing method, system and storage medium, which can ensure the high availability of each request of the distributed service link and the consistency of the overall link.

[0005] In a first aspect, an embodiment of the present disclosure provides a distributed service link exception handling method, including:

[0006] The upstream service sends a service request to the downstream service;

[0007] The downstream service processes the received service request and sends the processing result to the upstream service;

[0008] If there is an abnormal processing result, the upstream service thread pool calls the offline task compensation service link to perform offline compensation processing on the abnormal processing result service request, and sends the offline compensation processing result to the upstream service; wherein, the service call logic of the offline task compensation service link includes the service call logic between the upstream service and the downstream service.

[0009] In a second aspect, an embodiment of the present disclosure provides a distributed service link exception handling system, including an upstream service and a downstream service, wherein:

[0010] The upstream service sends a service request to the downstream service;

[0011] The downstream service processes the received service request and sends the processing result to the upstream service;

[0012] If there is an abnormal processing result, the upstream service thread pool corresponding to the upstream service calls the offline task compensation service link to perform offline compensation processing on the abnormal processing result service request, and sends the offline compensation processing result to the upstream service; wherein, the service call logic of the offline task compensation service link includes the service call logic between the upstream service and the downstream service.

[0013] In a third aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described distributed service link exception handling methods.

[0014] The upstream service of the disclosed embodiment sends a service request to the downstream service; the downstream service processes the received service request and sends the processing result to the upstream service; if there is an abnormal processing result, the upstream service thread pool calls the offline task compensation service link to perform offline compensation processing on the service request with abnormal processing result, and sends the offline compensation processing result to the upstream service; wherein, the service call logic of the offline task compensation service link includes the service call logic between the upstream service and the downstream service. The above-mentioned method of using the offline task compensation service link to process the service request with abnormal processing in the online service link, and feeding back the offline compensation processing result to the upstream service after the processing is completed, can effectively solve the problem of data missing in the online service link caused by fuse degradation, and ensure the high availability of the service request and the robustness of the service link; in addition, the offline task compensation service link adopts the same service call logic as the online service link, which ensures the consistency of the offline task compensation processing and the online request processing, and thus also ensures the consistency of the overall link. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0016] Figure 1 A flowchart of a distributed service link exception handling method provided by an embodiment of the present disclosure;

[0017] Figure 2 A flowchart of online service link processing in a distributed service link provided by an embodiment of the present disclosure;

[0018] Figure 3 A flowchart of using an offline task compensation service link processing provided by an embodiment of the present disclosure;

[0019] Figure 4A schematic diagram of the structure of a distributed service link exception handling system provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0020] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0021] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0022] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0023] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0024] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0025] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0026] Figure 1 This is a flow chart of a distributed service link exception handling method provided by an embodiment of the present disclosure. This embodiment is applicable to the situation where a distributed service link needs to handle the abnormal service request after the circuit breaker is downgraded due to abnormal service request processing in the distributed service link. The method can be executed by a distributed service link exception handling system. Figure 1 As shown, the method may include the following steps:

[0027] S110. The upstream service sends a service request to the downstream service.

[0028] In a distributed service link, for the same service request, the end that sends the service request is the upstream service, and the end that receives the service request is the downstream service. In this embodiment, upstream service and downstream service are relative concepts. For a service, it can be the upstream service of its downstream service, and it can also be the downstream service of its upstream service. Exemplarily, downstream service B can be the upstream service of downstream service C, and downstream service B can also be the downstream service of upstream service A.

[0029] In order to improve the concurrency and response speed of the system, the upstream service in this embodiment can preferably make asynchronous requests to the downstream service, that is, the upstream service issues a service request and the downstream service executes the service request. During this process, the upstream service does not need to wait for a response from the downstream service.

[0030] In a distributed system, the downstream service uses a separate thread pool to process the service request of the upstream service, rather than simply relying on the traditional Tomcat thread, which can establish an effective isolation layer between the upstream service and the downstream service to prevent the entire system from crashing due to the instability of the downstream service. Therefore, in this embodiment, the downstream service can preferably use a separate thread pool to process the service request sent by the upstream service, and accordingly, the upstream service sending the service request to the downstream service can be the upstream service sending the service request to the downstream service's downstream service thread pool.

[0031] In order to facilitate recording the order of service requests, orderly manage service requests, and enable the system to better cope with high-concurrency requests and improve the efficiency of request processing, preferably, this embodiment can also configure a memory queue for the downstream service to store and sort the service requests sent by the upstream service, wherein the service requests in the memory queue can be sorted by request time or by call priority, etc. Correspondingly, the upstream service sending the service request to the downstream service can also be the upstream service sending the service request to the memory queue of the downstream service.

[0032] S120: The downstream service processes the received service request and sends the processing result to the upstream service.

[0033] In this embodiment, the processing result may include two situations: a normal processing result and an abnormal processing result. A normal processing result means that the downstream service completes the processing of the service request and the processing has not timed out. At this time, the processing result sent by the downstream service to the upstream service is the service result corresponding to the service request. An abnormal processing result may include the failure of the downstream service to process the service request, or the timeout of the downstream service processing the service request. At this time, the processing result sent by the downstream service to the upstream service is abnormal processing result information; if the downstream service is configured with a memory queue, the abnormal processing result may also include the existence of a service request with a response timeout in the memory queue. At this time, the memory queue can remove the service request with a response timeout from the queue and send the abnormal processing result information to the upstream service. The above-mentioned service requests that failed to process, timed out, and were removed by the memory queue are all service requests with abnormal processing results. The service requests with abnormal processing results in this embodiment can be stored in the corresponding database, and can also be stored in the external memory queue pre-configured by the downstream service.

[0034] S130. If there is an abnormal processing result, the upstream service thread pool calls the offline task compensation service link to perform offline compensation processing on the abnormal processing result service request, and sends the offline compensation processing result to the upstream service; wherein the service call logic of the offline task compensation service link includes the service call logic between the upstream service and the downstream service.

[0035] In response to the above-mentioned abnormal processing results, the abnormal processing result service request can be processed by calling a pre-designed offline task compensation service link, wherein the offline task compensation service link has the same service call logic as the online service link including the upstream service and the downstream service. The service request is processed through the offline task compensation service link, and the offline compensation processing result obtained can be the same as the online service link including the upstream service and the downstream service, which makes up for the problem of missing upstream service data due to abnormal processing of the service request by the downstream service.

[0036] The upstream service of this embodiment sends a service request to the downstream service; the downstream service processes the received service request and sends the processing result to the upstream service; if there is an abnormal processing result, the upstream service thread pool calls the offline task compensation service link to perform offline compensation processing on the service request with abnormal processing result, and sends the offline compensation processing result to the upstream service; wherein, the service call logic of the offline task compensation service link includes the service call logic between the upstream service and the downstream service. The above-mentioned method of using the offline task compensation service link to process the service request with abnormal processing in the online service link, and feeding back the offline compensation processing result to the upstream service after the processing is completed, can effectively solve the problem of data missing caused by fuse degradation in the online service link, and ensure the high availability of the service request and the robustness of the service link; in addition, the offline task compensation service link adopts the same service call logic as the online service link, which ensures the consistency of the offline task compensation processing and the online request processing, and thus also ensures the consistency of the overall link.

[0037] On the basis of the above embodiments, further, if the downstream service is pre-configured with an external memory queue, the downstream service processes the received service request and sends the processing result to the upstream service, including:

[0038] If the downstream service fails to process the service request or times out, the service request with the corresponding abnormal processing result is stored in the external memory queue, and the abnormal processing result information is fed back to the upstream service.

[0039] The processing timeout may include the situation that the service request is not processed completely but the processing time exceeds the preset time, or the service request is processed completely but the upstream service has released the corresponding thread, etc. In this embodiment, when the downstream service fails to process the service request or the processing times out, the downstream service stores the obtained processing result abnormal service request in the external memory queue.

[0040] The downstream service of this embodiment pre-configures an external memory queue, which can be used to store service requests with abnormal processing results. By reading the external memory queue, the system can know which service requests with abnormal processing results are in the online service link, so that the subsequent offline task compensation service link can obtain the service requests with abnormal processing results to perform offline task compensation.

[0041] On the basis of the above embodiments, further, the downstream service processes the received service request, further comprising:

[0042] After receiving the service request, the downstream service calls the operating system kernel thread to process the service request;

[0043] Correspondingly, the downstream service fails to process the service request or times out, including: the operating system kernel thread fails to process the service request or times out.

[0044] In this embodiment, it can be determined whether the downstream service calls the operating system kernel thread to process the service request according to the service needs. Exemplarily, if the service result can be determined without relying on external service attributes, the operating system kernel thread can be called to process the service request.

[0045] When the upstream service needs to wait for the result of the downstream service, by relying on the system kernel notification, thread resources can be released in time, improving system concurrency, ensuring overall performance while reducing the risk of thread blocking.

[0046] On the basis of the above embodiments, the upstream service thread pool further calls the offline task compensation service link to perform offline compensation processing on the service request with abnormal processing result, including:

[0047] The upstream service thread pool reads the current processing result exception service request in the external storage queue and sends it to the offline upstream service;

[0048] The offline upstream service sends the current processing result exception service request to the offline downstream service;

[0049] The offline downstream service calls the operating system kernel thread to process the current abnormal processing result service request. After the processing is successful, the above steps are used to process the next abnormal processing result service request.

[0050] For downstream services that call the operating system kernel thread to process service requests, if the operating system kernel thread fails to process the service request or the processing times out, the offline task compensation service link also uses the above-mentioned method of calling the operating system kernel thread to process service requests with abnormal processing results, thereby ensuring the consistency of the processing results of the offline task compensation service link and the online service link.

[0051] On the basis of the above embodiments, further, if the downstream service is pre-configured with a memory queue and a downstream service thread pool, the upstream service sends a service request to the downstream service, including:

[0052] The upstream service sends the service request to the memory queue;

[0053] The downstream service thread pool obtains the service request from the memory queue and sends it to the downstream service.

[0054] By configuring a separate thread pool and memory queue for downstream services, an effective isolation layer can be established between upstream and downstream services to prevent the entire system from crashing due to the instability of downstream services. At the same time, service requests can be managed in an orderly manner, allowing the system to better cope with high-concurrency requests and improve the efficiency of request processing.

[0055] On the basis of the above embodiments, further, the downstream service processes the received service request and sends the processing result to the upstream service, including:

[0056] The memory queue continuously monitors whether there is a service request with a response timeout in the queue. If so, the corresponding response timeout service request is stored in the external memory queue, and the abnormal processing result information is fed back to the upstream service. If not, no operation is performed; wherein, the response timeout includes that the time period during which the service request waits for a response in the queue exceeds a first preset time period, or the sum of the time period during which the service request waits for a response in the queue and the time period during which the service request waits for a response in the downstream service thread pool exceeds a second preset time period.

[0057] The above-mentioned service request with timed response in the memory queue is stored in the external memory queue, which can provide a basis for subsequent offline task compensation services.

[0058] Exemplarily, the first preset time period is 300ms, and the service request has been waiting in the queue for 300ms and still not been called, then the memory queue stores the service request in the external memory queue. Another exemplary case is that the second preset time period is 500ms, and the service request has been waiting in the queue for 200ms and is acquired by the downstream service thread pool, and has been waiting in the downstream service thread pool for 300ms and still not responded to by the downstream service, then the memory queue stores the service request in the external memory queue.

[0059] On the basis of the above embodiments, the upstream service thread pool further calls the offline task compensation service link to perform offline compensation processing on the service request with abnormal processing result, including:

[0060] The upstream service thread pool reads the abnormal processing result service request in the external storage queue and sends it to the offline upstream service;

[0061] The offline upstream service sends the service request with abnormal processing result to the offline memory queue;

[0062] The offline downstream service thread pool obtains the current processing result exception service request from the offline memory queue and sends it to the offline downstream service;

[0063] The offline downstream service processes the current abnormal processing result service request, and after successful processing, uses the above steps to process the next abnormal processing result service request.

[0064] For downstream services configured with memory queues and separate thread pools, if the downstream service fails to process the service request or the processing times out, and there are service requests with response timeouts in the memory queue, the offline task compensation service link also uses the method of configuring memory queues and separate thread pools for offline downstream services to process service requests with abnormal processing results, ensuring the consistency of the processing results of the offline task compensation service link and the online service link.

[0065] On the basis of the above embodiments, further, the downstream service processes the received service request and sends the processing result to the upstream service, further comprising:

[0066] The downstream service completes processing of the service request and the processing does not time out, and sends the processing result after the processing is completed to the upstream service.

[0067] If the downstream service receives the service request and calls the operating system kernel thread to process the service request, accordingly, the downstream service completes processing the service request without timing out, which may include: the operating system kernel thread completes processing the service request without timing out.

[0068] Figure 2 A flowchart of online service link processing in a distributed service link provided by an embodiment of the present disclosure; Figure 3 A flowchart of using an offline task compensation service link processing provided by an embodiment of the present disclosure.

[0069] like Figure 2As shown, service A and service B are upstream services, and service A and service B are respectively configured with service A thread pool and service B thread pool, and downstream service a, downstream service b and downstream service c are downstream services of service A, and downstream service a is configured with memory queue 1 and service a thread pool, and downstream service c is configured with memory queue 3 and service c thread pool, and downstream service a, downstream service b and downstream service c are respectively configured with external memory queue 1, external memory queue 2 and external memory queue 3. Among them, step 1: the upstream service of service A sends an upstream request to the service A thread pool through the TOMCAT thread pool, and the service A thread pool sends the upstream request to service A, and service A decomposes the upstream request into three service requests, namely service request a, service request b and service request c. Step 2: service A sends service request a to memory queue 1. Step 3: service A thread returns. Step 4: service A sends service request b to downstream service b, and downstream service b calls the operating system kernel thread to process service request b, and service A thread is released. Step 5: the operating system kernel thread returns the processing result to service A. Step 6: service A sends service request c to memory queue 3. Step 7: Service A thread returns. Step 8: The upstream service thread of service A returns. Step 1): Service a thread pool (or service c thread pool) obtains service request a (or service request c) from memory queue 1 (or memory queue 3). Step 2): Service a thread pool (or service c thread pool) sends service request a (or service request c) to downstream service a (or downstream service c). Step 3): Downstream service a (or downstream service c) processes the received service request a (or service request c) and sends the processing result to service a thread pool (or service c thread pool). Step 4): Service a thread pool (or service c thread pool) sends the processing result to service A. Step 5): When the service request processing result is abnormal, memory queue 1 (or memory queue 3) or downstream service a (or downstream service c) transfers the corresponding service request to external memory queue 1 (or external memory queue 3). Step 6): When the service request processing result is abnormal, the downstream service b transfers the corresponding service request to the external memory queue 2 and notifies the operating system kernel thread to cancel the current task.

[0070] like Figure 3 As shown, the offline task compensation service link corresponds to Figure 2Service A and downstream services a, b and c in it. For offline downstream service a, the specific process of the offline task compensation service link is: the service A thread pool reads the processing result exception service request from the external memory queue 1 and sends it to the offline service A. The offline service A sends the processing result exception service request to the offline memory queue 1. The offline service a thread pool obtains the corresponding processing result exception service request from the offline memory queue 1 and sends it to the offline downstream service a. The offline downstream service a processes the processing result exception service request. After the processing is completed, the processing result is sent to the offline service A through the offline service a thread pool. The offline service A sends the processing result to its upstream service through the service A thread pool. For the offline downstream service c, the specific process of the offline task compensation service link is the same as that of the offline downstream service a, which will not be repeated here. For the offline downstream service b, the specific process of the offline task compensation service link is: the service A thread pool reads the processing result exception service request from the external memory queue 2 and sends it to the offline service A. The offline service A sends the processing result exception service request to the offline downstream service b. The offline downstream service b calls the operating system kernel thread to process the processing result exception service request. After the processing is completed, the operating system kernel thread sends the processing result to the offline service A. The offline service A sends the processing result to its upstream service through the service A thread pool.

[0071] Figure 4 This is a schematic diagram of the structure of a distributed service link exception handling system provided by an embodiment of the present disclosure. This embodiment is used to execute the distributed service link exception handling method described in any of the above embodiments, and the system includes an upstream service 410, a downstream service 420, and an offline task compensation service link 430 ( Figure 4 In the figure, the upstream service 410 and the downstream service 420 are only examples and are not limited in number), wherein:

[0072] The upstream service 410 sends a service request to the downstream service 420;

[0073] The downstream service 420 processes the received service request and sends the processing result to the upstream service 410;

[0074] If there is an abnormal processing result, the upstream service thread pool corresponding to the upstream service 410 calls the offline task compensation service link 430 to perform offline compensation processing on the abnormal processing result service request, and sends the offline compensation processing result to the upstream service 410; wherein, the service call logic of the offline task compensation service link 430 includes the service call logic between the upstream service 410 and the downstream service 420.

[0075] The upstream service of this embodiment sends a service request to the downstream service; the downstream service processes the received service request and sends the processing result to the upstream service; if there is an abnormal processing result, the upstream service thread pool calls the offline task compensation service link to perform offline compensation processing on the service request with abnormal processing result, and sends the offline compensation processing result to the upstream service; wherein, the service call logic of the offline task compensation service link includes the service call logic between the upstream service and the downstream service. The above-mentioned method of using the offline task compensation service link to process the service request with abnormal processing in the online service link, and feeding back the offline compensation processing result to the upstream service after the processing is completed, can effectively solve the problem of data missing caused by fuse degradation in the online service link, and ensure the high availability of the service request and the robustness of the service link; in addition, the offline task compensation service link adopts the same service call logic as the online service link, which ensures the consistency of the offline task compensation processing and the online request processing, and thus also ensures the consistency of the overall link.

[0076] On the basis of the above embodiments, further, if the downstream service 420 is pre-configured with an external memory queue, the downstream service 420 processes the received service request and sends the processing result to the upstream service 410, including:

[0077] If the downstream service 420 fails to process the service request or times out, the service request with the corresponding abnormal processing result is stored in the external memory queue, and the abnormal processing result information is fed back to the upstream service 410.

[0078] On the basis of the above embodiments, further, the downstream service 420 processes the received service request, further comprising:

[0079] After receiving the service request, the downstream service 420 calls the operating system kernel thread to process the service request;

[0080] Correspondingly, the downstream service 420 fails to process the service request or times out, including: the operating system kernel thread fails to process the service request or times out.

[0081] On the basis of the above embodiments, further, the upstream service thread pool calls the offline task compensation service link 430 to perform offline compensation processing on the service request with abnormal processing result, including:

[0082] The upstream service thread pool reads the current processing result exception service request in the external storage queue and sends it to the offline upstream service;

[0083] The offline upstream service sends the current processing result exception service request to the offline downstream service;

[0084] The offline downstream service calls the operating system kernel thread to process the current abnormal processing result service request. After the processing is successful, the above steps are used to process the next abnormal processing result service request.

[0085] On the basis of the above embodiments, further, if the downstream service 420 is pre-configured with a memory queue and a downstream service thread pool, the upstream service 410 sends a service request to the downstream service 420, including:

[0086] The upstream service 410 sends the service request to the memory queue;

[0087] The downstream service thread pool obtains the service request from the memory queue and sends it to the downstream service 420 .

[0088] On the basis of the above embodiments, further, the downstream service 420 processes the received service request and sends the processing result to the upstream service 410, including:

[0089] The memory queue continuously monitors whether there is a service request with response timeout in the queue. If so, the corresponding service request with response timeout is stored in the external memory queue, and the abnormal processing result information is fed back to the upstream service 410. If not, no operation is performed; wherein, the response timeout includes the time period of the service request waiting for a response in the queue exceeding the first preset time period, or the sum of the time period of the service request waiting for a response in the queue and the time period of waiting for a response from the downstream service 420 in the downstream service thread pool exceeding the second preset time period.

[0090] On the basis of the above embodiments, further, the upstream service thread pool calls the offline task compensation service link 430 to perform offline compensation processing on the service request with abnormal processing result, including:

[0091] The upstream service thread pool reads the abnormal processing result service request in the external storage queue and sends it to the offline upstream service;

[0092] The offline upstream service sends the service request with abnormal processing result to the offline memory queue;

[0093] The offline downstream service thread pool obtains the current processing result exception service request from the offline memory queue and sends it to the offline downstream service;

[0094] The offline downstream service processes the current abnormal processing result service request, and after successful processing, uses the above steps to process the next abnormal processing result service request.

[0095] On the basis of the above embodiments, further, the downstream service 420 processes the received service request and sends the processing result to the upstream service 410, further comprising:

[0096] The downstream service 420 completes processing of the service request and the processing does not time out, and sends the processing result after the processing is completed to the upstream service 410.

[0097] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present disclosure also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the distributed service link exception handling method as described in any of the above embodiments is implemented.

[0098] The computer-readable storage media of this embodiment include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer-readable storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0099] The computer instructions stored in the computer-readable storage medium of the above embodiment are used to enable the computer to execute the distributed service link exception handling method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0100] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0101] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0102] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A distributed service link exception handling method, characterized in that: include: The upstream service sends a service request to the downstream service; The downstream service processes the received service request and sends the processing result to the upstream service; If there is an abnormal processing result, the upstream service thread pool calls the offline task compensation service link to perform offline compensation processing on the abnormal processing result service request, and sends the offline compensation processing result to the upstream service; wherein, the service call logic of the offline task compensation service link includes the service call logic between the upstream service and the downstream service.

2. The method according to claim 1, characterized in that If the downstream service is pre-configured with an external storage queue, the downstream service processes the received service request and sends the processing result to the upstream service, including: If the downstream service fails to process the service request or times out, the service request with the corresponding abnormal processing result is stored in the external memory queue, and the abnormal processing result information is fed back to the upstream service.

3. The method according to claim 2, characterized in that The downstream service processes the received service request, further comprising: After receiving the service request, the downstream service calls the operating system kernel thread to process the service request; Correspondingly, the downstream service fails to process the service request or times out, including: the operating system kernel thread fails to process the service request or times out.

4. The method according to claim 4, characterized in that: The upstream service thread pool calls the offline task compensation service link to perform offline compensation processing on service requests with abnormal processing results, including: The upstream service thread pool reads the current processing result exception service request in the external storage queue and sends it to the offline upstream service; The offline upstream service sends the current processing result exception service request to the offline downstream service; The offline downstream service calls the operating system kernel thread to process the current abnormal processing result service request. After the processing is successful, the above steps are used to process the next abnormal processing result service request.

5. The method according to claim 2, characterized in that: If the downstream service is pre-configured with a memory queue and a downstream service thread pool, the upstream service sends a service request to the downstream service, including: The upstream service sends the service request to the memory queue; The downstream service thread pool obtains the service request from the memory queue and sends it to the downstream service.

6. The method according to claim 5, characterized in that The downstream service processes the received service request and sends the processing result to the upstream service, including: The memory queue continuously monitors whether there is a service request with a response timeout in the queue. If so, the corresponding response timeout service request is stored in the external memory queue, and the abnormal processing result information is fed back to the upstream service. If not, no operation is performed; wherein, the response timeout includes that the time period during which the service request waits for a response in the queue exceeds a first preset time period, or the sum of the time period during which the service request waits for a response in the queue and the time period during which the service request waits for a response in the downstream service thread pool exceeds a second preset time period.

7. The method according to claim 5, characterized in that The upstream service thread pool calls the offline task compensation service link to perform offline compensation processing on service requests with abnormal processing results, including: The upstream service thread pool reads the abnormal processing result service request in the external storage queue and sends it to the offline upstream service; The offline upstream service sends the service request with abnormal processing result to the offline memory queue; The offline downstream service thread pool obtains the current processing result exception service request from the offline memory queue and sends it to the offline downstream service; The offline downstream service processes the current abnormal processing result service request, and after successful processing, uses the above steps to process the next abnormal processing result service request.

8. The method according to claim 2, characterized in that: The downstream service processes the received service request and sends the processing result to the upstream service, further comprising: The downstream service completes processing of the service request and the processing does not time out, and sends the processing result after the processing is completed to the upstream service.

9. A distributed service link exception handling system, characterized in that: Includes upstream services and downstream services, including: The upstream service sends a service request to the downstream service; The downstream service processes the received service request and sends the processing result to the upstream service; If there is an abnormal processing result, the upstream service thread pool corresponding to the upstream service calls the offline task compensation service link to perform offline compensation processing on the abnormal processing result service request, and sends the offline compensation processing result to the upstream service; wherein, the service call logic of the offline task compensation service link includes the service call logic between the upstream service and the downstream service.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the distributed service link exception handling method as described in any one of claims 1 to 8 is implemented.