Application service exception handling method, device, equipment and readable storage medium

By intercepting and analyzing the response results of the target application service, counting the number of exceptions and degrading them, the vicious cycle caused by application service exceptions is solved, the exception handling efficiency is improved, and the service is automatically upgraded and downgraded.

CN115499492BActive Publication Date: 2025-02-18PINGAN YIQIANBAO E COMMERCE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211114473.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-14
Publication Date
2025-02-18
Estimated Expiration
2042-09-14

AI Technical Summary

Technical Problem

When an application's service has an exception or timeout, it will cause the upstream application to wait for timeout, causing the thread pool to be full, and the original normal service becomes unavailable, causing a vicious cycle and reducing the efficiency of application service exception handling.

Method used

By intercepting the response results of the target application service, identifying the result status, creating a counter to count the number of exceptions, and downgrading the target application service based on the number of exceptions until the preset upgrade conditions are met.

Benefits of technology

It realizes that when there is application services in the service cluster, timely isolate the service in a timely manner to avoid affecting the upstream system, reduce the risk of a vicious cycle, and automatically upgrade when the service returns to normal, avoiding manual operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115499492B_ABST
    Figure CN115499492B_ABST
Patent Text Reader

Abstract

The present application discloses an exception handling method, device, equipment and readable storage medium for application services, which relates to the field of Internet technology. When an application service is unavailable in the entire service cluster, the service can be isolated in time to avoid affecting the upstream system and forming a vicious circle. The method includes: using the first identifier of the target application service, intercepting the response result returned to the target application service, the response result is used to indicate the response to the application request issued by the target application service; determining the result status of the response result, the result status includes a normal state and an abnormal state; when the result status is an abnormal state, creating a first counter and increasing the number of abnormalities; counting the number of abnormalities stored in the first counter, and based on the number of abnormalities, downgrading the target application service until the target application service meets the preset upgrade conditions, and upgrading the target application service.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to an exception handling method, device, equipment and readable storage medium for application services. Background Art

[0002] With the continuous development of Internet technology, in order to shorten the execution efficiency of application services and improve the scalability of application services, more and more Internet companies are adopting distributed service architecture, that is, the services provided by each application are managed by a thread pool.

[0003] However, the number of threads in the thread pool is limited and fixed. When an application service has an exception or times out, its upstream application will also time out. The thread pool of the upstream system is full, and the originally normal service will become unavailable, causing a vicious circle, which in turn leads to low efficiency in handling application service exceptions. Therefore, there is an urgent need for an exception handling method for application services to improve the efficiency of handling application service exceptions. Summary of the invention

[0004] In view of this, the present application provides an exception handling method, device, equipment and readable storage medium for application services. The main purpose is to solve the problem that when an application service has an exception or times out, its upstream application will also time out, and the thread pool of the upstream system will be full, and the originally normal service will become unavailable, causing a vicious cycle.

[0005] According to the first aspect of the present application, a method for handling exceptions in an application service is provided, the method comprising:

[0006] Using a first identifier of a target application service, intercepting a response result returned to the target application service, the response result being used to indicate a response to an application request issued by the target application service;

[0007] Determine a result state of the response result, wherein the result state includes a normal state and an abnormal state;

[0008] When the result state is the abnormal state, creating a first counter and increasing the number of abnormal times by one;

[0009] The number of exceptions stored in the first counter is counted, and based on the number of exceptions, the target application service is downgraded until the target application service meets a preset upgrade condition, and then the target application service is upgraded.

[0010] According to a second aspect of the present application, there is provided an exception handling device for an application service, the device comprising:

[0011] An interception module, used to intercept a response result returned to the target application service using a first identifier of the target application service, wherein the response result is used to indicate a response to an application request issued by the target application service;

[0012] A determination module, used to determine the result status of the response result, wherein the result status includes a normal state and an abnormal state;

[0013] A creation module, used for creating a first counter and increasing the number of exceptions once when the result state is the abnormal state;

[0014] The statistical module is used to count the number of exceptions stored in the first counter, and based on the number of exceptions, downgrade the target application service until the target application service meets a preset upgrade condition, and then upgrade the target application service.

[0015] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.

[0016] According to a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the methods described in the first aspect are implemented.

