Service iteration method and device, computing equipment and storage medium

By creating a new process during the service iteration process, passing the connection socket descriptor and status information, and restoring the connection status on the new process, the problem of old connection exit is solved, lossless and smooth iteration is achieved, and the speed of service iteration and user experience are improved.

CN120670013APending Publication Date: 2025-09-19SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510766899.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-09
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

In the existing service iteration method, old connections are difficult to exit, resulting in client request interruption, state loss and potential risks. Existing technologies usually use lossy methods to cut off connections, affecting user experience.

Method used

Create a new process, pass the connection socket descriptor and status information of the original process to the new process, initialize the new process and restore the connection status, terminate the monitoring function of the original process, and allow the new process to take over the connection request.

Benefits of technology

It achieves lossless and smooth iteration of services, avoids forced connection disconnection, ensures data integrity and user experience, and improves iteration speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670013A_ABST
    Figure CN120670013A_ABST
Patent Text Reader

Abstract

The invention discloses a service iteration method and device, computing equipment and a storage medium, and the method comprises the steps: creating a new process corresponding to an original process, and switching the new process into an update service program; transmitting a connection socket descriptor and socket state information corresponding to the original process to the new process; performing initialization processing on the update service program; the initialization processing comprises resource preloading processing and connection monitoring function starting processing; when it is monitored that the initialization processing is completed, terminating the connection monitoring function of the original process; performing connection state recovery processing on the new process according to the socket state information and performing data communication according to the connection socket descriptor; through the mode of the application, the processing processes of the new connection and the old connection can be smoothly switched into the new processes, so that the updating service program can gradually replace the function of the original service program, the problem that the connection is forcibly cut off in the service iteration process is avoided, and lossless smooth iteration of the service can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and specifically to a service iteration method, apparatus, computing device, computer storage medium, and computer program product. Background Art

[0002] Smooth iteration involves gradually updating system versions while minimizing service interruptions and risks, ensuring unimpeded user experience. Currently, mainstream smooth iteration methods include blue-green deployment, rolling release, and grayscale release. Blue-green deployment requires two environments and implements iteration through traffic switching, offering the advantage of fast rollbacks but high costs. Rolling release involves gradually updating instances, benefiting from resource savings but cumbersome rollbacks. Grayscale release involves initially releasing the new version to a limited number of users before gradually expanding the scope. This is suitable for testing new features and offers low risk.

[0003] In existing service iteration methods, in order to reduce the time spent on connection establishment and handshakes, long connections are usually used. However, during the service iteration process, if the old connection lasts too long, it will be difficult to exit the old service. Existing technologies usually choose lossy methods to cut off the connection, which will have certain negative impacts on the client, including client request interruption, state loss and other potential risks. Summary of the Invention

[0004] In view of the above problems, the present application is proposed to provide a service iteration method, apparatus, computing device, computer storage medium and computer program product that overcome the above problems or at least partially solve the above problems.

[0005] According to one aspect of the present application, a service iteration method is provided, comprising:

[0006] Creating a new process corresponding to the original process, and switching the new process to the update service program;

[0007] Passing the connection socket descriptor and socket status information corresponding to the original process to the new process;

[0008] Initializing the update service program; wherein the initialization process includes resource preloading and connection monitoring function activation;

[0009] When the initialization process is detected to be complete, the connection monitoring function of the original process is terminated;

[0010] The new process performs connection state recovery processing according to the socket state information and performs data communication according to the connection socket descriptor.

[0011] In an optional implementation, the socket status information includes one or more of the following information: data sending and receiving status information, receiving buffer status information, sending buffer status information, and connection status information.

[0012] In an optional embodiment, the method further comprises:

[0013] Monitoring the initialization processing progress of the update service program, and updating the status bit set in the new process according to the initialization processing progress;

[0014] The connection monitoring function of terminating the original process further includes:

[0015] When the original process determines that the initialization process is completed according to the status bit in the new process, a preset closing function is called to close the listening socket descriptor corresponding to the original process.

[0016] In an optional embodiment, the performing connection state recovery processing according to the socket state information on the new process and performing data communication according to the connection socket descriptor further includes:

[0017] By using inter-process communication, the original process sends an enabling instruction for the connection socket descriptor to the new process, and the new process responds to the enabling instruction and executes the steps of enabling the corresponding connection socket descriptor and performing connection status recovery processing according to the corresponding socket status information.

[0018] In an optional embodiment, the method further comprises:

