A method and device for stability of a service system based on mutual guardianship between processes

By using a method of mutual protection between processes and utilizing checkpoint files to record and update process information, the problem of untimely anomaly detection in process monitoring methods is solved, thereby achieving the stability and rapid recovery of the business system.

CN115795443BActive Publication Date: 2026-04-28ZHENGZHOU YUNZHI XINAN SECURITY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHENGZHOU YUNZHI XINAN SECURITY TECH CO LTD
Filing Date
2022-11-30
Publication Date
2026-04-28

Smart Images

  • Figure CN115795443B_ABST
    Figure CN115795443B_ABST
Patent Text Reader

Abstract

The present application belongs to the network communication technical field, disclose a kind of service system stability method and device based on mutual for each other of process, by a registration monitoring daemon mechanism, all process of registration realizes unified method, each other's daemon process between two, while regulating unified monitoring point, so that arbitrary process between process each other communication can also be well carried out process state judgment, so that service system can be detected in time and recovered in time when process hangs due to abnormality, increase the stability of the overall operation of service system.The present application sets up appropriate time period, when process appears abnormality, can be found in time and be recovered in time, and process is judged by exception detection point between process, does not need process to carry out network communication or state response directly between process, reduces communication complexity and design complexity, reduces coupling.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of network communication, and particularly relates to a service system stability method and device based on mutual daemon of processes. BACKGROUND

[0002] The existing process safety monitoring method is as follows:

[0003] 1. Without daemon process, the business process generates running log by itself. The defect of this method is that if an exception occurs, it can only be located later and cannot immediately handle the problem.

[0004] 2. With daemon process, but the daemon process may also be hung up due to abnormal conditions, and cannot start the daemon function; there is also a case that the daemon process cannot communicate with the business process due to business restrictions, or the daemon cannot find a suitable monitoring point to determine whether the business process is running normally.

[0005] 3. Based on the system timer, a specific script is used to trigger the business process state polling monitoring at a fixed time, and trigger the exception handling operation when an exception is found. The disadvantage of this method is that the system timer service may be abnormal or closed by the user. SUMMARY

[0006] The present application proposes a business system stability device and method based on mutual daemon of processes to solve the above problems of the existing process safety monitoring method, and a registration monitoring daemon mechanism is used to make all registered processes achieve a unified method, and two processes are mutually daemon processes, and a unified monitoring point is specified, so that the process state can be well judged without communication between processes, and the process hanging due to abnormality of the business system can be detected and recovered in time, and the overall operation stability of the business system is increased.

[0007] In order to achieve the above purpose, the present application adopts the following technical scheme:

[0008] The present application proposes a business system stability method based on mutual daemon of processes, which comprises:

[0009] Step 1: using the daemon process daemon to start, create and open the daemon process group detection point working area directory, and creating a directory on the disk;

[0010] Step 2: the daemon process daemon writes the startup command of the process, the self-information update interval T_update_daemon, the process detection time interval T_detect_daemon and the current system time T_current into the corresponding detection point file;

[0011] Step 3: If other processes join the daemon group, the process start command, information update time interval, process detection time interval and current system time of the other processes are written into the corresponding checkpoint file in the format of the daemon;

[0012] Step 4: The daemon updates the checkpoint file belonging to itself every T_update_daemon time interval, and updates the T_current time in the checkpoint file of the daemon using the current system time T_current_new; other processes joining the daemon group update their own checkpoint files regularly according to their own information update time intervals;

[0013] Step 5: All processes in the daemon group read the T_current time in all checkpoint files every T_process_detection time interval, and then compare the difference between the current system time T_current_new and the T_current time with the information update time interval of each process checkpoint file; if the difference is greater than the information update time interval, the daemon operation of the detected process is executed, and if the difference is not greater than the information update time interval, the next process checkpoint file is detected until all checkpoint files are detected;

[0014] Step 6: After each abnormal process is found and the process daemon operation is executed, log recording is performed in the log file of the process group checkpoint work area, which is convenient for later operation and inspection.

[0015] Further, the naming format of the checkpoint file is id_pid_processName, wherein id is the process id number itself, pid is the parent id number of creating the process, and processName is the name of the process.

[0016] Further, the step 2 and step 3 further comprise:

[0017] The checkpoint file is named according to the naming format of the checkpoint file.