[0017] By means of the above technical scheme, the present application provides an exception handling method, device, equipment and readable storage medium for an application service. The present application first uses the first identifier of the target application service to intercept the response result of the application request issued to the target application service returned by the server. Subsequently, the response result is identified to determine the result state of the response result, wherein the result state may include a normal state and an abnormal state. Next, when the result state is an abnormal state, a first counter is created to increase the number of abnormal times once; the number of abnormal times stored in the first counter is counted, and based on the number of abnormal times, the target application service is downgraded until the target application service meets the preset upgrade conditions and the target application service is upgraded. Through the downgrade mechanism, the abnormal application service is downgraded and limited, so that when there is an application service that is unavailable in the entire service cluster, the service is isolated in time, thereby avoiding affecting the upstream system and forming a vicious circle. Further, when the downgraded service returns to normal, it can be upgraded in time to avoid manual operation, thereby realizing closed-loop processing between service upgrades and downgrades.

[0018] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0020] Figure 1 A schematic diagram of a process flow of an exception handling method for an application service provided in an embodiment of the present application is shown;

[0021] Figure 2A A schematic diagram of a process flow of an exception handling method for an application service provided in an embodiment of the present application is shown;

[0022] Figure 2B A schematic diagram of a process flow of an exception handling method for an application service provided in an embodiment of the present application is shown;

[0023] Figure 3A A schematic diagram showing the structure of an exception handling device for an application service provided in an embodiment of the present application is shown;

[0024] Figure 3B A schematic diagram showing the structure of an exception handling device for an application service provided in an embodiment of the present application is shown;

[0025] Figure 3C A schematic diagram showing the structure of an exception handling device for an application service provided in an embodiment of the present application is shown;

[0026] Figure 4 A schematic diagram of the device structure of a computer device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0027] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0028] The present application embodiment provides an exception handling method for application services, such as Figure 1 As shown, the method includes:

[0029] 101. Use a first identifier of a target application service to intercept a response result returned to the target application service, where the response result is used to indicate a response to an application request issued by the target application service.

[0030] The first identifier is used to indicate the identity of the target application service, such as the name and code of the target application service. This application does not specifically limit the content and type of the first identifier. In actual application, the user will call the target application service based on the client and send an application request to the server in advance, such as obtaining a mobile phone number, modifying an address, etc. This application does not specifically limit the content of the application request.

[0031] Furthermore, after receiving the application request, the server will return a corresponding response to the application request, that is, return a response result. Thus, the exception handling method of the application service provided by the present application can analyze the response result and determine whether the target application service can run normally.

[0032] 102. Determine a result status of the response result, where the result status includes a normal status and an abnormal status.

[0033] In actual operation scenarios, the response result can be divided into two states, namely normal state and abnormal state. When the response result carries the data content that should be returned, the result state of the response result is normal. On the contrary, when the response result does not carry the data content that should be returned, the result state of the response result is abnormal.

[0034] For example, a user wants to obtain balance information and issues a balance acquisition request. If the response result carries the relevant balance value, the result status of the response result is a normal status; if the response result does not carry the relevant balance value, the result status of the response result is an abnormal status.

[0035] 103. When the result state is an abnormal state, create a first counter and increase the number of abnormal times by one.

[0036] If the response result is normal, some downstream functions can continue to be executed to ensure the smooth operation of the application service. On the contrary, if the response result is abnormal, the application request needs to be re-initiated and some downstream functions cannot be continued. Therefore, by identifying the result status of the response result, it is determined whether the service returns normally, and then whether the target application can run normally.

[0037] Considering that a certain number of exceptions is not enough to affect the normal operation of the target application service, the present application is provided with a first counter. When the result state is an abnormal state, a first counter is created to accumulate the number of abnormalities when the response state is an abnormal state. Specifically, each time the result state is an abnormal state, the number of abnormalities is increased once for the first counter, and the number of abnormalities of the response result is continuously accumulated.

[0038] 104. Count the number of exceptions stored in the first counter, and based on the number of exceptions, downgrade the target application service until the target application service meets a preset upgrade condition, and then upgrade the target application service.