[0019] After completing the state recovery processing of all connections on the new process, the original process is terminated.

[0020] In an optional embodiment, the method further comprises:

[0021] Create a listening socket descriptor corresponding to the new process;

[0022] Bind the listening socket descriptor corresponding to the new process to the IP and port bound to the listening socket descriptor corresponding to the original process;

[0023] The initialization processing of the update service program further includes: enabling a listening socket descriptor corresponding to the new process.

[0024] In an optional embodiment, the method further comprises:

[0025] Get the progress information of the socket status information transferred from the original process to the new process;

[0026] The transfer progress information is displayed.

[0027] According to another aspect of the present application, a service iteration device is provided, comprising:

[0028] A creation module, configured to create a new process corresponding to the original process and switch the new process to the update service program;

[0029] A transfer module, configured to transfer the connection socket descriptor and socket status information corresponding to the original process to the new process;

[0030] An initialization module, configured to initialize the update service program; wherein the initialization process includes resource preloading and connection monitoring function activation;

[0031] A management module, configured to terminate the connection monitoring function of the original process when detecting that the initialization process is completed;

[0032] A processing module is used to perform connection state recovery processing on the new process according to the socket state information and to perform data communication according to the connection socket descriptor.

[0033] In an optional implementation, the socket status information includes one or more of the following information: data sending and receiving status information, receiving buffer status information, sending buffer status information, and connection status information.

[0034] In an optional embodiment, the device further comprises:

[0035] A monitoring module, configured to monitor the initialization processing progress of the update service program and update a status bit set in the new process according to the initialization processing progress;

[0036] The management module is further configured to: when the original process determines that the initialization process is completed according to the status bit in the new process, call a preset closing function to close the listening socket descriptor corresponding to the original process.

[0037] In an optional embodiment, the processing module is further configured to:

[0038] By using inter-process communication, the original process sends an enabling instruction for the connection socket descriptor to the new process, and the new process responds to the enabling instruction and executes the steps of enabling the corresponding connection socket descriptor and performing connection status recovery processing according to the corresponding socket status information.

[0039] In an optional embodiment, the management module is further configured to:

[0040] After completing the state recovery processing of all connections on the new process, the original process is terminated.

[0041] In an optional embodiment, the transfer module is further configured to:

[0042] Create a listening socket descriptor corresponding to the new process;

[0043] Bind the listening socket descriptor corresponding to the new process to the IP and port bound to the listening socket descriptor corresponding to the original process;

[0044] The initialization module is further used to: enable the listening socket descriptor corresponding to the new process.

[0045] In an optional implementation, the monitoring module is further configured to: obtain transfer progress information of the socket status information transferred from the original process to the new process; and display the transfer progress information.

[0046] According to another aspect of the present application, a computing device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;

[0047] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned service iteration method.

[0048] According to another aspect of the present application, a computer storage medium is provided, wherein the storage medium stores at least one executable instruction, and the executable instruction enables a processor to perform operations corresponding to the above-mentioned service iteration method.

[0049] According to another aspect of the present application, a computer program product is provided, comprising at least one executable instruction, wherein the executable instruction enables a processor to perform operations corresponding to the above-mentioned service iteration method.

[0050] According to the service iteration method, apparatus, computing device, computer storage medium and computer program product provided in the embodiments of the present application, a new process corresponding to the original process is created, the new process is switched to the update service program, and service iteration is achieved based on switching the process connected to the opposite device (i.e., the client); the connection socket descriptor and socket status information corresponding to the original process are passed to the new process so that the new process can use the connection socket descriptor used by the original process to communicate, and the connection and its status with the opposite device are restored on the new process to ensure that the restored connection can work normally and the integrity and accuracy of the data are guaranteed; after the new process is created, the update service program is initialized. When the initialization process is completed, the new process starts to listen for new connections, and the connection listening function of the original process is terminated, so that the new process can accept new request traffic, avoiding the situation where the new connection request is incorrectly assigned to the original process; in summary, through the method of the embodiments of the present application, the processing processes of the new connection and the old connection can be smoothly switched to the new process, so that the update service program can gradually replace the functions of the original service program, avoiding the problem of forced disconnection of the connection during the service iteration process, and achieving lossless and smooth iteration of the service.

[0051] The embodiment of the present application monitors and displays the transfer progress information of the socket status information from the original process to the new process, so that the administrator can understand the transfer status intuitively and timely, and facilitate the administrator to efficiently complete the service iteration work.

