Fault drilling method, device and equipment and storage medium
By employing proxy clients to generate call link base class templates and inject fault messages, the method achieves precise fault simulation in production environments, addressing the limitations of current chaos engineering methods.
Patent Information
- Application Number
- CN202310739146.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-20
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2043-06-20
AI Technical Summary
Current chaos engineering fault injection methods lack precision in granularity and control range, making it impossible to achieve fault injection with logical isolation at the interface level and preventing accurate fault simulation in production environments.
A method and device that utilize proxy clients to turn on control switches for application interfaces, generate call link base class templates through interface identification, and inject fault messages to simulate faults accurately, allowing for precise fault simulation in production environments.
Enables fine-grained fault simulation by determining fault injection at the interface level, improving the accuracy of fault detection and resolution in distributed systems.
Smart Images

Figure CN119172219A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to communication technology, and in particular to a fault drill method, apparatus, device and storage medium. Background Art
[0002] There are many types of failures in the operation and maintenance system, which lead to system chaos and service interruption. Determining the cause of the failure and locating the node where the failure occurred after the failure occurs is a post-event response and passive response, resulting in low efficiency in fault resolution. In recent years, Chaos Engineering has begun to emerge. It actively introduces abnormal states (disturbance) of software or hardware into the system, creates failure scenarios, and shows system weaknesses based on the system's behavior under various pressures to improve the system architecture.
[0003] However, the granularity of the current chaos engineering fault injection is too coarse, and the control range of the fault is not precise enough. It is impossible to achieve fault injection with logical isolation at the interface level, and the fault drill scenario cannot be implemented in the production environment, resulting in inaccurate fault simulation. Summary of the invention
[0004] The present application provides a fault drill method, apparatus, device and storage medium to solve the above-mentioned problems.
[0005] In a first aspect, the present application provides a fault drill method, the method is applied to a server, the server is communicatively connected to a control device, the distributed system jointly deployed by the server and other servers includes multiple application interfaces and corresponding proxy clients, the method includes:
[0006] Each of the application interfaces obtains a proxy client startup instruction transmitted by the control device;
[0007] In response to the proxy client startup instruction, turning on the control switch corresponding to the proxy client of each application interface;
[0008] Transmitting a call link base class template set associated with each application interface to the control device; the call link base class template set includes at least one call link base class template, and each call link base class template includes a sequence of sequential calls of at least one application interface;
[0009] The first application interface of the target call link base class template obtains the preset fault message transmitted by the control device; the target call link base class template is a call link base class template determined by the control device from the call link base class template set, and the target call link base class template includes at least one target application interface;
[0010] Respond to the preset fault message in sequence according to the calling order of each application interface in the target calling link base class template, and generate corresponding fault feedback information;
[0011] The fault feedback information is transmitted to the control device through the proxy client of each target application interface, so that the control device determines the relationship between the preset fault message and the target fault feedback information according to the fault feedback information and the target fault feedback information.
[0012] In the above technical scheme, before the control device performs fault injection on the application interface, the control switch corresponding to the proxy client of the application interface is turned on to determine the control scope of the fault in units of application interfaces, and multiple call link base class templates composed of each application interface are determined by scanning each application interface. The control device selects a call link base class template as the target call link base class template, and injects a preset fault message into the target call link base class template. The application interface in the target call link base class template responds to the preset fault message in turn, and feeds back the response information to the control device, so that the control device compares the fault feedback information of each interface with the target fault feedback information to determine whether the target fault is caused by the fault message. Since the fault injection is performed on an entire call link base class template, the production environment drill can be realized to improve the accuracy of the fault simulation.
[0013] Optionally, transmitting the call link base class template set associated with each application interface to the control device specifically includes:
[0014] Each application interface obtains a call link base class template acquisition instruction transmitted by the control device;
[0015] In response to the calling link base class template acquisition instruction, after each application interface obtains the message information transmitted by the upstream object, its corresponding proxy client adds the identification information of the application interface into the message information;
[0016] Transmitting the message information to the downstream application interface in the order of calling the application interface until the proxy client of the last application interface adds its identification information to the message information;
[0017] Feedback the message information from the last application interface to the first application interface among the application interfaces in the reverse order of the message information transmission sequence;
[0018] The proxy client of the first application interface transmits the message information to the control device, so that the control device obtains the call link base class template from the message information, and composes the call link base class template set from multiple call link base class templates with different call orders.
[0019] Optionally, after each application interface obtains the message information transmitted by the upstream object, its corresponding proxy client adds the identification information of the application interface into the message information, specifically including:
[0020] After the control switch of the proxy client of each application interface is started, the corresponding application interface is scanned to obtain scanning information; the scanning information includes the controller layer;
[0021] Using the scanning information, annotating the application interfaces obtained by the scanning, wherein the annotating information of each application interface includes an object identifier of the application interface, a module identifier of the application where the application interface is located, and a subject identifier of the device where the application is located;
[0022] A proxy class is generated according to the controller layer, and after each application interface obtains the message information transmitted by the upstream object, the proxy class adds the identification information of the application interface into the message information.
[0023] Optionally, the scanning information further includes: object attribute information of the application interface, the object attribute information including interface name, application name, port, interface method name, interface request mode, interface request parameter type, interface return parameter type, interface request URL;
[0024] The scanning information is used to mark the application interface obtained by the scan, specifically including:
[0025] The object identifier of the application interface is generated according to the object attribute information, and the object identifier includes the interface name, application name, port, application IP, controller, interface method name, interface request mode, interface request parameter type, interface return parameter type, and interface request URL.
[0026] Optionally, the scanning information further includes: module attribute information of the application, the module attribute information including application name and port;
[0027] The method further comprises:
[0028] The module identification of the application is generated according to the module attribute information; the module identification includes the application name, port, application IPList, and host IPList.
[0029] Optionally, the scanning information further includes: main attribute information of the device, the main attribute information including host IP and MAC address information;
[0030] The method further comprises:
[0031] A subject identification of the device is generated according to the subject attribute information; the subject identification includes the subject attribute information.
[0032] Optionally, the method further comprises:
[0033] Match the application name, port, and application IP in the object identifier of the application interface with the application name, port, and application IPList in each module identifier to determine the application associated with the application interface;
[0034] According to the host IPList in the module identification of the application associated with the application interface, the host IP in each of the subject identifications is matched to determine the device associated with the application;
[0035] The identification information of the application interface is generated according to the object identification of the application interface, the module identification of the application associated with the application interface, and the subject identification of the device associated with the application.
[0036] In the above technical solution, the identification information of the application interface is generated through the object identifier of the application interface, the module identifier of the application associated with the application interface, and the subject identifier of the device associated with the application, so as to accurately locate the position of each interface and ensure the accuracy of the fault drill process.
[0037] Optionally, the preset fault message includes at least one preset fault sub-message of the target application interface;
[0038] Responding to the preset fault message in sequence according to the calling order of each application interface in the target calling link base class template, and generating corresponding fault feedback information, specifically including:
[0039] Setting breakpoints before and after calling a program of the target application interface through a proxy class;
[0040] Obtaining a fault sub-message at a breakpoint before calling a program, and transmitting the fault sub-message to the control device, so that the control device determines a fault transmission condition according to the fault sub-message;
[0041] The endpoint after the calling program obtains the fault feedback information of the target application interface to the fault sub-message.
[0042] In the above technical solution, breakpoints are set before and after the calling program, and the running status of the application at each breakpoint is obtained, which further realizes the situation where the interface call generates a fault when the fault message is injected, thereby reducing the granularity of fault injection.
[0043] In a second aspect, the present application provides a fault drill method, which is applied to a control device, wherein the control device is communicatively connected to at least one server, and the distributed system deployed on each of the servers includes multiple application interfaces and corresponding proxy clients, and the method includes:
[0044] Transmitting a proxy client startup instruction to each of the application interfaces, wherein the proxy client startup instruction is used to turn on a control switch of the proxy client of each of the application interfaces;
[0045] Obtaining a call link base class template set associated with each application interface; the call link base class template set includes at least one call link base class template, and each of the call link base class templates includes a sequence of sequential calls of at least one application interface;
[0046] Determine a target call link base class template from the call link base class template set; the target call link base class template includes at least one target application interface;
[0047] Transmitting a preset fault message to the first application interface of the target calling link base class template; the preset fault message is used to enable each application interface of the target calling link base class template to obtain the preset fault message in the calling order and respond to the preset fault message;
[0048] Fault feedback information of each target application interface is obtained, and a relationship between the preset fault message and the target fault feedback information is determined according to the fault feedback information and the target fault feedback information.
[0049] In the above technical scheme, before the control device performs fault injection on the application interface, the control switch corresponding to the proxy client of the application interface is turned on to determine the control scope of the fault in units of application interfaces, and multiple call link base class templates composed of each application interface are determined by scanning each application interface. The control device selects a call link base class template as the target call link base class template, and injects a preset fault message into the target call link base class template. The application interface in the target call link base class template responds to the preset fault message in turn, and feeds back the response information to the control device, so that the control device compares the fault feedback information of each interface with the target fault feedback information to determine whether the target fault is caused by the fault message. Since the fault injection is performed on an entire call link base class template, the production environment drill can be realized to improve the accuracy of the fault simulation.
[0050] Optionally, a call link base class template set associated with each application interface is obtained, specifically including:
[0051] Transmitting a call link base class template acquisition instruction to multiple application interfaces, and obtaining multiple call link base class templates with different call orders sent by a proxy client of a first application interface of the multiple application interfaces;
[0052] Combining a plurality of the call link base class templates into the call link base class template set;
[0053] Among them, the link base class template acquisition instruction is used to enable the first application interface, after obtaining the message information transmitted by the upstream object, its corresponding proxy client adds the identification information of the application interface into the message information, and then transmits it to the downstream application interface, until the proxy client of the last application interface adds its identification information into the message information, and then feeds the message information back to the first application interface, and the proxy client of the first application interface transmits the message information to the control device, so that the control device obtains the call link base class template from the message information.
[0054] In a third aspect, the present application provides a fault drill device, comprising:
[0055] An acquisition module is used for each application interface to acquire the proxy client startup instruction transmitted by the control device;
[0056] A processing module, configured to respond to the proxy client startup instruction and turn on the control switch corresponding to the proxy client of each of the application interfaces;
[0057] The processing module is also used to transmit the call link base class template set associated with each application interface to the control device; the call link base class template set includes at least one call link base class template, and each call link base class template includes a sequence of sequential calls of at least one application interface;
[0058] The processing module is also used to obtain the preset fault message transmitted by the control device through the first application interface of the target call link base class template; the target call link base class template is a call link base class template determined by the control device from the call link base class template set, and the target call link base class template includes at least one target application interface;
[0059] The processing module is also used to respond to the preset fault message in sequence according to the calling order of each application interface in the target calling link base class template, and generate corresponding fault feedback information;
[0060] The processing module is further configured to transmit the fault feedback information to the control device through the proxy client of each target application interface, so that the control device determines the relationship between the preset fault message and the target fault feedback information according to the fault feedback information and the target fault feedback information.
[0061] In a fourth aspect, the present application provides a fault drill device, comprising:
[0062] A processing module, used for transmitting a proxy client startup instruction to each application interface, wherein the proxy client startup instruction is used for turning on a control switch of the proxy client of each application interface;
[0063] An acquisition module is used to obtain a call link base class template set associated with each application interface; the call link base class template set includes at least one call link base class template, and each call link base class template includes a sequence of sequential calls of at least one application interface;
[0064] The processing module is also used to determine a target call link base class template from the call link base class template set; the target call link base class template includes at least one target application interface;
[0065] The processing module is also used to transmit the preset fault message to the first application interface of the target calling link base class template; the preset fault message is used to enable each application interface of the target calling link base class template to obtain the preset fault message in the calling order and respond to the preset fault message;
[0066] The processing module is further used to obtain fault feedback information of each target application interface, and determine the relationship between the preset fault message and the target fault feedback information according to the fault feedback information and the target fault feedback information.
[0067] In a fifth aspect, the present application provides an electronic device, comprising: a processor and a memory communicatively connected to the processor;
[0068] Memory stores computer instructions;
[0069] When executing computer instructions, the processor is used to implement the method involved in the first aspect or the second aspect.
[0070] In a sixth aspect, the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the method involved in the first aspect or the second aspect.
[0071] The present application provides a fault drill method, apparatus, device and storage medium. Before a control device performs fault injection on an application interface, a control switch corresponding to a proxy client of the application interface is turned on to determine the control scope of the fault in units of application interfaces. By scanning each application interface, multiple call link base class templates composed of each application interface are determined. The control device selects a call link base class template as a target call link base class template, and injects a preset fault message into the target call link base class template. The application interface in the target call link base class template responds to the preset fault message in turn, and feeds back the response information to the control device, so that the control device compares the fault feedback information of each interface with the target fault feedback information to determine whether the target fault is caused by the fault message. Since the fault injection is performed on an entire call link base class template, the production environment drill can be realized, and the accuracy of the fault simulation is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0073] Figure 1 This is an application scenario diagram of a fault drill method provided by the present application according to an exemplary embodiment;
[0074] Figure 2 This is an application scenario diagram of a fault drill method provided by the present application according to another exemplary embodiment;
[0075] Figure 3 An interactive diagram of a fault drill method provided by the present application according to an exemplary embodiment;
[0076] Figure 4 A schematic diagram of a flow chart of a method for generating a call link base class template provided by the present application according to an exemplary embodiment;
[0077] Figure 5 This is a schematic diagram of an interface call provided by the present application according to an exemplary embodiment;
[0078] Figure 6 This is a schematic diagram of an interface call provided by the present application according to another exemplary embodiment;
[0079] Figure 7 This is a schematic diagram of an interface call provided by the present application according to another exemplary embodiment;
[0080] Figure 8 This is a schematic diagram of an interface call provided by the present application according to another exemplary embodiment;
[0081] Fig. 9 A schematic diagram of a scenario of a method for generating a calling link base class template provided by the present application according to an exemplary embodiment;
[0082] Fig.10 A schematic diagram of a flow chart of a method for marking identification information of an application interface provided by the present application according to an exemplary embodiment;
[0083] Fig.11 A schematic diagram of the structure of a fault drill device provided by the present application according to an exemplary embodiment;
[0084] Fig.12 A schematic diagram of the structure of an electronic device provided according to an embodiment of the present application.
[0085] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0086] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0087] There are many types of failures in the operation and maintenance system, which lead to system chaos and service interruption. Determining the cause of the failure and locating the node where the failure occurred after the failure occurs is a post-event response and passive response, resulting in low efficiency in fault resolution. In recent years, Chaos Engineering has begun to emerge. It actively introduces abnormal states (disturbance) of software or hardware into the system, creates failure scenarios, and shows system weaknesses based on the system's behavior under various pressures to improve the system architecture.
[0088] However, the granularity of the current chaos engineering fault injection is too coarse, and the control range of the fault is not precise enough. It is impossible to achieve fault injection with logical isolation at the interface level, and the fault drill scenario cannot be implemented in the production environment, resulting in inaccurate fault simulation.
[0089] In order to solve the above problems, the present application provides a fault drill method, device, equipment and storage medium. The technical concept of the present application is: to determine the application interface to be injected with a fault, set a proxy client, start the control switch of the proxy client, determine the unique identifier of each application interface, and through the mutual calls of the interfaces, use the identifiers of each interface to generate a call link base class template to represent various call situations between the interfaces, select a call link base class template, and inject a fault message into the interface corresponding to the call link base class template, and analyze the response of each interface to the fault message to see whether the fault message produces the expected fault.
[0090] Figure 1 This is an application scenario diagram of a fault drill method provided by the present application according to an exemplary embodiment, such as Figure 1 As shown, it includes a control device 10 and multiple servers 201, the multiple servers 201 constitute a server cluster 20, and the control device 10 and the server cluster 20 are connected.
[0091] A distributed system is deployed on the server cluster 10, and the distributed system includes multiple applications. A single application or multiple applications jointly provide services to a terminal used by a user.
[0092] Figure 2 This is an application scenario diagram of a fault drill method provided by the present application according to another exemplary embodiment. Figure 2 FIG. 4 shows a case where an application is deployed on a server cluster 20. Figure 2 As shown, the distributed system of the server cluster 20 includes application A 301 and application B 302. Application A 301 will call application B 302 during operation.
[0093] A proxy client is deployed in each of the application A 301 and the application B 302 , that is, the application A 301 deploys the proxy client 3011 , and the application B 302 deploys the proxy client 3012 . Both the proxy client 3011 and the proxy client 3012 are in communication connection with the control device 10 .
[0094] In one embodiment, the control device 10 implements heartbeat detection, fault injection, and breakpoint control of the proxy client through Netty communication.
[0095] When the control switches of the proxy client 3011 of application A 301 and the proxy client 3012 of application B 302 are turned on, the proxy client 3011 scans application A 301 and the proxy client 3012 scans application B 302 to determine the application-associated information, and use the information to generate unique identification information, and use the identification information to determine the call link between the applications.
[0096] The proxy client 3011 of application A301 transmits the call link including application A and application B to the control device 10, so that the control device 10 sets a fault message for the call link and transmits the message to application A 301. Application A and application B respond to the message in the calling order, generate a fault, and transmit relevant information of the fault to the control device 10. The control device 10 generates a comparison between the fault and the preset fault to determine whether the fault is caused by the fault type and fault point in the preset message.
[0097] Based on the above application scenarios, some implementation methods of the present application are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the timing of the steps in the following method embodiments is only an example and not a strict limitation.
[0098] Figure 3 This is an interactive diagram of a fault drill method provided by the present application according to an exemplary embodiment, such as Figure 3As shown, including:
[0099] S101, a control device sends a proxy client startup instruction to each application interface in a server.
[0100] The proxy client is a plug-in embedded in a software application, similar to referencing a tool jar package in a Java project.
[0101] The proxy client can scan and annotate the application and the proxy class, wherein the proxy class can generate a fault injection call chain base class template and receive and execute injected fault messages.
[0102] The proxy client is provided with a control switch, which is used to determine the logical isolation range. When the control switch is turned on, the application interface is within the logical isolation range and participates in the execution of the fault message; when the control switch is turned off, the application interface is within the logical isolation range and does not participate in the execution of the fault message.
[0103] S102: The server responds to the proxy client startup instruction and turns on the control switch corresponding to the proxy client of each application interface.
[0104] S103: The server sends a call link base class template set associated with each application interface to the control device.
[0105] The call link base class template set includes at least one call link base class template, and each call link base class template includes a sequence of sequential calls of at least one application interface.
[0106] S104: The control device determines a target call link base class template from a call link base class template set.
[0107] The control device determines a call link base class template from the call link base class template set as a target call link base class template, and sets a fault message for one or more application interfaces included in the target call link base class template.
[0108] S105. The control device sends a preset fault message to the target calling the first application interface of the link base class template.
[0109] S106. The server responds to the preset fault message in sequence according to the calling order of each application interface in the target calling link base class template, and generates corresponding fault feedback information.
[0110] The preset fault message includes at least one preset fault sub-message of a target application interface. The target application interface is the application interface for setting the fault of the control device. For example, in a link called by interfaces A, B, and C in sequence, interfaces A and C are not set with fault messages but normal messages, and interface B is set with a fault message, then interface B is the target application interface.
[0111] More specifically, the process of the server responding to the preset fault message and generating corresponding fault feedback information specifically includes:
[0112] Through the proxy class, breakpoints are set before and after the calling program of the target application interface, the pre-call message is executed before the breakpoint, the fault sub-message is obtained at the breakpoint before the calling program, and the fault sub-message is transmitted to the control device, so that the control device determines the fault transmission situation according to the fault sub-message, and obtains the fault feedback information of the target application interface to the fault sub-message at the endpoint after the calling program.
[0113] S107: The server sends fault feedback information to the control device through the proxy client of each target application interface.
[0114] S108. The control device determines a relationship between a preset fault message and the target fault feedback information according to the fault feedback information and the target fault feedback information.
[0115] When the fault feedback information matches the target fault feedback information, it is determined that the target fault feedback information is generated by the preset fault message, otherwise, it is not.
[0116] In the above technical scheme, before the control device performs fault injection on the application interface, the control switch corresponding to the proxy client of the application interface is turned on to determine the control scope of the fault in units of application interfaces, and multiple call link base class templates composed of each application interface are determined by scanning each application interface. The control device selects a call link base class template as the target call link base class template, and injects a preset fault message into the target call link base class template. The application interface in the target call link base class template responds to the preset fault message in turn, and feeds back the response information to the control device, so that the control device compares the fault feedback information of each interface with the target fault feedback information to determine whether the target fault is caused by the fault message. Since the fault injection is performed on an entire call link base class template, the production environment drill can be realized to improve the accuracy of the fault simulation.
[0117] Figure 4 This is a flow chart of a method for generating a call link base class template according to an exemplary embodiment of the present application, such as Figure 4 As shown, including:
[0118] S201. Each application interface obtains a call link base class template acquisition instruction transmitted by a control device.
[0119] S202 . In response to calling the link base class template acquisition instruction, after each application interface obtains the message information transmitted by the upstream object, its corresponding proxy client adds the identification information of the application interface into the message information.
[0120] If the application interface is at the first position in the call link, the upstream object of the application interface is the external system or the front-end interface; if the application interface is not at the first position in the call link, the upstream object of the application interface is the application interface of the call link.
[0121] S203: Transmit the message information to the downstream application interface in the calling sequence of the application interface until the proxy client of the last application interface adds its identification information into the message information.
[0122] The application interface in step S202 transmits the message containing its identification information to the next application interface in the calling chain by calling the interface. The called application interface will add its identification to the message in accordance with the processing method of step S202, and so on, until the last application interface in the calling chain obtains the message and adds its identification information to the message.
[0123] The following explains the various calling situations of the application interface in turn:
[0124] In one embodiment, the calling sequence of the application interface is as follows: Figure 5 As shown, in the call link, the call link of the application interface is unique. When interface A calls interface B, it transmits its identifier IDA to interface B. The call link generated according to the call relationship is "IDA-IDB". When interface B calls interface C, it transmits the determined call link to interface C. Interface C adds its identifier IDC to the call link, updates the call link "IDA-IDB-IDC", and feeds back the call link to interface B. Interface B then feeds back the call link to interface A, completing the generation of a call link base class template.
[0125] In another embodiment, the calling sequence of the application interface is as follows: Figure 6 and Figure 7 As shown, the calling process of interfaces A, B, and C is the same as Figure 5 The embodiments shown are the same and will not be described again. When interface C is called, on the one hand, interface D can be called, and on the other hand, interface E can be called, and two call links "IDA-IDB-IDC-IDD" and "IDA-IDB-IDC-IDE" are generated respectively.
[0126] In another embodiment, the calling sequence of the application interface is as follows: Figure 8 As shown, interface A calls interfaces B, C, and D in sequence, and finally generates a call link "IDA-IDB-IDC-IDD".
[0127] S204 . Feedback the message information from the last application interface to the first application interface among the application interfaces in reverse order of the message information transmission sequence.
[0128] S205. The proxy client of the first application interface transmits the message information to the control device, so that the control device obtains the call link base class template from the message information, and composes a call link base class template set from a plurality of call link base class templates with different call orders.
[0129] In the above technical solution, each application interface adds identification information to the message in sequence according to the order of calling, which can automatically record not only the specific application interface included in the calling link, but also the calling order of each application interface, so that the control device can set and inject faults according to the link, so as to realize fine-grained fault drills according to the application interface.
[0130] Fig. 9 This is a schematic diagram of a scenario of a method for generating a calling link base class template provided by the present application according to an exemplary embodiment, such as Fig. 9 As shown, there are two physical machines: physical machine A and physical machine B.
[0131] Application A and application B are installed in physical machine A, and application C, application D, and application E are installed in physical machine B. A proxy client is set in each of the above applications, and the switch of each proxy client is turned on.
[0132] When generating a call link, application A runs application A after receiving an external call or a front-end call. During the running process, interface B is called, application B runs, application B calls interface C1, runs application C, application C calls interface D1, runs application D, and after the call is completed, the call link "interface A-interface B-interface C1-interface D1" is fed back to the control device.
[0133] During the running process, application B also calls interface C2 to run application C. During the running process, it calls interface E to run application E. After completing the call, it feeds back the call link "interface A-interface B-interface C2-interface E" to the control device.
[0134] Fig.10 This is a flow chart of a method for marking identification information of an application interface provided by the present application according to an exemplary embodiment. Fig.10 As shown, including:
[0135] S301: After the control switch of the proxy client of each application interface is started, the corresponding application interface is scanned to obtain scanning information.
[0136] The scanning information includes the controller layer, object attribute information, application module attribute information, and device main attribute information. The object attribute information includes interface name, application name, port, interface method name, interface request method, interface request parameter type, interface return parameter type, and interface request URL.
[0137] The module attribute information of the application includes the application name and port.
[0138] The subject attribute information includes the host IP and MAC address information.
[0139] S302: Use the scanning information to mark the application interface obtained by scanning.
[0140] The annotation information of each application interface includes the object identifier of the application interface, the module identifier of the application where the application interface is located, and the subject identifier of the device where the application is located.
[0141] More specifically, in the process of marking the application interface obtained by scanning, an object identifier of the application interface is generated according to the object attribute information, wherein the object identifier includes the interface name, application name, port, application IP, controller, interface method name, interface request mode, interface request parameter type, interface return parameter type, and interface request URL.
[0142] Generate the module identification of the application according to the module attribute information; the module identification includes the application name, port, application IPList, and host IPList.
[0143] Generate a subject identification of the device according to the subject attribute information; the subject identification includes the subject attribute information
[0144] The host IPList in the module identification of the application associated with the application interface is matched with the host IP in each subject identification to determine the device associated with the application.
[0145] The identification information of the application interface is generated according to the object identification of the application interface, the module identification of the application associated with the application interface, and the subject identification of the device associated with the application.
[0146] S303: Generate a proxy class according to the controller layer. After obtaining the message information transmitted by the upstream object, each application interface adds the identification information of the application interface into the message information through the proxy class.
[0147] The software fault link call base class template is generated by adding the identification information of each interface into the message.
[0148] The arrangement of calling base class template for software fault link is divided into automatic and manual;
[0149] For example, there is a fault injection link base class template: interface A->interface B->interface C->interface D;
[0150] There are two instances of interface A (applications APP1 and APP2), one instance of interface B (application APP3), two instances of interface C (applications APP4 and APP5), and one instance of interface D (application APP6).
[0151] The automatic arrangement module finds all the corresponding application and host information through the elements in the interface, and then arranges according to the autonomous algorithm. The specific process is as follows:
[0152] There are two application IPs (APP1-IP, APP2-IP) in the attribute element of the interface A object. Associate the application APP1 and APP2 module IDs by using the application IPs APP1-IP and APP2-IP, and find the APP1-host ID and APP2-host ID in the module ID attribute.
[0153] Interface A generates two physical instance nodes:
[0154] Interface A (application APP1, APP1-module ID, APP1-host ID) is referred to as: interface A logical node 1;
[0155] Interface A (application APP2, APP2-module ID, APP2-host ID) is referred to as: interface A logical node 2.
[0156] And so on B, C, D are as follows:
[0157] Interface B (application APP3, APP3-module ID, APP3-host ID) is referred to as: interface B logical node 1;
[0158] Interface C (application APP4, APP4-module ID, APP4-host ID) is referred to as: interface C logical node 1;
[0159] Interface C (application APP5, APP5-module ID, APP5-host ID) is referred to as: interface C logical node 2;
[0160] Interface D (application APP6, APP6-module ID, APP6-host ID) is referred to as: interface D logical node 1.
[0161] Automatically orchestrate and generate software fault injection physical node links based on the physical instance nodes above:
[0162] Interface A logical node 1->Interface B logical node 1->Interface C logical node 1->Interface D logical node 1;
[0163] Interface A logical node 1->Interface B logical node 1->Interface C logical node 2->Interface D logical node 1;
[0164] Interface A logical node 2 -> interface B logical node 1 -> interface C logical node 1 -> interface D logical node 1;
[0165] Interface A logical node 2 -> interface B logical node 1 -> interface C logical node 2 -> interface D logical node 1.
[0166] The manual arrangement process is as follows:
[0167] If the user specifies to use interface A logical node 1 and interface C logical node 1.
[0168] The user only needs to manually select the element information of each interface to generate a physical node link for fault injection that meets the user's needs:
[0169] Interface A (module ID and host ID of APP1) -> interface B (module ID and host ID of APP3) -> interface C (module ID and host ID of APP4) -> interface D (module ID and host ID of APP6).
[0170] It is worth noting that when the fault message is injected into the fault injection physical node link generated above, it is necessary to ensure that the proxy client switches of all logical nodes are turned on.
[0171] In the above technical solution, the identification information of the application interface is generated through the object identifier of the application interface, the module identifier of the application associated with the application interface, and the subject identifier of the device associated with the application, so as to accurately locate the position of each interface and ensure the accuracy of the fault drill process.
[0172] Fig.11 This is a schematic diagram of the structure of a fault drill device provided according to an embodiment of the present application. The fault drill device 400 includes an acquisition module 401 and a processing module 402, wherein:
[0173] Acquisition module 401, used for each application interface to acquire the proxy client startup instruction transmitted by the control device;
[0174] Processing module 402, for responding to the proxy client startup instruction, turning on the control switch corresponding to the proxy client of each application interface;
[0175] The processing module 402 is further used to transmit the call link base class template set associated with each application interface to the control device; the call link base class template set includes at least one call link base class template, and each call link base class template includes the order of sequentially calling at least one application interface;
[0176] The processing module 402 is also used to target the first application interface of the link base class template to obtain the preset fault message transmitted by the control device; the target call link base class template is a call link base class template determined by the control device from the call link base class template set, and the target call link base class template includes at least one target application interface;
[0177] The processing module 402 is also used to respond to the preset fault message in sequence according to the calling order of each application interface in the target calling link base class template, and generate corresponding fault feedback information;
[0178] The processing module 402 is further configured to transmit the fault feedback information to the control device through the proxy client of each target application interface, so that the control device determines the relationship between the preset fault message and the target fault feedback information according to the fault feedback information and the target fault feedback information.
[0179] In one feasible embodiment, the processing module 402 is further configured to:
[0180] Each application interface obtains the call link base class template acquisition instruction for controlling the transmission of the device;
[0181] In response to calling the link base class template acquisition instruction, after each application interface obtains the message information transmitted by the upstream object, its corresponding proxy client adds the identification information of the application interface into the message information;
[0182] According to the calling order of the application interface, the message information is transmitted to the downstream application interface until the proxy client of the last application interface adds its identification information into the message information;
[0183] Feedback the message information from the last application interface to the first application interface among the application interfaces in the reverse order of the message information transmission sequence;
[0184] The proxy client of the first application interface transmits the message information to the control device, so that the control device obtains the call link base class template from the message information, and composes a call link base class template set from multiple call link base class templates with different call orders.
[0185] In one feasible embodiment, the processing module 402 is further configured to:
[0186] After the control switch of the proxy client of each application interface is started, the corresponding application interface is scanned to obtain scanning information; the scanning information includes the controller layer;
[0187] Using the scanning information, the application interfaces obtained by the scan are annotated. The annotated information of each application interface includes an object identifier of the application interface, a module identifier of the application in which the application interface is located, and a subject identifier of the device in which the application is located;
[0188] The proxy class is generated according to the controller layer. After each application interface obtains the message information transmitted by the upstream object, the identification information of the application interface is added into the message information through the proxy class.
[0189] In one feasible embodiment, the processing module 402 is further configured to:
[0190] Generate an object identifier for the application interface based on the object attribute information. The object identifier includes the interface name, application name, port, application IP, controller, interface method name, interface request method, interface request parameter type, interface return parameter type, and interface request URL.
[0191] The scanning information also includes: object attribute information of the application interface, the object attribute information includes interface name, application name, port, interface method name, interface request mode, interface request parameter type, interface return parameter type, and interface request URL.
[0192] In one feasible embodiment, the processing module 402 is further configured to:
[0193] Generate the module identification of the application according to the module attribute information; the module identification includes the application name, port, application IPList, and host IPList;
[0194] The scanning information also includes: module attribute information of the application, and the module attribute information includes the application name and port.
[0195] In one feasible embodiment, the processing module 402 is further configured to:
[0196] A subject identification of the device is generated according to the subject attribute information; the subject identification includes the subject attribute information; wherein the scanning information also includes: the subject attribute information of the device, and the subject attribute information includes the host IP and MAC address information.
[0197] In one feasible embodiment, the processing module 402 is further configured to:
[0198] Match the application name, port, and application IP in the object identifier of the application interface with the application name, port, and application IPList in each module identifier to determine the application associated with the application interface;
[0199] According to the host IPList in the module identification of the application associated with the application interface, the host IP in each subject identification is matched to determine the device associated with the application;
[0200] The identification information of the application interface is generated according to the object identification of the application interface, the module identification of the application associated with the application interface, and the subject identification of the device associated with the application.
[0201] In one feasible embodiment, the processing module 402 is further configured to:
[0202] Set breakpoints before and after calling the target application interface through the proxy class;
[0203] Obtaining a fault sub-message at a breakpoint before calling the program, and transmitting the fault sub-message to a control device, so that the control device determines the fault transmission condition according to the fault sub-message;
[0204] Obtaining the fault feedback information of the target application interface to the fault sub-message at the endpoint after the calling program;
[0205] The preset fault message includes at least one preset fault sub-message of a target application interface.
[0206] Fig.12 The present application is provided with a schematic diagram of the structure of an electronic device according to an embodiment. The electronic device 500 includes a memory 501 and a processor 502, and the memory 501 is used to store computer instructions executable by the processor. The memory 501 may include a high-speed random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.
[0207] When executing computer instructions, the processor 502 implements each step of the fault drill method in the above embodiment with the control device or server as the execution subject. For details, please refer to the relevant description in the above method embodiment. The processor 502 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the invention can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
[0208] Optionally, the memory 501 can be independent or integrated with the processor 502. When the memory 501 is independently provided, the electronic device 500 further includes a bus for connecting the memory 501 and the processor 502. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0209] An embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When a processor executes the computer instructions, each step of the fault drill method in the above embodiment is implemented.
[0210] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the various steps of the fault drill method in the above embodiment.
[0211] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0212] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A fault drill method, characterized in that: The method is applied to a server, the server is in communication connection with a control device, and a distributed system jointly deployed by the server and other servers includes multiple application interfaces and corresponding proxy clients, and the method includes: Each of the application interfaces obtains a proxy client startup instruction transmitted by the control device; In response to the proxy client startup instruction, turning on the control switch corresponding to the proxy client of each application interface; Transmitting a call link base class template set associated with each application interface to the control device; the call link base class template set includes at least one call link base class template, and each call link base class template includes a sequence of sequential calls of at least one application interface; The first application interface of the target call link base class template obtains the preset fault message transmitted by the control device; the target call link base class template is a call link base class template determined by the control device from the call link base class template set, and the target call link base class template includes at least one target application interface; Respond to the preset fault message in sequence according to the calling order of each application interface in the target calling link base class template, and generate corresponding fault feedback information; The fault feedback information is transmitted to the control device through the proxy client of each target application interface, so that the control device determines the relationship between the preset fault message and the target fault feedback information according to the fault feedback information and the target fault feedback information.
2. The method according to claim 1, characterized in that Transmitting the call link base class template set associated with each application interface to the control device specifically includes: Each application interface obtains a call link base class template acquisition instruction transmitted by the control device; In response to the calling link base class template acquisition instruction, after each application interface obtains the message information transmitted by the upstream object, its corresponding proxy client adds the identification information of the application interface into the message information; Transmitting the message information to the downstream application interface in the order of calling the application interface until the proxy client of the last application interface adds its identification information to the message information; Feedback the message information from the last application interface to the first application interface among the application interfaces in the reverse order of the message information transmission sequence; The proxy client of the first application interface transmits the message information to the control device, so that the control device obtains the call link base class template from the message information, and composes the call link base class template set from multiple call link base class templates with different call orders.
3. The method according to claim 2, characterized in that After each application interface obtains the message information transmitted by the upstream object, its corresponding proxy client adds the identification information of the application interface into the message information, specifically including: After the control switch of the proxy client of each application interface is started, the corresponding application interface is scanned to obtain scanning information; the scanning information includes the controller layer; Using the scanning information, annotating the application interfaces obtained by the scanning, wherein the annotating information of each application interface includes an object identifier of the application interface, a module identifier of the application where the application interface is located, and a subject identifier of the device where the application is located; A proxy class is generated according to the controller layer, and after each application interface obtains the message information transmitted by the upstream object, the proxy class adds the identification information of the application interface into the message information.
4. The method according to claim 3, characterized in that The scanning information also includes: object attribute information of the application interface, the object attribute information includes interface name, application name, port, interface method name, interface request mode, interface request parameter type, interface return parameter type, interface request URL; The scanning information is used to mark the application interface obtained by the scan, specifically including: The object identifier of the application interface is generated according to the object attribute information, and the object identifier includes the interface name, application name, port, application IP, controller, interface method name, interface request mode, interface request parameter type, interface return parameter type, and interface request URL.
5. The method according to claim 4, characterized in that The scanning information also includes: module attribute information of the application, the module attribute information includes application name and port; The method further comprises: The module identification of the application is generated according to the module attribute information; the module identification includes the application name, port, application IPList, and host IPList.
6. The method according to claim 5, characterized in that The scanning information also includes: the main attribute information of the device, the main attribute information includes the host IP and MAC address information; The method further comprises: A subject identification of the device is generated according to the subject attribute information; the subject identification includes the subject attribute information.
7. The method according to claim 6, characterized in that The method further comprises: Match the application name, port, and application IP in the object identifier of the application interface with the application name, port, and application IPList in each module identifier to determine the application associated with the application interface; According to the host IPList in the module identification of the application associated with the application interface, the host IP in each of the subject identifications is matched to determine the device associated with the application; The identification information of the application interface is generated according to the object identification of the application interface, the module identification of the application associated with the application interface, and the subject identification of the device associated with the application.
8. The method according to claim 1, characterized in that The preset fault message includes at least one preset fault sub-message of the target application interface; Responding to the preset fault message in sequence according to the calling order of each application interface in the target calling link base class template, and generating corresponding fault feedback information, specifically including: Setting breakpoints before and after calling a program of the target application interface through a proxy class; Obtaining a fault sub-message at a breakpoint before calling a program, and transmitting the fault sub-message to the control device, so that the control device determines a fault transmission condition according to the fault sub-message; The endpoint after the calling program obtains the fault feedback information of the target application interface to the fault sub-message.
9. A fault drill method, characterized in that: The method is applied to a control device, the control device is in communication connection with at least one server, and the distributed system deployed on each of the servers includes multiple application interfaces and corresponding proxy clients, and the method includes: Transmitting a proxy client startup instruction to each of the application interfaces, wherein the proxy client startup instruction is used to turn on a control switch of the proxy client of each of the application interfaces; Obtaining a call link base class template set associated with each application interface; the call link base class template set includes at least one call link base class template, and each of the call link base class templates includes a sequence of sequential calls of at least one application interface; Determine a target call link base class template from the call link base class template set; the target call link base class template includes at least one target application interface; Transmitting a preset fault message to the first application interface of the target calling link base class template; the preset fault message is used to enable each application interface of the target calling link base class template to obtain the preset fault message in the calling order and respond to the preset fault message; Fault feedback information of each target application interface is obtained, and a relationship between the preset fault message and the target fault feedback information is determined according to the fault feedback information and the target fault feedback information.
10. The method according to claim 9, characterized in that Get the call link base class template set associated with each application interface, including: Transmitting a call link base class template acquisition instruction to multiple application interfaces, and obtaining multiple call link base class templates with different call orders sent by a proxy client of a first application interface of the multiple application interfaces; Combining a plurality of the call link base class templates into the call link base class template set; Among them, the link base class template acquisition instruction is used to enable the first application interface, after obtaining the message information transmitted by the upstream object, its corresponding proxy client adds the identification information of the application interface into the message information, and then transmits it to the downstream application interface, until the proxy client of the last application interface adds its identification information into the message information, and then feeds the message information back to the first application interface, and the proxy client of the first application interface transmits the message information to the control device, so that the control device obtains the call link base class template from the message information.
11. A fault drill device, characterized in that: include: An acquisition module is used for each application interface to acquire the proxy client startup instruction transmitted by the control device; A processing module, configured to respond to the proxy client startup instruction and turn on the control switch corresponding to the proxy client of each of the application interfaces; The processing module is also used to transmit the call link base class template set associated with each application interface to the control device; the call link base class template set includes at least one call link base class template, and each call link base class template includes a sequence of sequential calls of at least one application interface; The processing module is also used to obtain the preset fault message transmitted by the control device through the first application interface of the target call link base class template; the target call link base class template is a call link base class template determined by the control device from the call link base class template set, and the target call link base class template includes at least one target application interface; The processing module is also used to respond to the preset fault message in sequence according to the calling order of each application interface in the target calling link base class template, and generate corresponding fault feedback information; The processing module is further configured to transmit the fault feedback information to the control device through the proxy client of each target application interface, so that the control device determines the relationship between the preset fault message and the target fault feedback information according to the fault feedback information and the target fault feedback information.
12. A fault drill device, characterized in that: include: A processing module, used for transmitting a proxy client startup instruction to each application interface, wherein the proxy client startup instruction is used for turning on a control switch of the proxy client of each application interface; An acquisition module is used to obtain a call link base class template set associated with each application interface; the call link base class template set includes at least one call link base class template, and each call link base class template includes a sequence of sequential calls of at least one application interface; The processing module is also used to determine a target call link base class template from the call link base class template set; the target call link base class template includes at least one target application interface; The processing module is also used to transmit the preset fault message to the first application interface of the target calling link base class template; The preset fault message is used to enable the target to call each application interface of the link base class template to obtain the preset fault message in the calling order and respond to the preset fault message; The processing module is further used to obtain fault feedback information of each target application interface, and determine the relationship between the preset fault message and the target fault feedback information according to the fault feedback information and the target fault feedback information.
13. An electronic device, characterized in that: include: A processor and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor is used to implement the method according to any one of claims 1 to 8, or claim 9 or 10 when executing the computer-executable instructions.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which are used to implement the method according to any one of claims 1 to 8, or claim 9 or 10 when executed by a processor.
Citation Information
Patent Citations
Micro-service application oriented failure test tool and method
CN110262972A
Fault drilling method and device, computer equipment and storage medium
CN112631846A
Fault drilling method and device based on chaos engineering, terminal equipment and medium
CN114113984A
Custom type fault simulation method and device in Java program
CN115408299A
Method and system for realizing online chaos experiment, electronic equipment and medium
CN115840716A