[0039] During the entire operation process, the first counter continuously accumulates the number of exceptions. Each time the number of exceptions increases, the accumulated value in the first counter is counted, that is, the number of exceptions. Next, based on the accumulated number of exceptions, it is determined whether the target application service needs to be downgraded, and the target application service is isolated until the target application service meets the preset upgrade conditions and resumes normal operation.

[0040] The method provided in the embodiment of the present application first uses the first identifier of the target application service to intercept the response result of the application request issued to the target application service returned by the server. Subsequently, the response result is identified to determine the result status of the response result, wherein the result status may include a normal state and an abnormal state. Next, when the result status is an abnormal state, a first counter is created and the number of abnormalities is increased once; the number of abnormalities stored in the first counter is counted, and based on the number of abnormalities, the target application service is downgraded until the target application service meets the preset upgrade conditions and the target application service is upgraded. Through the downgrade mechanism, the abnormal application service is downgraded and limited, so that when an application service is unavailable in the entire service cluster, the service is isolated in time, thereby avoiding affecting the upstream system and forming a vicious circle. Furthermore, when the downgraded service returns to normal, it can be upgraded in time to avoid manual operation, thereby realizing closed-loop processing between service upgrades and downgrades.

[0041] The present application embodiment provides an exception handling method for application services, such as Figure 2A As shown, the method includes:

[0042] 201. Identify all received response results, determine the second identifier corresponding to each response result, determine the second identifier that is consistent with the first identifier among all the second identifiers, and intercept the response results corresponding to the second identifiers with the consistent content.

[0043] With the continuous development of Internet technology, in order to shorten the execution efficiency of application services and improve the scalability of application services, more and more Internet companies adopt distributed service architecture, that is, the services provided by each application are managed by thread pools. However, the number of threads in the thread pool is limited and fixed. When an application service is abnormal or timed out, its upstream application will also time out. When the thread pool of the upstream system is full, the originally normal service will become unavailable, causing a vicious cycle, which in turn leads to low efficiency in handling application service exceptions.

[0044] Therefore, the present application provides an exception handling method, device, equipment and readable storage medium for an application service. The present application first uses the first identifier of the target application service to intercept the response result of the application request issued to the target application service returned by the server. Subsequently, the response result is identified to determine the result status of the response result, wherein the result status may include a normal state and an abnormal state. Next, when the result status is an abnormal state, a first counter is created and the number of abnormal times is increased once; the number of abnormal times stored in the first counter is counted, and based on the number of abnormal times, the target application service is downgraded until the target application service meets the preset upgrade conditions and the target application service is upgraded. Through the downgrade mechanism, the abnormal application service is downgraded and limited, so that when an application service is unavailable in the entire service cluster, the service is isolated in time, thereby avoiding affecting the upstream system and forming a vicious circle. Further, when the downgraded service returns to normal, it can be upgraded in time to avoid manual operation, thereby realizing closed-loop processing between service upgrades and downgrades.

[0045] In the embodiments of the present application, Figure 2B As shown, the relevant technicians have added a service status monitoring interceptor to the preset RPC service framework. The interceptor is mainly responsible for intercepting the response result and judging whether the return result of the server is normal.

[0046] Specifically, the client where the target application service is located will send an application request to the server in advance through the forwarder, such as a request to obtain a mobile phone number, modify an address, etc. The server will make a corresponding response to the application request and return it to the client through the forwarder.

[0047] Furthermore, the interceptor provided by the method can intercept the response result forwarded by the forwarder to the client. Considering that a large number of response results may be sent back at the same time, in order to quickly find the corresponding target response result, the method sets a second identifier, that is, an identity identifier for indicating the application service, such as the name and code of the application service. The application does not specifically limit the content and type of the second identifier.

[0048] Then, all received response results are identified through data identification technology, and the second identifier corresponding to each response result is read. In fact, in order to efficiently and quickly identify the corresponding target response result, the identifier type of the first identifier and the second identifier can be consistent.

[0049] Next, all the second identifiers are compared with the first identifier respectively to determine the target second identifier that is consistent with the first identifier, that is, the response result corresponding to the target second identifier is the response result returned to the target application service. Finally, the response result corresponding to the second identifier with the consistent content is intercepted by the interceptor.