[0052] The embodiment of the present application monitors the progress of the initialization processing of the update service program. When it is detected that the initialization processing has been completed, it promptly switches to a new process receiving new connection requests, which can improve the service iteration speed.

[0053] The embodiment of the present application can gradually enable the connection socket descriptors and connections migrated to the new process by sending an open instruction to the new process.

[0054] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present application. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:

[0056] Figure 1A flowchart of a service iteration method provided by an embodiment of the present application is shown;

[0057] Figure 2 A flowchart of a service iteration method provided by another embodiment of the present application is shown;

[0058] Figure 3 A flowchart of a service iteration method provided by another embodiment of the present application is shown;

[0059] Figure 4 A schematic diagram showing the functional structure of a service iteration device provided in an embodiment of the present application is shown;

[0060] Figure 5 A schematic diagram of the structure of a computing device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0061] The following describes exemplary embodiments of the present application in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0062] First, the terms involved in one or more embodiments of the present application are explained.

[0063] File descriptor: File Descriptor, referred to as FD, is an integer identifier used in the operating system to identify and manage open files or input / output resources.

[0064] Socket: An abstraction for an endpoint for bidirectional communication between application processes on different hosts on a network. A socket is one end of a process's communication on a network, providing a mechanism for application-layer processes to exchange data using network protocols.

[0065] Listening socket: The server uses a socket to listen for client connection requests. It does not directly transmit data with the client, but is responsible for receiving new connection requests and creating a new "connection socket" for each successfully established connection.

[0066] Connection socket: A socket created by a listening socket and used to communicate data with a specific client.

[0067] A process is the basic unit of resource allocation and scheduling in the operating system. Each process has its own independent memory space, system resources, and execution path. Service programs run through processes. When a service process receives a client request, it executes the corresponding business logic based on the request content, generates a response, and writes the response back to the client via the connection socket descriptor.

[0068] Domain sockets: Used for communication between processes running on the same machine. Although Internet domain sockets can be used for the same purpose, domain sockets are more efficient. Domain sockets simply copy data; they do not perform protocol processing, adding or removing network headers, calculating checksums, generating sequence numbers, or sending acknowledgments.

[0069] Figure 1 FIG. 1 shows a flow chart of a service iteration method provided by an embodiment of the present application. Figure 1 As shown, the method includes the following steps:

[0070] Step S110: Create a new process corresponding to the original process, and switch the new process to the update service program.

[0071] The service program of the original process is the old version of the service program, and the updated service program is the new version of the service program. After creating a new process, the program code of the new process is replaced with the updated service program.

[0072] Step S120: passing the connection socket descriptor and socket status information corresponding to the original process to the new process.

[0073] The connection socket used by a process is used for data communication with a specific client. Socket status information is the status information corresponding to the connection socket. The original process may have multiple connection socket descriptors corresponding to it, and accordingly, there may also be multiple pieces of socket status information.

[0074] The connection socket descriptors corresponding to the original process are passed to the new process so that the new process can communicate using the connection socket descriptors used by the original process; the status information of the connection socket corresponding to the original process is passed to the new process so that the normal connection and its status can be restored on the new process, so that the client previously connected to the original process can switch to connecting to the new process, and the restored connection can work normally.

[0075] Step S130: Initialize the update service program.

[0076] Initialization processing includes resource preloading and connection monitoring. Resource preloading involves loading configuration files, initializing database connections, and allocating memory resources. Enabling connection monitoring involves performing specific operations to enable the new process to listen for client connection requests, effectively enabling the update service to listen for client connection requests. During the update service initialization process, the new process cannot handle requests normally, and the original process will still be responsible for acquiring new connections with clients.

[0077] Step S140: When the initialization process is detected to be completed, the connection monitoring function of the original process is terminated.

[0078] After the initialization processing of the update service program is completed, the new process can handle connection requests normally, and the connection monitoring function of the original process is terminated so that the original process no longer monitors new connection requests, ensuring that all subsequent new connection requests are handled by the new process, avoiding the situation where new connection requests are incorrectly assigned to the original process, and being able to smoothly switch the processing process of new connection requests from the original process to the new process.

[0079] It should be noted that the execution order between step S120 and step S130 is not fixed, and both are dynamically triggered and executed according to actual conditions after a new process is created.

[0080] Step S150: performing connection status recovery processing on the new process according to the socket status information and performing data communication according to the connection socket descriptor.

