Proxy service restart method, device, equipment and storage medium

By detecting unfinished processing of tasks and creating new work processes when the proxy service is restarted, the problem of task interruption caused by direct restart is solved and business continuity and service availability are ensured.

CN118590534BActive Publication Date: 2025-01-21GUANGZHOU SANQI DREAM NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410682058.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2025-01-21
Estimated Expiration
2044-05-29

AI Technical Summary

Technical Problem

Directly restarting the proxy service that consumes time-consuming task processing will cause task processing to be interrupted, resulting in unavailability of the service and affecting the normal progress of the business.

Method used

When receiving the restart command, a shutdown signal is sent to the first worker process through the main process. When it is detected that the task has not been completed, the network connection of the service component is closed, and a process creation signal is sent to the main process to create a new worker process. and service components to receive and process tasks.

Benefits of technology

Ensure that long-term tasks being processed are not interrupted to avoid adverse impacts on the business, and ensure service availability when the agent service is upgraded or configuration is updated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118590534B_ABST
    Figure CN118590534B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a proxy service restart method, device, equipment and storage medium, the method comprising: sending a shutdown signal to the currently running first working process through the main process when a restart command is received, closing the network connection of the first service component through the first working process when the first working process receives the shutdown signal and detects that the corresponding first service component has unfinished tasks, so as to stop the first service component from receiving tasks sent by the management server, and sending a process creation signal to the main process, creating a second working process and a corresponding second service component through the main process when the main process receives the process creation signal, and opening the network connection of the second service component through the second working process, so as to enable the second service component to receive and process tasks sent by the management server. The availability of the proxy service is ensured, and the long and time-consuming tasks being processed are ensured not to be interrupted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a proxy service restart method, apparatus, device, and storage medium. Background Art

[0002] Currently, Internet-based service programs usually provide services to external clients, receive and process instructions from external clients, and execute specific instructions internally. These service programs include HTTP services, data collection, and proxy services responsible for long-time task processing. Among them, the aforementioned service programs need to have high availability, be able to provide services and process tasks uninterruptedly, and be able to meet the needs of large-scale deployment.

[0003] Manual restart of services is common and frequent due to program upgrades, configuration reloading, etc. For proxy services that process long and time-consuming tasks, directly restarting the service will cause task processing of the service program to be interrupted, making the service unavailable and affecting the normal operation of the business, which needs to be improved. Summary of the invention

[0004] The embodiments of the present application provide a proxy service restart method, apparatus, device and storage medium to solve the problem that directly restarting the service will cause the long-time task processing of the service program to be interrupted, making the service unavailable and affecting the normal operation of the business. It achieves the satisfaction of the proxy service upgrade or configuration update while ensuring the availability of the proxy service, ensuring that the long-time tasks being processed are not interrupted, and avoiding adverse effects on the business.

[0005] In a first aspect, an embodiment of the present application provides a proxy service restart method, the method comprising:

[0006] When a restart command is received, a shutdown signal is sent to the currently running first working process through the main process;

[0007] When the first working process receives the shutdown signal and detects that the corresponding first service component has unfinished tasks, the first working process closes the network connection of the first service component to stop the first service component from receiving tasks sent by the management server, and sends a process creation signal to the main process;

[0008] When the main process receives the process creation signal, a second working process and a corresponding second service component are created through the main process, and the network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0009] In a second aspect, an embodiment of the present application further provides a proxy service restart device, including:

[0010] A shutdown signal transmission module, configured to send a shutdown signal to the currently running first working process through the main process when a restart command is received;

[0011] a service connection closing module, configured to close the network connection of the first service component through the first working process when the first working process receives the closing signal and detects that the corresponding first service component has unfinished tasks, so as to stop the first service component from receiving tasks sent by the management server, and send a process creation signal to the main process;

[0012] The new working process creation module is configured to create a second working process and a corresponding second service component through the main process when the main process receives the process creation signal, and to open a network connection of the second service component through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0013] In a third aspect, an embodiment of the present application further provides a proxy service restart device, the device comprising:

[0014] one or more processors;

[0015] a storage device configured to store one or more programs,