[0018] Further, the content of the log recording includes: the id and process name of the daemoned process, the id and process name of the process executing the process daemon, and the operation time.

[0019] Another aspect of the present application provides a business system stability device based on mutual daemoning between processes, comprising:

[0020] A directory creation module is configured to start, create and open a daemon group checkpoint work directory by using a daemon, and create the directory on a disk;

[0021] A first information writing module is configured to write, by the daemon, a start command of a process of the daemon, a self-information update interval T_update_daemon, a process detection interval T_detect_daemon and a current system time T_current into a corresponding checkpoint file;

[0022] A second information writing module is configured to write, by the daemon, a start command of a process of another process, an information update interval, a process detection interval and a current system time into the corresponding checkpoint file in a format of the daemon if the another process joins the daemon group;

[0023] A checkpoint file information update module is configured to update, by the daemon, a checkpoint file belonging to the daemon every T_update_daemon interval, and update a T_current time in the checkpoint file of the daemon by using a current system time T_current_new; the processes joining the daemon group update their own checkpoint files regularly according to their own information update intervals;

[0024] A detection module is configured to read, by all processes in the daemon group, a T_current time in all checkpoint files every T_detect_daemon interval, and then compare a difference between the T_current time and a current system time T_current_new with an information update interval of each process checkpoint file; if the difference is greater than the information update interval, a daemon operation of the process is performed, and if the difference is not greater than the information update interval, a next process checkpoint file is detected until all checkpoint files are detected;

[0025] A log recording module is configured to record logs in a log file in a process group checkpoint work area every time an abnormal process is found and a process daemon operation is performed, so as to facilitate operation and maintenance inspection in the future.

[0026] Further, a naming format of the checkpoint file is id_pid_processName, wherein id is an id number of the process itself, pid is a parent id number of the process, and processName is a name of the process.

[0027] Further, the first information writing module and the second information writing module are further configured to:

[0028] According to the naming format of the detection point file, the detection point file is named.

[0029] Further, the log record content includes: the id and process name of the daemoned process, the process id and process name of the process daemon, and the operation time.

[0030] Compared with the prior art, the application has the beneficial effects:

[0031] 1. By setting a suitable time period, when the process is abnormal, it can be found in time and recovered in time.

[0032] 2. The processes are mutual daemon processes, as long as one process works normally, other abnormal processes can still be quickly recovered, ensuring the stability of the business system.

[0033] 3. The processes are judged by the abnormal detection points, without direct network communication or state response between the processes, reducing the communication complexity and design complexity, and reducing the coupling. BRIEF DESCRIPTION OF DRAWINGS

[0034] Figure 1 A flowchart of a business system stability method based on mutual daemon between processes according to an embodiment of the application;

[0035] Figure 2 A business system stability device structure schematic diagram based on mutual daemon between processes according to an embodiment of the application. DETAILED DESCRIPTION

[0036] The application will be further explained in conjunction with the drawings and specific embodiments:

[0037] A business system stability method based on mutual daemon between processes according to the application, first, the daemon process opens up the working directory of the daemon process group, and agrees on two methods (1. self update; 2. group inspection) that each process in the daemon process group needs to implement. The self update method refers to periodically writing the information of the process itself in the file according to the agreed format, providing other processes as a basis for judging whether the detected process is alive. The group inspection method refers to each process in the daemon process group periodically reading all detection point files under the detection point working directory, judging whether the detected process is normal according to the related information in each file, and then determining whether maintenance operation is needed.

[0038] Specifically, as shown in the figure, the method comprises: Figure 1

[0039] ​First step: The daemon daemon starts, creates and opens the daemon group checkpoint work area directory, and creates a directory on the disk ( / detection).

[0040] Second step: The daemon daemon writes the startup command of its own process, the self-information update interval T_update_daemon, the process detection time interval T_detect_daemon, and the current system time T_current into the checkpoint file. Further, the file naming format is: id_pid_processName (id: process id number; pid: parent id number of creating the process; processName: name of the process).

