CN115002000B - Fault tolerance method, device, equipment and storage medium for abnormal interface - Google Patents

Fault tolerance method, device, equipment and storage medium for abnormal interface Download PDF

Info

Publication number
CN115002000B
CN115002000B CN202210723732.8A CN202210723732A CN115002000B CN 115002000 B CN115002000 B CN 115002000B CN 202210723732 A CN202210723732 A CN 202210723732A CN 115002000 B CN115002000 B CN 115002000B
Authority
CN
China
Prior art keywords
interface
abnormal
fault
service request
monitored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210723732.8A
Other languages
Chinese (zh)
Other versions
CN115002000A (en
Inventor
庄志辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202210723732.8A priority Critical patent/CN115002000B/en
Publication of CN115002000A publication Critical patent/CN115002000A/en
Application granted granted Critical
Publication of CN115002000B publication Critical patent/CN115002000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the technical field of Internet and discloses an abnormal interface fault tolerance method, device, equipment and storage medium. The method comprises the following steps: acquiring interface information, identifying an abnormal interface according to the interface information and marking the identified abnormal interface; presetting a fault-tolerant strategy of an abnormal interface according to the interface information and carrying out association processing on the abnormal interface and the fault-tolerant strategy; receiving a service request, intercepting the service request, reading an interface identifier in the service request, and detecting whether a target interface pointed by the interface identifier is an abnormal interface or not; when the target interface is detected to be identified as an abnormal interface, the fault-tolerant strategy corresponding to the abnormal interface is searched and used as the fault-tolerant strategy of the target interface, and a response result is obtained according to the fault-tolerant strategy to respond to the service request. By the method, the access flow of the interface can be dynamically adjusted, the occupation of resources is reduced, and the user experience is improved.

Description

Fault tolerance method, device, equipment and storage medium for abnormal interface
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a fault tolerance method, device, equipment and storage medium for an abnormal interface.
Background
At present, along with the rapid development of internet technology, there is the interface of the high frequency access of top page generally in APP, in the APP that faces B end, C end, often can exist and block up because unusual network request, and lead to normal business to be unable to operate, when the service of a certain business component runs into the problem, if do not in time handle the problem, cause the resource to occupy easily, can influence other interfaces of other business components generally, and then influence normal business process, cause data blocking to lead to the response untimely, increased risk and the instability of system downtime, and then influence user experience.
Disclosure of Invention
The invention provides an abnormal interface fault tolerance method, device, equipment and storage medium, which can dynamically adjust the access flow of an interface when the interface is abnormal, thereby reducing the occupation of resources and the influence of the abnormality on other business processes and improving the user experience.
In order to solve the technical problems, the invention adopts a technical scheme that: the fault tolerance method of the abnormal interface comprises the following steps:
acquiring interface information, identifying an abnormal interface according to the interface information and marking the identified abnormal interface;
pre-configuring a fault-tolerant strategy of the abnormal interface according to the interface information and carrying out association processing on the abnormal interface and the fault-tolerant strategy;
receiving a service request, intercepting the service request, reading an interface identifier in the service request, and detecting whether a target interface pointed by the interface identifier is an abnormal interface or not;
when the target interface is detected to be identified as an abnormal interface, searching a fault-tolerant strategy corresponding to the abnormal interface as the fault-tolerant strategy of the target interface, and acquiring a response result according to the fault-tolerant strategy to respond to the service request.
According to one embodiment of the present invention, the obtaining interface information, identifying an abnormal interface according to the interface information, and performing a marking process on the identified abnormal interface includes:
acquiring the interface information, wherein the interface information comprises an interface URL of a historical service request, an interface return status code and processing time consumption of the historical service request, and the interface URL at least comprises the interface identifier;
within a first preset time range, counting the overtime duty ratio of the historical service request of the same interface according to the processing time consumption, determining an interface to be monitored according to the overtime duty ratio, and performing first marking processing on the interface to be monitored;
and monitoring the interface to be monitored in real time, calculating average connection time consumption of the interface to be monitored within a second preset time range, identifying an abnormal interface according to the average connection time consumption, and performing second marking processing on the identified abnormal interface.
According to an embodiment of the present invention, in a first preset time range, counting a timeout ratio of the historical service request of the same interface according to the processing time consumption, determining an interface to be monitored according to the timeout ratio, and performing a first marking process on the interface to be monitored includes:
comparing the processing time consumption of each historical service request of the same interface with a first preset time threshold value in a first preset time range, and calculating the ratio of the number of the historical service requests with the processing time consumption exceeding the first preset time threshold value to the total number of all the historical service requests of the same interface to obtain the overtime ratio;
comparing the overtime duty ratio with a preset value, and judging whether the overtime duty ratio is larger than the preset value or not;
if yes, determining the interface as an interface to be monitored and performing first marking processing on the interface to be monitored.
According to an embodiment of the present invention, calculating average connection time consumption of the interface to be monitored within a second preset time range, identifying an abnormal interface according to the average connection time consumption, and performing a second marking process on the identified abnormal interface includes:
calculating the ratio of the sum of the processing time consumption of all the historical service requests of the interface to be monitored to the total number of the historical service requests of the interface to be monitored within a second preset time range to obtain average connection time consumption;
comparing the average time consumption with a second preset time threshold value, and judging whether the average time consumption is larger than the second preset time threshold value or not;
if yes, determining the interface to be monitored as an abnormal interface, and performing second marking processing on the abnormal interface.
According to an embodiment of the present invention, before the counting of the timeout duty ratio of the historical service request of the same interface according to the processing time consumption in the first preset time range, the method further includes:
and identifying abnormal data according to the interface return state code and eliminating the abnormal data.
According to one embodiment of the present invention, the pre-configuring the fault tolerance policy of the abnormal interface according to the interface information includes:
identifying the interface type of the abnormal interface according to the interface information;
and pre-configuring the fault tolerance strategy according to the interface type.
According to one embodiment of the invention, the interface type includes a first component interface and a second component interface, and the pre-configuring the fault tolerance policy according to the interface type includes:
when the interface type is a first component interface, the fault tolerance policy takes empty data as a response result;
when the interface type is the second component interface, the fault tolerance policy is to obtain a Redis value from a Redis cache as a response result.
In order to solve the technical problems, the invention adopts another technical scheme that: provided is an abnormal interface fault-tolerant device, comprising:
the acquisition module is used for acquiring interface information, identifying an abnormal interface according to the interface information and marking the identified abnormal interface;
the association module is used for pre-configuring a fault-tolerant strategy of the abnormal interface according to the interface information and carrying out association processing on the abnormal interface and the fault-tolerant strategy;
the detection module is used for receiving a service request, intercepting the service request, reading an interface identifier in the service request, and detecting whether a target interface pointed by the interface identifier is an abnormal interface or not;
and the response module is used for searching a fault-tolerant strategy corresponding to the abnormal interface as the fault-tolerant strategy of the target interface when the target interface is detected to be the abnormal interface, and acquiring a response result according to the fault-tolerant strategy to respond to the service request.
In order to solve the technical problems, the invention adopts a further technical scheme that: there is provided a computer device comprising: the system comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the fault tolerance method of the abnormal interface when executing the computer program.
In order to solve the technical problems, the invention adopts a further technical scheme that: there is provided a computer storage medium having stored thereon a computer program which, when executed by a processor, implements the above-described abnormal interface fault tolerance method.
The beneficial effects of the invention are as follows: by identifying the abnormal interface and pre-configuring the fault-tolerant strategy for the abnormal interface, when a service request is received, the fault-tolerant strategy is matched through the detection of the abnormal interface, and the access flow of the interface can be dynamically adjusted when the interface is abnormal, so that the resource occupation and the influence of the abnormality on other service processes are reduced, and the service processing efficiency and the user experience are improved.
Drawings
FIG. 1 is a flow chart of an abnormal interface fault tolerance method according to an embodiment of the present invention;
FIG. 2 is a flow chart of an abnormal interface fault tolerance method according to another embodiment of the present invention;
FIG. 3 is a schematic diagram of an abnormal interface fault tolerance device according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a computer device according to an embodiment of the present invention;
fig. 5 is a schematic structural view of a computer storage medium according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first," "second," "third," and the like in this disclosure are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first", "a second", and "a third" may explicitly or implicitly include at least one such feature. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise. All directional indications (such as up, down, left, right, front, back … …) in embodiments of the present invention are merely used to explain the relative positional relationship, movement, etc. between the components in a particular gesture (as shown in the drawings), and if the particular gesture changes, the directional indication changes accordingly. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the invention. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
FIG. 1 is a flow chart of an abnormal interface fault tolerance method according to an embodiment of the invention. It should be noted that, if there are substantially the same results, the method of the present invention is not limited to the flow sequence shown in fig. 1. As shown in fig. 1, the method comprises the steps of:
step S101: and acquiring interface information, identifying an abnormal interface according to the interface information, and marking the identified abnormal interface.
In step S101, in an application scenario, the abnormal interface fault-tolerant framework may include: the gateway can be associated with a plurality of service components, each service component can be provided with an interceptor and a plurality of interfaces, and the interfaces are connected with the database or other associated parties. For example, the service components include an account component, a message component, and an insurance component, where in this embodiment the account component and the insurance component are core service components, and the message component is a non-core service component, where the non-core service component allows for data delay or inaccuracy of acquired related data over a period of time when a system becomes problematic, and so on. When accessing the APP, a user sends a service request to enter a service component through a gateway to call service data of a related interface, an interface URL can be obtained through the service request at the gateway, and the service component to be forwarded is determined through the context of the interface URL.
Further, interface information of each interface can be obtained at the gateway, and the interface information is stored in a message queue for message consumption. The interface information includes an interface URL of the history service request, an interface return status code, and processing time consumption of the history service request. In the actual process, the gateway can determine the interface required to be called according to the interface URL contained in the service request, identify the abnormal interface according to the time consumption of the processing of the historical service request after the call is finished, and mark the identified abnormal interface.
The service request may include a uniform resource locator (Uniform Resource Locator, URL), the interface URL including at least a domain name identifier and an interface identifier. For example, if the interface URL is http://127.0.0.1/project/api/account/getUserInfo, the interface identifier contained is/project/api/account, indicating that the gateway forwards the service request to the account system component, and calling the account component; if the interface URL is http:// 127.0.1/project/api/notify/getHomePageNumber, the contained interface mark is/project/api/notify, which indicates that the gateway forwards the service request to the message component and invokes the notify component; if the interface URL is http:// 127.0.1/project/api/insource/getIndusteByUser, the contained interface identifier is/project/api/insource, the gateway forwards the service request to the insurance component, and the insource component is called.
The interface return status code refers to a status of requesting response through the interface after a service request is forwarded to the corresponding interface. The interface return status codes include normal status codes, e.g., 200, and abnormal status codes, e.g., 404, 502, 500, etc. In one scenario, the service request responds successfully, the interface return status code is 200, in another scenario, the system makes an error, resulting in an unsuccessful response to the service request, the interface return status code may be 404, 502, or 500.
Processing time-consuming refers to the time required from when a service request is sent out by the gateway until the gateway receives the response result of the service request.
Further, referring to fig. 2, step S101 further includes the following steps:
step S201: and acquiring interface information, wherein the interface information comprises an interface URL of the historical service request, an interface return status code and processing time consumption of the historical service request, and the interface URL at least comprises an interface identifier.
The related content of step S201 is described in detail in the foregoing, and will not be described herein.
Step S202: and in a first preset time range, counting the overtime duty ratio of the historical service request of the same interface according to the processing time consumption, determining the interface to be monitored according to the overtime duty ratio, and carrying out first marking processing on the interface to be monitored.
In step S202, comparing the processing time consumption of each historical service request of the same interface with a first preset time threshold within a first preset time range, calculating the ratio of the number of the historical service requests with the processing time consumption exceeding the first preset time threshold to the total number of all the historical service requests of the same interface, and obtaining a timeout duty ratio; comparing the timeout duty ratio with a preset value, and judging whether the timeout duty ratio is larger than the preset value; if yes, determining the interface as the interface to be monitored, performing first marking processing on the interface to be monitored, and storing marking processing results.
In one implementation manner, the first preset time threshold and the preset value may be dynamically adjusted, specifically may be set manually by an operation and maintenance personnel, or may be set automatically by a computer, for example, the first preset time is 1 minute, the first preset time threshold is 2 seconds, and the preset value is 80%. The first preset time threshold is the overtime time of the service request, and when the processing time consumption of the historical service request is larger than the first preset time threshold, the processing time consumption of the historical service request is overtime.
In one scenario, assuming that interface 1 has 10 historical service requests within 1 minute of Job-timed task monitoring, the processing time of each historical service request is compared with 2 seconds, wherein the processing time of 9 historical service requests exceeds 2 seconds, the timeout ratio is 9/10=0.9, that is, within 1 minute, interface 1 has 90% of the processing time of service requests timeout and 90% is greater than 80%, so interface 1 is determined to be an interface to be monitored and the first marking process is performed on the interface to be monitored, so that the dynamics of the interface can be accurately monitored later.
In an implementation manner, before the time-out duty ratio of the historical service request of the same interface is counted according to the processing time consumption in the first preset time range, the method further includes: and identifying the abnormal data and eliminating the abnormal data according to the interface return state code so as to improve the reliability of the data and the accuracy of subsequent data calculation.
Step S203: and monitoring the interface to be monitored in real time, calculating average connection time consumption of the interface to be monitored within a second preset time range, identifying the abnormal interface according to the average connection time consumption, and carrying out second marking processing on the abnormal interface which is identified to eat.
In step S203, calculating the ratio of the sum of the processing time consumption of all the historical service requests of the interface to be monitored to the total number of the historical service requests of the interface to be monitored within a second preset time range, so as to obtain average connection time consumption; comparing the average time consumption with a second preset time threshold value, and judging whether the average time consumption is larger than the second preset time threshold value or not; if yes, determining the interface to be monitored as an abnormal interface, performing second marking processing on the abnormal interface, and storing a marking processing result.
In one implementation, the duration of the second preset time and the first preset time may be the same or different, and the second preset time threshold and the first preset time threshold may be the same or different. The second preset time and the second preset time threshold can be dynamically adjusted, and specifically can be set manually by operation and maintenance personnel, or can be set automatically by a computer, for example, the second preset time is 1 minute, and the second preset time threshold is 2 seconds. The second preset time threshold is the timeout time of the interface, and when the average connection time consumption of the interface to be monitored is greater than the second preset time threshold, the average connection time consumption of the interface to be monitored is timeout.
In one scenario, assuming that the Job timing task monitors 10 historical service requests of the interface 1 to be monitored within 1 minute, the sum of the processing time consumption of the 10 historical service requests is 30 seconds, the average connection time consumption of the interface 1 to be monitored is 30/10=3 seconds, that is, the average connection time consumption of the interface 1 to be monitored exceeds 2 seconds, the interface 1 to be monitored is determined to be an abnormal interface, and the abnormal interface is marked for the second time.
Step S102: and pre-configuring a fault-tolerant strategy of the abnormal interface according to the interface information and carrying out association processing on the abnormal interface and the fault-tolerant strategy.
In step S102, the interface information includes an interface URL, where the interface URL includes an interface identifier, and the embodiment identifies an interface type of the abnormal interface according to the interface identifier, for example, the interface URL is http://127.0.0.1/project/api/notify/gethomepage number, and the included interface identifier is/project/api/notify, which indicates that the gateway forwards the service request to the message component, invokes the notify component, where the message component interface belongs to a non-core service component interface type. For another example, the interface URL is http:// 127.0.1/project/api/account/getUserInfo, and the interface identifier included is/project/api/account, which means that the gateway forwards the service request to the account system component, calls the account component, and the account system component belongs to the interface type of the core service component.
In one implementation, the interface type includes a first component interface and a second component interface, where the first component interface is a core service component interface or a non-core service component interface, the second component interface is a core service component interface or a non-core service component interface, and the types of the first component interface and the second component interface are different.
According to the interface type pre-configured fault-tolerant strategy, different interface types configure different fault-tolerant strategies, and the fault-tolerant strategies are set in one-to-one correspondence with the interface types. In one implementation manner, if the first component interface is a non-core service component interface and the second component interface is a core service component interface, pre-configuring the fault-tolerant policy according to the interface type includes: when the interface type is the first component interface, the fault tolerance policy takes the empty data as a response result; when the interface type is the second component interface, the fault tolerance policy is to obtain the Redis value from the Redis cache as a response result.
In one implementation, the abnormal interface and the fault-tolerant policy are associated in the form of a key value pair, and the association relationship between the abnormal interface and the fault-tolerant policy is ("abnormal interface=fault-tolerant policy"). Assuming that the interface 1 of the service component a is an abnormal interface, when the interface type of the abnormal interface is the first component interface, the fault-tolerant policy is to take the null data as a response result, and then there is an association relationship that the service component a interfaces 1=returns the null data. Assuming that the interface 1 of the service component a is an abnormal interface, when the interface type of the abnormal interface is the second component interface, the fault tolerance policy is to obtain the Redis value from the Redis cache as a response result, and then there is an association relationship that the service component a is interfaced 1=returned to the Redis value.
According to the embodiment, when the abnormal interface is obtained, the corresponding fault-tolerant strategy is directly pre-configured, and pre-stored in the form of key value pairs, so that the fault-tolerant strategy matching can be directly carried out by utilizing the pre-stored association relation when the same interface call request is carried out subsequently, and the processing efficiency and the user experience are improved.
Step S103: receiving a service request, intercepting the service request, reading an interface identifier in the service request, and detecting whether a target interface pointed by the interface identifier is an abnormal interface or not.
In step S103, each service component is provided with an interceptor through which all service requests from passing requests to the service component pass, and in which the tag of the acquisition interface is stored by the Redis. Specifically, whether the target interface pointed by the interface identifier is the marked abnormal interface can be judged by identifying the interface identifier in the interface URL.
Step S104: when the target interface is detected to be an abnormal interface, searching a fault-tolerant strategy corresponding to the abnormal interface as a fault-tolerant strategy of the target interface, and acquiring a response result according to the fault-tolerant strategy to respond to the service request.
In step S104, when the target interface of the service request is an abnormal interface, matching to a fault-tolerant policy corresponding to the abnormal interface, and if the fault-tolerant policy is to return null data, directly returning the null data at the interceptor; if the fault tolerance strategy is to acquire the Redis value from the Redis cache as a response result, the Redis value is read and returned at the interceptor. In other embodiments, other fault tolerance strategies may also exist, which are not described in detail herein. Assuming that there is an association relationship of service component a interface 1=return Redis value, when detecting that interface 1 of service component a is an abnormal interface, obtaining a fault-tolerant policy of "return Redis value" according to the association relationship of service component a interface 1=return Redis value.
In the embodiment, when the abnormal interface is detected, the result is directly processed and returned at the interceptor, so that the service request processing time of the abnormal interface is shortened, the access amount of the abnormal interface to the associated party or the database is reduced, the occupation of resources is prevented, and the service processing efficiency and the user experience are improved.
According to the abnormal interface fault tolerance method, the abnormal interface is identified, the fault tolerance strategy is preconfigured for the abnormal interface, when the service request is received, the fault tolerance strategy is matched through abnormal interface detection, and when the interface is abnormal, the access flow of the interface can be dynamically adjusted, so that the resource occupation and the influence of the abnormality on other service flows are reduced, and the service processing efficiency and the user experience are improved.
FIG. 3 is a schematic diagram of an abnormal interface fault tolerance device according to an embodiment of the present invention. As shown in fig. 3, the apparatus 30 includes an acquisition module 31, an association module 32, a detection module 33, and a response module 34.
The obtaining module 31 is configured to obtain interface information, identify an abnormal interface according to the interface information, and perform marking processing on the identified abnormal interface;
the association module 32 is configured to pre-configure a fault-tolerant policy of the abnormal interface according to the interface information and associate the abnormal interface with the fault-tolerant policy;
the detection module 33 is configured to receive a service request, intercept the service request, read an interface identifier in the service request, and detect whether a target interface pointed by the interface identifier is an abnormal interface;
the response module 34 is configured to, when detecting that the target interface is identified as an abnormal interface, find a fault-tolerant policy corresponding to the abnormal interface as a fault-tolerant policy of the target interface, and obtain a response result according to the fault-tolerant policy to respond to the service request.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the invention. As shown in fig. 4, the computer device 40 includes a processor 41 and a memory 42 coupled to the processor 41.
The memory 42 stores program instructions for implementing the abnormal interface fault tolerance of any of the embodiments described above.
The processor 41 is configured to execute program instructions stored in the memory 42 to implement an abnormal interface fault tolerance.
The processor 41 may also be referred to as a CPU (Central Processing Unit ). The processor 41 may be an integrated circuit chip with signal processing capabilities. The processor 41 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a computer storage medium according to an embodiment of the present invention. The computer storage medium according to the embodiment of the present invention stores a program file 51 capable of implementing all the methods described above, where the program file 51 may be stored in the form of a software product in the computer storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the embodiments of the present invention. And the aforementioned computer storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or other various media capable of storing program codes, or a terminal device such as a computer, a server, a mobile phone, a tablet, or the like.
In the several embodiments provided in the present invention, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of elements is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is only the embodiments of the present invention, and therefore, the patent scope of the invention is not limited thereto, and all equivalent structures or equivalent processes using the descriptions of the present invention and the accompanying drawings, or direct or indirect application in other related technical fields, are included in the scope of the invention.

Claims (9)

1. An abnormal interface fault tolerance method, comprising:
acquiring interface information, identifying an abnormal interface according to the interface information and marking the identified abnormal interface;
pre-configuring a fault-tolerant strategy of the abnormal interface according to the interface information and carrying out association processing on the abnormal interface and the fault-tolerant strategy;
receiving a service request, intercepting the service request, reading an interface identifier in the service request, and detecting whether a target interface pointed by the interface identifier is an abnormal interface or not;
when the target interface is detected to be an abnormal interface, searching a fault-tolerant strategy corresponding to the abnormal interface as a fault-tolerant strategy of the target interface, and acquiring a response result according to the fault-tolerant strategy to respond to the service request;
the obtaining interface information, identifying the abnormal interface according to the interface information and marking the identified abnormal interface comprises the following steps:
acquiring the interface information, wherein the interface information comprises an interface URL of a historical service request, an interface return status code and processing time consumption of the historical service request, and the interface URL at least comprises the interface identifier;
within a first preset time range, counting the overtime duty ratio of the historical service request of the same interface according to the processing time consumption, determining an interface to be monitored according to the overtime duty ratio, and performing first marking processing on the interface to be monitored;
and monitoring the interface to be monitored in real time, calculating average connection time consumption of the interface to be monitored within a second preset time range, identifying an abnormal interface according to the average connection time consumption, and performing second marking processing on the identified abnormal interface.
2. The abnormal interface fault tolerance method according to claim 1, wherein, in the first preset time range, counting a timeout duty ratio of the historical service request of the same interface according to the processing time consumption, determining an interface to be monitored according to the timeout duty ratio, and performing a first marking process on the interface to be monitored includes:
comparing the processing time consumption of each historical service request of the same interface with a first preset time threshold value in a first preset time range, and calculating the ratio of the number of the historical service requests with the processing time consumption exceeding the first preset time threshold value to the total number of all the historical service requests of the same interface to obtain the overtime ratio;
comparing the overtime duty ratio with a preset value, and judging whether the overtime duty ratio is larger than the preset value or not;
if yes, determining the interface as an interface to be monitored and performing first marking processing on the interface to be monitored.
3. The method for fault tolerance of an abnormal interface according to claim 1, wherein calculating average connection time consumption of the interface to be monitored within a second preset time range, identifying the abnormal interface according to the average connection time consumption, and performing a second marking process on the identified abnormal interface includes:
calculating the ratio of the sum of the processing time consumption of all the historical service requests of the interface to be monitored to the total number of the historical service requests of the interface to be monitored within a second preset time range to obtain average connection time consumption;
comparing the average time consumption with a second preset time threshold value, and judging whether the average time consumption is larger than the second preset time threshold value or not;
if yes, determining the interface to be monitored as an abnormal interface, and performing second marking processing on the abnormal interface.
4. The method for fault tolerance of an abnormal interface according to claim 1, wherein before the time-out duty cycle of the historical service request of the same interface is counted according to the processing time in the first preset time range, further comprising:
and identifying abnormal data according to the interface return state code and eliminating the abnormal data.
5. The abnormal interface fault tolerance method according to claim 1, wherein the pre-configuring the fault tolerance policy of the abnormal interface according to the interface information comprises:
identifying the interface type of the abnormal interface according to the interface information;
and pre-configuring the fault tolerance strategy according to the interface type.
6. The abnormal-interface fault-tolerance method according to claim 5, wherein the interface type includes a first component interface and a second component interface, and wherein pre-configuring the fault-tolerance policy according to the interface type includes:
when the interface type is a first component interface, the fault tolerance policy takes empty data as a response result;
when the interface type is the second component interface, the fault tolerance policy is to obtain a Redis value from a Redis cache as a response result.
7. An abnormal interface fault tolerance apparatus for implementing the abnormal interface fault tolerance method according to any one of claims 1 to 6, comprising:
the acquisition module is used for acquiring interface information, identifying an abnormal interface according to the interface information and marking the identified abnormal interface;
the association module is used for pre-configuring a fault-tolerant strategy of the abnormal interface according to the interface information and carrying out association processing on the abnormal interface and the fault-tolerant strategy;
the detection module is used for receiving a service request, intercepting the service request, reading an interface identifier in the service request, and detecting whether a target interface pointed by the interface identifier is an abnormal interface or not;
and the response module is used for searching a fault-tolerant strategy corresponding to the abnormal interface as the fault-tolerant strategy of the target interface when the target interface is detected to be the abnormal interface, and acquiring a response result according to the fault-tolerant strategy to respond to the service request.
8. A computer device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the abnormal interface fault tolerance method according to any one of claims 1-6 when executing the computer program.
9. A computer storage medium having stored thereon a computer program, which when executed by a processor implements the abnormal interface fault tolerance method of any of claims 1-6.
CN202210723732.8A 2022-06-24 2022-06-24 Fault tolerance method, device, equipment and storage medium for abnormal interface Active CN115002000B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210723732.8A CN115002000B (en) 2022-06-24 2022-06-24 Fault tolerance method, device, equipment and storage medium for abnormal interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210723732.8A CN115002000B (en) 2022-06-24 2022-06-24 Fault tolerance method, device, equipment and storage medium for abnormal interface

Publications (2)

Publication Number Publication Date
CN115002000A CN115002000A (en) 2022-09-02
CN115002000B true CN115002000B (en) 2024-04-05

Family

ID=83037772

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210723732.8A Active CN115002000B (en) 2022-06-24 2022-06-24 Fault tolerance method, device, equipment and storage medium for abnormal interface

Country Status (1)

Country Link
CN (1) CN115002000B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8380820B1 (en) * 2011-04-08 2013-02-19 Cellco Partnership Sending synchronous responses to requests from frontend applications
CN111414263A (en) * 2020-03-20 2020-07-14 深圳乐信软件技术有限公司 Information processing method, device, server and storage medium
CN113115351A (en) * 2021-03-31 2021-07-13 深圳市优克联新技术有限公司 Network exception processing method and device, terminal equipment and medium
CN113971093A (en) * 2020-07-22 2022-01-25 中移(苏州)软件技术有限公司 Message processing method, device, equipment and computer storage medium
CN114065194A (en) * 2021-11-23 2022-02-18 中国工商银行股份有限公司 Method and device for detecting abnormal interface application, electronic equipment and storage medium
CN114153712A (en) * 2021-11-22 2022-03-08 深圳市晨北科技有限公司 Exception handling method, device, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9665391B2 (en) * 2012-05-17 2017-05-30 International Business Machines Corporation Automated transaction tuning in application servers
CN113157198A (en) * 2020-01-07 2021-07-23 伊姆西Ip控股有限责任公司 Method, apparatus and computer program product for managing a cache

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8380820B1 (en) * 2011-04-08 2013-02-19 Cellco Partnership Sending synchronous responses to requests from frontend applications
CN111414263A (en) * 2020-03-20 2020-07-14 深圳乐信软件技术有限公司 Information processing method, device, server and storage medium
CN113971093A (en) * 2020-07-22 2022-01-25 中移(苏州)软件技术有限公司 Message processing method, device, equipment and computer storage medium
CN113115351A (en) * 2021-03-31 2021-07-13 深圳市优克联新技术有限公司 Network exception processing method and device, terminal equipment and medium
CN114153712A (en) * 2021-11-22 2022-03-08 深圳市晨北科技有限公司 Exception handling method, device, equipment and storage medium
CN114065194A (en) * 2021-11-23 2022-02-18 中国工商银行股份有限公司 Method and device for detecting abnormal interface application, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN115002000A (en) 2022-09-02

Similar Documents

Publication Publication Date Title
CN106548402B (en) Resource transfer monitoring method and device
CN110362455B (en) Data processing method and data processing device
CN108540533B (en) Request answering method and device
CN109039803A (en) A kind of method, system and the computer equipment of processing readjustment notification message
CN110969417B (en) Government affair item synchronization method, device, system, computer equipment and storage medium
CN109145590A (en) A kind of function hook detection method, detection device and computer-readable medium
CN113242297A (en) Service system and service state adjusting method
CN108650123B (en) Fault information recording method, device, equipment and storage medium
CN108429636B (en) Method and device for positioning abnormal system and electronic equipment
CN112530074A (en) Queuing and calling reminding method, device, equipment and storage medium
CN115002000B (en) Fault tolerance method, device, equipment and storage medium for abnormal interface
WO2021040852A1 (en) Assigning a severity level to a computing service using tenant telemetry data
JP6574310B2 (en) Evaluation information matching method, apparatus and server
CN115037653B (en) Service flow monitoring method, device, electronic equipment and storage medium
CN115242621B (en) Network private line monitoring method, device, equipment and computer readable storage medium
CN115277588B (en) Fusing current limiting system based on middle platform system
CN107766232B (en) Plug-in management method and device
CN112910684B (en) Method and terminal for monitoring key data through real-time streaming platform
CN109348053B (en) Telephone number mark processing method, server, terminal device and computer readable storage medium
CN114510507A (en) Data verification method, device, terminal equipment and medium
CN114221807A (en) Access request processing method and device, monitoring equipment and storage medium
CN114764324A (en) Enterprise resource planning system and integration method thereof
CN112948225A (en) Link monitoring method and device, monitoring equipment and storage medium
CN110196874A (en) Data subscription method, device and server
CN110876852A (en) Network game data processing method and system of micro-service

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant