Service file processing method and electronic equipment
By constructing a target directed graph to automatically compare the service startup order, the problem of startup failure caused by complex dependencies in the server management system is solved, achieving efficient and accurate service file processing, and improving system stability and operation and maintenance efficiency.
Patent Information
- Application Number
- CN202511134316.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-13
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-08-13
AI Technical Summary
In server management systems, the service startup order has complex dependencies, manual verification is inefficient, it is easy to miss implicit dependency issues, dynamic verification capabilities are lacking, and the output format lacks readability and visual interactivity, which affects system stability.
By constructing a directed graph of the target, based on the basic and dependency information of the service file, the system automatically compares the theoretical and actual startup order, identifies the directed edges of the problem, generates adjustment information, and combines a visual interactive interface to assist in the repair process.
It improves the automation, speed, and accuracy of service startup, reduces operation and maintenance costs, enhances system stability and operational efficiency, and significantly improves the accuracy and visualization capabilities of dependency analysis.
Smart Images

Figure CN120994273A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of service management, and particularly relates to a service file processing method and an electronic device. BACKGROUND
[0002] In a server management system, a baseboard management controller (BMC) is responsible for starting and managing system services. The dependency relationship of system services is complex. If the starting order does not meet the dependency requirement, the service starting may fail or the function may not be available, which seriously affects the system stability.
[0003] In the related art, a service configuration file is usually manually written, and the validity and rationality of the service file are verified by manually checking the service configuration file and logs. However, this method seriously depends on manual experience, and is low in efficiency and easy to miss implicit dependency problems. SUMMARY
[0004] Embodiments of the present application provide a service file processing method and an electronic device, which are used to efficiently and accurately adjust the service file, and thus ensure that the service is successfully started and functions normally.
[0005] In a first aspect, an embodiment of the present application provides a service file processing method, comprising:
[0006] constructing a target directed graph based on service files corresponding to a plurality of services respectively; wherein each service file comprises basic information and dependency information of a corresponding service, the dependency information is used to indicate the dependency relationship between the service and other services when starting, each node of the target directed graph represents a service, and each directed edge of the target directed graph represents the dependency relationship between two services constituting the directed edge;
[0007] comparing a theoretical starting order of the plurality of services represented based on the target directed graph with an actual starting order of the plurality of services, to determine at least one target directed edge with a starting order problem; wherein the actual starting order is obtained after starting the plurality of services based on the dependency information in the plurality of service files;
[0008] generating adjustment information according to the at least one target directed edge; wherein the adjustment information is used to indicate that the service files of at least two target services constituting the at least one target directed edge are adjusted.
[0009] According to the service file of each service, the service file of each service includes the basic information of the corresponding service and the dependency information, and the dependency information can represent the dependency relationship between the service and other services when starting. In the target directed graph constructed based on the service files of the plurality of services, each node can represent a service, and each directed edge can represent the dependency relationship between the two services constituting the directed edge. Then, the theoretical starting order of the plurality of services represented by the target directed graph can be compared with the actual starting order of the plurality of services, and at least one target directed edge with a problem in the starting order can be determined, and adjustment information can be generated according to the at least one target directed edge. The adjustment information is used to indicate that the service files of at least two target services constituting the at least one target directed edge are adjusted. Such a design considers the dependency relationship between services, automatically, quickly and efficiently generates adjustment information, and controls the service to start based on the service file adjusted based on the adjustment information, which can ensure the normal starting and running of the service.
[0010] In an optional implementation, the target directed graph is constructed based on the service files of the plurality of services, including:
[0011] An initial directed graph is constructed based on the plurality of service files.
[0012] A closed loop subgraph in the initial directed graph is identified, and a reference directed edge constituted by any two nodes in the plurality of nodes constituting the closed loop subgraph is disconnected to obtain the target directed graph.
[0013] According to the embodiments of the present application, the closed loop subgraph will cause a circular dependency, which will cause the ordering to be infeasible. Therefore, the reference directed edge constituted by any two nodes in the plurality of nodes constituting the closed loop subgraph can be disconnected to destroy the circular dependency. In this way, the topological sorting operation can be performed on the initial directed graph to obtain the target directed graph.
[0014] In an optional implementation, the initial directed graph is constructed based on the plurality of service files, including:
[0015] For each service file, strong dependency information and weak dependency information of the service file are extracted. The strong dependency information is used to indicate a first other service having a strong dependency relationship with the service corresponding to the service file, and the weak dependency information is used to indicate a second other service having a weak dependency relationship with the service corresponding to the service file. The strong dependency relationship represents that the starting time of the service is less than or greater than the starting time of the first other service, and the weak dependency relationship represents that the time difference between the starting time of the service and the starting time of the second other service is less than a set time range.
[0016] The initial directed graph is constructed according to the strong dependency information and the weak dependency information of each service file.
[0017] In the embodiments of the present application, considering that the dependency relationship is different, the subsequent generation of adjustment information or the manner of adjusting the service file according to the adjustment information can be different, therefore, in the process of constructing the initial directed graph, the dependency relationship is subdivided, the strong dependency information and the weak dependency information in each service file can be extracted, and then the initial directed graph can be constructed in combination with the corresponding strong dependency relationship and weak dependency relationship.
[0018] In an optional implementation, the method further includes:
[0019] For any one target directed edge, if the services represented by the two nodes constituting the target directed edge are in a strong dependency relationship, alarm information is generated; if the services represented by the two nodes constituting the target directed edge are in a weak dependency relationship, optimization suggestions are generated; wherein the alarm information carries the information of the target directed edge.
[0020] In the embodiments of the present application, different processing suggestions can be generated for the strong dependency relationship and the weak dependency relationship, and the service file can be adjusted in a targeted manner.
[0021] In an optional implementation, the adjustment information is generated according to at least one target directed edge, including:
[0022] Determining the problem type of the at least one target directed edge;
[0023] Generating the adjustment information according to the problem type, the risk level of the service file corresponding to at least two target services constituting the at least one target directed edge, and the service file corresponding to the two services constituting the reference directed edge; wherein the risk level of each service file is determined after checking the compliance of each service file by using the checking command.
[0024] In the embodiments of the present application, the adjustment information generated not only includes the problem type of the target directed edge with a problem, but also includes the risk level of the target service corresponding to the target directed edge, so that the adjustment information obtained is more comprehensive, so as to adjust the service file more comprehensively.
[0025] In an optional implementation, the theoretical startup order of the plurality of services represented by the target directed graph is compared with the actual startup order of the plurality of services, and at least one target directed edge with a problem in the startup order is determined, including:
[0026] Determining a plurality of dependency chains according to the target directed graph; wherein each dependency chain is composed of a plurality of directed edges constituted by a plurality of nodes, and the services represented by the plurality of nodes constitute a complete function;
[0027] For the theoretical start-up order of the services represented by the plurality of nodes represented by each dependency chain, a search is performed in the actual start-up order to determine at least one target directed edge in the dependency chain that is different from the actual start-up order.
[0028] In the embodiment of the present application, the comparison between the theoretical start-up order and the actual start-up order can be performed in units of dependency chains, which can improve the comparison efficiency and quickly determine the problematic target directed edge.
[0029] In an optional implementation, the method further includes:
[0030] The target directed graph is displayed, and the target directed edge is highlighted in the target directed graph.
[0031] In the embodiment of the present application, the problematic target directed edge is displayed visually, which facilitates the user to quickly determine the target directed edge.
[0032] In an optional implementation, the method further includes:
[0033] In response to a viewing operation of the user, nodes corresponding to services having a dependency relationship with a first service indicated by the viewing operation are highlighted.
[0034] In response to a filtering operation of the user, a directed edge indicated by the filtering operation is highlighted.
[0035] In the embodiment of the present application, in the case of visual display, not only the nodes that the user wants to view can be viewed, but also the directed edges that the user wants to view can be viewed, which can assist the user to perform other operations.
[0036] In an optional implementation, the services are a plurality of system services controlled to be executed by a baseboard management controller.
[0037] In a second aspect, an embodiment of the present application provides a processing apparatus of a service file, including:
[0038] A directed graph construction unit is configured to: construct a target directed graph based on service files corresponding to a plurality of services respectively; wherein each service file includes basic information and dependency information of a corresponding service, the dependency information is used to indicate a dependency relationship between the service and other services at the time of start-up, each node of the target directed graph represents a service, and each directed edge of the target directed graph represents a dependency relationship between two services constituting the directed edge.
[0039] A problem determination unit is configured to: compare a theoretical start-up order of a plurality of services represented by a target directed graph with an actual start-up order of the plurality of services to determine at least one target directed edge having a problem in the start-up order; wherein the actual start-up order is obtained after the plurality of services are started based on dependency information in the plurality of service files.
[0040] An adjusting unit is configured to generate adjusting information according to the at least one target directed edge, wherein the adjusting information is used to indicate adjustment on service files of at least two target services constituting the at least one target directed edge.
[0041] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements steps of any of the above methods when executing the computer program.
[0042] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores computer program instructions, and the computer program instructions are executed by a processor to implement steps of any of the above methods.
[0043] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is executed by a processor to implement steps of any of the above methods. BRIEF DESCRIPTION OF DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments of the present application. Obviously, the drawings to be introduced below are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0045] Figure 1 An architecture diagram of a service file processing system according to an embodiment of the present application is provided.
[0046] Figure 2 A flowchart of a service file processing method according to an embodiment of the present application is provided.
[0047] Figure 3 A visualization diagram of a target directed graph according to an embodiment of the present application is provided.
[0048] Figure 4 Another visualization diagram of a target directed graph according to an embodiment of the present application is provided.
[0049] Figure 5 A flowchart of a complete service file processing method according to an embodiment of the present application is provided.
[0050] Figure 6 A structural diagram of a service file processing apparatus according to an embodiment of the present application is provided.
[0051] Figure 7 A structural diagram of an electronic device according to an embodiment of the present application is provided. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application.
[0053] For the convenience of understanding, the terms involved in the embodiments of the present application are explained as follows:
[0054] (1) Baseboard management controller, a chip embedded on the motherboard of a computer, used for remotely managing and monitoring the hardware status of servers and other devices.
[0055] (2) systemd, full name systemd, is a commonly used init software in Linux, which is used to represent the dependency relationship between system services, and to realize the parallel start of services during system initialization.
[0056] (3) Graphviz graphviz, an open source toolkit for drawing graphs described by Graph Description Language (DOT) scripts.
[0057] (4) NetworkX, a Python library for complex network analysis, which is used to create, operate and study the topology and dynamic characteristics of graph structure.
[0058] (5) Tkinter Tkinter, the standard Graphical User Interface (GUI) toolkit of Python, provides cross-platform window components and interactive functions.
[0059] Any number of elements in the drawings is used for example and not limitation, and any naming is only used for distinction and does not have any limiting meaning.
[0060] In the server management system, the baseboard management controller is responsible for the start and management of system services. The dependency relationship of system services is complex, and if the start order does not meet the dependency requirements, it may cause service start failure or function unavailable, which seriously affects the system stability. The traditional verification method relies on manual writing and checking of service configuration files and logs, which essentially belongs to single-dimensional checking, and is inefficient and easy to miss implicit dependency problems. Especially in cloud computing and directed edge computing scenarios, the dynamicity of services is enhanced, and its disadvantages are more obvious.
[0061] In the related art, the validity of a service file is usually verified by a person with the help of a basic dependency analysis tool. The basic dependency analysis tool systemd-analyze is a tool provided by a Linux system, which can provide basic service startup time statistics and dependency tree output, but can only statically display the dependency relationship and cannot dynamically detect the conflict between the actual startup order and the theoretical dependency, and lacks visual interactive capability. In addition, in the manual verification process, the startup order and dependency relationship of the system service mainly depend on manual verification using the above systemd-analyze tool. The tester needs to check the configuration file of each service one by one according to the tool output result, understand its dependency relationship, and manually record and analyze. It depends on a specific systemd version or needs to install a third-party tool (such as systemd-cgls).
[0062] Therefore, the above-mentioned related art has the following problems:
[0063] (1) Low verification efficiency.
[0064] For example, a server system carries an average of 150+ systemd service units, each service unit stores a service file for starting a service, and among these services, 30% have implicit dependency relationships. In the related art, manual verification takes an average of 4-6 hours per time. For actual service startup timing problem verification, the time stamp of the journalctl log needs to be manually cross-compared with the result of the systemd-analyze tool, and the manual verification takes an average of more than 2 hours per time. In addition, systemd-analyze only outputs raw logs, and the tracing of the dependency chain needs to be manually checked layer by layer, which is time-consuming and easy to miss.
[0065] The main reasons for low verification efficiency include the lack of automatic tool chain and log dispersion. For the lack of automatic tool chain, the systemd ecosystem does not provide a dependency relationship and timing correlation analysis module; for log dispersion, the time stamp and dependency relationship (unit file) are stored in different subsystems.
[0066] (2) Lack of dynamic verification capability.
[0067] The tool in the related art only performs static analysis on the syntax of the service configuration file and does not verify the effectiveness of the dependency relationship in combination with the actual startup timing. In some cases, the theoretical dependency relationship declared in the service configuration file may be invalid due to service startup timeout, resource competition (such as CPU preemption), kernel scheduling delay, etc., which will cause abnormal service functions. Therefore, in the related art, only static configuration errors (such as file permission problems) can be detected, and runtime dependency conflicts (such as circular dependencies) cannot be found, or when a circular dependency is detected, only an error is reported and the program exits without providing a repair suggestion.
[0068] The reasons for the lack of dynamic verification capability are as follows: the systemd architecture separates configuration resolution from the runtime state machine, causing static analysis to be unable to perceive dynamic behavior; dependency relationship checking only occurs during service loading, and is not covered throughout the entire life cycle.
[0069] (3) Output format readability defects.
[0070] The output of the tool in the related art is usually in pure text format, and when the dependency level exceeds 5 levels, the readability sharply decreases, and it is difficult to understand the hidden dependency relationship or the difference between strong and weak dependencies when manually checking.
[0071] The reasons for the output format readability defects mainly include: DOT language as a general graph description language, lack of field-specific optimization, and missing key information.
[0072] (4) Visualization interaction defects.
[0073] The tool in the related art needs to rely on the Graphviz package to convert the DOT text into a static picture. However, when the dependency graph node exceeds 100, the generated picture layout is chaotic, the lines are crossed, and it is impossible to highlight the key path or conflict dependency, causing the user to be unable to quickly and clearly find the problem item when using. The dependency relationship is displayed in text or a simple DOT graph, and cannot be interactively investigated (such as systemd-analyze plot).
[0074] Therefore, the present application provides a service file processing method, which realizes intelligent verification of system service startup order and dependency relationship. Specifically, by remotely connecting a server, analyzing service dependency relationship, generating a service dependency topology graph, extracting an actual startup timing, cross-comparing a theoretical dependency order and an actual startup order, locating potential risks, and visualizing display through a graphical interface, the method assists in quickly troubleshooting and repairing problems.
[0075] After introducing the design idea of the embodiments of the present application, the application scenarios to which the technical solutions of the embodiments of the present application can be applied will be briefly introduced. It should be noted that the following application scenarios are only used to illustrate the embodiments of the present application and are not limited. In specific implementation, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.
[0076] Reference Figure 1 It is an architecture diagram of a service file processing system provided by the embodiments of the present application, which can optimize and detect system service startup based on dynamic dependency analysis and timing verification. The architecture includes a remote service collection layer, a compliance verification module, a timing comparison engine, and a visualization interaction layer.
[0077] The remote service acquisition layer utilizes a multi-threaded connection pool based on the Paramiko library to parallelize command execution on the BMC, collecting service configuration, dependency relationships, and startup timestamp data. The dependency modeling engine parses After / Before / Requires syntax in service configuration files, constructing a directed graph model (nx.DiGraph) to distinguish between strong and weak dependencies. The compliance verification module automatically categorizes 12 types of issues in service files, such as permission errors, path errors, and dependency conflicts, based on regular expression patterns (predefined rule sets in re.compile). The time-series comparison engine uses systemctlshow to obtain the actual service startup timestamp, compares it with the theoretical topology sorting results, and identifies order conflicts and circular dependencies. The visualization and interaction layer uses NetworkX and Matplotlib / Tkinter to construct a dynamic and interactive dependency graph, supporting node focusing, error highlighting, and dependency chain tracing.
[0078] The application scenarios of this application include, but are not limited to: for released BMC or general Linux platforms, service startup order and compliance verification can be performed to replace manual testing and save labor costs; in continuous integration or continuous delivery pipelines, lightweight scripts can support error interception in the pre-release stage to reduce errors from flowing into the production department.
[0079] Of course, the methods provided in the embodiments of this application are not limited to... Figure 1 The application scenarios shown can also be used in other possible scenarios, and this application does not impose any limitations. Figure 1 The functions that each device in the application scenario shown can achieve will be described in subsequent method embodiments, and will not be elaborated on here.
[0080] To further illustrate the technical solutions provided in the embodiments of this application, a detailed description is provided below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of this application provide method operation steps as shown in the following embodiments or drawings, the method may include more or fewer operation steps based on conventional or non-inventive methods. In steps where there is no logically necessary causal relationship, the execution order of these steps is not limited to the execution order provided in the embodiments of this application.
[0081] The following is combined with Figure 1 The application scenarios shown illustrate the technical solutions provided in the embodiments of this application.
[0082] refer to Figure 2 This application provides a method for processing service files, applied to an electronic device, which may be a BMC (Browser Management System). The method includes the following steps:
[0083] S201: constructing a target directed graph based on the service files corresponding to the plurality of services respectively.
[0084] S202: comparing a theoretical start order of the plurality of services represented based on the target directed graph with an actual start order of the plurality of services to determine at least one target directed edge with a start order problem.
[0085] S203: generating adjustment information according to the at least one target directed edge.
[0086] In the embodiments of the present application, since each service file includes the basic information and the dependency information of the corresponding service, the dependency information can represent the dependency relationship between the service and other services when starting, so that in the target directed graph constructed based on the service files corresponding to the plurality of services respectively, each node can represent a service, and each directed edge can represent the dependency relationship between the two services constituting the directed edge. Then, the theoretical start order of the plurality of services represented based on the target directed graph can be compared with the actual start order of the plurality of services, and then at least one target directed edge with a start order problem can be determined, and adjustment information can be generated according to the at least one target directed edge, the adjustment information being used to indicate that the service files of at least two target services constituting the at least one target directed edge are adjusted. Such a design considers the dependency relationship between services, automatically, quickly and efficiently generates adjustment information, and controls the service start based on the service files adjusted based on the adjustment information, which can ensure the normal start and operation of the service.
[0087] In relation to S201, each service file includes the basic information and the dependency information of the corresponding service, wherein the basic information can include the service name, the service function and the service identifier, etc., and the dependency information is used to indicate the dependency relationship between the service and other services when starting.
[0088] In the embodiments of the present application, the target directed graph can be constructed based on the service files corresponding to the plurality of services respectively, wherein each node of the target directed graph represents a service, and each directed edge of the target directed graph represents the dependency relationship between the two services constituting the directed edge.
[0089] Optionally, the construction process of the target directed graph can be explained through steps A1-A2:
[0090] A1: constructing an initial directed graph based on the plurality of service files.
[0091] The process can be implemented through steps A1-1 to A1-2:
[0092] A1-1: for each service file, extracting the strong dependency information and the weak dependency information of the service file.
[0093] The strong dependency information is used to indicate a first other service that has a strong dependency relationship with the service corresponding to the service file, and the weak dependency information is used to indicate a second other service that has a weak dependency relationship with the service corresponding to the service file. The strong dependency relationship indicates that the start time of the service is less than or greater than the start time of the first other service, and the weak dependency relationship indicates that the time difference between the start time of the service and the start time of the second other service is less than a set time range.
[0094] That is, the strong dependency relationship indicates that there is a clear start order between two services, for example, service A must be started before service B, otherwise service B cannot be started; and the weak dependency relationship indicates that as long as the time difference between the start times of the two services is within the set time range.
[0095] A1-2: Construct an initial directed graph according to the strong dependency information and the weak dependency information corresponding to each service file.
[0096] Optionally, based on the dependency relationship, a directed graph is used for modeling, where each node represents an independent service, and the directed edges between the nodes represent the dependency relationship, for example, if there is an A→B directed edge, it indicates that service B depends on the start completion of service A.
[0097] In the embodiments of the application, in the process of generating the initial directed graph, the strong dependency directed edge and the weak dependency directed edge are distinguished, and different processing logics can be used in the subsequent detection process.
[0098] A2: Identify a closed loop subgraph in the initial directed graph, and break a reference directed edge formed by any two nodes in the plurality of nodes constituting the closed loop subgraph, to obtain a target directed graph.
[0099] After obtaining the initial directed graph, a topological sorting operation can be performed to verify the order of the initial directed graph. If a circular dependency causes a closed loop subgraph to exist, and the closed loop subgraph causes the sorting to be infeasible, for example, NetworkXUnfeasible exception can be captured. At this time, the conflict directed edge forming the closed loop can be automatically stripped, for example, the conflict directed edge (for distinction, represented by a reference directed edge) formed by any two nodes in the plurality of nodes constituting the closed loop subgraph is broken, and the initial directed graph is updated to obtain a target directed graph. In addition, in order to perform subsequent trace analysis, the source file and the corresponding code line number of the conflict directed edge can be recorded.
[0100] The embodiment of the application can effectively solve the problem of difficult discovery and positioning of circular dependency in traditional service dependency analysis by performing a topological sorting operation. By dynamically detecting and stripping conflict directed edges, the final generated theoretical start order is ensured to be executable, laying the foundation for subsequent start timing verification. This mechanism improves the reliability of dependency modeling and avoids the risk of system initialization failure due to dependency closed loop
[0101] Related to S202, after obtaining the target directed graph, the theoretical start order of the plurality of services represented thereby can be determined. In order to determine at least one target directed edge with a problem in the start order, the actual start order can be determined after starting the plurality of services based on the dependency information in the plurality of service files, and then comparison can be performed.
[0102] Optionally, the ExecMainStartTimestamp and ExecMainExitTimestamp attributes of each service unit inside the server can be remotely batch queried in an automated manner, and then the actual start time data can be extracted to determine the actual start order.
[0103] The comparison process can be implemented through steps B1-B2:
[0104] B1: Determine a plurality of dependency chains according to the target directed graph.
[0105] Each dependency chain is composed of a plurality of directed edges composed of a plurality of nodes, and the services represented by the plurality of nodes constitute a complete function, for example, an execution chain can be a root node and its child nodes until the leaf nodes.
[0106] B2: For the theoretical start order of the services represented by the plurality of nodes of each dependency chain, search in the actual start order to determine at least one target directed edge in the dependency chain that is different from the actual start order.
[0107] For any one target directed edge, if the services represented by the two nodes constituting the target directed edge have a strong dependency relationship, an alarm information is generated; if the services represented by the two nodes constituting the target directed edge have a weak dependency relationship, an optimization suggestion is generated; wherein the alarm information carries the information of the target directed edge.
[0108] For example, if a strong dependency relationship (such as service A should be started before service B) is detected to have been violated in actual start (i.e., service A is started later than service B), a dependency chain is recorded and a serious level alarm with detailed trace information is generated. For a weak dependency relationship, it is checked whether the associated services are started synchronously or at close times, and if there is a significant deviation in the start time, an optimization suggestion is generated.
[0109] S203, after the comparison is completed, generating adjustment information according to the at least one target directed edge, the adjustment information being used to indicate adjusting service files of at least two target services constituting the at least one target directed edge.
[0110] Optionally, the process can be implemented through steps C1-C2:
[0111] C1: determining a problem type of the at least one target directed edge;
[0112] C2: generating adjustment information according to the problem type, risk levels of service files respectively corresponding to at least two target services constituting the at least one target directed edge, and service files respectively corresponding to two services constituting the reference directed edge.
[0113] The risk level of each service file is determined after checking the compliance of each service file by applying a check command.
[0114] Optionally, when performing the compliance check, a systemd-analyze verify command can be called, and all systemd service unit files inside the server can be remotely and batched executed. For the returned original error information, pre-defined 11 types of regular expression patterns are used for item-by-item matching and classification. After the classification is completed, the system outputs the results in a structured manner, and different severity levels are assigned according to the problem type.
[0115] Through the compliance check, the embodiments of the present application can automatically implement efficient and systematic compliance verification of a large number of service files. Compared with the traditional manual line-by-line review of logs, the speed and accuracy of error discovery are greatly improved, and through risk grading, it is helpful for operation and maintenance personnel to prioritize the disposal of critical configuration errors and reduce the potential risks in the service deployment and operation process.
[0116] The embodiments of the present application can accurately reveal the hidden service competition problems, dependency delay problems or unreasonable configuration problems in the server startup process. Not only the consistency check of the theoretical model and the actual behavior is realized, but also quantitative data support is provided for optimizing the system startup efficiency and reducing service dependency exceptions.
[0117] In addition, based on the ServiceGraphApp class, a graphical interactive interface based on Tkinter is constructed. In the interface, the user can assist in positioning the problem through the following interactive operations, for example, directly displaying the target directed graph, or highlighting the target directed edge in the target directed graph, or clicking any node in the target directed graph to automatically highlight the direct dependency relationship associated with the node, or searching for the service name through the input box to quickly filter and focus on a specific service dependency chain. For the detected abnormal dependency directed edge, the system highlights the edge using a red directed edge, so that the problem position is intuitive and visible.
[0118] In a specific example, Figure 3 A schematic diagram of visualization of a target directed graph provided by an embodiment of the present application is shown, Figure 3 showing the dependency relationship between service A, service B, service C, service D, service E and service F; Figure 4 Another schematic diagram of visualization of a target directed graph provided by an embodiment of the present application is shown, Figure 4 showing the dependency relationship between service G, service H, service I, service J and service L, wherein the directed edge between service H and service J is a target directed edge with a problem in start order, and in Figure 4 the directed edge can be displayed in the form of a dashed line or in different colors. It should be noted that Figure 4 the start order of the target directed edge shown in the above is the theoretical start order, and does not represent the actual start order.
[0119] The embodiment of the present application can display the complex service dependency relationship inside the server in a visual and interactive manner, greatly reducing the difficulty of the operation and maintenance personnel in understanding the system start logic. At the same time, the abnormal dependency relationship is intuitively identified through the graphical interface, greatly speeding up the problem positioning and repair process, and improving the overall operation and maintenance response speed and efficiency.
[0120] In summary, in the embodiment of the present application, dynamic topological sorting and timestamp verification are used to cover static configuration and runtime order conflicts, improve analysis accuracy; automatic dependency chain tracking directly marks the conflict source service and configuration file position, improves problem positioning efficiency; provides an interactive graph, supports click focusing, error highlighting and weak dependency filtering, improves visualization capability; based on the Secure Shell (SSH) protocol general interface, compatible with the systemd implementation of the Linux distribution (based on the paramiko library call), improves compatibility; strips the conflict directed edge, automatically generates a feasible start order, and improves self-healing capability.
[0121] Figure 5 A flowchart of a complete service file processing method provided by an embodiment of the present application is shown,Figure 5 at least comprising the following steps:
[0122] S501: For each service file, extract the strong dependency information and the weak dependency information of the service file.
[0123] S502: Construct an initial directed graph according to the strong dependency information and the weak dependency information corresponding to each service file.
[0124] S503: Identify a closed loop subgraph in the initial directed graph, and disconnect a reference directed edge formed by any two nodes in the closed loop subgraph to obtain a target directed graph.
[0125] S504: Determine a plurality of dependency chains according to the target directed graph; wherein each dependency chain is composed of a plurality of directed edges formed by a plurality of nodes, and the services represented by the plurality of nodes constitute a complete function.
[0126] S505: For the theoretical startup order of the services represented by the plurality of nodes in each dependency chain, search in the actual startup order to determine at least one target directed edge in the dependency chain that is different from the actual startup order.
[0127] S506: Determine the problem type of the at least one target directed edge.
[0128] S507: According to the problem type, the risk level of the service files corresponding to the at least two target services constituting the at least one target directed edge, and the service files corresponding to the two services constituting the reference directed edge, generate adjustment information.
[0129] S508: Display the target directed graph and highlight the target directed edge in the target directed graph.
[0130] The specific execution process of each step can be referred to the foregoing embodiments, which will not be described here.
[0131] In the embodiments of the present application, topology sorting, timing verification and interactive visualization are combined for systemd service analysis. Compared with the existing tools (such as systemd-analyze) which can only detect single-layer problems, the embodiments of the present application can realize cross-level dependency chain tracing. In addition, through SSH connection pool and regular pre-compilation, the performance of large-scale deployment can be guaranteed.
[0132] In addition, the beneficial effects of the embodiments of the present application can also be explained from the specific data level:
[0133] By double verification of strong dependency and weak dependency, the exposure rate of hidden startup competition problems (such as service A causing B timeout due to delayed startup) not found in related technologies is increased from <30% to 98%; startup reliability is increased by more than 90%. The problem positioning time is shortened from 2-4 hours of traditional manual investigation to 5 minutes, saving problem positioning time; the 11 rule sets of the compliance verification module increase the configuration error repair integrity to 100%, improve the error repair rate, and improve the overall operation and maintenance efficiency by 10 times. Compared with the related art which needs to continuously run the monitoring process (such as journalctl-f), the present application only collects data momentarily (SSH connection pool multiplexing technology) in the startup phase, and has the advantage of lightweight; the memory occupation is reduced from more than 200MB of traditional tools to less than 50MB, and the resource occupation is reduced by 70%.
[0134] As shown in Figure 6 Based on the same inventive concept as the processing method of the service file, the embodiment of the present application also provides a service file processing device, which comprises a directed graph construction unit 61, a problem determination unit 62 and an adjustment unit 63.
[0135] The directed graph construction unit 61 is configured to: construct a target directed graph based on a plurality of service files corresponding to a plurality of services respectively; wherein each service file comprises basic information and dependency information of the corresponding service, the dependency information is used to indicate the dependency relationship between the service and other services at startup, and each node of the target directed graph represents a service, and each directed edge of the target directed graph represents the dependency relationship between the two services constituting the directed edge;
[0136] The problem determination unit 62 is configured to: compare the theoretical startup order of the plurality of services represented by the target directed graph with the actual startup order of the plurality of services, and determine at least one target directed edge with a problem in the startup order; wherein the actual startup order is obtained after starting the plurality of services based on the dependency information in the plurality of service files;
[0137] The adjustment unit 63 is configured to: generate adjustment information according to the at least one target directed edge; wherein the adjustment information is used to indicate that the service files of at least two target services constituting the at least one target directed edge are adjusted.
[0138] In an optional implementation, the directed graph construction unit 61 is specifically configured to:
[0139] construct an initial directed graph based on the plurality of service files;
[0140] identify a closed loop subgraph in the initial directed graph, and disconnect a reference directed edge constituted by any two nodes in the plurality of nodes constituting the closed loop subgraph to obtain the target directed graph.
[0141] In an optional implementation, the directed graph construction unit 61 is specifically configured to:
[0142] For each service file, extract strong dependency information and weak dependency information of the service file; wherein, the strong dependency information is used to indicate a first other service that has a strong dependency relationship with the service corresponding to the service file, and the weak dependency information is used to indicate a second other service that has a weak dependency relationship with the service corresponding to the service file; the strong dependency relationship means that the starting time of the service is less than or greater than the starting time of the first other service, and the weak dependency relationship means that the time difference between the starting time of the service and the starting time of the second other service is less than a set time range;
[0143] According to the strong dependency information and the weak dependency information corresponding to each service file, an initial directed graph is constructed.
[0144] In an optional implementation, the directed graph construction unit 61 is further configured to:
[0145] For any one target directed edge, if the services represented by the two nodes constituting the target directed edge have a strong dependency relationship, an alarm information is generated; if the services represented by the two nodes constituting the target directed edge have a weak dependency relationship, an optimization suggestion is generated; wherein, the alarm information carries the information of the target directed edge.
[0146] In an optional implementation, the adjustment unit 63 is specifically configured to:
[0147] Determine the problem type of at least one target directed edge;
[0148] According to the problem type, the risk level of the service file corresponding to at least two target services constituting at least one target directed edge, and the service file corresponding to the two services constituting the reference directed edge, generate adjustment information; wherein, the risk level of each service file is determined after checking the compliance of each service file by applying the checking command.
[0149] In an optional implementation, the problem determination unit 62 is configured to:
[0150] According to the target directed graph, determine a plurality of dependency chains; wherein, each dependency chain is composed of a plurality of directed edges composed of a plurality of nodes, and the services represented by the plurality of nodes constitute a complete function;
[0151] For the theoretical starting order of the services represented by the plurality of nodes of each dependency chain, search in the actual starting order to determine at least one target directed edge in the dependency chain that is different from the actual starting order.
[0152] In an optional implementation, further comprising a display unit configured to:
[0153] Display the target directed graph and highlight the target directed edge in the target directed graph.
[0154] In one alternative implementation, the display unit is further configured to:
[0155] In response to a user's viewing action, highlight the nodes corresponding to services that depend on the first service indicated by the viewing action.
[0156] In response to the user's filtering action, highlight the directed edge indicating the filtering action.
[0157] In one alternative implementation, the service is a plurality of system services controlled and executed by the baseboard management controller.
[0158] The service file processing apparatus proposed in this application embodiment adopts the same inventive concept as the above-described service file processing method and can achieve the same beneficial effects, so it will not be described again here.
[0159] Based on the same inventive concept as the above-mentioned service file processing method, this application also provides an electronic device, which may specifically be a desktop computer, portable computer, smartphone, tablet computer, personal digital assistant (PDA), server, etc. Figure 7 As shown, the electronic device may include a processor 701 and a memory 702.
[0160] The processor 701 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0161] The memory 702, as a non-volatile computer readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory can include at least one type of storage medium, for example, can include flash memory, hard disk, multimedia card, card type memory, random access memory (RAM), static random access memory (SRAM), programmable read only memory (PROM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), magnetic memory, magnetic disk, optical disk, etc. The memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures and capable of being accessed by a computer, but is not limited thereto. The memory 702 in the embodiments of the present application can also be a circuit or any other device capable of realizing a storage function, used to store program instructions and / or data.
[0162] A person of ordinary skill in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware, and the foregoing program can be stored in a computer readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; the above-mentioned computer storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to: mobile storage device, random access memory (RAM), magnetic memory (such as floppy disk, hard disk, magnetic tape, magneto-optical disk (MO) and the like), optical storage (such as CD, DVD, BD, HVD and the like), and semiconductor memory (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid state disk (SSD)) and various media capable of storing program codes.
[0163] Alternatively, the above-mentioned integrated units of the present application, if realized in the form of software function modules and sold or used as independent products, can also be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the embodiments of the method of the present application. The aforementioned storage medium includes: a mobile storage device, a random access memory (RAM), a magnetic memory (such as a floppy disk, a hard disk, a magnetic tape, a magneto-optical disk (MO), etc.), an optical memory (such as a CD, a DVD, a BD, a HVD, etc.), and a semiconductor memory (such as a ROM, an EPROM, an EEPROM, a non-volatile memory (NAND FLASH), a solid state disk (SSD)), and various media that can store program codes.
[0164] Based on the same inventive concept, the embodiments of the present application also provide a computer program product, which comprises computer program codes, and when the computer program codes run on a computer, the computer executes the processing method of the service file as any one of the above. Since the above computer program product solves the problem in the same principle as the processing method of the service file, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be described.
[0165] The above embodiments are only used to specifically introduce the technical solutions of the present application, and the above embodiment descriptions are only used to help understand the method of the embodiments of the present application, and should not be understood as a limitation of the embodiments of the present application. Changes or replacements that can be easily thought of by those skilled in the art should be covered within the protection scope of the embodiments of the present application.
Claims
1. A method for processing service files, characterized in that, include: A target directed graph is constructed based on the service files corresponding to multiple services. Each service file includes basic information and dependency information of the corresponding service. The dependency information is used to indicate the dependency relationship between the service and other services at startup. Each node of the target directed graph represents a service, and each directed edge of the target directed graph represents the dependency relationship between the two services that constitute the directed edge. Based on the theoretical startup order of multiple services represented by the target directed graph, the actual startup order of the multiple services is compared with the actual startup order to identify at least one target directed edge where the startup order has a problem; wherein, the actual startup order is obtained after starting the multiple services based on the dependency information in the multiple service files; Adjustment information is generated based on the at least one target directed edge; wherein the adjustment information is used to indicate adjustments to the service files of at least two target services constituting the at least one target directed edge.
2. The method according to claim 1, characterized in that, The construction of the target directed graph based on the service files corresponding to each of the multiple services includes: An initial directed graph is constructed based on the aforementioned multiple service files; Identify the closed-loop subgraph in the initial directed graph, and disconnect the reference directed edge formed by any two nodes among the multiple nodes constituting the closed-loop subgraph to obtain the target directed graph.
3. The method according to claim 2, characterized in that, The construction of the initial directed graph based on the multiple service files includes: For each service file, extract the strong dependency information and weak dependency information of the service file; wherein, the strong dependency information is used to indicate a first other service that has a strong dependency relationship with the service corresponding to the service file, and the weak dependency information is used to indicate a second other service that has a weak dependency relationship with the service corresponding to the service file; the strong dependency relationship indicates that the start time of the service is less than or greater than the start time of the first other service, and the weak dependency relationship indicates that the time difference between the start time of the service and the start time of the second other service is less than a set time range; The initial directed graph is constructed based on the strong dependency information and weak dependency information corresponding to each service file.
4. The method according to claim 3, characterized in that, The method further includes: For any given target directed edge, if the services represented by the two nodes constituting the target directed edge have a strong dependency relationship, an alarm message is generated; if the services represented by the two nodes constituting the target directed edge have a weak dependency relationship, an optimization suggestion is generated; wherein, the alarm message carries information about the target directed edge.
5. The method according to claim 2, characterized in that, The step of generating adjustment information based on the at least one target directed edge includes: The problem type for determining the at least one directed edge with a target; Adjustment information is generated based on the problem type, the risk levels of the service files corresponding to the at least two target services constituting the at least one target directed edge, and the service files corresponding to the two services constituting the reference directed edge; wherein, the risk level of each service file is determined after applying an inspection command to check the compliance of each service file.
6. The method according to claim 1, characterized in that, The theoretical startup order of the multiple services represented by the target directed graph is compared with the actual startup order of the multiple services to determine at least one target directed edge where the startup order has a problem, including: Based on the target directed graph, multiple dependency chains are determined; wherein each dependency chain consists of multiple directed edges composed of multiple nodes, and the services represented by each of the multiple nodes constitute a complete function. For each dependency chain, based on the theoretical startup order of the services represented by the multiple nodes, a search is performed in the actual startup order to determine at least one target directed edge in the dependency chain that differs from the actual startup order.
7. The method according to claim 1, characterized in that, The method further includes: Display the target directed graph and highlight the target directed edges in the target directed graph.
8. The method according to claim 7, characterized in that, The method further includes: In response to a user's viewing action, the nodes corresponding to services that have a dependency relationship with the first service indicated by the viewing action are highlighted; In response to the user's filtering action, the directed edge indicated by the filtering action is highlighted.
9. The method according to any one of claims 1 to 8, characterized in that, The services are multiple system services controlled and executed by the baseboard management controller.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, 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 9.
Citation Information
Patent Citations
Method and device for generating information
CN111324470A
Big data service component deployment method and system, terminal and storage medium
CN114443294A
Monitoring method and system for abnormal operation of micro-service architecture
CN118869812A
Method for starting application, related device and computer program product
CN119166232A
Service starting sequence optimization method and device, electronic equipment and storage medium
CN120371479A