[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the proxy service restart method described in the embodiment of the present application.

[0017] In a fourth aspect, an embodiment of the present application further provides a non-volatile storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute the proxy service restart method described in the embodiment of the present application when executed by a computer processor.

[0018] In the embodiment of the present application, when a restart command is received, a shutdown signal is sent to the currently running first working process through the main process. When the first working process receives the shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed through the first working process to stop the first service component from receiving tasks sent by the management server, and a process creation signal is sent to the main process. When the main process receives the process creation signal, a second working process and a corresponding second service component are created through the main process, and the network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server. In the above scheme, when the first working process detects that the first service component has unfinished tasks, it does not directly exit, but closes the network connection of the first service component, which can stop the old working process from continuing to receive tasks sent by the management server, and ensure that the long and time-consuming tasks being processed are not interrupted, avoiding adverse effects on the business. At the same time, by reopening a new working process through the main process to receive and process tasks, the availability of the proxy service can be guaranteed while satisfying the proxy service upgrade or configuration update. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A flowchart of a proxy service restart method provided in an embodiment of the present application;

[0020] Figure 2 A flowchart of a proxy service restart method including determining whether to send a shutdown signal based on a process quantity comparison result provided in an embodiment of the present application;

[0021] Figure 3 A flowchart of a proxy service restart method including determining a related processing process based on a process quantity comparison result provided in an embodiment of the present application;

[0022] Figure 4 A flowchart of another proxy service restart method including determining a related processing process based on a process quantity comparison result provided in an embodiment of the present application;

[0023] Figure 5 A flowchart of a proxy service restart method including determining whether to send a shutdown signal according to an environment variable provided in an embodiment of the present application;

[0024] Figure 6 A flowchart of a proxy service restart method provided by an embodiment of the present application, including a process of self-checking a first working process to determine whether the process is an isolated process;

[0025] Figure 7 A flowchart of a proxy service restart method including a process of outputting the remaining processing time of an unfinished task provided in an embodiment of the present application;

[0026] Figure 8 A structural block diagram of a proxy service restart device provided in an embodiment of the present application;

[0027] Fig. 9 A schematic diagram of the structure of a proxy service restart device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, rather than to limit the embodiments of the present application. It should also be noted that, for ease of description, only parts related to the embodiments of the present application are shown in the accompanying drawings, rather than all structures.

[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0030] Figure 1 A flowchart of a proxy service restart method provided in an embodiment of the present application, wherein the proxy service may be a service program deployed on a business server, which may be used to receive and process long-time tasks assigned by a management server, provide services to a client, etc. The proxy service restart method may be implemented with a business server as the execution subject. Figure 1 As shown, the specific steps include:

[0031] Step S101: When a restart command is received, a shutdown signal is sent to the currently running first working process through the main process.

[0032] Among them, the restart command can be an interactive instruction entered by the developer through the command line interface after completing the service upgrade, configuration update and other operations, which is used to instruct the restart operation of the proxy service. The proxy service restart can be to close the old work process and recreate a new work process that matches the relevant adjustments of the service upgrade, configuration update and other operations. The main process can be a resident process that can be used to manage the creation and closing of work processes. The main process can be used to notify the currently running work process to exit, so as to close the work process that has not implemented the relevant adjustments of the service upgrade, configuration update, etc. Specifically, the main process can send a shutdown signal to the currently running first work process so that the first work process executes the exit.

[0033] Step S102: When the first working process receives a shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed by the first working process to stop the first service component from receiving tasks sent by the management server, and a process creation signal is sent to the main process.

[0034] Among them, the first working process can be the old working process currently responsible for managing the task start and stop processing of the first service component. For example, when the first working process starts to execute, the first service component can be enabled for task processing, and when the first working process exits, the first service component can be disabled for task processing. The first service component can be a reusable module that provides specific functions or services, which is used to receive and process long-time tasks sent by the management service end, wherein the long-time tasks are tasks that take a long time to complete, and can be data analysis and mining, image processing and rendering, video encoding and transcoding, cloud computing and distributed computing, service deployment and updating, etc. Since the working process may still have long-time tasks that have not been processed and completed when the proxy service is restarted, if the working process directly executes the process exit after receiving the shutdown signal, it will cause the existing task processing to be interrupted, affecting the user experience. Therefore, when the first working process receives the shutdown signal, it is necessary to synchronously confirm whether the first service component associated with it has unfinished tasks. If the first working process does not detect that the first service component has unfinished tasks, it can directly execute the process exit. If the first working process detects that the first service component has unfinished tasks, it may temporarily not exit the process, but close the network connection of the first service component to stop the first service component from continuing to receive tasks sent by the management server, and simultaneously notify the main process to create a new working process to resume receiving and processing tasks sent by the management server. Optionally, after the first working process detects that the first service component has completed task processing, it may choose to deactivate the first service component and exit the process.

[0035] Step S103: When the main process receives a process creation signal, a second working process and a corresponding second service component are created through the main process, and the network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0036] When the main process receives a process creation signal, a second work process can be created through the main process. The second work process can be a new work process currently responsible for managing the task start and stop processing of the second service component, which is used to replace the old work process to continue task processing management. The second work process opens the network connection of the second service component and can replace the original first service component to continue to receive and process the tasks sent by the management server.