[0081] For the connections that have been established by the original process, the socket status of these connections also needs to be transferred to the new process, so that the clients connected to the original process can smoothly switch to connecting to the new process. Since the new process loads the updated service program, smooth iteration of the service is achieved.

[0082] Socket status information includes: data transmission and reception status information, receive buffer status information, send buffer status information, and / or connection status information. The data transmission and reception status information indicates the extent to which data has been sent and received. The receive buffer status information and send buffer status information are used to restore the receive buffer and send buffer of the connection socket. The connection status information indicates whether the connection corresponding to the connection socket is disconnected or connected. By passing accurate and complete socket status information to the new process and using the socket status information to restore the connection and its status, the connection and status restored on the new process can be kept consistent with those before the migration, thus avoiding data loss or errors during service iteration.

[0083] In the new process, all connections and their status are restored based on the socket status information, and the connection socket descriptor passed by the original process is used to communicate with the client, so that the restored connection can continue to work normally, avoiding the problem of forced disconnection of the original connection during service iteration.

[0084] To sum up, according to the service iteration method provided in this embodiment, a new process corresponding to the original process is created, and the new process is switched to the update service program, and service iteration is realized based on switching the process connected to the device; the connection socket descriptor and socket status information corresponding to the original process are passed to the new process, so that the new process can use the connection socket descriptor used by the original process to communicate, and the connection and its status with the opposite device are restored on the new process to ensure that the restored connection can work normally and the integrity and accuracy of the data are guaranteed; after the new process is created, the update service program is initialized. When the initialization is completed, the new process starts to listen for new connections, and the connection listening function of the original process is terminated, so that the new process can accept new request traffic, avoiding the situation where the new connection request is incorrectly assigned to the original process; through the method of the embodiment of the present application, the processing processes of the new connection and the old connection can be smoothly switched to the new process, so that the update service program can gradually replace the functions of the original service program, avoiding the problem of forced disconnection of the connection during the service iteration process, and realizing lossless and smooth iteration of the service.

[0085] Figure 2 FIG. 1 is a flow chart showing a service iteration method provided by another embodiment of the present application. Figure 2 As shown, the method includes the following steps:

[0086] Step S210: Create a new process corresponding to the original process, switch the new process to the update service program, and pass the connection socket descriptor corresponding to the original process to the new process.

[0087] During the normal operation of a service, there will be a large number of file descriptors, including file descriptors for the network, file descriptors for opening related files, etc. Among them, the file descriptors used for the network include listening socket descriptors and connecting socket descriptors. The listening socket descriptor is used to obtain a new connection with the client, and the connecting socket descriptor is used to communicate data with the client.

[0088] In an optional embodiment, this step is implemented by calling fork and exec, which also includes the following steps: clearing the FD_CLOEXEC flag of the connection socket descriptor corresponding to the original process. The function of fork is to create a child process of the current process, and the created child process is a copy of the parent process; the function of exec is to replace the image of the current process, load a new program and execute it. Specifically, the original process creates a child process by calling the fork function, that is, a new process corresponding to the original process is obtained, and the new process calls the exec function to replace its own program code with the update service program; the FD_CLOEXEC flag is used to mark whether the file descriptor is automatically closed when the process calls the exec function. By clearing the FD_CLOEXEC flag of the connection socket descriptor, the connection socket descriptor corresponding to the original process is still available in the update service program loaded in the new process, that is, the update service program already contains the various connection socket descriptors used by the original process.

[0089] In addition to the connection socket descriptor corresponding to the original process, the listening socket descriptor corresponding to the original process must also be transferred to the new process. In an optional embodiment, transferring the listening socket descriptor corresponding to the original process to the new process includes: creating a listening socket descriptor corresponding to the new process; and binding the listening socket descriptor corresponding to the new process to the IP address and port bound to the listening socket descriptor corresponding to the original process, thereby enabling program updates without interrupting service.

[0090] In addition, other file descriptors besides the listening socket descriptor and the connecting socket descriptor can also be transferred by calling fork and exec.

[0091] Step S220: passing the socket status information corresponding to the original process to the new process.

[0092] The socket status information is specifically status information corresponding to the connection socket. The socket status information can be transferred from the original process to the new process through inter-process communication.

[0093] In an optional implementation, the socket status information is passed to the new process as additional communication information using an inter-process communication method.

