CN111488201A - Deployment and operation method of micro-service - Google Patents
Deployment and operation method of micro-service Download PDFInfo
- Publication number
- CN111488201A CN111488201A CN202010598091.9A CN202010598091A CN111488201A CN 111488201 A CN111488201 A CN 111488201A CN 202010598091 A CN202010598091 A CN 202010598091A CN 111488201 A CN111488201 A CN 111488201A
- Authority
- CN
- China
- Prior art keywords
- service
- starting
- micro
- executor
- support component
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/4557—Distribution of virtual machine instances; Migration and load balancing
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a micro-service deployment and operation method which comprises a service construction stage, a service deployment starting stage and a service stop unloading stage. The user sends a service starting instruction through the service controller, the service controller obtains the initialization parameters, the service starting parameters configured by the user and the service running mode, the service package is placed under the appointed path of the actuator, and the actuator realizes the starting running of the service under the running condition. The service support component starts a thread, periodically checks the service registration information and informs the service controller of the service starting condition. The user sends out a service stop instruction through the service controller, the service controller informs the executor to unload the specified service, the executor executes to close and delete the specified service, and the service support component realizes canceling the service registration reporting thread. In the invention, each micro-service exists as a separate module without mutual interference, and the consumption of hardware resources by a service process can be obviously reduced by selecting single-process deployment.
Description
Technical Field
The invention provides a micro-service deployment and operation method, mainly relates to the deployment and operation related technology of a software system, and can realize the deployment and operation of the software system developed based on Java language and micro-service architecture under the condition of limited hardware resources.
Background
With the wide application of micro-service architecture, a large and complex application program can organize a same set of functions together to provide services to service consumers around a specific service according to reusable dimensions. The services are coordinated and matched with each other, and the services are communicated with each other by adopting a lightweight communication mechanism. Each service runs as a separate process and can be deployed independently into the production environment.
In the initial stage of service development, the system usually has relatively small user quantity and relatively simple function. Nevertheless, in consideration of the maintainability and the expandability of the system in the later stage, many systems are still designed and developed by using a software architecture based on the micro-service, and a simple system is divided into a plurality of micro functional unit modules with independence according to specific services, so that loose coupling among the functional units is realized, and a plurality of micro service applications are formed.
Conventionally, each business service is deployed locally on a server in a separate process and multiple pairs. At this stage, however, the hardware budget is also insufficient, and a large number of service copies run on the server in an independent process manner, which may cause high memory overhead and frequent context switching of the process, thereby affecting service efficiency and service quality. This greatly affects the deployment and operation of software systems developed based on microservice architectures on small-scale hardware clusters.
In order to solve the defect, the invention provides a micro-service deployment and operation method, which can obviously reduce the hardware resource consumption of a micro-service architecture software system under the conditions of not increasing the hardware resource overhead, not changing the software system architecture and not modifying the software source code, and simultaneously reserve the capability of seamlessly switching to complete service deployment and operation, thereby providing powerful guarantee for hardware resource expansion and system upgrading in the future.
Disclosure of Invention
The present invention is directed to a method for deploying and operating a microservice, which addresses the limitations and disadvantages of the prior art.
The purpose of the invention is realized by the following technical scheme: the micro-service single-process deployment method provided by the invention is a deployment method for realizing deployment of a plurality of service copies in the same Web server. The executor is a Web application server that supports Servlet specifications, such as Tomcat, Jetty, Jboss, etc. The service controller and the service support component are indispensable modules for service governance in a micro-service architecture, wherein the service controller provides service starting and service stopping functions, and the service support component provides service registration and discovery functions. The invention provides a micro-service deployment and operation method, which comprises the following steps:
(1) service construction: all the microservices need to be introduced into a service support component in a microservice architecture in the construction stage, and the service compiling and packaging are executed by using the custom plug-in.
(1.1) the development of the microservice needs to conform to Servlet specifications.
And (1.2) the self-defined plug-in is a service compiling and packaging plug-in realized based on a Maven packaging plug-in, and the function of compiling and packaging files such as Class files, resource files, third party dependence and the like into an independent service package is realized.
(2) Service deployment initiation: firstly, a user sends a service starting instruction through a service controller, secondly, the service controller obtains an initialization parameter, a service starting parameter configured by the user and a service running mode, and thirdly, the service package is placed under an actuator specified path. And (3) continuously scanning the path designated by the executor under the condition that the executor is not restarted, and executing the step (2.1) and the step (2.2) to realize the starting operation and the registration process of the service if a newly added service package is found. Because the microservice development conforms to the Servlet specification, the enforcer will execute the launch logic in the service support component after the Servlet container is launched.
(2.1) the operation steps of the actuator for realizing the starting operation of the service are as follows: firstly, the executor decompresses the service package, and then creates and uses a flat class loader to analyze and load the dynamic service package, so as to realize the starting and running of the service.
(2.2) the start-up logic in the service support component is as follows: firstly, the service supporting component obtains service starting parameters, secondly, the initialization of the Spring container is entrusted to a Spring factory to be completed, and finally, after the initialization of the Spring container is completed, the service registration reporting operation is realized.
(3) Service stop offload: first, the user issues a service stop command through the service controller, and then the service controller notifies the executor to uninstall the specified service.
(3.1) service stop operation: the service support component interrupts the service registration reporting thread.
(3.2) service offload operation: the executor destroys the Servlet container when unloading the specified service, destroys the Spring container when destroying the Servlet container, and executes the operation of closing the relevant thread in the container by the service unloading logic in the service support component when destroying the Spring container because the micro-service development conforms to the Servlet specification.
Through the three steps, the consumption of the service copy on the hardware resources can be obviously reduced under the condition that the hardware resources are limited, the smooth transition of the service deployment mode is completed after the hardware resources are promoted, the source codes do not need to be changed, and the service migration deployment can be quickly completed without changing the architecture of a software system.
Drawings
FIG. 1 is a schematic diagram of a microservice single process deployment;
FIG. 2 is a timing diagram of actuator startup and initialization;
FIG. 3 is a flow diagram of service deployment and initiation;
fig. 4 is a flow chart of service stop and offload.
Detailed Description
The invention is described in further detail below with reference to the figures and the examples of embodiment.
The micro-service single-process deployment mentioned in the present invention is a deployment manner that multiple service copies are deployed in the same Web server, and referring to fig. 1, three micro-services are respectively service a, service B, and service C deployed in the same Web server, i.e., an executor.
The executor mentioned in the invention is a Web application server supporting Servlet specification, such as Tomcat, Jetty, Jboss, etc., as shown in fig. 2, the executor starting process is to call an Init method to initialize step by step, call a Start method to Start, and select a function of adding timing registration and reporting executor node information after the executor is started through an analysis process.
The service controller and the service support component are indispensable modules for service governance in a micro-service architecture, wherein the service controller provides service starting and service stopping functions, and the service support component provides service registration and discovery functions.
The method for deploying and operating the micro-service specifically comprises the following steps:
(1) service construction: all the microservices need to be introduced into a service support component in a microservice architecture in the construction stage, and the service compiling and packaging are executed by using the custom plug-in.
(1.1) the development of the microservice needs to conform to Servlet specifications.
And (1.2) the custom plug-in is a service compiling and packaging plug-in realized based on a Maven packaging plug-in, and the function of compiling and packaging files such as Class files, resource files, third party dependencies and the like into an independently operable service package is realized.
(2) Service deployment initiation: as shown in fig. 3, firstly, the user sends a service start instruction through the service controller, secondly, the service controller obtains the initialization parameter, the service start parameter configured by the user, and the service running mode, and secondly, places the service package under the path specified by the executor. And (3) under the condition that the executor runs, continuously scanning the executor specified path, and executing the step (2.1) and the step (2.2) to realize the starting operation and the registration process of the service if a newly added service package is found. Because the microservice development conforms to the Servlet specification, the enforcer will execute the launch logic in the service support component after the Servlet container is launched.
(2.1) the operation steps of the actuator for realizing the starting operation of the service are as follows: firstly, the executor decompresses the service package, and then creates and uses a flat class loader to analyze and load the dynamic service package, so as to realize the starting and running of the service.
(2.2) the start-up logic in the service support component is as follows: firstly, the service supporting component obtains service starting parameters, secondly, the initialization of the Spring container is entrusted to a Spring factory to be completed, and finally, after the initialization of the Spring container is completed, the service registration reporting operation is realized.
(3) Service stop offload: as shown in fig. 4, first, the user notifies the service application program to perform a service stop operation through the service controller, and then the service controller notifies the executor to uninstall the specified service application program.
(3.1) service stop operation: the service support component provides monitoring and subscribing of events by using Spring, and interrupts the service registration reporting thread.
(3.2) service offload operation: the executor destroys the Servlet container when uninstalling the specified application program, and destroys the Spring container first when destroying the Servlet container, because the microservice development conforms to the Servlet specification, the executor executes the operation of closing the relevant thread in the container by the service uninstalling logic in the service support component when destroying the Spring container.
Through the steps, the functions of deployment and micro-service operation of a software system developed based on Java language and micro-service architecture can be realized under the condition of limited hardware resources.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and should not be taken as limiting the invention, so that any modifications, equivalents, improvements, etc. made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims (10)
1. A method for deploying and operating micro-services, the method comprising:
(1) service construction: the development of the micro service needs to meet Servlet specifications, the micro service introduces a service support component in a construction stage, and a user-defined plug-in is used for executing service compiling and packaging;
(2) service deployment initiation: a user sends a service starting instruction through a service controller, the service controller obtains an initialization parameter, a service starting parameter configured by the user and a service running mode, and a service package is placed under an actuator specified path; under the condition that the executor is not restarted, scanning an executor specified path, and if a newly added service package is found, executing the starting operation and registration process of the service; the executor executes the starting logic in the service support component after the Servlet container is started;
(3) service stop offload: the user sends out a service stop instruction through the service controller, and the service controller informs the executor to unload the specified service.
2. The method for deploying and running the micro-service according to claim 1, wherein the operation steps of the executor for starting and running the service are as follows: firstly, the executor decompresses the service package, and then creates and uses a flat class loader to analyze and load the dynamic service package, so as to realize the starting and running of the service.
3. The method of claim 1, wherein the start-up logic in the service support component is as follows: firstly, the service supporting component obtains service starting parameters, secondly, the initialization of the Spring container is entrusted to a Spring factory to be completed, and finally, after the initialization of the Spring container is completed, the service registration reporting operation is realized.
4. The microservice deployment and operation method according to claim 1, wherein the service stop operation is specifically: the service support component provides monitoring and subscribing of events by using Spring, and interrupts the service registration reporting thread.
5. The method of claim 1, wherein the executor destroys the Servlet container when the specified service is unloaded, destroys the Spring container when the Servlet container is destroyed, and executes the operation of closing the relevant thread in the container by the service unloading logic in the service support component when the Spring container is destroyed.
6. The method for deploying and running the micro-service according to claim 1, wherein the micro-service is deployed by a single process, that is, multiple copies of the service are deployed in the same Web server.
7. The method of claim 1, wherein the executor is a Web application server supporting Servlet specification, including Tomcat, Jetty, Jboss.
8. The method for deploying and operating the micro-service according to claim 1, wherein the starting process of the executor is as follows: and an Init method is called for initializing step by step, a Start method is called for starting, and functions of timed registration and reporting of actuator node information are added after the actuator is started through analysis flow selection.
9. The method for deploying and operating the micro-service according to claim 1, wherein the service controller and the service support component are modules indispensable to service administration in the micro-service architecture, wherein the service controller provides service start and service stop functions, and the service support component provides service registration discovery function.
10. The microservice deployment and operation method of claim 1, wherein the custom plug-in is a service compilation and packaging plug-in implemented based on a Maven packaging plug-in, which implements compilation and packaging of files into an independently operable service package.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010598091.9A CN111488201B (en) | 2020-06-28 | 2020-06-28 | Deployment and operation method of micro-service |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010598091.9A CN111488201B (en) | 2020-06-28 | 2020-06-28 | Deployment and operation method of micro-service |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111488201A true CN111488201A (en) | 2020-08-04 |
CN111488201B CN111488201B (en) | 2020-11-03 |
Family
ID=71795798
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010598091.9A Active CN111488201B (en) | 2020-06-28 | 2020-06-28 | Deployment and operation method of micro-service |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111488201B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111782233A (en) * | 2020-08-05 | 2020-10-16 | 绵阳市智慧城市产业发展有限责任公司 | Micro-service multi-scenario deployment adaptive design model |
CN117331675A (en) * | 2023-11-27 | 2024-01-02 | 云筑信息科技(成都)有限公司 | Graceful start-stop method in micro service |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106790059A (en) * | 2016-12-20 | 2017-05-31 | Tcl集团股份有限公司 | Intelligent television Launcher cloud systems service calling method and system |
-
2020
- 2020-06-28 CN CN202010598091.9A patent/CN111488201B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106790059A (en) * | 2016-12-20 | 2017-05-31 | Tcl集团股份有限公司 | Intelligent television Launcher cloud systems service calling method and system |
Non-Patent Citations (2)
Title |
---|
CHRIS RICHARDSON等: "《microservices from design to deployment》", 31 December 2016, NGINX * |
JIMBO_LIU: "SpringBoot Web项目打包后快速生成Windows下服务注册、卸载、服务运行停止、控制台运行等小程序", 《HTTPS://BLOG.CSDN.NET/LIU_JINPING_/ARTICLE/DETAILS /103075643》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111782233A (en) * | 2020-08-05 | 2020-10-16 | 绵阳市智慧城市产业发展有限责任公司 | Micro-service multi-scenario deployment adaptive design model |
CN117331675A (en) * | 2023-11-27 | 2024-01-02 | 云筑信息科技(成都)有限公司 | Graceful start-stop method in micro service |
CN117331675B (en) * | 2023-11-27 | 2024-03-26 | 云筑信息科技(成都)有限公司 | Graceful start-stop method in micro service |
Also Published As
Publication number | Publication date |
---|---|
CN111488201B (en) | 2020-11-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111488201B (en) | Deployment and operation method of micro-service | |
WO2002084479A2 (en) | Method and apparatus for performing online application upgrades in a java platform | |
CN111897539B (en) | Method and device for deploying application according to service roles | |
CN111610985B (en) | Kubernetes cluster rapid deployment method on domestic platform | |
WO2002075540A2 (en) | Method and apparatus for providing application specific strategies to a java platform including load balancing policies | |
CN111061487A (en) | Container-based load balancing distributed compiling system and method | |
CN113419750B (en) | Model reasoning service calling system and method | |
CN111966366A (en) | Cluster deployment method and device of multi-CPU architecture | |
CN113779477A (en) | Assembly line publishing method and system based on PaaS cloud platform | |
WO2002084487A2 (en) | Method and apparatus for performing failure recovery in a java platform | |
US7177934B2 (en) | Method and apparatus for providing application specific strategies to a JAVA platform including start and stop policies | |
CN112015438B (en) | Lightweight containerized distributed system based on infrastructure and deployment method | |
CN116450153B (en) | Rapid deployment method for containerized simulation platform | |
CN109032674B (en) | Multi-process management method, system and network equipment | |
CN114553703B (en) | Deployment method, device, equipment and storage medium of industrial equipment control strategy | |
CN106815056B (en) | Application heat deployment method and device based on JCL framework | |
CN110837394B (en) | High-availability configuration version warehouse configuration method, terminal and readable medium | |
CN108228192B (en) | Method for realizing dynamic management of service-oriented airborne software | |
CN115145604A (en) | Containerized electric power marketing system deployment method | |
CN113010531B (en) | Block chain BAAS system task scheduling framework based on directed acyclic graph | |
CN112035352B (en) | Cloud lifecycle management-based rapid automatic compiling and deploying method | |
CN108958745A (en) | A kind of device and method in cloud platform deployment Spark cluster | |
CN113867776A (en) | Method and device for publishing middle station application, electronic equipment and storage medium | |
Dong et al. | SADE: a development environment for adaptive multi-agent systems | |
CN116541035A (en) | Method, system, equipment and medium for upgrading container orchestration engine |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |