Methods, apparatus, computer equipment, and storage media for testing the chaos of system processes.

By constructing a directed graph of processes and converting it into a tree graph, and calculating the criticality ranking for chaos testing, the problem of important processes being missed in existing technologies is solved, enabling rapid discovery of critical system processes and improving testing efficiency.

CN119597663BActive Publication Date: 2026-05-26CHINA TELECOM CLOUD TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2024-11-27
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing technologies, process anomaly testing relies on experience-based judgment and manual execution, which leads to the omission of important processes, insufficient testing efficiency, and an inability to quickly identify important system problems.

Method used

By determining the dependencies between system processes, a directed process graph is constructed and converted into a tree graph. The criticality of each node is calculated, and chaos tests are performed according to the criticality to ensure that important processes are tested first.

Benefits of technology

It improves the testing efficiency of important processes, enabling the rapid identification of processes that cause significant system problems, and enhances the effectiveness of chaos testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597663B_ABST
    Figure CN119597663B_ABST
Patent Text Reader

Abstract

This application relates to a method, apparatus, computer device, and storage medium for chaos testing of system processes, belonging to the field of software testing technology. The method includes: determining a directed process graph based on processes in the system and the dependencies between processes; nodes in the directed process graph corresponding to processes; determining a tree graph corresponding to the directed process graph; and for the tree graph, determining the criticality of each node; the criticality is determined based on the critical value of the node and the critical values ​​of its child nodes; the criticality is used to represent the importance of the node; and performing chaos testing on the processes corresponding to the nodes according to the process testing order corresponding to the criticality. This method can improve the testing efficiency of important processes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software testing technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for testing the chaos of a system process. Background Technology

[0002] When an operating system boots up, it launches numerous processes to provide basic services. During operation, each user creates corresponding processes as they install software packages and set up services according to their needs. These processes all require system resources such as CPU, memory, and network, and some processes communicate and depend on each other. Therefore, process anomalies can lead to system service failures, other process malfunctions, and even system crashes. Thus, the operating system's behavior during process anomalies reflects its robustness. In software development, tests simulating process anomalies can be conducted to avoid these situations.

[0003] However, process anomaly testing in related technologies mainly relies on experience-based judgment and manual execution. Testers first select certain important processes to construct anomalies based on experience, then manually execute the abnormal operations on the selected processes, and finally observe the system's performance. This testing method, relying solely on experience to judge process importance, may miss core processes that are not transparent to the user. Furthermore, the processes selected by testers are random, failing to quickly identify important system problems. Consequently, the testing efficiency for important processes and those causing significant system issues is insufficient. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for chaotic testing of system processes that can improve the testing efficiency of important processes, in order to address the above-mentioned technical problems.

[0005] Firstly, this application provides a method for testing chaos in a system process. The method includes:

[0006] A process directed graph is determined based on the processes in the system and the dependencies between them; the nodes in the process directed graph correspond to the processes.

[0007] A tree diagram corresponding to the directed graph of the process is determined, and for the tree diagram, the criticality of each node in the tree diagram is determined; the criticality is determined based on the critical value of the node and the critical values ​​of the child nodes of the node; the criticality is used to represent the importance of the node.

[0008] Based on the process testing order corresponding to the criticality, a chaos test is performed on the process corresponding to the node.

[0009] In one embodiment, determining the process directed graph based on processes in the system and the dependencies between those processes includes:

[0010] Obtain the dependencies between processes in the system and determine the vector graphics SVG file used to store the dependencies;

[0011] Based on the strategy that directed edges point from the node corresponding to the current process to the node corresponding to the dependent process, the SVG file is converted into a process directed graph; the process directed graph includes at least one of directed cyclic graphs and directed acyclic graphs.

[0012] In one embodiment, after determining the process directed graph based on the processes in the system and the dependencies between the processes, the method further includes:

[0013] If the directed graph of the process contains a directed cyclic graph, then the cycle of the directed cyclic graph is determined;

[0014] The processes in the loop are merged and determined as loop nodes of the directed cyclic graph; each loop node is a single abstract node, which is used to represent the node corresponding to each process in the loop.

[0015] The directed cyclic graph is updated based on the loop nodes to obtain the updated process directed graph.

[0016] In one embodiment, determining the criticality of each node in the tree diagram includes:

[0017] For each node in the tree diagram, the initial value of the subtree size of the current node is determined to be the key value of the current node;

[0018] Determine the subtree size value corresponding to each child node of the current node, which is the key value of the child node;

[0019] The criticality of the current node is obtained by summing the critical value of the current node with the critical values ​​of each of the child nodes.

[0020] In one embodiment, the method further includes:

[0021] If the current node is a loop node, then the criticality of the current node is determined to be the criticality of the nodes corresponding to each process contained in the current node.

[0022] In one embodiment, performing chaos testing on the process corresponding to the node according to the process testing order corresponding to the criticality includes:

[0023] Based on the order of criticality of each node in the tree diagram, determine the criticality ranking sequence of the processes corresponding to the nodes;

[0024] If there are processes with the same criticality in the criticality ranking sequence, then the criticality ranking sequence is reordered according to the process IDs of the processes in ascending order to obtain a reordered criticality ranking sequence.

[0025] Using a chaos testing tool, anomaly simulations were performed on each process in the reordered criticality ranking sequence, and the simulation results for each process were determined. The simulation results included process recovery time, system recovery time, and the number and names of other affected processes.

[0026] Secondly, this application also provides a chaos testing device for system processes. The device includes:

[0027] A directed graph determination module is used to determine a process directed graph based on the processes in the system and the dependencies between the processes; the nodes in the process directed graph correspond to the processes.

[0028] The criticality determination module is used to determine the tree diagram corresponding to the directed graph of the process, and for the tree diagram, to determine the criticality of each node in the tree diagram; the criticality is determined based on the critical value of the node and the critical values ​​of the child nodes of the node; the criticality is used to represent the importance of the node;

[0029] The process testing module is used to perform chaos testing on the processes corresponding to the nodes according to the process testing order corresponding to the criticality.

[0030] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program that, when executed by the processor, performs the following steps:

[0031] A process directed graph is determined based on the processes in the system and the dependencies between them; the nodes in the process directed graph correspond to the processes.

[0032] A tree diagram corresponding to the directed graph of the process is determined, and for the tree diagram, the criticality of each node in the tree diagram is determined; the criticality is determined based on the critical value of the node and the critical values ​​of the child nodes of the node; the criticality is used to represent the importance of the node.

[0033] Based on the process testing order corresponding to the criticality, a chaos test is performed on the process corresponding to the node.

[0034] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0035] A process directed graph is determined based on the processes in the system and the dependencies between them; the nodes in the process directed graph correspond to the processes.

[0036] A tree diagram corresponding to the directed graph of the process is determined, and for the tree diagram, the criticality of each node in the tree diagram is determined; the criticality is determined based on the critical value of the node and the critical values ​​of the child nodes of the node; the criticality is used to represent the importance of the node.

[0037] Based on the process testing order corresponding to the criticality, a chaos test is performed on the process corresponding to the node.

[0038] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:

[0039] A process directed graph is determined based on the processes in the system and the dependencies between them; the nodes in the process directed graph correspond to the processes.

[0040] A tree diagram corresponding to the directed graph of the process is determined, and for the tree diagram, the criticality of each node in the tree diagram is determined; the criticality is determined based on the critical value of the node and the critical values ​​of the child nodes of the node; the criticality is used to represent the importance of the node.

[0041] Based on the process testing order corresponding to the criticality, a chaos test is performed on the process corresponding to the node.

[0042] The aforementioned method, apparatus, computer equipment, storage medium, and computer program product for chaotic testing of system processes determine a directed graph of processes based on the dependencies between processes within the system. Each node in the directed graph corresponds to a process. By transforming the directed graph, a corresponding tree diagram is obtained. The dependencies between processes can be represented based on the parent-child relationships of nodes in the tree diagram. By determining the criticality of each node in the tree diagram, the importance of each process can be determined, and processes can be sorted based on their criticality to obtain the process testing order. Chaos testing is performed on processes according to the process testing order, ensuring that important processes are tested first. This allows important processes, those causing significant system problems, to be tested quickly, thereby improving the efficiency of chaos testing. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is an application environment diagram of a system process chaos testing method in one embodiment;

[0045] Figure 2 This is a flowchart illustrating a method for testing the chaos of a system process in one embodiment.

[0046] Figure 3 This is a schematic diagram of a directed cyclic graph in one embodiment;

[0047] Figure 4 This is a schematic diagram of a directed acyclic graph in one embodiment;

[0048] Figure 5 This is a schematic diagram of a tree diagram in one embodiment;

[0049] Figure 6 This is a structural block diagram of a chaos testing device for system processes in one embodiment;

[0050] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0051] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0052] The system process chaos testing method provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. Terminal 102 can send the processes in the system and the dependencies between processes to server 104. Server 104 can identify processes as nodes and the dependencies between processes as edges, obtaining a directed graph of processes, where nodes in the directed graph correspond to processes. Server 104 can transform the directed graph of processes, representing the edges in the directed graph as parent-child relationships between nodes, thus obtaining a tree graph corresponding to the directed graph of processes. Server 104 can determine the criticality of each node based on the key value of each node in the tree graph and the key value of each node's corresponding child node, and determine the process testing order of each node based on the criticality. Finally, server 104 performs chaos testing according to the process testing order.

[0053] The data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located on the cloud or other network servers. The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, and tablets. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0054] In one exemplary embodiment, such as Figure 2 As shown, a method for testing the chaos of a system process is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps S202 to S206. Wherein:

[0055] Step S202: Determine the process directed graph based on the processes in the system and the dependencies between processes.