[0050] By using the response results and the identifiers of the target application service, the target response results corresponding to the target application service can be accurately found from multiple response results sent back at the same time, avoiding manual operation, improving recognition efficiency and reducing the risk of errors.

[0051] 202. Determine the result status of the response result.

[0052] In actual application, the server usually sets a unified error code to reflect its response. Taking web page request as an example, error code 400 (error request) means the server does not understand the syntax of the request; error code 401 (unauthorized) means the request requires identity authentication; error code 403 (forbidden) means the server rejects the request; error code 404 (not found) means the server cannot find the requested web page; error code 405 (method disabled) means the method specified in the request is disabled; error code 406 (not accepted) means the requested web page cannot be responded to using the requested content characteristics; error code 407 (request timeout) means the server times out while waiting for the request; error code 410 (deleted) means the requested resource has been permanently deleted; error code 200 (successful) means the server has successfully processed the request, etc. In this step, the response result can be judged by a pre-set unified error code to determine the result status of the response result. The specific process of determining the result status of the response result by the error code carried in the response result is as follows:

[0053] Read the target error code in the response result, compare the target error code with the unified error code table, and determine the content indicated by the target error code. Specifically, if the target error code indicates that the server successfully processed the request, such as the target error code is 200, 201, etc., then generate a judgment result indicating that the response result carries normal data content, and then generate a result status indicating that the response result is normal. If the target error code indicates that the processing request failed or timed out, such as the target error code is 400, 408, etc., then generate a judgment result indicating that the response result carries erroneous data content or displays a timeout, and then generate a result status indicating that the response result is abnormal.

[0054] 203. When the result state is an abnormal state, create a first counter and increase the number of abnormal times by one.

[0055] In the embodiment of the present application, the result status of the response result reflects the operation status of the target application service. When the result status is abnormal for more than a certain number of times, it means that the target application service is difficult to operate normally. In order to be able to count the number of abnormalities, the present application is provided with a first counter for accumulation. The specific accumulation process is as follows:

[0056] When the response result of the target application service is in an abnormal state for the first time, a first counter is immediately created, and the number of abnormal times is added to the first counter. Furthermore, when the response result of the target service is in an abnormal state again, the pre-created first counter is still used for accumulation. For example, if the response status received by the target application service after sending a request for the first time is an abnormal state, a first counter is created, and the number of abnormal times is added to the first counter, and the number of abnormal times is 1 at this time; if the response status received after sending the request for the second time is a normal state, there is no need to use the first counter for accumulation; if the response status received after sending the request for the third time is an abnormal state, the number of abnormal times is added to the first counter again, and the number of abnormal times is 2 at this time.

[0057] 204. When the result status of the response result is a normal status, create a second counter to count the normal number of times the result status is a normal status, and determine whether to re-accumulate the abnormal number of times according to the ratio of the normal number of times to the abnormal number of times.

[0058] In actual application, when the response result of the target application service is always in a normal state, no processing is required, and the intercepted response result can be directly returned to the target application service. After the response result of the target application service has been in an abnormal state, the response result is in a normal state, and a counter needs to be created for the response result in the normal state, that is, the second counter.

[0059] The normal state and the abnormal state are counted respectively by the first counter and the second counter to count the normal number and the abnormal number. For example, if the response state received after the target application service sends the request for the first time is an abnormal state, the first counter is created, and the abnormal number is increased once for the first counter, and the abnormal number is 1 at this time; if the response state received after the target application service sends the request for the second time is a normal state, the second counter is created, and the normal number is increased once for the second counter, and the normal number is 1 at this time; if the response state received after the target application service sends the request for the third time is an abnormal state, the abnormal number is increased once for the first counter again, and the abnormal number is 2 at this time.

[0060] Further, it is determined whether to re-accumulate the number of abnormal times according to the ratio of the normal number of times to the abnormal number of times. Specifically, the relevant technical personnel can set a target time, and after the target time, such as 15 minutes, 20 minutes, 30 minutes, etc., start to calculate the ratio of the normal number of times to the abnormal number of times. When the ratio is greater than the first preset threshold, it indicates that the current target application service is normal, the first counter and the second counter are all reset, and the response result returned to the target application service is intercepted again. The first counter and the second counter start counting again from 0 according to the result state of the response result. For example, the first preset threshold is 0.4, and the first counter is counted to obtain 6 abnormal times and 4 normal times. The ratio of the normal number of times to the abnormal number of times is 0.67, and 0.67 is greater than 0.4, indicating that the current target application service is normal, the first counter and the second counter are all reset, and when the response result returned to the target application service is intercepted again, the result state of the response result is determined. If the result state is an abnormal state, the first counter changes from 0 to 1, and if the result state is a normal state, the second counter changes from 0 to 1.

