Method and System for Interruption-Free Microservice Deployment
By modifying the properties and state changes of microservices, the problem of business interruption during microservice deployment is solved, seamless updates are achieved, and business continuity is ensured.
Patent Information
- Application Number
- CN202211329237.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-27
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2042-10-27
AI Technical Summary
Traditional microservice deployment methods are prone to business interruptions and exceptions during the update process, and the existing technology has failed to effectively solve this problem.
By modifying the properties of the microservice, including renaming the health detection page file and changing the status of the offline in the registration center, we ensure that the service is closed after the business is processed, and the health detection page file is restored after the update, so as to achieve seamless updates.
A seamless and smooth microservice application update is achieved, which avoids business exceptions, ensures that new business requests are not transferred to microservices to be updated, and prevents business interruptions.
Smart Images

Figure CN115801571B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of microservices, and in particular, to a method and system for deploying microservices without interruption. Background Art
[0002] In traditional microservice deployment, generally, the service needs to be shut down first and then updated and deployed. At this time, the business being processed by the service may fail due to forced interruption; in addition, due to a certain time interval in the health detection of the upstream service caller, it is impossible to immediately detect that the service has been shut down, and new business requests will still be sent, resulting in exceptions such as business rejection or timeout.
[0003] Patent document CN111176873A discloses a method, device, computer device and storage medium for automatically taking a microservice offline, which relates to the technical field of microservice architecture. The method includes: confirming a microservice in an abnormal state based on heartbeat detection and / or business detection of the microservice; updating information of the microservice in the abnormal state, and pushing the information of the microservice in the abnormal state to the upstream service; the upstream service is used to take the microservice in the abnormal state offline; and pushing the information of the backup microservice to the upstream service, and the upstream service adds the backup microservice to the load to replace the offline microservice. This method uses the backup microservice to replace the offline microservice, thereby providing a timely disaster recovery function.
[0004] Patent document CN111176873A focuses on how to solve the problem after a microservice appears abnormal, but does not solve how to prevent exceptions caused by service updates. Summary of the Invention
[0005] Aiming at the deficiencies in the prior art, the purpose of the present invention is to provide a method and system for deploying microservices without interruption.
[0006] According to a method for deploying microservices without interruption provided by the present invention, it includes:
[0007] The first processing step: modifying the attributes of the microservice to be updated according to the type of the microservice to be updated, where the attributes are used to indicate to the caller that the microservice is to be updated;
[0008] The second processing step: shutting down the microservice to be updated after the business being processed by the microservice to be updated is completed;
[0009] The third processing step: updating the microservice and starting the updated microservice;
[0010] The fourth processing step: bringing the updated microservice back online.
[0011] Preferably, the first processing step includes:
[0012] Renaming step: If there is an external load device among the callers of the microservice to be updated, rename the health check page file of the microservice to be updated so that the health check page file cannot be detected by the external load device; wherein, the attribute includes the health check page file name.
[0013] Offline step: If the callers of the microservice to be updated are only other microservices within the registration center, send an offline instruction to the registration center to take the microservice to be updated offline in the registration center and enter the offline state; wherein, the attribute includes the online status.
[0014] Preferably, the fourth processing step includes:
[0015] Restoring name step: For the microservice whose name was changed before the update, restore the health check page file to its original file name before the renaming.
[0016] Online step: For the microservice that was offline before the update, automatically go online in the registration center and enter the online state to provide services to the outside world.
[0017] Preferably, when the microservice is in the offline state, other microservices within the registration center, as callers, based on the detected offline state, ensure that new business requests will no longer be transferred to the microservice to be updated.
[0018] After the health check page file of the microservice is renamed, it cannot be detected by the external load detection device.
[0019] According to a microservice deployment system without interruption provided by the present invention, it includes:
[0020] The first processing module: Modify the attributes of the microservice to be updated according to the type of the microservice to be updated, and the attributes are used to indicate to the caller that the microservice is to be updated.
[0021] The second processing module: After the business being processed by the microservice to be updated is completed, close the microservice to be updated.
[0022] The third processing module: Update the microservice and start the updated microservice.
[0023] The fourth processing module: Bring the updated microservice back online.
[0024] Preferably, the first processing module includes:
[0025] Renaming module: If there is an external load device among the callers of the microservice to be updated, rename the health check page file of the microservice to be updated so that the health check page file cannot be detected by the external load device; where the attribute includes the health check page file name.
[0026] Offline module: If the callers of the microservice to be updated are only other microservices within the registration center, send an offline instruction to the registration center to take the microservice to be updated offline in the registration center and enter the offline state; where the attribute includes the online status.
[0027] Preferably, the fourth processing module includes:
[0028] Restoring name module: For the microservice whose name was changed before the update, restore the health check page file to the original file name before the name change.
[0029] Online module: For the microservice that was offline before the update, automatically go online in the registration center and enter the online state to provide services externally.
[0030] Preferably, when the microservice is in the offline state, other microservices within the registration center, as callers, based on the detected offline state, ensure that new business requests will no longer be transferred to the microservice to be updated.
[0031] After the health check page file of the microservice is renamed, it cannot be detected by the external load detection device.
[0032] According to a computer-readable storage medium storing a computer program provided by the present invention, characterized in that when the computer program is executed by a processor, the steps of the uninterrupted microservice deployment method are implemented.
[0033] According to an electronic device provided by the present invention, including a memory, a processor, and a computer program stored on the memory and executable on the processor, when the computer program is executed by the processor, the steps of the uninterrupted microservice deployment method are implemented.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] 1. The present invention updates microservice applications seamlessly and smoothly, preventing business exceptions caused by microservice interruptions during the deployment process.
[0036] 2. The present invention realizes that new business requests will no longer be transferred to the microservice without affecting microservice processing by changing the status of the microservice to be updated to the offline state; and renaming the file name of the health check page file of the microservice to be updated to avoid being detected by the external load device.
[0037] 3. By adopting the method of waiting for the business being processed by the microservice to be completed and then closing the service for update, the present invention ensures that the business process will not fail due to forced interruption. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Other features, objectives and advantages of the present invention will become more apparent by reading the following detailed description of non - restrictive embodiments with reference to the accompanying drawings:
[0039] Figure 1 It is a schematic flow diagram of the method of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0040] The present invention will be described in detail below with reference to specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but do not limit the present invention in any form. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several changes and improvements can still be made. These all fall within the protection scope of the present invention.
[0041] In order to perform microservice application updates seamlessly and smoothly and prevent business exceptions caused by microservice interruptions during deployment, the present invention realizes: 1) Without affecting microservice processing, change the status of the microservice to be updated to the offline state and ensure that the caller can detect this offline state, so that new business requests will no longer be transferred to this service; 2) After the business being processed by this microservice is completed, then close the service for update and startup; 3) Restore the microservice to the online state to provide services externally. Among them, for the offline state of the microservice, different methods are adopted for different microservice call relationships: A. For microservices only called by other microservices in the service registry. Utilize the service status detection and service forwarding mechanisms of the microservice registry to take the microservice offline in the registry before update. At this time, the ongoing business processing will not be affected, but business requests from other microservices will no longer be transferred to this service; B. For microservices called by external load devices (such as F5, LVS, etc.). Since external load devices cannot obtain the microservice status in the registry, special processing is required for these microservices. Configure the health detection method of the load device as: detect through the health detection page, remove the health detection page before update, and restore the health detection page after update.
[0042] The following specifically describes the method flow steps of the present invention.
[0043] According to a method for uninterrupted microservice deployment provided by the present invention, it includes:
[0044] Step S1: Determine the type of the microservice to be updated and perform corresponding processing;
[0045] Step S1.1: For a microservice that is only called by other microservices in the registry, send a shutdown instruction to the registry to shut down the microservice in the registry.
[0046] Step S1.2: For microservices called by external load devices (regardless of whether the microservice is called by other microservices in the registration center), rename the health detection page file of the microservice so that it cannot be detected by the load device;
[0047] Step S2: Wait for a certain period of time, and after the business being processed by the microservice is completed, shut down the service;
[0048] Step S3: Service update and startup;
[0049] Step S4: The service is back online;
[0050] Step S4.1: For microservices that are only called by other microservices in the registry, they will be automatically online in the registry after the service is started, without any additional steps;
[0051] Step S4.2: For the microservice called by the external load device, restore the health detection page file of the microservice to the original file name so that it can be detected by the load device.
[0052] The present invention also provides a non-interruptible microservice deployment system. The non-interruptible microservice deployment system can be implemented by executing the process steps of the non-interruptible microservice deployment method. That is, those skilled in the art can understand the non-interruptible microservice deployment method as a preferred embodiment of the non-interruptible microservice deployment system. Specifically, the non-interruptible microservice deployment system provided by the present invention includes:
[0053] The first processing module is configured to modify the attributes of the microservice to be updated according to the type of the microservice to be updated, wherein the attributes are used to indicate to the caller that the microservice is to be updated.
[0054] The second processing module: After the business being processed by the microservice to be updated is completed, the microservice to be updated is closed;
[0055] The third processing module updates the microservice and starts the updated microservice;
[0056] The fourth processing module: put the updated microservice back online.
[0057] The first processing module includes:
[0058] Renaming module: If there is an external load device among the callers of the microservice to be updated, rename the health check page file of the microservice to be updated so that the health check page file cannot be detected by the external load device; wherein, the attribute includes the health check page file name.
[0059] Offline module: If the callers of the microservice to be updated are only other microservices within the registration center, send an offline instruction to the registration center to take the microservice to be updated offline in the registration center and enter the offline state; wherein, the attribute includes the online status.
[0060] The fourth processing module includes:
[0061] Restoring name module: For the microservice whose name was renamed before the update, restore the health check page file to the original file name before renaming.
[0062] Online module: For the microservice that was offline before the update, automatically go online in the registration center and enter the online state to provide services externally.
[0063] When the microservice is in the offline state, other microservices within the registration center, as callers, based on the detected offline state, ensure that new business requests will no longer be transferred to the microservice to be updated; after the health check page file of the microservice is renamed, it cannot be detected by the external load detection device.
[0064] Those skilled in the art know that in addition to implementing the system, device, and its various modules provided by the present invention in the form of pure computer-readable program code, it is entirely possible to logically program the method steps to enable the system, device, and its various modules provided by the present invention to be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers, etc., to achieve the same program. Therefore, the system, device, and its various modules provided by the present invention can be considered as a kind of hardware component, and the modules included therein for implementing various programs can also be regarded as the structure within the hardware component; the modules for implementing various functions can also be regarded as both software programs for implementing the method and the structure within the hardware component.
[0065] According to a computer-readable storage medium storing a computer program provided by the present invention, characterized in that when the computer program is executed by a processor, it implements the steps of the non-interruptive microservice deployment method.
[0066] According to an electronic device provided by the present invention, including a memory, a processor, and a computer program stored on the memory and executable on the processor, when the computer program is executed by the processor, it implements the steps of the non-interruptive microservice deployment method.
[0067] The specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. Without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.
Claims
1. A method for uninterrupted microservice deployment, characterized in that, include: First processing step: modifying the attributes of the microservice to be updated according to the type of the microservice to be updated, wherein the attributes are used to indicate to the caller that the microservice is to be updated; Second processing step: After the business being processed by the microservice to be updated is completed, the microservice to be updated is closed; The third processing step is to update the microservice and start the updated microservice; Fourth processing step: Bring the updated microservice back online; The first processing step comprises: Renaming step: if there is an external load device in the caller of the microservice to be updated, rename the health detection page file of the microservice to be updated so that the health detection page file cannot be detected by the external load device; wherein the attribute includes the health detection page file name; Offline step: If the callers of the microservice to be updated are only other microservices in the registration center, a offline instruction is sent to the registration center to take the microservice to be updated offline in the registration center and enter the offline state; wherein the attributes include whether the microservice is online; The fourth processing step comprises: Rename step: For microservices that were renamed before the update, restore the health check page file to its original name before the name change; Online steps: For microservices that were offline before the update, they are automatically online in the registration center and enter the online state to provide external services.
2. The uninterrupted microservice deployment method according to claim 1, wherein When a microservice is offline, other microservices in the registration center, as callers, detect the offline state so that new business requests will no longer be transferred to the microservice to be updated. After the health detection page file of the microservice is renamed, it cannot be detected by external load detection equipment.
3. A micro-service deployment system without interruption, characterized in that, include: The first processing module is configured to modify the attributes of the microservice to be updated according to the type of the microservice to be updated, wherein the attributes are used to indicate to the caller that the microservice is to be updated. The second processing module: After the business being processed by the microservice to be updated is completed, the microservice to be updated is closed; The third processing module updates the microservice and starts the updated microservice; The fourth processing module: put the updated microservice back online; The first processing module includes: Rename module: if there is an external load device in the caller of the microservice to be updated, rename the health detection page file of the microservice to be updated so that the health detection page file cannot be detected by the external load device; wherein the attribute includes the health detection page file name; Offline module: If the callers of the microservice to be updated are only other microservices in the registration center, a offline instruction is sent to the registration center to take the microservice to be updated offline in the registration center and put it into the offline state; wherein the attributes include whether it is online; The fourth processing module includes: Rename module: For microservices that were renamed before the update, the health check page file is restored to the original file name before the name change; Online module: For microservices that were offline before the update, they are automatically put online in the registration center and enter the online state to provide external services.
4. The uninterrupted microservice deployment system according to claim 3, wherein When a microservice is offline, other microservices in the registration center, as callers, detect the offline state so that new business requests will no longer be transferred to the microservice to be updated. After the health detection page file of the microservice is renamed, it cannot be detected by the external load detection device.
5. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the uninterrupted microservice deployment method described in any one of claims 1 to 2.
6. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the computer program is executed by a processor, it implements the steps of the uninterrupted microservice deployment method described in any one of claims 1 to 2.
Citation Information
Patent Citations
Micro-service automatic put-out-of-service method and device, computer equipment and storage medium
CN111176873A
Configuration file management method and device
CN112612541A
Version updating method and device, electronic equipment and storage medium
CN113515297A