[0056] In a directed process graph, nodes correspond to processes; each node represents at least one process; edges represent dependencies between two processes; and dependencies indicate the execution order of two processes—the server must test the dependent process before executing other processes based on the dependencies. A directed process graph uses a graph data structure to represent processes and their dependencies.

[0057] Specifically, the server can traverse all processes on the system and the dependencies between them. After obtaining the processes and dependencies, processes can be viewed as nodes, and dependencies as directed edges. Combining multiple nodes and directed edges yields a directed process graph. In one example, there are processes A, B, C, and D. The dependencies are: processes B and D depend on process A, process A depends on process C, and process C depends on process B. Processes B and D can only be executed after process A executes, and process A can only be executed after process C executes.

[0058] Step S204: Determine the tree diagram corresponding to the directed graph of the process, and for the tree diagram, determine the criticality of each node in the tree diagram.

[0059] In this tree diagram, criticality is determined based on the critical value of a node and the critical values ​​of its child nodes; criticality represents the importance of a node. Each node corresponds to a process with a criticality. Nodes in the tree diagram represent at least one process. Edges in the tree diagram are undirected. Each node in the tree diagram can include a root node and leaf nodes.

[0060] Specifically, the server can use the nodes pointed to by the directed edges in the directed graph of the process as the parent nodes of the tree diagram, thereby determining the child and parent nodes in the tree diagram. It then connects the child and parent nodes with undirected edges to obtain the tree diagram corresponding to the directed graph of the process. For each node in the tree diagram, the server can determine the key value of the current node and traverse its child nodes to obtain the key values ​​corresponding to those child nodes. The server merges the key value of the current node with the key values ​​of its child nodes to obtain the key score of the current node. In an example, the current node is process A, and its child nodes are processes B and D. The key value of process A is 1, the key value of process B is 2, and the key value of process D is 1. Therefore, merging the key values ​​of processes A, B, and D yields a key score of 4 for process A.

[0061] Step S206: Perform chaos tests on the processes corresponding to the nodes according to the process test order corresponding to the criticality.

[0062] The process test order refers to the arrangement of processes in the system, and it determines the order in which chaos tests are performed on each process. Chaos testing is a software testing method used to improve the reliability and resilience of a system in the face of uncertainty and failures. Servers can proactively introduce faults or anomalies to observe how the system responds, thereby discovering problems in processes.

[0063] Specifically, the server can sort nodes by their criticality. For example, the server can determine the process testing order based on the node criticality. For each process, the server can perform chaos testing individually to determine the process's performance and response in the face of faults and anomalies.

[0064] In the aforementioned method for chaotic testing of system processes, a directed graph of processes is determined by analyzing the dependencies between processes within the system. Each node in the directed graph corresponds to a process. By transforming the directed graph, a corresponding tree diagram is obtained. The parent-child relationships between nodes in the tree diagram represent the dependencies between processes. By determining the criticality of each node in the tree diagram, the importance of each process can be determined, and processes are ranked based on their criticality to obtain the process testing order. Chaos testing is performed on processes according to this testing order, ensuring that important processes are tested first. This allows critical processes, and those causing significant system problems, to be quickly identified, thereby improving the efficiency of chaos testing.

[0065] In an exemplary embodiment, the specific implementation process of the step "determine the process directed graph based on the processes in the system and the dependencies between processes" includes:

[0066] Obtain the dependencies between processes in the system and determine the SVG vector image file to store the dependencies. Based on the strategy that directed edges point from the node corresponding to the current process to the node corresponding to the dependent process, convert the SVG file into a process directed graph.

[0067] Directed graphs of processes include at least one of directed cyclic graphs and directed acyclic graphs. Vector graphics (SVG) files are an XML-based vector graphics file format used to describe two-dimensional graphics.

[0068] Specifically, the server can traverse all processes in the system and the dependencies recorded within each process. The server generates SVG files by using processes as elements and dependencies as paths. The server parses the SVG files, identifying processes as nodes and edges as directed edges. The server can represent the dependencies between nodes based on the direction of the directed edges. During the generation of directed edges, the server can treat each edge as a path from the node corresponding to the current process to the node corresponding to a dependent process, thus a single directed edge can represent the dependency between two nodes. Based on this, the server can represent the dependencies between nodes using directed edges and generate a directed process graph composed of nodes and directed edges.

[0069] In one example, the processes in the system do not necessarily have dependencies. Therefore, multiple directed process graphs can exist within the same system, and each directed process graph has a different type. The types of directed process graphs can include directed cyclic graphs, directed acyclic graphs, and single-node graphs. For single nodes, since single nodes have no dependencies, the processing of determining the tree diagram corresponding to a single node is not performed in this embodiment. However, the processes corresponding to single nodes still need to be tested.

[0070] In this embodiment, by using directed edges as process dependencies and abstracting processes as nodes to represent elements in the SVG graph, the SVG file can be accurately converted into a process directed graph, thus improving the accuracy of generating the process directed graph.