[0037] In the above, when a restart command is received, a shutdown signal is sent to the currently running first working process through the main process. When the first working process receives the shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed through the first working process to stop the first service component from receiving tasks sent by the management server, and a process creation signal is sent to the main process. When the main process receives the process creation signal, a second working process and a corresponding second service component are created through the main process, and the network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server. In the above scheme, when the first working process detects that the first service component has unfinished tasks, it does not directly exit, but closes the network connection of the first service component, which can stop the old working process from continuing to receive tasks sent by the management server, and ensure that the long-time tasks being processed are not interrupted, avoiding adverse effects on the business. At the same time, by reopening a new working process through the main process to receive and process tasks, the availability of the proxy service can be guaranteed while satisfying the proxy service upgrade or configuration update.

[0038] Figure 2 A flowchart of a proxy service restart method including determining whether to send a shutdown signal based on a process quantity comparison result is provided in an embodiment of the present application. Figure 2 As shown, the specific steps include:

[0039] Step S201: When a restart command is received, the number of processes of the currently running first working process is counted through the main process.

[0040] According to the business deployment requirements and device resource configuration of different application scenarios, developers can set a fixed number of at least one or more worker processes managed by each main process during normal operation. In one embodiment, a main process can manage a single worker process. In one embodiment, a main process can manage a fixed number of multiple worker processes.

[0041] Step S202: When the number of processes is consistent with the preset number of processes, a closing signal is sent to the first working process through the main process.

[0042] Among them, the preset number of processes can be the number of working processes managed by the main process that is preset by the developer when it runs normally. If the number of processes is consistent with the preset number of processes, it can be considered that the number of first working processes corresponding to the main process is normal and they are all old processes to be closed. Therefore, a shutdown signal can be sent to the first working process through the main process. If the number of processes is inconsistent with the preset number of processes, for example, if the number of processes is less than the preset number of processes, it can be considered that there may be an abnormal exit of the working process. For example, if the number of processes is greater than the preset number of processes, it can be considered that the last service restart was not completed, and the new process and the old process exist at the same time. Therefore, the proxy service cannot be restarted normally at present, and you can choose to exit the restart process.

[0043] Step S203: When the first working process receives a shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed by the first working process to stop the first service component from receiving tasks sent by the management server, and a process creation signal is sent to the main process.

[0044] Step S204: When the main process receives a process creation signal, a second working process and a corresponding second service component are created through the main process, and a network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0045] As mentioned above, by adding a main process to count the number of the first working process, it is possible to determine whether the number of its processes matches the preset number of processes corresponding to the current business, and then reasonably determine whether the current proxy service can enter the restart process normally, so as to avoid the situation where the working process exits abnormally or the last restart is not completed, and directly execute the proxy service restart, resulting in service abnormalities or repeated startup problems.

[0046] Figure 3 A flowchart of a proxy service restart method including determining a related processing process based on a process quantity comparison result provided in an embodiment of the present application. Figure 3 As shown, the specific steps include:

[0047] Step S301: When a restart command is received, the number of processes of the currently running first working process is counted through the main process.

[0048] Step S302: When the number of processes is consistent with the preset number of processes, a closing signal is sent to the first working process through the main process.

[0049] Step S303: When the number of processes is less than the preset number of processes, the main process queries the set system log file to see whether there is process exception information corresponding to the recorded working process identifier.

[0050] Among them, if the number of processes is less than the preset number of processes, it can be regarded as an abnormal exit in the first working process created by the main process, and the developer needs to conduct an abnormal investigation, and the restart process of the proxy service cannot be directly executed to avoid affecting the processing of existing tasks. The system log file can be used to record the running status, error information, and abnormal exit of the working process. If the first working process exits abnormally, the abnormal exit of the first working process will be recorded in the system log file. Therefore, the main process can query the system log file to determine whether there is corresponding process exception information based on the working process identifier of the first working process that has been created. The process exception information can be an exception code or prompt text that records the abnormal exit of the first working process.