[0061] 205. Count the number of exceptions stored in the first counter, and based on the number of exceptions, downgrade the target application service until the target application service meets a preset upgrade condition, and then upgrade the target application service.

[0062] In the embodiment of the present application, after each increase in the number of exceptions, the accumulated value in the first counter is counted, and according to the accumulated number of exceptions, it is determined whether the target application service needs to be downgraded, that is, the target application service is isolated until the target application service meets the preset upgrade conditions and resumes normal operation.

[0063] Specifically, when the number of abnormal times is greater than or equal to the second preset threshold, the target application service is downgraded, or when the ratio of the normal times to the abnormal times is less than or equal to the first preset threshold, it indicates that the current target application service is abnormal and needs to be downgraded. For example, the first preset threshold is 0.4, the first counter is counted to obtain 8 abnormal times, 2 normal times, and the ratio of the normal times to the abnormal times is 0.25, 0.25 is less than 0.4, indicating that the current target application service is abnormal and the target application service is downgraded; or the second preset threshold is 10 times, if the number of abnormal times is greater than or equal to 10 times, the target application service is downgraded.

[0064] Furthermore, the downgraded target application service is limited in current to determine whether the target application service has a resource lock. If the target application service does not have a resource lock, a failure is directly returned.

[0065] If the target application service obtains the resource lock, the target application service is allowed to send a service request, and the corresponding response result is intercepted. Based on the response result, the downgrade of the target application service is released. Specifically, the response result of the target application service is intercepted, and a third counter is created to count the normal number of times the response result of the target application service is in a normal state. When the normal number of times the target application service meets the preset upgrade condition, the downgrade of the target application service is released, and the preset upgrade condition is used to indicate that the normal number is greater than or equal to the third preset threshold. During actual operation, after the target service is downgraded, a new counter can be created as the third counter to count the number of successful requests after the target application service is downgraded. The second counter can also be cleared to zero, and the second counter after being cleared to zero is used as the third counter to count the number of successful requests of the target application service during the downgrade period, that is, the normal number of times the response status is a normal state.

[0066] The method provided in the embodiment of the present application first uses the first identifier of the target application service to intercept the response result of the application request issued to the target application service returned by the server. Subsequently, the response result is identified to determine the result status of the response result, wherein the result status may include a normal state and an abnormal state. Next, when the result status is an abnormal state, a first counter is created and the number of abnormalities is increased once; the number of abnormalities stored in the first counter is counted, and based on the number of abnormalities, the target application service is downgraded until the target application service meets the preset upgrade conditions and the target application service is upgraded. Through the downgrade mechanism, the abnormal application service is downgraded and limited, so that when an application service is unavailable in the entire service cluster, the service is isolated in time, thereby avoiding affecting the upstream system and forming a vicious circle. Furthermore, when the downgraded service returns to normal, it can be upgraded in time to avoid manual operation, thereby realizing closed-loop processing between service upgrades and downgrades.

[0067] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides an exception handling device for application services, such as Figure 3A As shown, the device includes: an interception module 301, a determination module 302, a creation module 303, and a statistics module 304.

[0068] The interception module 301 is used to intercept a response result returned to the target application service using a first identifier of the target application service, wherein the response result is used to indicate a response to an application request issued by the target application service;

[0069] The determination module 302 is used to determine the result status of the response result, and the result status includes a normal state and an abnormal state;

[0070] The creation module 303 is used to create a first counter and increase the number of exceptions when the result state is the abnormal state;

[0071] The statistical module 304 is used to count the number of exceptions stored in the first counter, and based on the number of exceptions, downgrade the target application service until the target application service meets a preset upgrade condition, and then upgrade the target application service.