[0071] In an exemplary embodiment, after the step "determine the process directed graph based on the processes in the system and the dependencies between processes", the method further includes:

[0072] If the directed graph of processes contains a directed cyclic graph, then the cycle in the directed cyclic graph is identified; the processes in the cycle are merged and identified as cycle nodes in the directed cyclic graph. The directed cyclic graph is then updated based on the cycle nodes to obtain the updated directed graph of processes.

[0073] In this context, a loop node is a single abstract node, used to represent the nodes corresponding to each process within the loop. A directed cyclic graph contains directed edges and loops. A loop is used to represent a closed loop formed by directed edges between multiple nodes. A loop node is used to represent all nodes in the loop through a single node.

[0074] Specifically, the server can determine the type of the process directed graph. If the type is determined to be a directed cyclic graph, topological sorting can be used to detect cycles in the graph and identify the processes contained within those cycles. For example, if a cycle consisting of process A -> process B -> process C -> process A is detected, it can be determined that the cycle contains processes A, B, and C. The server can then represent the nodes corresponding to processes A, B, and C using a cycle node. By replacing the original nodes of each process in the cycle with cycle nodes, the server updates the process directed graph, eliminating the cycles and transforming the graph from a directed cyclic graph to a directed acyclic graph.

[0075] Since a loop node can represent the original process in the loop, it can replace the dependencies contained in the original process. For example, loop node P can replace the nodes corresponding to the original processes A, B, and C. The dependency relationship between the original process A and process D can be transformed into the dependency relationship between loop node P and process D. The dependency relationship between the original process B and process F can be transformed into the dependency relationship between loop node P and process F.

[0076] In this embodiment, by identifying the cycles in the directed graph of the process and replacing each node of the cycle in the directed graph of the process with the cycle node, the type of the directed graph of the process can be transformed from a directed cyclic graph to a directed acyclic graph, thereby reducing the complexity of the directed graph of the process.

[0077] In an exemplary embodiment, the specific implementation process of the step "determining the criticality of each node in the tree diagram" includes:

[0078] For each node in the tree diagram, determine the initial value of the subtree size of the current node as the key value of the current node; determine the subtree size value of each child node of the current node as the key value of the child node; sum the key value of the current node with the key values ​​of each child node to obtain the keyness of the current node.

[0079] Specifically, the initial subtree size is a pre-set key value for each node. For example, for nodes A and B, the initial subtree size can be set to a first key value and a second key value, respectively. The subtree size of a child node is the sum of the initial subtree sizes of all nodes in the child node's subtree. For example, if child node C is a child of node A, and child node C also has subtrees that depend on child node C, the server can determine the initial subtree size of child node C, the subtree size of each node in child node C's subtree, and sum these values ​​to obtain the subtree size of child node C. The server can also sum the initial subtree size of the current node and the subtree size values ​​of each of the current node's child nodes to obtain the criticality of the current node. Based on this, the server can obtain the criticality of each node in the tree diagram.

[0080] In this embodiment, the subtree size value of each node is gradually obtained by using the initial subtree size value of each node in the tree diagram, and the criticality of the node is obtained by using the subtree size value and the initial subtree size value, which can improve the accuracy and efficiency of determining criticality.

[0081] In an exemplary embodiment, the method further includes: if the current node is a loop node, then determining the criticality of the current node as the criticality of the nodes corresponding to each process contained in the current node.

[0082] Specifically, if a node in the tree diagram is a loop node, then the loop node contains multiple processes. In this case, the key score corresponding to the loop node can be shared with the key scores of the nodes corresponding to the multiple processes. For example, if loop node P contains processes A, B, and C, and the key score corresponding to loop node P is 10, then the key scores of processes A, B, and C are also 10.

[0083] Optionally, the server can redetermine the initial subtree size of each node based on the initial subtree size of each node represented by the loop node, and the sum of this initial subtree size and the criticality of the loop node's child nodes is the criticality of that node. For example, if the criticality of the child nodes of loop node P is 9, and the initial subtree sizes of processes A, B, and C are 1, 2, and 3 respectively, then the criticalities of processes A, B, and C can be determined to be 10, 11, and 12 respectively.

[0084] Optionally, the criticality of each individual node can be the initial value of the subtree size of that node.

[0085] In this embodiment, by sharing the criticality of the loop node with the different processes corresponding to the loop node, the criticality of the node corresponding to each process can be quickly determined.

[0086] In an exemplary embodiment, the specific implementation process of the step "perform chaos testing on the processes corresponding to the nodes according to the process testing order corresponding to the criticality" includes:

[0087] Based on the order of criticality of each node in the tree diagram, determine the criticality ranking sequence of the processes corresponding to the nodes; if there are processes with the same criticality in the criticality ranking sequence, then reorder the criticality ranking sequence according to the process ID in ascending order to obtain the reordered criticality ranking sequence; use a chaos testing tool to perform anomaly simulation on each process in the reordered criticality ranking sequence, and determine the simulation results of the anomaly simulation of each process.