[0051] Step S304: When there is process abnormality information in the system log file, an alarm message containing the process abnormality information is output to the user interface through the main process.

[0052] If there is process exception information in the system log file, an alarm message containing the process exception information can be output to the user interface through the main process to remind the developer to conduct relevant exception troubleshooting.

[0053] Step S305: When the first working process receives a shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed through the first working process to stop the first service component from receiving tasks sent by the management server, and a process creation signal is sent to the main process.

[0054] Step S306: When the main process receives a process creation signal, a second working process and a corresponding second service component are created through the main process, and the network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0055] As mentioned above, when the number of processes of the currently running first working process is less than the preset number of processes, the proxy service is exited and restarted, and an alarm message containing process exception information is queried and output through the main process, which can help developers to promptly identify the cause of the abnormal exit of the old process and maintain the stability of the proxy service.

[0056] Figure 4 Another flowchart of a proxy service restart method for determining a related processing process based on a process quantity comparison result provided in an embodiment of the present application. Figure 4 As shown, the specific steps include:

[0057] Step S401: When a restart command is received, the number of processes of the currently running first working process is counted through the main process.

[0058] Step S402: When the number of processes is consistent with the preset number of processes, a closing signal is sent to the first working process through the main process.

[0059] Step S403: When the number of processes is less than the preset number of processes, the main process queries the set system log file to see whether there is process exception information corresponding to the recorded working process identifier.

[0060] Step S404: When there is process abnormality information in the system log file, an alarm message containing the process abnormality information is output to the user interface through the main process.

[0061] Step S405: When the number of processes is greater than the preset number of processes, a first prompt message is output to the user interface through the main process, where the first prompt message is used to prompt that there is a work process to be closed that is waiting for the task to be completed.

[0062] Among them, if the number of processes is greater than the preset number of processes, it can be regarded that the old work process of the last restart operation has not been completely closed, and there are new work processes and old work processes in the proxy service at the same time. The restart operation of this proxy service can be regarded as a frequent and repeated operation of the user, so there is no need to execute it. At the same time, a first prompt message can be output to the user interface. The first prompt message is used to prompt that there is a work process to be closed waiting for the task to be completed, so as to inform the developer that the last restart operation has not been completed and the restart of the proxy service can be temporarily triggered.

[0063] Step S406: When the first working process receives a shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed through the first working process to stop the first service component from receiving tasks sent by the management server, and a process creation signal is sent to the main process.

[0064] Step S407: When the main process receives a process creation signal, a second working process and a corresponding second service component are created through the main process, and a network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0065] As mentioned above, when the number of processes of the currently running first working process is greater than the preset number of processes, the proxy service is exited and restarted to avoid repeated creation of new working processes due to the user continuously triggering the restart operation of the proxy service, and outputting the first prompt information through the main process, which can effectively remind the developer that the last restart operation was not completed, thereby reducing the number of invalid restart operations.

[0066] Figure 5 A flowchart of a proxy service restart method including determining whether to send a shutdown signal according to an environment variable is provided in an embodiment of the present application. Figure 5 As shown, the specific steps include:

[0067] Step S501: When a restart command is received, the environment variables of the currently running first working process are obtained through the main process.

[0068] When the main process creates a new first working process, an environment variable containing a newly created process identifier can be generated and passed to the first working process. Therefore, when a restart command is received, the environment variable of the currently running first working process can be obtained through the main process as a basis for determining whether the first working process is a new working process.

[0069] Step S502: When it is determined that the environment variable does not contain the new process identifier, a shutdown signal is sent to the currently running first working process through the main process.

[0070] Among them, if the environment variable does not contain the new process identifier, it can be regarded that the first working process is not a new working process, the previous restart operation of the proxy service has been completed, and the current restart operation can continue to be executed, otherwise there will be a redundant process problem of repeated creation of the working process.

[0071] Step S503: When the first working process receives a shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed through the first working process to stop the first service component from receiving tasks sent by the management server, and a process creation signal is sent to the main process.

