Micro-service intelligent deployment method, device, equipment and medium
By encapsulating microservices into containers and automatically deploying them using the host scoring model, the problem of existing microservice deployment is solved, and efficient and accurate microservice deployment is achieved.
Patent Information
- Application Number
- CN202411811801.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-05-06
AI Technical Summary
Existing microservice deployments rely on manual operations, resulting in unintelligent and high error rates.
By encapsulating microservices into containers and using host scoring models to predict host scores based on machine learning algorithms, the microservice containers are automatically deployed to the host with the highest score.
Improves the efficiency of microservice deployment, reduces deployment error rates, and achieves higher flexibility and manageability.
Smart Images

Figure CN119938065A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of microservice deployment technology, and in particular to a microservice intelligent deployment method, device, equipment and medium. Background Art
[0002] Microservices is an architectural style where a large complex software application consists of one or more microservices. Each microservice in the system can be deployed independently and is loosely coupled. Each microservice focuses on completing only one task and does it well. In all cases, each task represents a small business capability.
[0003] With the development of cloud computing, microservice architecture has become increasingly important. However, manually deploying microservices is still a complex and error-prone process. Therefore, the need for automated containerized microservice deployment systems has become increasingly urgent.
[0004] However, the deployment of existing microservices is achieved through online operation and maintenance personnel. The operation and maintenance personnel deploy configuration parameters according to the needs of microservices and deploy them on hosts that meet the deployment conditions based on experience. However, if an abnormality occurs, manual intervention is required to redeploy the configuration, which has a high probability of error.
[0005] In view of this, there is an urgent need to provide a method for intelligently deploying microservices. Summary of the invention
[0006] In order to overcome the problems existing in the related art, the present disclosure provides a microservice intelligent deployment method, device, equipment and medium to solve the technical problems in the related art that manual deployment of microservices is not intelligent and has a high error rate.
[0007] One or more embodiments of this specification provide a microservice intelligent deployment method, including the following steps:
[0008] 1) Encapsulate microservices into images and build containers;
[0009] 2) determining a qualified host machine based on the deployment feature data carried by the microservice, wherein the deployment feature data includes the CPU, memory, and disk usage / usability of the host machine; and
[0010] 3) Based on the host scoring model, the host score is predicted based on the server performance indicators of each host, and the microservice container is deployed to the host with the highest score using an automated deployment tool; wherein the host scoring model is obtained by training a machine learning algorithm using server performance data as input and the corresponding score set as output, and the server performance indicators include CPU, memory and disk usage / usability. Further, the step of packaging the microservice image to build a container includes the following steps:
[0011] Microservices are built into file packages through Jenkins, which are then built into Docker images and uploaded to a private image repository to build microservice containers.
[0012] Furthermore, the training process of the host scoring model is as follows:
[0013] Obtain server performance indicator data for each type of host and set corresponding scores;
[0014] Preprocess the server performance indicator data to eliminate interference data and data inconsistency;
[0015] The server performance indicator data of the host machine is used as input, the corresponding score is set as output, and the machine learning algorithm is trained according to the preset convergence conditions until convergence, so as to obtain a trained host machine scoring model.
[0016] Furthermore, the step before step 2) further includes the following steps:
[0017] Determine whether the microservice carries deployment configuration parameters. If so, filter and determine the qualified host machine according to the deployment configuration parameters. If the screening obtains no less than one host machine, execute step 3). If there is only one qualified host machine, do not execute step 3) and directly deploy the microservice container to the host machine.
[0018] Furthermore, it also includes automated deployment steps, specifically:
[0019] After the microservice container is deployed to the host with the highest score, during the operation of the host, the various server performance indicators of the host are monitored by the monitoring software. When any server performance indicator is greater than the preset threshold, the new host is determined to deploy the microservice container by executing steps 2)-3).
[0020] Furthermore, the method further comprises the steps of:
[0021] When a qualified host is obtained, the host server performance indicators are collected. If the monitoring program does not obtain the server performance indicators of the corresponding host or any indicator of the server performance indicators exceeds the preset value, the host will be discarded.
[0022] Furthermore, the server performance index of the host machine includes resource utilization or availability, and the preset threshold of resource utilization is 80%-90% or the availability is 10%-20%.
[0023] One or more embodiments of this specification provide a microservice intelligent deployment device, including:
[0024] Containerization module, used to encapsulate microservices into images and build containers;
[0025] A first screening module is used to determine a qualified host machine according to the deployment feature data carried by the microservice, wherein the deployment feature data includes the CPU, memory and disk availability of the host machine; and
[0026] The prediction and deployment module is used to predict the host score based on the server performance indicators of each host based on the host scoring model, and use the automated deployment tool to deploy the microservice container to the host with the highest score; the host scoring model is obtained by training the machine learning algorithm with the server performance data as input and the corresponding score as output. The server performance indicators include CPU, memory and disk usage / availability.
[0027] One or more embodiments of the present specification provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the microservice intelligent deployment method as described in any one of the above when executing the computer program.
[0028] One or more embodiments of the present specification provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the microservice intelligent deployment method as described in any one of the above items is implemented.
[0029] The present invention provides a microservice intelligent deployment method, device, equipment and medium, which have the advantages of unified management and control of container-based microservices. First, the purpose of microservice containerization is to achieve resource isolation and scalability. By encapsulating microservices in an independent container environment, they can be more conveniently deployed and adjusted independently, and each microservice can run in its own container without interfering with each other. At the same time, it can be flexibly expanded or shrunk according to the load conditions. This containerized architecture can provide higher flexibility and manageability, and then select qualified hosts based on the deployment feature data carried by the microservices, and predict the host scores based on the corresponding server performance data through the trained host scoring model, so as to determine the host with the highest score as the microservice container deployment object. In this way, machine learning algorithms are used to perform adaptive optimization and predictive deployment of microservices, rather than simply deploying based on rules or human experience, which improves the deployment efficiency of microservices and reduces the deployment error rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 A flowchart of a microservice intelligent deployment method provided for one or more embodiments of this specification;
[0032] Figure 2 A flow chart of the training process of the host scoring model provided for one or more embodiments of this specification;
[0033] Figure 3 A flow chart of an automated deployment process provided for one or more embodiments of this specification;
[0034] Figure 4 A block diagram of a microservice intelligent deployment device provided for one or more embodiments of this specification; and
[0035] Figure 5 A schematic diagram of the structure of a computer device provided for one or more embodiments of this specification. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0037] The present invention is described in detail below in conjunction with specific implementation methods and the accompanying drawings.
[0038] Method Embodiment
[0039] According to an embodiment of the present invention, a microservice intelligent deployment method is provided, such as Figure 1 As shown, it is a flow chart of the microservice intelligent deployment method provided in this embodiment. The microservice intelligent deployment method according to the embodiment of the present invention includes:
[0040] Step S1, encapsulate the microservice into an image to build a container;
[0041] Step S2, determining a qualified host machine based on the deployment feature data carried by the microservice, wherein the deployment feature data includes the CPU, memory and disk availability of the host machine, which is used to limit the minimum memory, CPU and disk required for the host machine to deploy the microservice.
[0042] Step S3, based on the host scoring model, the host score is predicted based on the server performance indicators of each host, and the microservice container is deployed to the host with the highest score using an automated deployment tool; wherein the host scoring model is obtained by training a machine learning algorithm using server performance data as input and the corresponding score set as output, and the server performance indicators include CPU, memory, disk usage / usability, network traffic, system load, etc.; resource availability, etc. may also be considered according to demand, wherein,
[0043] CPU usage: such as average CPU usage, CPU peak usage, etc.
[0044] Memory usage: such as average memory usage, remaining available memory, etc.
[0045] Disk I / O: The speed or load of disk reading and writing.
[0046] Network traffic: usage of inbound and outbound bandwidth.
[0047] System load: For example, process queue length, system average load.
[0048] These characteristic data can be collected through system monitoring tools (such as top, vmstat, iostat, etc.).
[0049] The microservice intelligent deployment method provided in this embodiment unifies the management and control of container-based microservices. First, the purpose of microservice containerization is to achieve resource isolation and scalability. By encapsulating microservices in an independent container environment, they can be more conveniently deployed and adjusted independently, and each microservice can run in its own container without interfering with each other. At the same time, they can be flexibly expanded or shrunk according to the load conditions. This containerized architecture can provide higher flexibility and manageability. Then, qualified hosts are screened out according to the deployment feature data carried by the microservices, and the host scores are predicted according to the corresponding server performance data through the trained host scoring model, so as to determine the host with the highest score as the microservice container deployment object. In this way, machine learning algorithms are used to perform adaptive optimization and predictive deployment of microservices, rather than simply deploying based on rules or human experience, which improves the deployment efficiency of microservices and reduces the deployment error rate.
[0050] In this embodiment, the microservice is built into, for example, a jar package through Jenkins, and then built into a docker image and uploaded to a private image repository to implement microservice container construction.
[0051] In a specific embodiment, each microservice is clustered and pooled through Docker (container) + Kubernetes (container orchestration) technology to generate a Kubenetes resource pool, and a containerized operating environment is created through the Kubernetes API.
[0052] In this embodiment, reference Figure 2 As shown in the figure, the training process of the host scoring model is as follows:
[0053] Step S10, obtaining server performance index data of each type of host machine and setting corresponding scores; in this embodiment, the server performance index of each type of host machine can be obtained from multiple sources such as server logs, network performance indicators, and application feedback. In this embodiment, the server performance index data of the host machine can be obtained through the netdata monitoring program deployed on the host machine.
[0054] Step S11, preprocessing the server performance indicator data, including data cleaning and formatting, to eliminate interference data and data inconsistency.
[0055] Step S12, taking the server performance indicator data of the host machine as input, setting the corresponding score as output, and training the machine learning algorithm according to the preset convergence condition until convergence, thereby obtaining a trained host machine scoring model.
[0056] In this embodiment, how to use the gradient boosting machine (GBM) algorithm to build a host scoring model, through Python and scikit-learn, combined with the server performance indicator data set, after data preprocessing, use the GBM algorithm to train the model to predict the host score, wherein the server performance indicator data in the data set can be CPU, memory and disk usage, and the corresponding score, and the score can also be obtained according to the preset initial score value combined with the preset weights of CPU, memory and disk usage.
[0057] In this embodiment, the machine learning algorithm may use a neural network model, a gradient boosting model, etc. This embodiment takes the gradient boosting algorithm (Gradient Boosting) as an example to illustrate the entire training process.
[0058] This embodiment adopts a gradient boosting algorithm including multiple weak learners. During the training process, the multiple weak learners are iteratively trained. The convergence condition of the training is determined based on the change of the gradient or the change of the objective function value. When the norm of the gradient (or a specified gradient component) is less than a preset threshold, or the change of the objective function value is less than the set threshold, it means that the gradient boosting algorithm has converged and the training is completed. The loss function of the gradient boosting algorithm is:
[0059] For regression problems, a commonly used loss function is the squared error:
[0060] L(yi,F(xi))=12(yi-F(xi))2L(y_i,F(x_i))=\frac{1}{2}(y_i-F(x_i))^2L(yi,F(xi))=21(yi-F(xi))2;
[0061] Its gradient is:
[0062]
[0063] This means that we want to fit the gap between the predicted value and the true value.
[0064] Indicators such as mean square error (MSE) and root mean square error (RMSE) are used to evaluate the prediction accuracy of the model. The commonly used evaluation formula is:
[0065] MSE=1n∑i=1n(yi-y^i)2\text{MSE}=\frac{1}{n}\sum_{i=1}^n(y_i-\hat{y}_i)^2MSE=n1i=1∑n(yi-y^i)2;
[0066] Among them, y^i\hat{y}_iy^i is the predicted value of the model, and yiy_iyi is the true value.
[0067] In this embodiment, the selection of the threshold value set by the above algorithm is usually adjusted based on experience and experimental results to achieve reasonable convergence performance, but the convergence condition of the gradient boosting algorithm used in this embodiment is determined based on the change of the gradient or the change of the objective function value, that is, when the norm of the gradient is less than the threshold, the algorithm is considered to have converged. The specific threshold depends on factors such as the complexity of the problem, the scale of the data, and the parameter setting of the algorithm. In general, a smaller threshold can improve the accuracy of the algorithm, but it may take a longer convergence time. Therefore, during the training process, a larger gradient norm threshold, such as 0.01, can be set first, and the algorithm training can be performed. During the training process, according to the change of the gradient and the change of the objective function value, if it is found that the algorithm converges quickly or achieves satisfactory results under the threshold, then the threshold can be further reduced, such as set to 0.001, to obtain a more refined convergence performance. However, if we find that the algorithm converges slowly or fails to achieve the expected results, the threshold can be appropriately relaxed, such as set to 0.1, to speed up the convergence.
[0068] In a specific embodiment, training based on the gradient boosting algorithm to obtain a host scoring model includes the following steps:
[0069] 1) Extract the server performance indicator data of the host machine from the API provided by the netdata monitoring software every 10 seconds.
[0070] 2) The extracted server performance indicator data is processed by the preprocessing function, the data is cleaned and structured, and finally structured into JSON data, and pushed to the rabbitmq queue to obtain the training set. Because only one microservice can be processed at the same time, rabbitmq is used for decoupling.
[0071] 3) Use the training set (rabbitmq) to train the selected gradient boosting algorithm until convergence.
[0072] 4) Evaluate the performance and accuracy of the trained model on the test set, and adjust the hyperparameters of the gradient boosting algorithm based on the evaluation results, mainly adjusting the learning rate. In this embodiment, the adjustment range is 0.4-0.6, and the smaller the value, the greater the computational cost.
[0073] In this embodiment, if a new server performance indicator dimension is added, the model needs to be retrained according to the above steps.
[0074] In this embodiment, containerization provides resource isolation and scalability, enabling microservices to run and train independently, improving flexibility and manageability, and the gradient boosting algorithm optimizes deployment objects by training multiple weak learners to determine the best deployment host based on predicted server performance indicators.
[0075] In this embodiment, the microservice may carry not only the deployment feature data as a condition for screening the host machine, but also the deployment configuration parameters, wherein the deployment configuration parameters are used to determine the configuration parameter conditions of the host machine. Therefore, before step S3, step S201 is also included, which is specifically:
[0076] S201, determine whether the microservice carries deployment configuration parameters. If so, determine a qualified host machine based on the deployment configuration parameters. If no less than one host machine is obtained through screening, determine a qualified host machine based on the deployment feature data carried by the microservice in step S3 based on the information of multiple hosts. If there is only one qualified host machine, no longer execute step S3, and deploy the microservice container to the corresponding host machine.
[0077] In a specific embodiment, each host machine will have one or more configuration parameters (tag parameters). For example, the configuration parameters of host machine 1 (Node1) may be tag: ["taosd", "extener_IP"...], each parameter is a specific limitation on the host machine configuration, and the deployment configuration parameters further limit the requirements of the microservice host machine to be deployed. If the microservice has special requirements, the corresponding tag will be set, and the host machine will be preliminarily screened according to the tag. In this embodiment, the deployment configuration parameters carried by the microservice have the highest priority as the conditions for screening the host machine. If there is only one host machine matched by the specified tag, the scoring process will be omitted, and the microservice will be deployed directly on the corresponding host machine. The deployment configuration parameters can also be empty. If it is empty, only the host machine will be predicted and scored.
[0078] In this embodiment, during the host screening process, if the monitoring program fails to obtain the server performance index of the corresponding host or any of the server performance indexes exceeds a preset value (eg, CPU usage ≥ 90% or availability < 10%), the host will be discarded.
[0079] In order to ensure that the application deployed by the microservice maintains the best performance and resource utilization, this embodiment also sets automated deployment steps, which are as follows:
[0080] Step S4, automated deployment;
[0081] After the microservice container is deployed to the host with the highest score, during the operation of the host, the various server performance indicators of the host are monitored and determined by the monitoring software. When any server performance indicator is greater than the preset threshold, the new host is determined to deploy the microservice container by executing steps S2-S3.
[0082] In one embodiment, reference Figure 3 As shown in the figure, the automated deployment specifically includes the following steps:
[0083] Step S41, during the operation of the host machine, the various resource indicators of the host machine are monitored and determined by the monitoring software, the resource utilization rate of the host machine is determined, and the resource occupancy rate of the microservices deployed on the host machine is also monitored. The monitoring software can be a netdata monitoring program deployed on the host machine. The program has an open API that can be called, and the resource occupancy at the process level can be obtained. It natively supports the performance monitoring of docker containers and also monitors the resource usage of the server.
[0084] Step S42, if the resource usage rate is greater than the preset threshold, determine the number of microservice containers deployed on the corresponding host machine, and if it is determined that the number of microservice containers is greater than 1, execute step S43, and if it is determined that the number of microservice containers is equal to 1, execute step S44.
[0085] Step S43, determine the microservice with the highest resource occupancy rate, and then execute step S44;
[0086] Step S44, calling steps S2-S3 to determine a new host machine for the microservice container for redeployment.
[0087] Preferably, in the present embodiment, the automatic deployment should also consider whether the microservice carries the deployment configuration parameters. Therefore, when executing step S4, when the resource utilization rate is greater than the preset threshold, the new host machine is determined to deploy the microservice container by executing steps S1-S3.
[0088] In this embodiment, the preset threshold value of the host machine resource utilization rate is 80%-90%, or the utilization rate is 10%-20%. Taking the preset threshold value of utilization rate as 80% as an example, through the above-mentioned automated deployment steps, if it is determined that the resource utilization rate of the host machine is lower than 80%, no redeployment operation is performed, and the data obtained this time can also be discarded. When the host machine resource utilization rate is higher than 80%, the microservice with the largest resource usage will select a new host machine, and the new host machine will be determined through steps S2-S3. After the new host machine is determined, the corresponding microservice is stopped through the docker-client method. This configuration is to avoid frequent operation of microservices. The operation process may affect the current connection (user), for example, the currently connected user may be disconnected or flashed. Therefore, if the resource utilization rate of the host machine does not exceed 80%, the microservice on the host machine will not be operated.
[0089] In addition, the automated deployment process of this embodiment can be implemented through an automated exception handling program, which can automate exception handling without manual intervention, so that dynamic adjustments can be made during the microservice deployment process instead of only considering static deployment configuration.
[0090] In this embodiment, the microservice container to be redeployed is rebuilt using the principle of create first and then delete. After the reconstruction is completed, the host of the removed microservice container is marked, and the microservice container deployment balancing operation is no longer performed on the host within a preset period of time (for example, 30 minutes).
[0091] Device Embodiment
[0092] According to an embodiment of the present invention, a microservice intelligent deployment device is provided, such as Figure 4 As shown, it is a block diagram of a microservice intelligent deployment device provided in this embodiment. The microservice intelligent deployment device according to an embodiment of the present invention includes:
[0093] Containerization module 10, used to package microservices into images and build containers;
[0094] The first screening module 20 is used to determine a qualified host machine based on the deployment feature data carried by the microservice, wherein the deployment feature data includes the CPU, memory and disk usage / usability of the host machine, and is used to limit the minimum memory, CPU and disk required for the host machine to deploy the microservice.
[0095] The prediction and deployment module 30 is used to predict the host score based on the server performance indicators of each host based on the host scoring model, and use the automated deployment tool to deploy the microservice container to the host with the highest score; wherein the host scoring model is obtained by training the machine learning algorithm with the server performance data as input and the corresponding score set as output, and the server performance indicators include CPU, memory and disk usage / usability; resource availability, etc. can also be considered according to demand.
[0096] The microservice intelligent deployment device provided in this embodiment unifies the management and control of container-based microservices. First, the purpose of microservice containerization is to achieve resource isolation and scalability. The containerization module 10 encapsulates the microservices in an independent container environment, which can be more convenient to deploy and adjust them independently. Each microservice can run in its own container without interfering with each other. At the same time, it can be flexibly expanded or shrunk according to the load conditions. This containerized architecture can provide higher flexibility and manageability. Then, qualified hosts are screened out according to the deployment feature data carried by the microservices, and the host scores are predicted according to the corresponding server performance data through the trained host scoring model, so as to determine the host with the highest score as the microservice container deployment object. In this way, the use of machine learning algorithms for adaptive optimization and predictive deployment of microservices is not simply based on rules or human experience, which improves the deployment efficiency of microservices and reduces the deployment error rate.
[0097] In this embodiment, the containerization module 10 is used to build a jar package through Jenkins and then directly build it into a docker image and upload it to a private image repository to realize microservice container construction; this embodiment deploys container-based microservices to a specific host, and the container technology allows multiple independent microservices to run on the same host machine, and it is convenient to switch the deployment of microservices in the host machine that meets the deployment conditions according to needs, because Docker containers are easy to replace, can be stacked, easy to distribute, and as universal as possible.
[0098] In this embodiment, the training process of the host scoring model is as follows:
[0099] Step A10, obtaining server performance index data of each type of host machine and setting corresponding scores; in this embodiment, the server performance index of each type of host machine can be obtained from multiple sources such as server logs, network performance indicators, and application feedback. In this embodiment, the server performance index data of the host machine can be obtained through the netdata monitoring program deployed on the host machine.
[0100] Step A11, preprocessing the server performance indicator data, including data cleaning and formatting, to eliminate interference data and data inconsistency.
[0101] Step A12, taking the server performance indicator data of the host machine as input and the corresponding score as output, and training the machine learning algorithm according to the preset convergence conditions until convergence, thereby obtaining a trained host machine scoring model.
[0102] In this embodiment, the machine learning algorithm may use a neural network model, a gradient boosting model, etc. This embodiment takes the gradient boosting algorithm (Gradient Boosting) as an example to illustrate the entire training process.
[0103] This embodiment adopts a gradient boosting algorithm (Gradient Boosting) including multiple weak learners. During the training process, the multiple weak learners are iteratively trained. The convergence condition of the training is judged according to the change of the gradient or the change of the objective function value. When the norm of the gradient (or a specified gradient component) is less than a preset threshold, or the change of the objective function value is less than the set threshold, it means that the gradient boosting algorithm has converged and the training is completed.
[0104] In this embodiment, an initial screening module 40 is also included, which is used to determine whether the microservice carries deployment configuration parameters. If so, a qualified host machine is determined based on the deployment configuration parameters. If no less than one host machine is obtained through screening, the corresponding multiple host machine information is fed back to the first screening module 20 to determine a qualified host machine based on the deployment feature data carried by the microservice. If there is only one qualified host machine, the system directly executes the deployment of the microservice container to the corresponding host machine.
[0105] In this embodiment, in order to ensure that the application deployed with microservices maintains optimal performance and resource utilization, this embodiment also provides an automated deployment module 50, which is used to monitor and determine various server performance indicators of the host machine through monitoring software during the operation of the host machine after the microservice container is deployed to the host machine with the highest score. When any server performance indicator is greater than a preset threshold, the initial screening module 40, the first screening module 20 and the prediction and deployment module 30 are called to determine the new host machine to deploy the microservice container.
[0106] The embodiment of the present invention is an apparatus embodiment corresponding to the above-mentioned method embodiment. The specific operations of the processing steps of each module can be understood by referring to the description of the method embodiment, which will not be repeated here.
[0107] like Figure 5 As shown, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the microservice intelligent deployment method in the above embodiment is implemented.
[0108] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the microservice intelligent deployment method in the above embodiment is implemented; or when the computer program is executed by a processor, the microservice intelligent deployment method in the above embodiment is implemented.
[0109] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0110] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and the contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.
Claims
1. A microservice intelligent deployment method, characterized in that The following steps are involved: 1) Encapsulate the microservice image to build a container; 2) determining a qualified host machine based on the deployment feature data carried by the microservice, wherein the deployment feature data includes the CPU, memory, and disk usage / usability of the host machine; and 3) Based on the host scoring model, the host score is predicted based on the server performance indicators of each host, and the microservice container is deployed to the host with the highest score using an automated deployment tool; wherein the host scoring model is obtained by training a machine learning algorithm using server performance data as input and the corresponding score set as output, and the server performance indicators include CPU, memory, and disk usage / availability.
2. The microservice intelligent deployment method according to claim 1, characterized in that: The steps of packaging the microservice into an image and building a container include: Microservices are built into file packages through Jenkins, which are then built into Docker images and uploaded to a private image repository to build microservice containers.
3. The microservice intelligent deployment method according to claim 1, characterized in that: The training process of the host scoring model is as follows: Obtain server performance indicator data for each type of host and set corresponding scores; Preprocess the server performance indicator data to eliminate interference data and data inconsistency; The server performance indicator data of the host machine is used as input, the corresponding score is set as output, and the machine learning algorithm is trained according to the preset convergence conditions until convergence, so as to obtain a trained host machine scoring model.
4. The microservice intelligent deployment method according to claim 1, characterized in that: The step 2) also includes the following steps, which are: Determine whether the microservice carries deployment configuration parameters. If so, filter and determine the qualified host according to the deployment configuration parameters. If the screening obtains no less than one host, execute step 3). If there is only one qualified host, do not execute step 3) and directly deploy the microservice container to the corresponding host.
5. The microservice intelligent deployment method according to claim 1, characterized in that: It also includes automated deployment steps, specifically: After the microservice container is deployed to the host with the highest score, the host's server performance indicators are monitored and determined by the monitoring software during the operation of the host. When any server performance indicator is greater than the preset threshold, the new host is determined to deploy the microservice container by executing steps 2)-3).
6. The microservice intelligent deployment method according to claim 1, characterized in that: Also includes the steps: When a qualified host is obtained, the host server performance indicators are collected. If the monitoring program does not obtain the server performance indicators of the corresponding host or any indicator of the server performance indicators exceeds the preset value, the host will be discarded.
7. The microservice intelligent deployment method according to claim 5 or 6, characterized in that: The server performance index of the host machine includes resource utilization rate or availability rate, and the preset threshold of resource utilization rate is 80%-90% or the availability rate is 10%-20%.
8. A microservice intelligent deployment device, characterized in that include: Containerization module, used to encapsulate microservices into images and build containers; A first screening module is used to determine a qualified host machine according to the deployment feature data carried by the microservice, wherein the deployment feature data includes the CPU, memory and disk availability of the host machine; and The prediction and deployment module is used to predict the host score based on the server performance indicators of each host based on the host scoring model, and use the automated deployment tool to deploy the microservice container to the host with the highest score; the host scoring model is obtained by training the machine learning algorithm with the server performance data as input and the corresponding score as output. The server performance indicators include CPU, memory and disk usage / availability.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the microservice intelligent deployment method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the microservice intelligent deployment method according to any one of claims 1 to 7 is implemented.