[0088] The simulation results include process recovery time, system recovery time, and the number and names of other affected processes.

[0089] Specifically, the server can sort the criticality of the nodes corresponding to each process from largest to smallest, obtaining a criticality sorting sequence. For multiple processes with the same criticality as those in the criticality sorting sequence, the servers can reorder these processes based on their process IDs, either in ascending or descending order, thereby updating the criticality sorting sequence and obtaining a reordered criticality sorting sequence.

[0090] After obtaining the reordered criticality ranking sequence, the server can use a pre-built chaos testing tool to perform anomaly simulations on each process in the criticality ranking sequence until all processes have undergone at least one anomaly simulation. For each process, the operating system's performance can be monitored during the anomaly simulation, and the simulation results can be reported. For example, process recovery time, system recovery time, and the number and names of other affected processes that exhibited anomalies can be recorded. Simultaneously, it can be determined whether the process experienced system crashes or restarts during the anomaly simulation, and these occurrences are recorded in the simulation results.

[0091] Optionally, for all process-directed graphs corresponding to each process in the system, and for all individual nodes corresponding to each process in the system, the server can determine each node in the tree diagram corresponding to the process-directed graph, and the criticality of each individual node. The server can determine the criticality sorting sequence of the processes corresponding to the nodes based on the order of the criticality of all nodes.

[0092] In this embodiment, processes are sorted by the criticality of nodes and the process ID to obtain a criticality ranking sequence. Chaos tests are then performed on each process based on the criticality ranking sequence to obtain the simulation results of each chaos test. This allows for priority testing of processes with high importance, identification of problems in important processes, and thus prevention of system crashes and improvement of testing efficiency for important processes.

[0093] The following detailed description, using a specific embodiment, illustrates the execution process of the aforementioned chaotic testing method for system processes. It mainly includes the following steps: retrieving process dependencies, converting the dependencies into a directed graph, detecting and removing cycles in the directed graph, converting the acyclic directed graph into a tree graph, calculating the criticality of each node, determining the order of process anomalies, simulating process anomalies sequentially using chaotic testing tools or generated scripts, and monitoring operating system performance to evaluate system robustness. This embodiment is primarily used to improve test coverage, enhance testing efficiency, quickly expose system problems, and enrich testing methods.

[0094] Specifically, the first step is to retrieve the dependencies of all processes on the system and generate a dependency SVG file. The second step is to convert the SGV file into a directed graph according to preset rules. Each node represents a process, and based on the dependencies between processes in the SVG file, the directed edges of the graph point from the node corresponding to the current process to the node corresponding to the process it depends on. The third step is to perform cycle detection and removal on the directed graph. A topological sorting algorithm is used to detect cycles in the directed graph, and the processes corresponding to the nodes in the cycle are recorded.

[0095]

[0096] in This represents a process. Each ring is then abstracted as a larger node. ,but Regenerate to node The directed edges are used to convert the directed cyclic graph into a directed acyclic graph. The fourth step is to convert the directed acyclic graph into a tree graph. Each node corresponds one-to-one with a node in the directed graph, and the node pointed to by the directed edge in the directed graph is the parent node in the tree graph.

[0097] Step 5: Calculate the subtree size of each node in the above tree diagram. This refers to the criticality of the process corresponding to each node. The initial subtree size of each node is set to 1 (representing the node itself), i.e. For each child node of each parent node, use the depth-first search (DFS) algorithm to calculate the size of its subtree. Then the size of the parent node's subtree is the sum of the initial size of the subtree and the size of the subtrees of all its child nodes, i.e. If a cycle is removed in the third step, calculate the nodes representing the cycle. The size of the subtree is Since the processes in the ring are interdependent, they are defined with the same criticality. .

[0098] Step 6: Determine the critical process exception order. Assign a criticality level to each process. Sort the processes from largest to smallest. If processes have the same criticality, sort them by process ID from smallest to largest. Step 7: Following the above sorting, use chaos testing tools or generate shell scripts to simulate process anomalies one by one. Step 8: Monitor the operating system's performance and provide feedback, such as the number and names of abnormal processes, system recovery time, etc. If system crashes, restarts, or other unavailability occur, the problem needs to be investigated and fixed.

[0099] This application embodiment first converts the process dependency relationship into a directed graph, then further processes the directed graph into a tree graph, and then calculates the subtree size of each leaf node, non-leaf node, and root node. Based on the subtree size of each node, a process criticality ranking can be obtained, thereby performing planned and sequential chaotic testing of process failures. This can effectively avoid the problem of missing core processes, improve testing efficiency, increase the speed of problem discovery, and the method is also inheritable.

[0100] In another exemplary embodiment, the first step is to use the operating system's process 1 to retrieve the dependencies of all processes on the system, such as using the systemd process command of the Linux system's process 1 to generate an SVG file of all process dependencies.