[0072] Step S504: When the main process receives a process creation signal, a second working process and a corresponding second service component are created through the main process, and a network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0073] As mentioned above, by determining whether it is a new work process based on the environment variables of the first work process, it is possible to effectively determine whether the proxy service has not completed the last restart operation, and when it is determined that the environment variable does not contain a new process identifier, continue to execute the restart operation, thereby avoiding the repeated creation of new work processes due to the user's continuous triggering of the proxy service restart operation.

[0074] Figure 6 A flowchart of a proxy service restart method provided by an embodiment of the present application includes a process of self-checking a first working process to determine whether the process is isolated. Figure 6 As shown, the specific steps include:

[0075] Step S601: When a restart command is received, a shutdown signal is sent to the currently running first working process through the main process.

[0076] Step S602: When the first working process receives a shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed by the first working process to stop the first service component from receiving tasks sent by the management server, and a process creation signal is sent to the main process.

[0077] Step S603: When the main process receives a process creation signal, a second working process and a corresponding second service component are created through the main process, and a network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0078] Step S604: When the first working process receives a shutdown signal and the current time reaches the set periodic time node, the process identifier of the parent process is obtained through the first working process.

[0079] Among them, since the main process may exit abnormally due to an unknown error, the first working process it manages will be hosted by the initialization process. If the proxy service is updated or the configuration is updated, the first working process cannot be closed and managed by the main process, occupying excess system resources. Therefore, the first working process can perform self-checks regularly to determine whether it is an orphan process. The cycle time can be adaptively set by the developer according to the business needs of the actual application scenario.

[0080] Step S605: When it is determined that the main process corresponding to the process identifier is the initialization process, the first working process execution process is exited.

[0081] Among them, the process ID of the parent process can be obtained through the first working process, and by judging whether the process ID of its parent process is consistent with the process ID of the initialization process, it is judged whether the parent process of the first working process is changed to the initialization process. If it is determined that the main process corresponding to the process ID is the initialization process, the first working process can execute the process exit.

[0082] As mentioned above, by periodically checking the process identifier of the parent process corresponding to the first working process, it can be determined whether the first working process is hosted on the initialization process, and the orphan process can be exited in time. When the proxy service is restarted, the system resources occupied by the orphan process can be reasonably released.

[0083] Figure 7 A flowchart of a proxy service restart method including a process of outputting the remaining processing time of an unfinished task provided by an embodiment of the present application. Figure 7 As shown, the specific steps include:

[0084] Step S701: When a restart command is received, a shutdown signal is sent to the currently running first working process through the main process.

[0085] Step S702: When the first working process receives a shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed through the first working process to stop the first service component from receiving tasks sent by the management server, and the remaining processing time of the task is obtained from the first service component through the first working process. A second prompt message corresponding to the remaining processing time is output to the user interface through the first working process, and a process creation signal is sent to the main process.

[0086] The first service component can estimate the remaining processing time of the unfinished processing task and output a second prompt message corresponding to the remaining processing time to the user interface, and the second prompt message can be used to provide a reference message of the unfinished task to the developer. Optionally, the first service component can estimate the remaining processing time according to the type and complexity of the task and the hardware resources of the service component.

[0087] Step S703: When the main process receives a process creation signal, a second working process and a corresponding second service component are created through the main process, and a network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0088] As described above, by obtaining and outputting the remaining processing time of the task from the first service component when it is detected that the corresponding first service component has unfinished task processing, the developer can be prompted with the remaining processing time required for the task, which is beneficial for the developer to grasp the real-time progress of the old work process processing long-time tasks when the proxy service is restarted.

[0089] Figure 8 This is a structural block diagram of a proxy service restart device provided in an embodiment of the present application. The device is configured to execute the proxy service restart method provided in the above embodiment and has the corresponding functional modules and beneficial effects of the execution method. Figure 8 As shown, the device specifically includes:

[0090] A shutdown signal transmission module 101 is configured to send a shutdown signal to the currently running first working process through the main process when a restart command is received;

[0091] The service connection closing module 102 is configured to close the network connection of the first service component through the first working process when the first working process receives a closing signal and detects that the corresponding first service component has unfinished tasks, so as to stop the first service component from receiving tasks sent by the management server, and send a process creation signal to the main process;