[0072] In a specific application scenario, the interception module 301 is used to identify all received response results, determine the second identifier corresponding to each response result, and the second identifier is used to indicate the application service returned by the current response result; among all the second identifiers, determine the second identifier that is consistent with the content of the first identifier, and intercept the response result corresponding to the second identifier with the consistent content.

[0073] In a specific application scenario, the determination module 302 is used to judge the response result according to a unified error code and generate a judgment result; if the judgment result indicates that the response result carries normal data content, a result status indicating that the response result is normal is generated; if the judgment result indicates that the response result does not carry normal data content or the display times out, a result status indicating that the response result is abnormal is generated.

[0074] In specific application scenarios, such as Figure 3B As shown, the device further includes: a return module 305 , a calculation module 306 , a comparison module 307 , and a clearing module 308 .

[0075] The return module 305 is used to return the intercepted response result to the target application service when the result status of the response result is in a normal state, and to create a second counter to count the normal number of times the response result is in a normal state;

[0076] The calculation module 306 is used to count the number of abnormal times stored in the first counter and the number of normal times stored in the first counter, and calculate the ratio of the normal number to the abnormal number;

[0077] The comparison module 307 is used to compare the ratio with a first preset threshold value to generate a comparison result;

[0078] The clearing module 308 is used to clear the number of abnormalities stored in the first counter and re-accumulate the number of abnormalities if the comparison result indicates that the ratio is greater than the first preset threshold.

[0079] In specific application scenarios, such as Figure 3C As shown, the device further includes: a degradation module 309.

[0080] The downgrading module 309 is configured to downgrade the target application service if the comparison result indicates that the ratio is less than or equal to the first preset threshold value, and then upgrade the target application service until the target application service meets a preset upgrade condition.

[0081] In a specific application scenario, the statistical module 304 is used to downgrade the target application service and limit the flow of the downgraded target application service when the number of exceptions is greater than or equal to a second preset threshold; after the target application service has a resource lock, allow the target application service to send a service request and intercept the corresponding response result, and upgrade the target application service based on the response result.

[0082] In a specific application scenario, the statistical module 304 is used to intercept the response result of the target application service, create a third counter, and count the normal number of times the response result of the target application service is in a normal state; when the normal number of the target application service meets the preset upgrade condition, the target application service is upgraded, and the preset upgrade condition is that the normal number is greater than or equal to the third preset threshold.

[0083] The device provided in the embodiment of the present application first uses the first identifier of the target application service to intercept the response result of the application request issued to the target application service returned by the server. Subsequently, the response result is identified to determine the result status of the response result, wherein the result status may include a normal state and an abnormal state. Next, when the result status is an abnormal state, a first counter is created and the number of abnormalities is increased once; the number of abnormalities stored in the first counter is counted, and based on the number of abnormalities, the target application service is downgraded until the target application service meets the preset upgrade conditions and the target application service is upgraded. Through the downgrade mechanism, the abnormal application service is downgraded and limited, so that when an application service is unavailable in the entire service cluster, the service is isolated in time, thereby avoiding affecting the upstream system and forming a vicious circle. Further, when the downgraded service returns to normal, it can be upgraded in time to avoid manual operation, thereby realizing closed-loop processing between service upgrades and downgrades.

[0084] It should be noted that for other corresponding descriptions of the functional units involved in the abnormality handling device for an application service provided in the embodiment of the present application, reference can be made to Figure 1 and FIG. 2A to FIG. 2B The corresponding description in will not be repeated here.

[0085] In an exemplary embodiment, see Figure 4, and also provides a device, which includes a communication bus, a processor, a memory and a communication interface, and may also include an input and output interface and a display device, wherein each functional unit can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the exception handling method of the application service in the above embodiment.

[0086] A computer-readable storage medium stores a computer program, which implements the steps of the exception handling method for application services when executed by a processor.

[0087] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by hardware, or by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0088] Those skilled in the art will appreciate that the accompanying drawings are merely schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily required for implementing the present application.

[0089] Those skilled in the art will appreciate that the modules in the device in the implementation scenario can be distributed in the device in the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more devices different from the implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple sub-modules.

[0090] The above application serial numbers are for description only and do not represent the advantages or disadvantages of the implementation scenarios.