[0101] Step 2: Convert the above SVG file into a directed graph according to certain rules. For example, the dependencies between processes A, B, C, D, E, and F described in the SVG file are: process A depends on processes B and D, process B depends on process C, process C depends on process A, process E depends on process A, and process F depends on process B. Following the rule that each node represents a process and directed edges point from the node corresponding to the current process to the node corresponding to its dependent processes, the dependencies in the above example can be converted into a directed graph as follows: Figure 3 A directed graph containing a cycle: Based on the dependency description of the entire SVG file, multiple independent directed graphs will be generated, including directed cyclic graphs, directed acyclic graphs, individual nodes, etc.

[0102] Step 3: Use topological sorting to detect cycles in each directed graph and record the process names in each cycle. For example, if a cycle is detected... Figure 3 The ring in And record the process as Then Figure 3 The ring in the middle is abstracted into a large node. ,but Finally, regenerate the nodes. The directed edges, such as Figure 4 As shown, there are directed edges Convert to Directed edge Convert to Directed edge Convert to At this point, The ring is removed, resulting in a directed ring. Figure 3 Transform into a directed acyclic loop Figure 4 Following this method, each directed graph is sequentially checked for cycles and the cycles are removed until all graphs are transformed into directed acyclic graphs.

[0103] Step 4: Convert each of the above directed acyclic graphs into a tree diagram. For example... Figure 4 Nodes in These are the root node and leaf node of the tree diagram, respectively. The node pointed to by the directed edge is the parent node of the tree diagram. The transformed tree diagram is as follows: Figure 5 As shown, node D is the root node, and node... It is a leaf node of node D, and nodes E and F are both nodes. The leaf nodes. Using the same method, convert all directed acyclic graphs into tree graphs.

[0104] Step 5: Calculate the subtree size value of each node in the above tree diagram, that is, the criticality of the process corresponding to each node. Assume... Figure 5The initial size of the subtree of each node is 1 (representing the node itself), that is... .

[0105] For each parent node, the subtree size is calculated using a depth-first search algorithm. Then the size of the parent node's subtree is the initial value plus the sum of the sizes of the subtrees of all its child nodes. For example... Figure 5 In the middle, node If the subtrees are node E and its subtrees, and node F and its subtrees, then node... The subtree size is the initial value plus the subtree size of node E and the subtree size of node F, that is... .

[0106] The subtree of node D is a node and nodes If the subtree of node D is a subtree, then the size of the subtree of node D is the initial value plus the size of the subtree of node D, that is... .

[0107] If leaf nodes E and F have no subtrees, then the size of their subtrees is the initial value, i.e. Because the ring was removed in the third step. And there are Therefore, the criticality of processes A, B, and C is equal to that of the nodes. The subtree size value, i.e. Thus, the criticality of processes A, B, C, D, E, and F has been calculated using the method described above. Similarly, the criticality of all processes in the system can be calculated.

[0108] Step 6: Sort each process by its criticality from highest to lowest. If processes have the same criticality, sort them by their process ID from lowest to highest, with criticality having higher priority than process ID. In Step 5, processes A, B, and C have the same criticality, and processes E and F also have the same criticality. Use the operating system's `ps` command to view their process IDs. Each process ID is unique, and they can be sorted by process ID from lowest to highest. Assume the process IDs of processes A, B, and C are in the following ascending order: [ N A , N B , N C ] The IDs of processes E and F are in ascending order as follows: [ N F , N E ] ,So Figure 3All processes in the process are sorted by criticality from highest to lowest as follows: [ λ D , λ A , λ B , λ C , λ F , λ E ] .

[0109] Similarly, by inserting each process in the system into the correct position in the sorting sequence based on its criticality and process ID, we can obtain the criticality ranking of all processes in the system. The criticality ranking reflects the order of the degree of impact of process anomalies on the system.

[0110] Step 7: Using chaos testing tools or generating shell scripts, simulate the corresponding process exceptions in the system in order of criticality from left to right, until all processes have been simulated to have an exception once.

[0111] Step 8: For each process that malfunctions in Step 7, monitor the operating system's behavior and provide feedback. For example, record the process recovery time, system recovery time, the number and names of other affected processes that malfunction. Also, pay attention to whether the system will crash or restart. If the system crashes or restarts and becomes unusable, troubleshoot and fix the problem.

[0112] Optionally, the implementation of this application can be simplified by skipping the tree diagram conversion and directly using the Depth-First Search (DFS) algorithm to calculate the process criticality of each node in the directed acyclic graph. When calculating the subtree size, this application involves setting initial values, which can be modified according to actual conditions to adapt to different system requirements. This application records the number and names of other affected processes that also become abnormal when a process fails. By comparing this with the current process dependency graph, the process dependency graph can be iteratively updated in a timely manner, triggering a recalculation of criticality. This ensures that the dependencies in the graph are updated in real time, thereby guaranteeing higher accuracy in the calculated process criticality.