[0092] The new working process creation module 103 is configured to create a second working process and a corresponding second service component through the main process when the main process receives a process creation signal, and to open a network connection of the second service component through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0093] In the above, when a restart command is received, a shutdown signal is sent to the currently running first working process through the main process. When the first working process receives the shutdown signal and detects that the corresponding first service component has unfinished tasks, the network connection of the first service component is closed through the first working process to stop the first service component from receiving tasks sent by the management server, and a process creation signal is sent to the main process. When the main process receives the process creation signal, a second working process and a corresponding second service component are created through the main process, and the network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server. In the above scheme, when the first working process detects that the first service component has unfinished tasks, it does not directly exit, but closes the network connection of the first service component, which can stop the old working process from continuing to receive tasks sent by the management server, and ensure that the long-time tasks being processed are not interrupted, avoiding adverse effects on the business. At the same time, by reopening a new working process through the main process to receive and process tasks, the availability of the proxy service can be guaranteed while satisfying the proxy service upgrade or configuration update.

[0094] In a possible embodiment, it further includes a process quantity statistics module configured as follows:

[0095] Count the number of processes of the first working process currently running through the main process;

[0096] Correspondingly, the shutdown signal transmission module 101 is further configured as follows:

[0097] When the number of processes is consistent with the preset number of processes, a shutdown signal is sent to the first working process through the main process.

[0098] In a possible embodiment, it further includes an alarm information output module configured as follows:

[0099] When the number of processes is less than the preset number of processes, the main process queries the set system log file to see whether there is process exception information corresponding to the recorded working process identifier;

[0100] When there is process abnormality information in the system log file, an alarm message containing the process abnormality information is output to the user interface through the main process.

[0101] In a possible embodiment, it further includes a first prompt information output module configured to:

[0102] When the number of processes is greater than the preset number of processes, a first prompt message is output to the user interface through the main process, where the first prompt message is used to prompt that there are work processes to be closed that are waiting for the task to be completed.

[0103] In a possible embodiment, an environment variable acquisition module is further included, configured as follows:

[0104] Obtain the environment variables of the currently running first working process through the main process;

[0105] Correspondingly, the shutdown signal transmission module 101 is further configured as follows:

[0106] When it is determined that the environment variable does not contain the new process identifier, a shutdown signal is sent to the currently running first working process through the main process.

[0107] In a possible embodiment, a work process exit module is further included, configured as follows:

[0108] When the first working process receives a shutdown signal and the current time reaches the set periodic time node, the process identifier of the parent process is obtained through the first working process;

[0109] When it is determined that the main process corresponding to the process identifier is the initialization process, the first working process execution process is exited.

[0110] In a possible embodiment, it further includes a second prompt information output module configured to:

[0111] Obtaining the remaining processing time of the task from the first service component through the first working process;

[0112] A second prompt message corresponding to the remaining processing time is output to the user interface through the first working process.

[0113] Fig. 9 A schematic diagram of a proxy service restart device provided in an embodiment of the present application, such as Fig. 9 As shown, the device includes a processor 201, a memory 202, an input device 203 and an output device 204; the number of processors 201 in the device can be one or more. Fig. 9 A processor 201 is taken as an example; the processor 201, memory 202, input device 203 and output device 204 in the device can be connected by a bus or other means. Fig. 9The example of connecting via a bus is taken. The memory 202, as a computer-readable storage medium, can be configured to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the proxy service restart method in the embodiment of the present application. The processor 201 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 202, that is, implements the above-mentioned proxy service restart method. The input device 203 can be configured to receive input digital or character information, and generate key signal input related to user settings and function control of the device. The output device 204 may include a display device such as a display screen.

[0114] The proxy service restart device provided above can be used to execute the proxy service restart method provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0115] An embodiment of the present application also provides a non-volatile storage medium containing computer executable instructions, which, when executed by a computer processor, is configured to execute a proxy service restart method described in the above embodiment, which includes: when a restart command is received, sending a shutdown signal to a currently running first working process through a main process; when the first working process receives the shutdown signal and detects that the corresponding first service component has unfinished tasks, closing the network connection of the first service component through the first working process to stop the first service component from receiving tasks sent by the management server, and sending a process creation signal to the main process; when the main process receives the process creation signal, creating a second working process and a corresponding second service component through the main process, and opening the network connection of the second service component through the second working process to enable the second service component to receive and process tasks sent by the management server.

[0116] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media, optical storage; registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system, which is connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations (e.g., in different computer systems connected via a network). The storage medium may store program instructions (e.g., embodied as a computer program) that can be executed by one or more processors.

[0117] Of course, the storage medium containing computer executable instructions provided in the embodiment of the present application is not limited to the above proxy service restart method, and the computer executable instructions can also execute the relevant operations in the proxy service restart method provided in any embodiment of the present application.