[0041] Third step: If other processes join the daemon group, the information update interval, process detection time interval, and current system time of the other processes are written into the corresponding checkpoint file according to the format of the daemon daemon. For example, process A joins the daemon group, and the startup command of process A's own process, the process A self-information update interval T_update_A, the process A detection time interval T_detect_A, and the current system time T_current are written into the checkpoint file according to the format of the daemon daemon, and the file naming format is: own process id number_pid_processName; process B joins the daemon group, and the startup command of process B's own process, the process B self-information update interval T_update_B, the process B detection time interval T_detect_B, and the current system time T_current are written into the file, and the file naming format is: own process id number_pid_processName. Subsequent processes join the daemon group, and so on.

[0042] Fourth step: the daemon updates its own checkpoint file every T_update_daemon time interval, and uses the current system time T_current_new to update the T_current time in the daemon's corresponding checkpoint file. Other processes that join the daemon group update their own checkpoint files according to their respective T_update_n time intervals. For example, process A updates its own checkpoint file every T_update_A time interval, and uses the current system time T_current_new to update the T_current time in the corresponding checkpoint file. Process B updates its own checkpoint file every T_update_B time interval, and uses the current system time T_current_new to update the T_current time in the corresponding checkpoint file. And so on.

[0043] Fifth step: all processes in the daemon group read the T_current time in all checkpoint files every T_detect_n process detection time interval, and then compare the difference between the current system time T_current_new and the T_current time with the T_update_n in the process checkpoint file. If the difference is greater than T_update_n, the daemon operation is performed for the detected process. If the difference is not greater than T_update_n, the next process checkpoint file is detected until all checkpoint files are detected. Taking the daemon process that detects process A's checkpoint as an example: if T_current_new-T_current>T_update_A, that is, if the current system time T_current_new-the last self-update time T_current recorded in process A's checkpoint file>the process A self-information update time interval T_update_A, it indicates that process A may have an abnormality. The daemon obtains the process id of process A according to the process A checkpoint file name, calls the kill command to close process A, and then restarts process A according to the start command of process A recorded in the process A checkpoint file, and updates the process id in the process A abnormality checkpoint file name.

[0044] Sixth step: after an abnormal process is found and the process daemon operation is performed, log recording is performed in the log file in the process group checkpoint work area, and the original process id, process name of the daemoned process, the process id, process name of the process daemon, operation time, and other information are recorded, which facilitates later operation and inspection.

[0045] On the basis of the above embodiment, as Figure 2As shown, the application also discloses a service system stability device based on mutual guardianship between processes, comprising:

[0046] A directory creation module is configured to start, create and open a daemon process group checkpoint work area directory by using a daemon process daemon, and create a directory on a disk.

[0047] A first information writing module is configured to write a start command of a process of the daemon process daemon, a self-information update time interval T_update_daemon, a process detection time interval T_detect_daemon and a current system time T_current into a corresponding checkpoint file.

[0048] A second information writing module is configured to write a process start command, an information update time interval, a process detection time interval and a current system time of other processes into corresponding checkpoint files in the format of the daemon process daemon if other processes join the daemon process group.

[0049] A checkpoint file information update module is configured to update the checkpoint file of the daemon process daemon every T_update_daemon time interval, and update the T_current time in the checkpoint file of the daemon process daemon by using a current system time T_current_new.

[0050] A detection module is configured to read the T_current time in all checkpoint files every process detection time interval of all processes in the daemon process group, and simultaneously subtract a current system time T_current_new, and then compare the difference with an information update time interval of each process checkpoint file.

[0051] A log recording module is configured to record logs in a log file in the process group checkpoint work area every time an abnormal process is found and a process guardian operation is performed, so as to facilitate later operation and maintenance inspection.

[0052] Further, the naming format of the checkpoint file is id_pid_processName, wherein id is a process id number, pid is a parent id number of the process, and processName is a name of the process.

[0053] Further, the first information writing module and the second information writing module are further used for:

[0054] According to the naming format of the detection point file, the detection point file is named.

[0055] Further, the content of the log record comprises: the id and process name of the daemoned process, the process id and process name of the process daemon, and the operation time.

[0056] To sum up, the application can find and recover the abnormal process in time by setting a suitable time period. The processes are mutual daemon processes. A business system often needs multiple processes to support. Unless all processes are abnormal and hang up, the probability of this situation is very low. As long as one process works normally, the other abnormal processes can be recovered quickly to ensure the stability of the business system. The processes judge the state through the abnormal detection point. The processes do not need to communicate directly or respond to the state, which reduces the communication complexity and design complexity and reduces the coupling.

