Service deployment method, device, electronic device, storage medium and program product
By identifying the path and target deployment package information of the public dependency library in the microservice description file, loading the required deployment packages, solving the problem of inefficient deployment of microservices and achieving an efficient deployment process.
Patent Information
- Application Number
- CN202411975091.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-04
AI Technical Summary
In the microservice architecture, the deployment of each microservice needs to rely on a large number of dependency libraries, configuration files, log files, etc., resulting in a huge overall installation package size of the application, increasing the cost of storage and transmission, and reducing deployment efficiency.
By identifying the first path and target deployment package information of the public dependency library in the description file of each microservice, accessing the public dependency library and loading the required target deployment package, the efficient deployment of the microservice is achieved.
The cost of storage and transmission of the corresponding deployment packages of each microservice is reduced, the deployment efficiency of microservices is improved, and the deployment time is shortened.
Smart Images

Figure CN119759377A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communications, and in particular to a service deployment method, device, electronic device, storage medium and program product. Background Art
[0002] Microservice architecture improves the scalability, maintainability, and flexibility of applications by splitting large applications into multiple small, independent microservices.
[0003] As the number of split microservices increases, the deployment of each microservice needs to rely on a large number of deployment packages such as dependent libraries, configuration files, log files, etc., resulting in a large overall installation package for the application. During the deployment of each microservice, the corresponding deployment package of each microservice is transmitted and stored to the node where the corresponding microservice is deployed. This process increases the storage and transmission costs, resulting in low deployment efficiency of the microservice. Summary of the invention
[0004] The present application provides a service deployment method, device, electronic device, storage medium and program product to solve the problem of low service deployment efficiency.
[0005] In a first aspect, the present application provides a controller applied to a main system, the method comprising:
[0006] Identify a first path of a common dependency library in a description file corresponding to each microservice, and identify target deployment package information in a description file corresponding to each microservice, wherein the common dependency library includes multiple deployment packages, and different deployment packages correspond to different deployment package information;
[0007] Accessing the common dependency library based on the first path, and loading the target deployment package corresponding to the target deployment package information of each microservice in the common dependency library;
[0008] The deployment of the corresponding microservices is realized based on the target deployment package of each microservice.
[0009] In an implementable manner, the description file further includes a second path of a business database and target business data information, the business database includes a plurality of business data, and different business data corresponds to different business data information. Before the target deployment package based on each microservice implements the deployment of the corresponding microservice, the method further includes:
[0010] Accessing the business database based on the second path, and loading target business data corresponding to the target business data information of each microservice in the business database;
[0011] The target deployment package based on each microservice implements the deployment of the corresponding microservice, including:
[0012] Deploy the corresponding microservices based on the target deployment package and target business data of each microservice.
[0013] In this manner, the target business data required by each microservice is loaded through the second path and target business information in the description file, so that when the microservice is deployed, the business corresponding to the microservice can be deployed.
[0014] In an achievable manner, before identifying the first path of the common dependency library in the description file corresponding to each microservice, the method further includes:
[0015] Build the common dependency library based on the deployment packages of each microservice;
[0016] The first path of the common dependency library is written into the description file corresponding to each microservice, and the target deployment package information required for the deployment of the corresponding microservice is written into the description file of each microservice.
[0017] In this method, a public dependency library is built, and the first path and target deployment package information are written in the description file. In this way, when the microservice is started, it is not necessary to load all deployment packages of the public dependency library, but only the target deployment package corresponding to the target deployment information package information needs to be loaded.
[0018] In one achievable manner, the common dependency library is constructed based on the deployment packages of each microservice, including:
[0019] Merging the deployment packages of the microservices to determine a deployment file set;
[0020] Deduplication processing is performed on the deployment packages in the deployment file set to determine the common dependency library.
[0021] In this method, the deployment package of each microservice is extracted and deduplication is performed to build a common dependency library, which significantly reduces the amount of data stored for microservice deployment.
[0022] In one possible implementation, the method further includes:
[0023] Updating at least one deployment package in the public dependency library to determine an updated public dependency library;
[0024] In response to the updated common dependency library, the updated common dependency library is accessed based on the first path, and the target deployment package corresponding to the target deployment package information of each microservice is loaded in the updated common dependency library, and the deployment of the corresponding microservice is implemented based on the target deployment package of each microservice.
[0025] In this way, the public dependency library can be updated directly to improve the efficiency of deployment package updates.
[0026] In an implementable manner, the step of identifying the first path of the common dependency library in the description file corresponding to each microservice includes:
[0027] Based on the class loader, the first path of the common dependency library is identified in the description file corresponding to each microservice.
[0028] In this manner, the first path can be identified by the class loader, so that the public dependency library can be accessed through the first path.
[0029] In a second aspect, the present application provides a service deployment device for a distributed system, the device comprising:
[0030] An identification module is used to identify a first path of a common dependency library in a description file corresponding to each microservice, and to identify target deployment package information in a description file corresponding to each microservice, wherein the common dependency library includes multiple deployment packages, and different deployment packages correspond to different deployment package information;
[0031] A loading module, used to access the common dependency library based on the first path, and load the target deployment package corresponding to the target deployment package information of each microservice in the common dependency library;
[0032] The deployment module is used to deploy the corresponding microservices based on the target deployment package of each microservice.
[0033] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0034] The memory stores computer-executable instructions;
[0035] The processor executes the computer-executable instructions stored in the memory to implement the method according to the first aspect.
[0036] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.
[0037] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
[0038] The service deployment method, device, electronic device, storage medium and program product provided by the present application write the first path of the common dependency library and the target deployment package information required by the microservice in the description file of each microservice. Therefore, when the microservice is deployed, based on the description file corresponding to the microservice, the common dependency library can be accessed through the first path, and the required target deployment package can be loaded in the common dependency library through the target deployment package information. After loading the target deployment package, the corresponding microservice can be deployed through the target deployment package. In this process, the deployment package required by each microservice is stored in the common dependency library, which can reduce the cost of separate storage and transmission of the corresponding deployment package of each microservice. When the microservice is deployed, the required target deployment package is directly loaded in the common dependency library, so that the microservice can be efficiently deployed through the deployment package. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0040] Figure 1 is an implementation scenario diagram shown in an exemplary embodiment;
[0041] Figure 2 is a flow chart of a service deployment method shown in an exemplary embodiment;
[0042] Figure 3 is a relationship diagram of a microservice and a common dependency library shown in an exemplary embodiment;
[0043] Figure 4 is a flow chart of a service deployment method shown in another exemplary embodiment;
[0044] Figure 5 is a flow chart of a service deployment method shown in another exemplary embodiment;
[0045] Figure 6 is a structural diagram of a service deployment device shown in an exemplary embodiment;
[0046] Figure 7 It is a block diagram of an electronic device shown in an exemplary embodiment.
[0047] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0048] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0049] Microservice architecture improves the scalability, maintainability and flexibility of the system by splitting large applications into multiple small, independent services. However, this also brings problems such as an increase in the number of services, complex dependencies, increased management difficulty, and redundant dependency packages.
[0050] As the number of split microservices increases, each service may contain a large number of dependent libraries, configuration files, log files, etc., resulting in a large overall installation package size, which increases storage and transmission costs and prolongs deployment time.
[0051] Each update or deployment of microservices requires manual configuration of the environment, installation of dependencies, and startup of services. The process is cumbersome and error-prone. At the same time, due to the differences between different environments, the performance of the application in different environments may be inconsistent.
[0052] Java (a programming language)-based microservices are suitable for a variety of application fields. They face a variety of deployment scenarios during deployment and complex business systems with multiple modules. The corresponding split Java microservices face problems such as large service installation packages and slow construction, distribution and deployment during development, deployment, and online upgrades.
[0053] The service deployment method, device, electronic device, storage medium and program product provided in this application are intended to solve the above technical problems of the prior art.
[0054] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0055] The service deployment method provided in this application can be implemented on any electronic device with data processing capabilities, or it can be a service deployment system. It should be noted that the service deployment system can be deployed separately on an electronic device in any environment (for example: deployed separately on an edge server in an edge environment), or it can be deployed entirely in a cloud environment, or it can be deployed in a distributed manner in different environments.
[0056] For example, the service deployment system can be logically divided into multiple parts, each with different functions. The various parts in the service deployment system can be deployed in any two or three of the electronic device (located on the user side, such as the client), the edge environment, and the cloud environment. The edge environment is an environment that includes a collection of edge electronic devices that are close to the electronic device. The edge electronic devices include: edge servers, edge stations with computing power, etc. The various parts of the container startup system deployed in different environments or devices work together to realize the functions of the data processing platform.
[0057] It should be understood that this application does not make any restrictive division on which parts of the service deployment system are deployed and in what specific environment. In actual application, it can be adaptively deployed according to the computing power of the electronic device, the resource availability of the edge environment and the cloud environment, or the specific application requirements.
[0058] like Figure 1 This is an implementation scenario diagram showing an exemplary embodiment. The service deployment system corresponding to the implementation scenario includes a client 10 and a server 11. The client 10 and the server 11 are connected via network communication.
[0059] The execution subject of the method of the embodiment of the present application is the server 11, and the client 10 can receive a microservice deployment request. The client 10 sends the microservice deployment request to the server 11 through the network. The server 11 performs service deployment and can feed back the microservice deployment result to the client 10 through the network. The client 10 has a graphic user interface, and the microservice deployment result can be displayed on the graphic interface.
[0060] In some embodiments, after receiving a microservice deployment request, the server 11 identifies the first path of the common dependency library in the description files corresponding to each microservice, and identifies the target deployment package information in the description files corresponding to each microservice, the common dependency library includes multiple deployment packages, and different deployment packages correspond to different deployment package information; the common dependency library is accessed based on the first path, and the target deployment package corresponding to the target deployment package information of each microservice is loaded in the common dependency library; and the deployment of the corresponding microservice is implemented based on the target deployment package of each microservice.
[0061] It is understandable that the service deployment device can be set at Figure 1 In the server 11, but the example shown in this embodiment Figure 1 The implementation environment shown is only exemplary. In other embodiments, the service deployment method may also be applied to other implementation environments, and the service deployment device may also be set in other structures in other implementation environments, which is not specifically limited here.
[0062] In this embodiment, the client 10 is an electronic device on the user side, which can be a wired terminal with a visualization structure or a wireless terminal. In other embodiments, the terminal can be an electronic device with a visualization structure such as a mobile phone, a computer, a tablet, and a vehicle-mounted device.
[0063] The server 11 can be an edge environment and a cloud environment, such as a physical server, a server cluster, and a cloud server, etc., and no specific limitations are given here.
[0064] Figure 2 is a flowchart of a service deployment method shown in an exemplary embodiment, which is applied to Figure 1 The server 11 in Figure 2 As shown, the method includes steps S201 to S203, which are described in detail as follows:
[0065] S201. Identify a first path of a common dependency library in a description file corresponding to each microservice, and identify target deployment package information in a description file corresponding to each microservice. The common dependency library includes multiple deployment packages, and different deployment packages correspond to different deployment package information.
[0066] In some embodiments, each microservice has a corresponding deployment package, through which the microservice can be deployed.
[0067] In some embodiments, the deployment packages of each microservice are uniformly stored in a common dependency library. When a microservice is deployed, the deployment package required to deploy the microservice can be loaded by accessing the common dependency library, thereby deploying the corresponding microservice.
[0068] In some embodiments, there are multiple deployment packages in the public dependency library, any two deployment packages are different, and different deployment packages correspond to different deployment package information. The deployment package information can be the name of the deployment package, or it can be a collection of the name of the deployment package and the file suffix. No specific restrictions are made here.
[0069] In some embodiments, different microservices correspond to one or more deployment packages, and the deployments of different microservices may include the same deployment packages. For a deployment package stored in the public dependency library, different microservices can load the deployment package to implement the deployment of the corresponding microservices when deployed, thereby reducing the amount of data stored in the public dependency library.
[0070] In some embodiments, different microservices correspond to description files, such as a MANIFEST.MF file, which contains a first path to a common dependency library. Thus, when a microservice is deployed, it can access the common dependency library located under the first path through the first path in the corresponding description file.
[0071] In some embodiments, each microservice corresponding description file also contains target deployment information required for the deployment of the corresponding microservice. Through the target deployment package information, the target deployment package required for the deployment of the microservice can be located in the public dependency library.
[0072] In some embodiments, for Java microservices, the deployment package in the common dependency library is a jar package (a file format used to package and distribute Java programs). Since the deployment packages of multiple microservices are stored in the common dependency library, the jar package can be called a common jar package.
[0073] S202: Access the public dependency library based on the first path, and load the target deployment package corresponding to the target deployment package information of each microservice in the public dependency library.
[0074] In some embodiments, for microservices that need to be deployed, the first path and target deployment package information can be determined through the description file corresponding to the microservice, so that the public dependency library can be accessed through the first path, and the target deployment package required by each microservice can be determined through the target deployment package information, and the loading of the target deployment package can be realized.
[0075] like Figure 3 As shown, the target deployment package required by each microservice can be loaded by accessing the public dependency library.
[0076] like Figure 3 Four microservices are shown in the figure. In other embodiments, another number of microservices may access the common dependency library when deployed.
[0077] In some embodiments, for a microservice, its corresponding deployment node can load the target deployment package required by the microservice, thereby implementing the deployment of the microservice through the loaded target deployment package.
[0078] In some embodiments, the deployment package corresponds to the deployment package information one-to-one, so that the corresponding target deployment package can be determined through the target deployment package information.
[0079] Different microservices load different target deployment packages.
[0080] In some embodiments, different microservices have corresponding target deployment package information that is different.
[0081] The target deployment package information may include one deployment package information or multiple deployment package information, which is determined according to the number of target deployment packages required by the corresponding microservice.
[0082] S203: Deploy the corresponding microservice based on the target deployment package of each microservice.
[0083] In some embodiments, after the target deployment package of each microservice is determined and the target deployment package is loaded, that is, the target deployment packages required by different microservices are loaded in the cache, at this time, the deployment of the corresponding microservice can be directly implemented based on the target deployment package loaded in the cache.
[0084] In some embodiments, the target deployment package is an executable file, and the deployment of the microservice can be achieved by running the target deployment package.
[0085] In an embodiment of the present application, by writing the first path of the common dependency library and the target deployment package information required by the microservice in the description file of each microservice, when the microservice is deployed, based on the description file corresponding to the microservice, the common dependency library can be accessed through the first path, and the required target deployment package can be loaded in the common dependency library through the target deployment package information. After loading the target deployment package, the corresponding microservice can be deployed through the target deployment package. In this process, the deployment package required by each microservice is stored in the common dependency library, which can reduce the cost of separate storage and transmission of the corresponding deployment package of each microservice. When the microservice is deployed, the required target deployment package is directly loaded in the common dependency library, so that the microservice can be efficiently deployed through the deployment package.
[0086] Figure 4 is a flowchart of a service deployment method shown in an exemplary embodiment, which is applied to Figure 1 The server 11 in Figure 4 As shown, the method includes step S401 and step S402, which are described in detail as follows:
[0087] S401. Access a business database based on the second path, and load target business data corresponding to target business data information of each microservice into the business database.
[0088] In some embodiments, the description file also includes a second path of a business database and target business data information. The business database includes multiple business data, and different business data corresponds to different business data information.
[0089] Business data is the data required by each microservice to process business. Different microservices correspond to different business data. The business data can be code, that is, the business data is the code required by each microservice to process business.
[0090] For a microservice, its corresponding business data can be carried by one file or multiple files, and there is no specific restriction here.
[0091] The business data information may be a name corresponding to the business data, or may be a collection of a name and a suffix corresponding to the business data, and no specific limitation is made here.
[0092] In some embodiments, the business data of multiple microservices are uniformly stored in a business database, and the second path of the business database is also written in the description file corresponding to each microservice. When each microservice is deployed, it can access the business database through the second path.
[0093] The description file corresponding to each microservice also contains target business data information, through which the target business data required by each microservice can be determined.
[0094] In some embodiments, when deploying a microservice, the business corresponding to the microservice is also deployed. Thus, the target business data required for deploying the microservice can be determined by loading the target business data corresponding to the target business data information of each microservice in the business database.
[0095] In some embodiments, for a microservice, its corresponding target business data is loaded on the node where the microservice is deployed, and the deployment of the microservice can be achieved directly through the loaded microservice.
[0096] In some embodiments, the business data corresponds to the business data information one by one, so that the corresponding target business data is determined through the target business data information.
[0097] In some embodiments, a business data is a package file that carries business data, and the number of business data corresponding to each microservice is one or more, which is determined according to the amount of business data required by the corresponding microservice to perform business.
[0098] In this way, the target deployment package and target business data corresponding to each microservice can be determined through the first path, the second path, the target deployment package information and the target business data information.
[0099] The target deployment package and target business data of each microservice are loaded in the node corresponding to the microservice deployment, and the microservice can be deployed through the loaded target deployment package and target business data.
[0100] With this, Figure 2 Step S203 may include:
[0101] S402: Deploy the corresponding microservice based on the target deployment package and target business data of each microservice.
[0102] In some embodiments, the business data is code, the target deployment package is an executable file, and the deployment of the microservice can be achieved by running the target deployment package and the target business data.
[0103] In an embodiment of the present application, when deploying microservices, the target business data required by each microservice is also loaded through the second path and target business information in the description file, so that when deploying microservices, the business corresponding to the microservice can be deployed, and after the microservice deployment is completed, the microservice can process the corresponding business through the target business data.
[0104] Figure 5 is a flowchart of a service deployment method shown in an exemplary embodiment, which is applied to Figure 1 The server 11 in Figure 5 As shown, the method includes step S501 and step S502. Figure 5 Can be implemented in Figure 2 Previously, the details are as follows:
[0105] S501. Build a common dependency library based on the deployment package of each microservice.
[0106] In some embodiments, microservices correspond to deployment packages. A common dependency library can be constructed by obtaining the deployment packages of each microservice. When the microservices are subsequently deployed, the required target deployment packages can be loaded in the common dependency library to deploy the microservices.
[0107] In some embodiments, the deployment package of each microservice is a build file of the microservice. At this time, the microservice is not built, but the deployment package required to deploy the microservice is built. After obtaining the deployment package, a public dependency library can be established.
[0108] In some implementations, the deployment packages of each microservice are merged to determine a deployment file set; and the deployment packages in the deployment file set are deduplicated to determine a common dependency library.
[0109] When there are two microservices that have the same deployment package, there are two deployment packages in the deployment file set.
[0110] In some embodiments, if there are three microservices, namely microservice A, microservice B and microservice C, the size of the deployment package corresponding to microservice A is a, the size of the deployment package corresponding to microservice B is b, and the size of the deployment package corresponding to microservice C is c, then the size of the deployment file set is a+b+c.
[0111] In some embodiments, the deployment file set may contain identical deployment packages, and thus, the common dependency library can be obtained by deduplicating the deployment packages in the deployment file set.
[0112] Similarly, for microservices A, B, and C, the size of the public dependency library is a+b+c minus the size of the deployment package filtered out by deduplication processing. Therefore, the size of the public dependency library will be significantly lower than the size of the deployment file collection.
[0113] It can be understood that in other embodiments, the deployment package in the common dependency library should be a deployment package of a unified version. Therefore, the deployment packages in the deployment file collection can also be deduplicated, version unified, etc. to obtain the common dependency library.
[0114] In an embodiment of the present application, by extracting the deployment package of each microservice and performing deduplication processing to build a common dependency library, the size of the deployment files required to deploy each microservice is significantly reduced, and the amount of data stored for microservice deployment is reduced.
[0115] In some embodiments, the business data of each microservice may also be extracted and stored in one location to obtain a business database.
[0116] S502: Write the first path of the common dependency library into the description file corresponding to each microservice, and write the target deployment package information required for the deployment of the corresponding microservice into the description file of each microservice.
[0117] In some embodiments, the first path of the common dependency library is written in the description file corresponding to each microservice, and the target deployment package information required for the corresponding microservice to be deployed is written in the description file of each microservice. When the microservice is subsequently deployed, the common dependency library can be accessed through the first path, and the required target deployment file can be loaded through the target deployment package information.
[0118] In some embodiments, a second path of the business database is written in the description file corresponding to each microservice, and target business data information required for deployment of the corresponding microservice is written in the description file of each microservice. When the microservice is subsequently deployed, the business database can be accessed through the second path, and the required target business data can be loaded through the target business data information.
[0119] In an embodiment of the present application, a common dependency library is constructed, and the first path and target deployment package information are written in the description file. In this way, when the microservice is started, it is not necessary to load all the deployment packages of the common dependency library. Only the target deployment package corresponding to the target deployment information package information needs to be loaded to realize the deployment of the microservice, thereby shortening the deployment time of the microservice.
[0120] In some implementations, the common dependency library and the business database may be managed and updated in a unified manner.
[0121] At least one deployment package in a common dependency library is updated to determine an updated common dependency library; in response to the updated common dependency library, the updated common dependency library is accessed based on the first path, and a target deployment package corresponding to the target deployment package information of each microservice is loaded in the updated common dependency library, and the deployment of the corresponding microservice is implemented based on the target deployment package of each microservice.
[0122] In some embodiments, an update interface may be set to directly update the deployment packages in the common dependency library, including updating the information in a deployment package, adding a deployment package, deleting a deployment package, etc., without specific limitations here.
[0123] In some embodiments, the business data in the business database may also be updated, such as updating the content of a business data, deleting business data, adding one or more of business data, which is not specifically limited here.
[0124] In some embodiments, after a deployment package in a common dependency library is updated, an updated common dependency library can be obtained, a response to the updated common dependency library can be set, the updated common dependency library can be accessed based on the first path, and the target deployment package information of each microservice can be loaded in the updated common dependency library. If the target deployment package loaded by a certain microservice is updated, the microservice can be redeployed based on the updated target deployment package. If the target deployment package loaded by a certain microservice is not updated, there is no need to redeploy.
[0125] Similar to the public dependency library, at least one business data in the business database is updated to determine an updated business database; in response to the updated business database, the updated business database is accessed based on the second path, and the target business data corresponding to the target business data information of each microservice is loaded in the updated business database, and the deployment of the corresponding microservice is implemented based on the target deployment package and target business data of each microservice.
[0126] When both the business database and the public dependency library are updated, the updated business database and public dependency library are accessed to determine the target business data and target deployment package of each microservice. If there is an update to the target deployment package and / or the target business data, the corresponding microservice is redeployed based on the updated target deployment package and / or the updated target business data.
[0127] In an embodiment of the present application, common dependency libraries and business data can be uniformly managed and updated, thereby reducing the process of repeated generation of common dependency libraries and business databases, reducing workload and lowering the error rate. This method is suitable for scenarios where deployment packages and business data need to be updated frequently, such as a rapidly iterative development environment.
[0128] In some implementations, a first path of a common dependency library is identified in a description file corresponding to each microservice based on a class loader.
[0129] In some embodiments, the description file is written to the first path, but the native environment cannot recognize the first path in the description file. The Java class loader (such as URLClassLoader) can be modified or extended to enable it to recognize the first path in the description file.
[0130] Similarly, the second path in the description file may also be identified based on the class loading.
[0131] In some embodiments, for Java microservices, a Java class loader, such as URLClassLoader (a class loader in Java), can be modified or extended to enable it to identify the first path and the second path in the description file.
[0132] In an embodiment of the present application, by setting a class loader, the first path in the description file can be identified, so that the public dependency library storing the microservice deployment package can be accessed to achieve subsequent deployment of microservices.
[0133] In an embodiment of the present application, a service deployment method is proposed, in which the deployment packages of each microservice are merged and deduplicated to build a common dependency library, and the business data of each microservice is uniformly stored to build a business database, and the first path of the common dependency library, the second path of the business database, the target business data information and the target deployment package information are written into the description file of each microservice. Therefore, when deploying the microservice, the business database and the common dependency library can be accessed through the first path and the second path of the description file, and the target deployment package and target business data required by each microservice can be loaded through the target business data information and the target deployment package information. Therefore, each microservice can load the target deployment package and target business data required by itself on demand to realize the deployment of the microservice, reduce the deployment time of the microservice, and improve the deployment efficiency.
[0134] This service deployment method is suitable for large-scale microservice architecture systems and scenarios that require frequent updates of dependencies, such as fast-iteration development environments. It can also be used in scenarios that have strict requirements on microservice deployment time and resource usage.
[0135] Figure 6 600 is a structural diagram of a service deployment device shown in an exemplary embodiment. The service deployment device 600 may include:
[0136] An identification module 610 is used to identify a first path of a common dependency library in a description file corresponding to each microservice, and to identify target deployment package information in a description file corresponding to each microservice, wherein the common dependency library includes multiple deployment packages, and different deployment packages correspond to different deployment package information;
[0137] The loading module 630 is used to access the public dependency library based on the first path, and load the target deployment package corresponding to the target deployment package information of each microservice in the public dependency library;
[0138] The deployment module 650 is used to implement the deployment of the corresponding microservice based on the target deployment package of each microservice.
[0139] In an implementable manner, the description file further includes a second path of the business database and target business data information, the business database includes multiple business data, different business data corresponds to different business data information, and before the deployment of the corresponding microservice is implemented based on the target deployment package of each microservice, the service deployment device also includes:
[0140] A business loading module, used to access the business database based on the second path, and load the target business data corresponding to the target business data information of each microservice in the business database;
[0141] The deployment modules include:
[0142] The deployment unit is used to implement the deployment of the corresponding microservice based on the target deployment package and target business data of each microservice.
[0143] In an achievable manner, the service deployment device further includes:
[0144] The construction module is used to build a common dependency library based on the deployment package of each microservice;
[0145] The description file generation module is used to write the first path of the common dependency library into the description file corresponding to each microservice, and write the target deployment package information required for the corresponding microservice to be deployed into the description file of each microservice.
[0146] In one possible implementation, the building blocks include:
[0147] A merging unit is used to merge the deployment packages of each microservice to determine a deployment file set;
[0148] The deduplication unit is used to deduplicate the deployment packages in the deployment file collection to determine the common dependency libraries.
[0149] In one possible implementation, the device further includes:
[0150] An update module, used to update at least one deployment package in a public dependency library to determine an updated public dependency library;
[0151] The redeployment module is used to respond to the updated common dependency library, access the updated common dependency library based on the first path, load the target deployment package corresponding to the target deployment package information of each microservice in the updated common dependency library, and implement the deployment of the corresponding microservice based on the target deployment package of each microservice.
[0152] In one possible implementation, the identification module includes:
[0153] The identification unit is used to identify the first path of the common dependency library in the description file corresponding to each microservice based on the class loader.
[0154] The service deployment device provided in this embodiment can be used to execute the above-mentioned service deployment method. Its implementation principle and technical effects are similar, and this embodiment will not be repeated here.
[0155] Figure 7 is a block diagram of an electronic device shown in an exemplary embodiment, see Figure 7 The electronic device 700 may include: a processor 71 and a memory 72, wherein the processor 71 and the memory 72 may communicate; illustratively, the processor 71 and the memory 72 communicate via a communication bus 73, the memory 72 is used to store computer execution instructions, and the processor 71 is used to call the computer execution instructions in the memory to execute the service deployment method shown in any of the above method embodiments.
[0156] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the present application may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
[0157] The present application provides a computer-readable storage medium, on which computer-executable instructions are stored; when the computer-executable instructions are executed by a processor, they are used to implement a service deployment method as described in any of the above embodiments.
[0158] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the service deployment method of the above-mentioned distributed system is implemented.
[0159] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0160] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0161] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0162] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0163] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not specifically stated, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.
[0164] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0165] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0166] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0167] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A service deployment method, characterized in that: include: Identify a first path of a common dependency library in a description file corresponding to each microservice, and identify target deployment package information in a description file corresponding to each microservice, wherein the common dependency library includes multiple deployment packages, and different deployment packages correspond to different deployment package information; Accessing the common dependency library based on the first path, and loading the target deployment package corresponding to the target deployment package information of each microservice in the common dependency library; The deployment of the corresponding microservices is realized based on the target deployment package of each microservice.
2. The method according to claim 1, characterized in that The description file also includes a second path of the business database and target business data information, the business database includes multiple business data, different business data corresponds to different business data information, and before the target deployment package based on each microservice implements the deployment of the corresponding microservice, the method also includes: Accessing the business database based on the second path, and loading target business data corresponding to the target business data information of each microservice in the business database; The target deployment package based on each microservice implements the deployment of the corresponding microservice, including: Deploy the corresponding microservices based on the target deployment package and target business data of each microservice.
3. The method according to claim 1, characterized in that Before identifying the first path of the common dependency library in the description files corresponding to each microservice, the method further includes: Build the common dependency library based on the deployment packages of each microservice; The first path of the common dependency library is written into the description file corresponding to each microservice, and the target deployment package information required for the deployment of the corresponding microservice is written into the description file of each microservice.
4. The method according to claim 3, characterized in that The deployment packages based on each microservice are used to build the common dependency library, including: Merging the deployment packages of the microservices to determine a deployment file set; Deduplication processing is performed on the deployment packages in the deployment file set to determine the common dependency library.
5. The method according to claim 1, characterized in that The method further comprises: Updating at least one deployment package in the public dependency library to determine an updated public dependency library; In response to the updated common dependency library, the updated common dependency library is accessed based on the first path, and the target deployment package corresponding to the target deployment package information of each microservice is loaded in the updated common dependency library, and the deployment of the corresponding microservice is implemented based on the target deployment package of each microservice.
6. The method according to claim 1, characterized in that The first path of identifying the common dependency library in the description file corresponding to each microservice includes: Based on the class loader, the first path of the common dependency library is identified in the description file corresponding to each microservice.
7. A service deployment device, characterized in that: include: An identification module is used to identify a first path of a common dependency library in a description file corresponding to each microservice, and to identify target deployment package information in a description file corresponding to each microservice, wherein the common dependency library includes multiple deployment packages, and different deployment packages correspond to different deployment package information; A loading module, used to access the common dependency library based on the first path, and load the target deployment package corresponding to the target deployment package information of each microservice in the common dependency library; The deployment module is used to deploy the corresponding microservices based on the target deployment package of each microservice.
8. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 6 when being executed by a processor.
Citation Information
Cited By
Method for reducing volume of Jar packet and quickly deploying Jar packet
CN121277543A