[0118] It should be noted that the numbering of each step in this scheme is only used to describe the overall design framework of this scheme, and does not represent the necessary order relationship between the steps. On the basis that the overall implementation process conforms to the overall design framework of this scheme, it belongs to the protection scope of this scheme, and the order of precedence in the form of text when describing is not an exclusive limitation on the specific implementation process of this scheme. It should be understood by those skilled in the art that the embodiments of the present application can be provided as methods, systems, or computer program products. In a typical configuration, a computing device includes one or more processors (CPU), an input / output interface, a network interface, and a memory. The memory may include non-permanent memory in a computer-readable medium, a random access memory (RAM) and / or a non-volatile memory in the form of a read-only memory (ROM) or a flash memory (fl ash RAM). The memory is an example of a computer-readable medium.

[0119] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0120] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A proxy service restart method, characterized in that: include: When a restart command is received, the number of processes of the currently running first working process is counted through the main process, and when the number of processes is consistent with the preset number of processes, a shutdown signal is sent to the currently running first working process through the main process, and the preset number of processes is the number of working processes managed when the main process is operating normally; When the first working process receives the shutdown signal and detects that the corresponding first service component has unfinished tasks, the first working process closes the network connection of the first service component to stop the first service component from receiving tasks sent by the management server, and sends a process creation signal to the main process; When the main process receives the process creation signal, a second working process and a corresponding second service component are created through the main process, and the network connection of the second service component is opened through the second working process to enable the second service component to receive and process tasks sent by the management server.

2. The proxy service restart method according to claim 1, characterized in that: Also includes: In the case that the number of processes is less than the preset number of processes, querying through the main process whether there is process exception information corresponding to the recorded working process identifier in the set system log file; When the process abnormality information exists in the system log file, an alarm message including the process abnormality information is output to a user interface through the main process.

3. The proxy service restart method according to claim 2, characterized in that: Also includes: When the number of processes is greater than the preset number of processes, a first prompt message is output to the user interface through the main process, where the first prompt message is used to prompt that there are work processes to be closed that are waiting for task completion.

4. The proxy service restart method according to claim 1, characterized in that: Before sending a shutdown signal to the currently running first working process through the main process, the method further includes: Obtaining the environment variables of the currently running first working process through the main process; Correspondingly, sending a shutdown signal to the currently running first working process through the main process includes: When it is determined that the environment variable does not contain the new process identifier, a shutdown signal is sent to the currently running first working process through the main process.

5. The proxy service restart method according to any one of claims 1 to 4, characterized in that: Also includes: When the first working process receives the shutdown signal and the current time reaches the set periodic time node, the process identifier of the parent process is obtained through the first working process; When it is determined that the main process corresponding to the process identifier is an initialization process, the first working process execution process is exited.

6. The proxy service restart method according to any one of claims 1 to 4, characterized in that: When the first working process receives the shutdown signal and detects that the corresponding first service component has unfinished tasks, the method further includes: Obtaining the remaining processing time of the task from the first service component through the first working process; A second prompt message corresponding to the remaining processing time is output to the user interface through the first working process.

7. A proxy service restart device, characterized in that: include: A shutdown signal transmission module is configured to, upon receiving a restart command, count the number of processes of the currently running first working process through the main process, and send a shutdown signal to the currently running first working process through the main process when the number of processes is consistent with a preset number of processes, wherein the preset number of processes is the number of working processes managed by the main process when the main process is operating normally; a service connection closing module, configured to close the network connection of the first service component through the first working process when the first working process receives the closing signal and detects that the corresponding first service component has unfinished tasks, so as to stop the first service component from receiving tasks sent by the management server, and send a process creation signal to the main process; The new working process creation module is configured to create a second working process and a corresponding second service component through the main process when the main process receives the process creation signal, and to open a network connection of the second service component through the second working process to enable the second service component to receive and process tasks sent by the management server.

8. A proxy service restart device, the device comprising: one or more processors; The storage device is configured to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the proxy service restart method according to any one of claims 1 to 6.

9. A non-volatile storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute the proxy service restart method according to any one of claims 1 to 6 when executed by a computer processor.

Citation Information

Patent Citations

  • Agent system restarting method and device, electronic equipment and storage medium

    CN115373802A

  • Service restarting method and related device

    CN116932062A