[0094] Socket status information includes: data transmission and reception status information, receive buffer status information, send buffer status information, and / or connection status information. The data transmission and reception status information indicates the extent to which data has been sent and received. The receive buffer status information and send buffer status information are used to restore the receive buffer and send buffer of the connection socket. The connection status information indicates whether the connection corresponding to the connection socket is disconnected or connected. By passing accurate and complete socket status information to the new process so that the socket status information can be used to subsequently restore the connection and its status, the connection and status restored on the new process can be kept consistent with those before the migration, thus avoiding data loss or errors during service iteration.

[0095] In an optional embodiment, the method also includes: obtaining the transfer progress information of the socket status information transferred from the original process to the new process; displaying the transfer progress information; obtaining the transfer progress of the socket status information transferred by the original process in real time or periodically, and then sending the transfer progress information to a display device for display, so that the administrator can understand the transfer status intuitively and promptly.

[0096] Optionally, the delivery progress information is determined based on the ratio of the amount of socket status information that has been delivered to the total amount of socket status information that needs to be delivered; optionally, the delivery progress information is determined based on the ratio of the time consumed in delivering the socket status information to the time required to deliver all the socket status information (obtained by calculation).

[0097] Step S230 , initializing the update service program, monitoring the initialization progress of the update service program, and updating the status bit set in the new process according to the initialization progress.

[0098] The initialization processing of the update service program specifically includes: resource preloading processing and connection monitoring function activation processing; resource preloading processing includes loading configuration files, initializing database connections, allocating memory resources, etc.; the specific method of activating the connection monitoring function processing of the update service program is: enabling the listening socket descriptor corresponding to the new process.

[0099] Among them, the time taken for the initialization processing of the update service program depends on the complexity of the update service program and the new process and the number of tasks included in the initialization processing. The higher the complexity and the more tasks, the longer the initialization processing takes. Optionally, the progress of the initialization processing is obtained based on the ratio of the number of completed tasks to the total number of tasks and the complexity calculation. For example, a weight coefficient is calculated based on the complexity, and the ratio of the number of completed tasks to the total number of tasks and the multiplication result of the weight coefficient are used as the progress of the initialization processing; optionally, the progress of the initialization processing is calculated based on the ratio of the time consumed by the initialization processing to the total time required for the initialization processing. The total time required for the initialization processing is calculated based on the complexity and the time taken for each task. This application does not limit the specific calculation method of the progress of the initialization processing.

[0100] A flag is set in the new process to indicate the initialization progress of the update service program. When the initialization progress is updated, the flag is updated according to the latest initialization progress. For example, different flags are set for different initialization progress. 0 is used to indicate that the initialization process is not completed, i.e., in the incomplete state, and 1 is used to indicate that the initialization process is completed, i.e., in the ready state.

[0101] Step S240: When the original process determines that the initialization process is completed according to the status bit in the new process, a preset close function is called to close the listening socket descriptor corresponding to the original process.

[0102] The original process can check the status bit set in the new process in real time, or it can check the status bit set in the new process at intervals of a predetermined period. When the original process detects that the status bit indicates that the initialization process is complete, it calls a preset close function to close its own listening socket descriptor, so that the original process no longer listens for new client connection requests. Specifically, the listenerfd (listening socket descriptor) is closed by calling a system call provided by the operating system, such as the close() function.

[0103] Specifically, the original process checks the status bit set in the new process through an inter-process communication mode, and the inter-process communication mode may adopt a pipe-based communication mode, a shared memory-based communication mode, or a domain socket-based communication mode.

[0104] In the embodiment of the present application, when it is monitored that the initialization processing of the update service program has been completed, the connection monitoring of the original process is terminated in a timely manner and switched to the new process to listen for new connection requests, which can avoid the situation where the new connection request is incorrectly assigned to the original process. At the same time, timely switching to the new process to receive the new connection request can improve the service iteration speed.

[0105] Step S250, using the inter-process communication method, the original process sends an enable instruction for the connection socket descriptor to the new process, and the new process responds to the enable instruction and executes the steps of enabling the corresponding connection socket descriptor and performing connection status recovery processing according to the corresponding socket status information.

[0106] After the new process receives the socket status information, it needs to restore the normal connection and restore the sending buffer, receiving buffer, connection status, etc. of the connection socket so that the connection can continue to work normally.

[0107] By transferring the connection socket descriptors, the new process (that is, the update service program) already contains all the connection socket descriptors used by the original process, but they have not yet been enabled. The connection socket descriptors migrated to the new process need to be gradually enabled and the corresponding connection status restored.