[0091] The above disclosure only discloses several specific implementation scenarios of the present application. However, the present application is not limited thereto, and any changes that can be conceived by technicians in this field should fall within the protection scope of the present application.

Claims

1. A method for handling exceptions in an application service, characterized in that: include: Using the first identifier of the target application service, intercepting a response result returned to the target application service through an interceptor, the response result being used to indicate a response to the application request issued by the target application service; Determine a result state of the response result, wherein the result state includes a normal state and an abnormal state; When the result state is the abnormal state, creating a first counter and increasing the number of abnormal times by one; The number of exceptions stored in the first counter is counted, and based on the number of exceptions, the target application service of the client is downgraded and isolated until the target application service meets a preset upgrade condition, and the target application service is upgraded to restore the target application service to a normal operating state.

2. The method according to claim 1, characterized in that The adopting the first identifier of the target application service to intercept the response result returned to the target application service includes: Identify all received response results, and determine a second identifier corresponding to each response result, where the second identifier is used to indicate an application service returned by the current response result; Among all the second identifiers, a second identifier having content consistent with the first identifier is determined, and a response result corresponding to the second identifier having the consistent content is intercepted.

3. The method according to claim 1, characterized in that The determining of the result status of the response result includes: The response result is judged according to a unified error code to generate a judgment result; If the determination result indicates that the response result carries normal data content, generating a result status indicating that the response result is normal; If the determination result indicates that the response result does not carry normal data content or is displayed in timeout, a result status indicating that the response result is abnormal is generated.

4. The method according to claim 1, characterized in that: After determining the result status of the response result, the method further includes: When the result status of the response result is a normal status, the intercepted response result is returned to the target application service, and a second counter is created to count the normal number of times the response result is a normal status; Counting the number of abnormal times stored in the first counter and the number of normal times stored in the first counter, and calculating the ratio of the normal times to the abnormal times; Comparing the ratio with a first preset threshold value to generate a comparison result; If the comparison result indicates that the ratio is greater than the first preset threshold, the number of abnormalities stored in the first counter is cleared and the number of abnormalities is accumulated again.

5. The method according to claim 4, characterized in that After comparing the ratio with the first preset threshold and generating a comparison result, the method further includes: if the comparison result indicates that the ratio is less than or equal to the first preset threshold, downgrading the target application service until the target application service meets the preset upgrade condition, and upgrading the target application service.

6. The method according to claim 1, characterized in that The step of downgrading the target application service based on the number of exceptions until the target application service meets a preset upgrade condition and upgrading the target application service includes: When the number of abnormalities is greater than or equal to a second preset threshold, downgrading the target application service, and limiting the flow of the downgraded target application service; After the target application service has a resource lock, the target application service is allowed to send a service request, and a corresponding response result is intercepted, and the target application service is upgraded according to the response result.

7. The method according to claim 6, characterized in that The step of upgrading the target application service according to the response result includes: intercepting a response result of the target application service, creating a third counter, and counting the number of normal times when the response result of the target application service is in a normal state; When the normal number of the target application service meets the preset upgrade condition, the target application service is upgraded, and the preset upgrade condition is that the normal number is greater than or equal to a third preset threshold.

8. An exception handling device for application services, characterized in that: include: An interception module, used to adopt a first identifier of a target application service and intercept a response result returned to the target application service through an interceptor, wherein the response result is used to indicate a response to an application request issued by the target application service; A determination module, used to determine the result status of the response result, wherein the result status includes a normal state and an abnormal state; A creation module, used for creating a first counter and increasing the number of exceptions once when the result state is the abnormal state; A statistical module is used to count the number of exceptions stored in the first counter, and based on the number of exceptions, downgrade and isolate the target application service until the target application service meets a preset upgrade condition, and upgrade the target application service to restore the target application service to a normal operating state.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

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 steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Flow control method and device, electronic equipment and readable storage medium

    CN110932988A

  • Abnormity early warning method, device and equipment and storage medium

    CN111756579A

  • Attack behavior detection method and device based on Web application firewall

    CN113660215A

  • SYSTEMS AND METHODS TO DETECT AND RESPOND TO DISTRIBUTED DENIAL OF SERVICE (DDoS) ATTACKS

    US20150033335A1