[0057] The above only shows the preferred embodiments of the application. It should be noted that those skilled in the art can make several improvements and refinements without departing from the principles of the application. These improvements and refinements should also be considered within the protection scope of the application.

Claims

1. A method for ensuring the stability of a business system based on inter-process mutual protection, characterized in that, include: Step 1: Start the daemon process, create and allocate the daemon group checkpoint workspace directory, and create the directory on the disk; Step 2: The daemon process writes its own process startup command, self-information update interval T_update_daemon, process detection interval T_detect_daemon, and current system time T_current to the corresponding detection point file; Step 3: If other processes join the daemon group, write the other processes' startup commands, information update intervals, process detection intervals, and current system time into the corresponding detection point file according to the daemon format. Step 4: Every T_update_daemon interval, the daemon process updates its own checkpoint file and updates the T_current time in the corresponding checkpoint file of the daemon process using the current system time T_current_new; other processes that have joined the daemon process group update their own checkpoint files periodically according to their respective information update intervals. Step 5: Each process in the daemon group reads the T_current time from all the detection point files after its respective process detection time interval, and calculates the difference between it and the current system time T_current_new. Then, it compares the difference with the information update time interval of each process's detection point file. If the difference is greater than the information update time interval, the process daemon operation is performed on the detected process. If the difference is not greater than the information update time interval, the process continues to detect the next process's detection point file until all detection point files have been detected. Step 6: After each abnormal process is detected and the process protection operation is performed, logs are recorded in the log file of the process group detection point work area to facilitate later operation and maintenance inspections.

2. The method for ensuring the stability of a business system based on inter-process mutual protection as described in claim 1, characterized in that, The naming format of the detection point file is id_pid_processName, where id is the process's own ID number, pid is the parent ID number that created the process, and processName is the name of the process.

3. The method for ensuring the stability of a business system based on inter-process mutual protection as described in claim 2, characterized in that, Steps 2 and 3 also include: Name the test point files according to the naming format for test point files.

4. The method for ensuring the stability of a business system based on inter-process mutual protection as described in claim 1, characterized in that, The log records include: the ID and name of the protected process, the ID and name of the process being protected, and the operation time.

5. A business system stability device based on inter-process mutual protection, characterized in that, include: The directory creation module is used to start, create, and allocate the workspace directory of the daemon group checkpoint, and create the directory on the disk. The first information writing module is used by the daemon process to write its own process startup command, self-information update interval T_update_daemon, process detection interval T_detect_daemon, and current system time T_current to the corresponding detection point file. The second information writing module is used to write the process startup command, information update interval, process detection interval, and current system time of other processes into the corresponding detection point file according to the daemon format if other processes join the daemon group. The checkpoint file information update module is used by the daemon process to update its own checkpoint file every T_update_daemon time interval, and to update the T_current time in the corresponding checkpoint file of the daemon process using the current system time T_current_new; other processes that have joined the daemon process group update their own checkpoint files periodically according to their respective information update time intervals. The detection module is used to read the T_current time from all detection point files for each process in the process group after its respective process detection time interval, and calculate the difference between the T_current_new and the current system time. Then, it compares the difference with the information update time interval of each process's detection point file. If the difference is greater than the information update time interval, the process guardian operation is performed for the detected process. If the difference is not greater than the information update time interval, the detection continues to the next process's detection point file until all detection point files have been detected. The logging module is used to record logs in the log file of the process group detection point workspace each time an abnormal process is detected and a process protection operation is performed, so as to facilitate subsequent operation and maintenance inspections.

6. The business system stability device based on inter-process mutual protection as described in claim 5, characterized in that, The naming format of the detection point file is id_pid_processName, where id is the process's own ID number, pid is the parent ID number that created the process, and processName is the name of the process.

7. A business system stability device based on inter-process mutual protection as described in claim 6, characterized in that, The first information writing module and the second information writing module are also used for: Name the test point files according to the naming format for test point files.

8. A business system stability device based on inter-process mutual protection as described in claim 5, characterized in that, The log records include: the ID and name of the protected process, the ID and name of the process being protected, and the operation time.

Citation Information

Patent Citations

  • Accelerated training of personal daemons

    CN106030594A

  • Detecting egresses of a point-to-multipoint label switched path in a ring network

    CN110519163A