[0108] Specifically, using inter-process communication, the original process sends an enable instruction for the target connection socket descriptor to the new process. In response to the enable instruction, the new process performs the following operations: enabling the target connection socket descriptor and restoring the connection state based on the socket state information corresponding to the target connection socket descriptor. After this, the new process can communicate with the client using the enabled connection socket descriptor and the restored connection.

[0109] In an optional implementation, when it is monitored that the original process has completed transferring the target connection socket descriptor and corresponding socket status information to the new process, the original process is caused to send an activation instruction for the target connection socket description to the new process.

[0110] Step S260: After completing the status recovery processing of all connections in the new process, terminate the original process.

[0111] When all the connection socket status information has been transferred, the original process no longer has any connections to process and is in an idle state. At this time, the original process can be safely terminated to release the system resources it occupied. Specifically, a termination signal (such as a SIGTERM signal) is sent to the original process, and the original process terminates itself in response to the termination signal.

[0112] It should be noted that there is no fixed execution order between step S220 and step S230, and both are dynamically triggered and executed based on actual conditions after a new process is created; step S250 can be triggered and executed after the connection socket descriptor and corresponding socket status information corresponding to each connection are passed to the new process.

[0113] In summary, according to the service iteration method provided by this embodiment, service iteration is achieved based on switching the process connected to the client, and the connection socket descriptor corresponding to the original process is passed to the new process, so that the new process can obtain the connection socket descriptor used by the original process and communicate with it; by passing the connection status information on the original process to the new process, the new process can restore the connection and status with the client, ensuring that the restored connection can work normally and the integrity and accuracy of the data are guaranteed; when it is monitored that the initialization processing of the update service program is completed, the connection monitoring function of the original process is terminated to avoid the situation where the new connection request is incorrectly assigned to the original process; thereby, the new process can receive the new connection request, and pass the relevant information of the client connection by memory transmission, so that the new process Gradually receive the relevant data of the original process, thereby gradually replacing the functions of the original service. Both new connections and old connections can be smoothly switched to the new process, avoiding the problem of forced connection disconnection during service iteration, and realizing lossless and smooth iteration of the service; further, by monitoring the transmission progress information of the socket status information from the original process to the new process and displaying it, the administrator can understand the transmission situation intuitively and timely, which is convenient for the administrator to complete the service iteration work efficiently; further, monitor the initialization processing progress of the updated service program, and when it is detected that the initialization processing has been completed, switch to the new process to receive new connection requests in time, which can improve the service iteration speed; further, by sending an open instruction to the new process, the connection socket descriptor and connection migrated to the new process can be gradually enabled.

[0114] Figure 3 A flow chart of a service iteration method according to another embodiment of the present application is shown. The method according to the embodiment of the present application is applied to an iteration scenario of a CDN component. The method includes the following steps:

[0115] Step S310: clear the FD_CLOEXEC flag of the relevant descriptor to be transferred in the original process.

[0116] This step is to retain the original related descriptors when the current process switches to the update service program, and the related descriptors include the connection socket descriptors.

[0117] Step S320: Send a signal to the original process so that the original process creates a child process through a fork method, and the child process switches to the service program of updating the CDN component through an exec method.

[0118] Through step S310 and step S320, a process of a new service can be created, and the relevant descriptors of the original process can be transferred to the new process.

[0119] Step S330: Initialize the service program for updating the CDN component.

[0120] During the initialization of the update service program, the new process cannot handle requests normally.

[0121] Step S340: terminate the connection monitoring of the original process.

[0122] After the initialization processing of the update service program is completed, it can start to monitor new connection requests, and the connection monitoring function of the original process will be terminated to avoid the new connection request being incorrectly assigned to the original process. For the new connection request, it can be smoothly switched to the new process for processing.

[0123] Step S350: Migrate the socket status information corresponding to the original process to the new process.

[0124] Step S360: The new process restores the normal connection according to the transferred socket status information.

[0125] Step S370: After the migration is completed, the original process is stopped.

[0126] Figure 4 The functional structure diagram of the service iteration device provided in the embodiment of the present application is shown. Figure 4 As shown, the device includes:

[0127] A creation module 410 is used to create a new process corresponding to the original process and switch the new process to the update service program;

[0128] A transfer module 420, configured to transfer the connection socket descriptor and socket status information corresponding to the original process to the new process;

[0129] Initialization module 430, used to initialize the update service program; wherein the initialization process includes resource preloading process and connection monitoring function start process;