[0113] This embodiment uses topological sorting to remove cycles from the directed graph, ultimately visualizing system process dependencies as parent-child relationships in a tree diagram, making the dependencies more intuitive. Simultaneously, processes forming cycles are redefined, simplifying the tree diagram structure and clarifying dependencies. This embodiment obtains the criticality of each process by calculating the subtree size of each node. First, each node is assigned an initial value, then a depth-first search algorithm is used to iteratively calculate the subtree size of each node, thus deriving the criticality of each process. This effectively quantifies the impact of each process on system robustness, providing reliable data for determining the order of process anomalies. This embodiment uses process criticality and process ID to determine the order of process anomalies. The first priority is process criticality, and the second priority is process ID, solving the problem of process anomaly sorting and preventing situations where a process cannot be sorted. The sorting results help testers effectively avoid missing core processes, and simulating anomalies starting with processes with high criticality allows for faster discovery of system problems. Furthermore, automating this method results in good inheritability of the testing method, allowing testers to employ diverse testing techniques. Furthermore, this method can be continuously updated and iterated to adapt to changes in new versions, thus serving as a reliable testing tool that can be used consistently.

[0114] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0115] Based on the same inventive concept, this application also provides a system process chaos testing apparatus for implementing the aforementioned system process chaos testing method. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more system process chaos testing apparatus embodiments provided below can be found in the limitations of the system process chaos testing method described above, and will not be repeated here.

[0116] In one exemplary embodiment, such as Figure 6As shown, a chaos testing device 600 for system processes is provided, comprising: a directed graph determination module 601, a criticality determination module 602, and a process testing module 603, wherein:

[0117] The directed graph determination module 601 is used to determine the process directed graph based on the processes in the system and the dependencies between processes; the nodes in the process directed graph correspond to the processes.

[0118] The criticality determination module 602 is used to determine the tree diagram corresponding to the directed graph of the process, and for the tree diagram, to determine the criticality of each node in the tree diagram; the criticality is determined based on the critical value of the node and the critical values ​​of the node's child nodes; the criticality is used to represent the importance of the node.

[0119] The process testing module 603 is used to perform chaos testing on the processes corresponding to nodes according to the process testing order corresponding to the criticality.

[0120] Furthermore, the directed graph determination module 601 is specifically used to: obtain the dependency relationships of each process in the system, determine the vector SVG file used to store the dependency relationships; and convert the SVG file into a process directed graph according to the strategy that directed edges point from the node corresponding to the current process to the node corresponding to the dependent process; the process directed graph includes at least one of directed cyclic graphs and directed acyclic graphs.

[0121] Furthermore, the device also includes a directed graph update module, used to determine the cycle of the directed graph if the process directed graph contains a directed cyclic graph; merge the processes in the cycle and determine them as cycle nodes of the directed cyclic graph; the cycle node is a single abstract node, and the abstract node is used to represent the node corresponding to each process in the cycle; update the directed cyclic graph according to the cycle node to obtain the updated process directed graph.

[0122] Furthermore, the criticality determination module 602 is specifically used for: for each node in the tree diagram, determining the initial value of the subtree size of the current node as the criticality value of the current node; determining the subtree size value corresponding to each child node of the current node as the criticality value of the child node; and summing the criticality value of the current node with the criticality values ​​of each child node to obtain the criticality of the current node.

[0123] Furthermore, the criticality determination module 602 is specifically used to: if the current node is a loop node, determine the criticality of the current node as the criticality of the nodes corresponding to each process contained in the current node.

[0124] Furthermore, the process testing module 603 is specifically used to: determine the criticality ranking sequence of processes corresponding to nodes based on the order of criticality of each node in the tree diagram; if there are processes with the same criticality in the criticality ranking sequence, then reorder the criticality ranking sequence according to the process IDs in ascending order to obtain the reordered criticality ranking sequence; use a chaos testing tool to perform abnormal simulation on each process in the reordered criticality ranking sequence, and determine the simulation results of each process abnormal simulation; the simulation results include process recovery time, system recovery time, and the number and names of other affected processes.

[0125] Each module in the chaos testing device for the aforementioned system process can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0126] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores process directed graphs, tree graphs, and other data composed of various processes. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a method for testing the chaos of system processes.

[0127] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0128] In one exemplary embodiment, a computer device is also provided, including a memory and a processor. The memory stores a computer program that, when executed by the processor, performs the following steps: determining a process directed graph based on processes in the system and the dependencies between processes; nodes in the process directed graph correspond to processes; determining a tree graph corresponding to the process directed graph; for the tree graph, determining the criticality of each node in the tree graph; the criticality is determined based on the critical value of the node and the critical values ​​of the node's child nodes; the criticality is used to represent the importance of the node; and performing a chaos test on the processes corresponding to the nodes according to the process test order corresponding to the criticality.