[0130] The management module 440 is configured to terminate the connection monitoring function of the original process upon detecting that the initialization process is completed;

[0131] The processing module 450 is configured to perform connection state recovery processing on the new process according to the socket state information and to perform data communication according to the connection socket descriptor.

[0132] In an optional implementation, the socket status information includes one or more of the following information: data sending and receiving status information, receiving buffer status information, sending buffer status information, and connection status information.

[0133] In an optional embodiment, the device further comprises:

[0134] A monitoring module, configured to monitor the initialization processing progress of the update service program and update a status bit set in the new process according to the initialization processing progress;

[0135] The management module 440 is further configured to: when the original process determines that the initialization process is completed according to the status bit in the new process, call a preset closing function to close the listening socket descriptor corresponding to the original process.

[0136] In an optional embodiment, the processing module 450 is further configured to:

[0137] By using inter-process communication, the original process sends an enabling instruction for the connection socket descriptor to the new process, and the new process responds to the enabling instruction and executes the steps of enabling the corresponding connection socket descriptor and performing connection status recovery processing according to the corresponding socket status information.

[0138] In an optional implementation, the management module 440 is further configured to:

[0139] After completing the state recovery processing of all connections on the new process, the original process is terminated.

[0140] In an optional embodiment, the transmission module 420 is further configured to:

[0141] Create a listening socket descriptor corresponding to the new process;

[0142] Bind the listening socket descriptor corresponding to the new process to the IP and port bound to the listening socket descriptor corresponding to the original process;

[0143] The initialization module 430 is further configured to enable a listening socket descriptor corresponding to the new process.

[0144] In an optional implementation, the monitoring module is further configured to: obtain transfer progress information of the socket status information transferred from the original process to the new process; and display the transfer progress information.

[0145] To sum up, according to the service iteration device provided by this embodiment, service iteration is realized based on switching the process connected to the device, and the connection socket descriptor and socket status information corresponding to the original process are passed to the new process so that the new process can use the connection socket descriptor used by the original process to communicate, and the connection and its status with the opposite device are restored on the new process to ensure that the restored connection can work normally and the integrity and accuracy of the data are guaranteed; after the new process is created, the update service program is initialized, and when the initialization is completed, the new process starts to listen for new connections, and the connection listening function of the original process is terminated, so that the new process can accept new request traffic, avoiding the situation where the new connection request is incorrectly assigned to the original process; thereby, the processing processes of the new connection and the old connection can be smoothly switched to the new process, so that the update service program can gradually replace the functions of the original service program, avoiding the problem of forced disconnection of the connection during the service iteration process, and realizing lossless and smooth iteration of the service.

[0146] An embodiment of the present application provides a non-volatile computer storage medium, which stores at least one executable instruction or computer program, and the executable instruction or computer program can enable a processor to perform operations corresponding to the service iteration method in any of the above method embodiments.

[0147] An embodiment of the present application provides a computer program product, which includes at least one executable instruction or computer program, and the executable instruction or computer program can enable a processor to perform operations corresponding to the service iteration method in any of the above method embodiments.

[0148] Figure 5 A schematic diagram of the structure of an embodiment of a computing device of the present application is shown. The specific embodiment of the present application does not limit the specific implementation of the computing device.

[0149] like Figure 5 As shown, the computing device may include: a processor (processor) 502 , a communications interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .

[0150] Processor 502, communication interface 504, and memory 506 communicate with each other via communication bus 508. Communication interface 504 is used to communicate with other devices, such as clients or other server network elements. Processor 502 is used to execute program 510, which may specifically perform the steps described in the aforementioned embodiment of the service iteration method for a computing device.

[0151] Specifically, the program 510 may include program codes, which include computer operation instructions.

[0152] Processor 502 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the computing device may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0153] The memory 506 is used to store the program 510. The memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0154] Program 510 can be specifically used to enable processor 502 to perform service iteration in any of the above-mentioned method embodiments. The specific implementation of each step in program 510 can refer to the corresponding description of the corresponding steps and units in the service iteration embodiment, and will not be repeated here. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working process of the above-mentioned devices and modules can refer to the corresponding process description in the above-mentioned method embodiment, and will not be repeated here.

[0155] In summary, according to the computing device, computer storage medium and computer program product provided in this embodiment, service iteration is realized based on switching the process connected to the device, and the connection socket descriptor and socket status information corresponding to the original process are passed to the new process so that the new process can use the connection socket descriptor used by the original process to communicate, and the connection and its status with the opposite device are restored on the new process to ensure that the restored connection can work normally and the integrity and accuracy of the data are guaranteed; after the new process is created, the update service program is initialized. When the initialization process is completed, the new process starts to listen for new connections, and the connection listening function of the original process is terminated, so that the new process can accept new request traffic, avoiding the situation where the new connection request is incorrectly assigned to the original process; thereby, the processing processes of the new connection and the old connection can be smoothly switched to the new process, so that the update service program can gradually replace the functions of the original service program, avoiding the problem of forced disconnection of the connection during the service iteration process, and realizing lossless and smooth iteration of the service.

[0156] The algorithm or demonstration provided here are not inherently relevant to any particular computer, virtual system or other equipment. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing this type of system. In addition, the present application embodiment is not directed to any specific programming language yet. It should be understood that various programming languages ​​can be utilized to realize the content of the present application described here, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the present application.

[0157] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.

[0158] Similarly, it should be understood that in order to streamline the present application and aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, various features of the embodiments of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting an intention that the claimed application requires more features than are expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Accordingly, the claims that follow the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of the present application.

[0159] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed herein may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0160] Furthermore, those skilled in the art will appreciate that although some embodiments herein include certain features included in other embodiments but not other features, combinations of features from different embodiments are intended to be within the scope of this application and to form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.

[0161] The various component embodiments of the present application can be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components according to the embodiments of the present application. The application can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for performing a part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0162] It should be noted that the above embodiments illustrate rather than limit the present application, and that a person skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of appropriately programmed computers. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments should not be understood as limiting the order of execution unless otherwise specified.

Claims

1. A service iteration method, comprising: Creating a new process corresponding to the original process, and switching the new process to the update service program; Passing the connection socket descriptor and socket status information corresponding to the original process to the new process; Initializing the update service program; wherein the initialization process includes resource preloading and connection monitoring function activation; When the initialization process is detected to be complete, the connection monitoring function of the original process is terminated; The new process performs connection state recovery processing according to the socket state information and performs data communication according to the connection socket descriptor.

2. The method according to claim 1, wherein The socket status information includes one or more of the following information: data sending and receiving status information, receiving buffer status information, sending buffer status information, and connection status information.

3. The method according to claim 1 or 2, wherein: The method further comprises: Monitoring the initialization processing progress of the update service program, and updating the status bit set in the new process according to the initialization processing progress; The connection monitoring function of terminating the original process further includes: When the original process determines that the initialization process is completed according to the status bit in the new process, a preset closing function is called to close the listening socket descriptor corresponding to the original process.

4. The method according to any one of claims 1 to 3, wherein The state recovery processing of the connection according to the socket state information on the new process and the data communication according to the connection socket descriptor further include: By using inter-process communication, the original process sends an enabling instruction for the connection socket descriptor to the new process, and the new process responds to the enabling instruction and executes the steps of enabling the corresponding connection socket descriptor and performing connection status recovery processing according to the corresponding socket status information.

5. The method according to any one of claims 1 to 4, wherein The method further comprises: After completing the state recovery processing of all connections on the new process, the original process is terminated.

6. The method according to any one of claims 1 to 5, wherein The method further comprises: Create a listening socket descriptor corresponding to the new process; Bind the listening socket descriptor corresponding to the new process to the IP and port bound to the listening socket descriptor corresponding to the original process; The initialization process for the update service program further includes: enabling a listening socket descriptor corresponding to the new process.

7. The method according to any one of claims 1 to 6, wherein The method further comprises: Get the progress information of the socket status information transferred from the original process to the new process; The transfer progress information is displayed.

8. A service iteration device, comprising: A creation module, configured to create a new process corresponding to the original process and switch the new process to the update service program; A transfer module, configured to transfer the connection socket descriptor and socket status information corresponding to the original process to the new process; An initialization module, configured to initialize the update service program; wherein the initialization process includes resource preloading and connection monitoring function activation; A management module, configured to terminate the connection monitoring function of the original process when detecting that the initialization process is completed; A processing module is used to perform connection state recovery processing on the new process according to the socket state information and to perform data communication according to the connection socket descriptor.

9. A computing device comprising: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the service iteration method according to any one of claims 1 to 7.

10. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute an operation corresponding to the service iteration method according to any one of claims 1 to 7.

11. A computer program product, comprising at least one executable instruction, wherein the executable instruction enables a processor to execute operations corresponding to the service iteration method according to any one of claims 1 to 7.