[0129] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps: determining a process directed graph based on processes in the system and the dependencies between processes; nodes in the process directed graph corresponding to processes; determining a tree graph corresponding to the process directed graph, and for the tree graph, determining the criticality of each node in the tree graph; the criticality is determined based on the critical value of the node and the critical values ​​of the node's child nodes; the criticality is used to represent the importance of the node; and performing chaos testing on the processes corresponding to the nodes according to the process testing order corresponding to the criticality.

[0130] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps: determining a process directed graph based on processes in the system and the dependencies between processes; nodes in the process directed graph corresponding to processes; determining a tree graph corresponding to the process directed graph, and for the tree graph, determining the criticality of each node in the tree graph; the criticality is determined based on the critical value of the node and the critical values ​​of the node's child nodes; the criticality is used to represent the importance of the node; and performing chaos testing on the processes corresponding to the nodes according to the process testing order corresponding to the criticality.

[0131] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0132] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0133] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for testing chaos in a system process, characterized in that, The method includes: A process directed graph is determined based on the processes in the system and the dependencies between them; the nodes in the process directed graph correspond to the processes. A tree diagram corresponding to the directed graph of the process is determined, and for the tree diagram, the criticality of each node in the tree diagram is determined; the criticality is determined based on the critical value of the node and the critical values ​​of the child nodes of the node; the criticality is used to represent the importance of the node. Based on the process testing order corresponding to the criticality, chaos testing is performed on the processes corresponding to the nodes, including: Based on the order of criticality of each node in the tree diagram, determine the criticality ranking sequence of the processes corresponding to the nodes; If there are processes with the same criticality in the criticality ranking sequence, then the criticality ranking sequence is reordered according to the process IDs of the processes in ascending order to obtain a reordered criticality ranking sequence. Using a chaos testing tool, anomaly simulations were performed on each process in the reordered criticality ranking sequence, and the simulation results for each process were determined. The simulation results included process recovery time, system recovery time, and the number and names of other affected processes.

2. The method according to claim 1, characterized in that, The step of determining the process directed graph based on the processes in the system and the dependencies between those processes includes: Obtain the dependencies between processes in the system and determine the vector graphics SVG file used to store the dependencies; Based on the strategy that directed edges point from the node corresponding to the current process to the node corresponding to the dependent process, the SVG file is converted into a process directed graph; the process directed graph includes at least one of directed cyclic graphs and directed acyclic graphs.

3. The method according to claim 2, characterized in that, After determining the process directed graph based on the processes in the system and the dependencies between those processes, the method further includes: If the directed graph of the process contains a directed cyclic graph, then the cycle of the directed cyclic graph is determined; The processes in the loop are merged and determined as loop nodes of the directed cyclic graph; each loop node is a single abstract node, which is used to represent the node corresponding to each process in the loop. The directed cyclic graph is updated based on the loop nodes to obtain the updated process directed graph.

4. The method according to claim 3, characterized in that, Determining the criticality of each node in the tree diagram includes: For each node in the tree diagram, the initial value of the subtree size of the current node is determined to be the key value of the current node; Determine the subtree size value corresponding to each child node of the current node, which is the key value of the child node; The criticality of the current node is obtained by summing the critical value of the current node with the critical values ​​of each of the child nodes.

5. The method according to claim 4, characterized in that, The method further includes: If the current node is a loop node, then the criticality of the current node is determined to be the criticality of the nodes corresponding to each process contained in the current node.

6. A chaos testing device for system processes, characterized in that, The device includes: A directed graph determination module is used to determine a process directed graph based on the processes in the system and the dependencies between the processes; the nodes in the process directed graph correspond to the processes. The criticality determination module is used to determine the tree diagram corresponding to the directed graph of the process, and for the tree diagram, to determine the criticality of each node in the tree diagram; the criticality is determined based on the critical value of the node and the critical values ​​of the child nodes of the node; the criticality is used to represent the importance of the node; The process testing module is used to perform chaos testing on the processes corresponding to the nodes according to the process testing order corresponding to the criticality, including: Based on the order of criticality of each node in the tree diagram, determine the criticality ranking sequence of the processes corresponding to the nodes; If there are processes with the same criticality in the criticality ranking sequence, then the criticality ranking sequence is reordered according to the process IDs of the processes in ascending order to obtain a reordered criticality ranking sequence. Using a chaos testing tool, anomaly simulations were performed on each process in the reordered criticality ranking sequence, and the simulation results for each process were determined. The simulation results included process recovery time, system recovery time, and the number and names of other affected processes.

7. The apparatus according to claim 6, characterized in that, The device further includes: The directed graph determination module is specifically used to obtain the dependency relationships of each process in the system, determine the vector SVG file used to store the dependency relationships, and convert the SVG file into a process directed graph according to the strategy that directed edges point from the node corresponding to the current process to the node corresponding to the dependent process; the process directed graph includes at least one of directed cyclic graphs and directed acyclic graphs.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.