A three-layer microservice architecture design and deployment method
By combining a three-tier microservice architecture design with the CatBoost model, the problem of insufficient dynamic identification and feedback capabilities in existing microservice architectures is solved, enabling efficient configuration risk prediction and hybrid deployment, and improving system stability and monitoring capabilities.
Patent Information
- Application Number
- CN202511255393.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-04
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-09-04
AI Technical Summary
Existing microservice architectures lack dynamic identification and feedback capabilities in service registration and discovery, load balancing, configuration management, and monitoring, leading to resource waste, difficulty in ensuring security, unpredictable failure risks caused by configuration changes, and difficulty in guaranteeing system stability.
A three-tier microservice architecture is adopted, including a service registration layer, a governance layer, and a runtime layer. The CatBoost model is introduced to predict configuration risks, and combined with a hybrid deployment strategy, dynamic configuration management and end-to-end tracing are achieved.
It improves the architectural elasticity, deployment security, and configuration risk controllability of microservice systems, enhances system stability and monitoring capabilities, and supports high-reliability application scenarios.
Smart Images

Figure CN120780320B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software engineering, and in particular to a three-layer microservice architecture design and deployment method. BACKGROUND
[0002] At present, microservice architecture is a mainstream technology paradigm for building large and complex software systems, and is widely used in many industry fields such as finance, e-commerce, government affairs and manufacturing. This architecture usually divides the system into multiple loosely coupled service units, each responsible for an independent business function, thereby achieving high maintainability, high scalability and flexible deployment capability of the system. Existing microservice systems generally include service registration and discovery, load balancing, routing forwarding, configuration management, service deployment and monitoring, and the deployment method is mostly based on a cloud-native container orchestration platform for elastic scaling and automated operation and maintenance.
[0003] In the prior art, service registration mainly relies on basic metadata collection and heartbeat mechanism maintenance, and the governance mechanism is mainly configured with static rules, lacking dynamic identification and feedback capability for service health status and risks. At the service deployment level, most systems use a unified cloud deployment mode, which fails to effectively combine service sensitivity for differentiated distributed deployment, resulting in resource waste and security difficulties. In addition, there is a lack of effective risk prediction means for the impact of configuration changes on system stability, which cannot estimate potential failure risks before deployment, easily causing service interruption or cascading failures. The monitoring mechanism generally focuses on index collection and log collection, and it is difficult to realize cross-service call link tracking and root cause positioning.
[0004] Therefore, how to provide a three-layer microservice architecture design and deployment method is a problem that needs to be solved by those skilled in the art. SUMMARY
[0005] One object of the present application is to provide a three-layer microservice architecture design and deployment method. The present application integrates service registration and governance mechanisms, service running and deployment mechanisms, and configuration management mechanisms based on risk prediction, and describes in detail the processing flow of microservice systems in each stage of registration and discovery, governance control, decoupling operation, dynamic configuration and risk assessment. The CatBoost model is introduced to predict the risk of configuration changes, and has the advantages of strong architecture flexibility, high deployment security, strong configuration risk controllability and high service stability.
[0006] According to the three-layer microservice architecture design and deployment method of the embodiment of the present application, the following steps are included:
[0007] A service registration layer is constructed, a registration center is deployed, information of each microservice at startup is collected and processed, and a service registration information set is obtained;
[0008] A service governance layer is constructed, service discovery, routing distribution, load balancing and fuse control are performed based on a service registration information set, and a service governance configuration set is constructed;
[0009] A service running layer is constructed, decoupled function service modules are deployed, independent databases and caches are configured, and a micro-service running architecture is formed;
[0010] A configuration management mechanism is established, service starts to pull configuration, configuration changes are pushed through a message bus and dynamically loaded, and a configuration change request information set is generated;
[0011] Based on the configuration change request information set, the CatBoost model is trained in batches in order to improve the model, and the configuration risk level information is output;
[0012] Based on the micro-service running architecture and the configuration risk level information, the service components are deployed according to the sensitivity in the local and cloud, and the hybrid deployment result information is obtained;
[0013] Based on the service governance configuration set and the service deployment topology structure, a full-link tracking mechanism is constructed, the Trace-ID record calling chain is injected and transmitted through the injection, and the running observation information set is obtained.
[0014] Optionally, the service registration layer is constructed, the registration center is deployed, the information of each micro-service at startup is collected and processed, and the service registration information set is obtained, which specifically includes:
[0015] The service registration center is deployed, the service registration interface, the health check interface, the heartbeat state management module and the service elimination module are constructed, and the empty service list is initialized;
[0016] When each micro-service instance starts, the micro-service instance information is collected, and the service metadata information set is formed;
[0017] Each item of service metadata in the service metadata information set is sent to the service registration center through the service registration interface, and the initial service list is obtained;
[0018] The service registration center allocates a corresponding heartbeat state recorder for the service metadata, updates the heartbeat timestamp in real time and establishes a mapping relationship, and forms a heartbeat state mapping table;
[0019] The service registration center periodically traverses the heartbeat state mapping table, compares the latest heartbeat timestamp corresponding to each item of service metadata with the current system time, and obtains the abnormal service metadata set;
[0020] The service registration center eliminates all abnormal service metadata from the initial service list according to the abnormal service metadata set, and obtains the service registration information set.
[0021] Optionally, the service governance layer is constructed, service discovery, routing distribution, load balancing and fuse control are performed based on the service registration information set, and the service governance configuration set is constructed, specifically including:
[0022] The service governance layer is constructed, the service gateway, load balancing component, fuse degradation module and routing management module are deployed, and the service governance configuration structure is initialized.
[0023] The service registration information set is called, the service metadata is grouped according to the service name, and the service discovery index mapping table is constructed.
[0024] When receiving a client request, the target service name is identified according to the service discovery index mapping table, and a target service candidate instance set is obtained.
[0025] The load balancing strategy is performed on the target service candidate instance set, the target service instance is determined, and the target service routing path is generated.
[0026] The client request is forwarded to the selected service instance through the service gateway according to the target service routing path.
[0027] In the service calling process, the response state of the target service instance is monitored in real time, when the number of continuous exceptions exceeds the set threshold, the fuse logic is triggered, the service instance is removed from the service registration information set, and the service discovery index mapping table is updated.
[0028] The current load balancing strategy configuration, routing path mapping, fuse rule parameters and the latest state of the service registration information set are written into the service governance configuration structure, and the updated service governance configuration set is obtained.
[0029] Optionally, the service running layer is constructed, the decoupled function service module is deployed, the independent database and cache are configured, and the micro-service running architecture is formed, specifically including:
[0030] The service running layer is constructed, the system is service module split according to business functions, and a service module set is obtained.
[0031] Each service module is containerized and encapsulated and deployed as an independent running process unit to obtain a service process set.
[0032] An independent database instance and cache node are allocated for each service process, and data access permission and connection pool parameters are configured to form an independent data support unit set.
[0033] The inter-service process communication mode is limited to synchronous API calling or asynchronous message queue mechanism, and a process communication topology graph is constructed.
[0034] Based on the service process set, the data support unit set and the process communication topology graph, a business service set is constructed.
[0035] Deploy the business service set to the available instance specified by the service governance layer, and register the metadata information to the registry center to form a micro-service running architecture.
[0036] Optionally, the establishment of the configuration management mechanism, service starts to pull configuration, configuration changes are pushed through the message bus and dynamically loaded, and the configuration change request information set is generated.
[0037] Establish a configuration management mechanism, deploy a configuration server for centralized storage of environment configuration files, and form a configuration file set.
[0038] Configure a unified interface service and authentication mechanism for the configuration server to provide remote pull capability for accessing configuration content by service name, forming a service configuration pull interface set.
[0039] When each service process starts, access the configuration server through the corresponding configuration pull interface according to the service name to obtain the initialization configuration context set.
[0040] The configuration server listens to the content changes of the configuration file set and builds a configuration broadcast message stream.
[0041] After the service process receives the target configuration change event in the configuration broadcast message stream, the corresponding service runtime performs a configuration context replacement operation, dynamically loads new configuration content, and records the change identifier.
[0042] Structurally encapsulate each configuration file pull and update event to form a configuration change request information, and aggregate the configuration change request information set according to the timestamp and service name.
[0043] Optionally, the configuration change request information set is used to train the batch ordered CatBoost model, and the configuration risk level information is output.
[0044] Based on the configuration change request information set, the change events are aggregated in timestamp order to obtain a configuration change batch set.
[0045] Based on the precedence relationship between each batch in the configuration change batch set, a batch dependency directed acyclic graph is constructed.
[0046] Topological sorting operation is performed on the batch dependency directed acyclic graph to obtain a batch topological sorting sequence.
[0047] Organize the configuration change samples in each batch into a feature vector set, bind each feature vector with the corresponding label, and construct a training data set.
[0048] Introduce a batch ordered promotion mechanism to improve the CatBoost model and output the predicted risk probability.
[0049] The predicted risk probability is compared with a set of pre-set risk level thresholds in stages to generate a risk level label;
[0050] The risk level label of each batch is bound with the corresponding service name and configuration field to generate a set of configuration risk level information.
[0051] Optionally, the introduction of the batch order boosting mechanism improves the CatBoost model, and the output of the predicted risk probability specifically includes:
[0052] The CatBoost model is improved by introducing a batch order boosting mechanism to obtain an improved CatBoost model, and the improved CatBoost model is formed by sequentially accumulating a plurality of batch CatBoost sub-models, and each CatBoost sub-model is composed of a plurality of ordered decision trees;
[0053] Topological sorting is performed on the set of configuration change batches to obtain a batch sequence, and for any target batch, only the residual information of the previous batch is allowed to be used to form a batch residual dependency set;
[0054] Based on the batch residual dependency set, first, the residual of the sample is calculated, and the residual is multiplied by the corresponding batch weight to obtain a weighted residual, and after normalizing the weighted residuals of all samples, the batch weighted residual set is formed;
[0055] An ordered target encoding mechanism is used for category features, and target statistics are calculated for samples to form a batch ordered feature set;
[0056] On the basis of the batch ordered feature set and the batch weighted residual set, a CatBoost feature split gain function is constructed, and all split gain value combinations form a batch feature split gain set;
[0057] Based on the batch feature split gain set, the feature with the maximum gain is selected as the split point to generate a symmetric binary tree node, and the splitting is repeated until the preset tree depth is reached to obtain a batch CatBoost sub-model;
[0058] After the training of the current batch CatBoost sub-model is completed, a weighted accumulation operation is performed based on the existing last round cumulative prediction value and the prediction result of the current batch sub-model to obtain the predicted risk probability of the target batch.
[0059] Optionally, based on the micro-service running architecture and the configuration risk level information, the sensitive deployment service components are deployed locally and in the cloud to obtain hybrid deployment result information, which specifically includes:
[0060] Based on the business functions and communication behaviors of each service module in the micro-service running architecture, key sensitivity evaluation features are extracted to obtain a sensitivity feature set;
[0061] Based on the sensitivity feature set and the configuration risk level information set, the sensitivity score of each micro-service instance is calculated;
[0062] According to the sensitivity score, each micro-service instance is divided into a sensitive service component and a non-sensitive service component to form a service sensitivity division result;
[0063] The sensitive service component is deployed on a local server, the non-sensitive service component is deployed on a cloud Kubernetes cluster, and a secure isolated deployment architecture is constructed based on a private network tunnel connecting the local server and the cloud Kubernetes cluster;
[0064] According to the service sensitivity division result and the deployment architecture, a micro-service deployment mapping relationship is established to form a service deployment topology graph, and a micro-service deployment operation is completed according to the service deployment topology graph to obtain hybrid deployment result information.
[0065] Optionally, the full-link tracking mechanism is constructed based on the service governance configuration set and the service deployment topology structure, and the Trace-ID record call chain is injected and transmitted to obtain a running observation information set, which specifically includes:
[0066] Based on the service governance configuration set and the service deployment topology structure, a full-link tracking and running observation mechanism is constructed, a request entry injection logic is configured in the API gateway, a globally unique request identifier Trace-ID is generated for each request entering the system, and request identification information is obtained;
[0067] When service calls are made between micro-services, the upstream service carries the request identification information in the request message, and the downstream service parses and transmits it to obtain link propagation information;
[0068] Based on the link propagation information, a multi-hop call node graph is constructed, and a call link tracking log is output to form a call tracking log set;
[0069] The call tracking log set is uploaded to a centralized log analysis system to construct a unified structured storage model to obtain a call link monitoring data set;
[0070] Based on the call link monitoring data set, performance indicators are calculated, and a graphical display view is constructed according to a business view to output a running observation information set.
[0071] The beneficial effects of the present application are:
[0072] The application divides the micro-service system into a service registration layer, a service management layer and a service running layer by constructing a three-layer micro-service architecture, deploys a registration center in the service registration layer to collect and manage service metadata information, ensures the dynamic availability of service instances, implements service discovery, routing forwarding, load balancing and fuse control in the service management layer, improves the robustness of request scheduling by introducing a multi-strategy combination scheduling mechanism, and adopts modular deployment and isolated resource configuration strategies in the service running layer to complete the construction of a decoupled service running structure, thereby improving service maintainability and system flexibility.
[0073] The application further designs a dynamic configuration management mechanism, uses a configuration server to realize centralized pulling of service start configuration and hot updating of remote configuration, and constructs a CatBoost risk prediction model based on batch ordered promotion based on configuration change request information, which can perform topology modeling and risk classification evaluation on different configuration batches. The method generates batch order by relying on constraints, and uses a residual training mechanism to improve the risk prediction ability of the model, effectively supporting the decision rationality and deployment security control in the configuration adjustment process.
[0074] In addition, the application establishes a full-link monitoring mechanism based on the service management configuration and deployment structure, realizes complete tracking of cross-service call chains by injecting Trace-ID, and forms stable operation observation ability in combination with a log analysis system, thereby realizing fine monitoring and real-time visual management in the micro-service system operation, and enhancing the stability and abnormal response ability of the system. The method supports a hybrid cloud deployment strategy, can automatically schedule services to local or cloud according to sensitivity levels, and is suitable for application scenarios with high requirements for system reliability and deployment compliance. BRIEF DESCRIPTION OF DRAWINGS
[0075] The accompanying drawings are included to provide a further understanding of the application, and constitute a part of the specification, together with the embodiments of the application, to explain the application, and do not constitute a limitation on the application. In the drawings:
[0076] Fig. 1 A flowchart of a three-layer micro-service architecture design and deployment method proposed by the application;
[0077] Fig. 2 A structure diagram of a batch ordered promotion CatBoost model in a three-layer micro-service architecture design and deployment method proposed by the application;
[0078] Fig. 3 A service scheduling structure diagram of a hybrid cloud deployment strategy in a three-layer micro-service architecture design and deployment method proposed by the application. DETAILED DESCRIPTION
[0079] The application will be described in further detail below with reference to the drawings. These drawings are simplified schematic diagrams and only show the basic structure of the application in a schematic manner, and thus only show the components relevant to the application.
[0080] Reference Figs. 1-3 A three-layer microservice architecture design and deployment method, comprising the following steps:
[0081] A service registration layer is constructed, a registration center is deployed, information of each microservice at startup is collected and processed, and a service registration information set is obtained;
[0082] A service governance layer is constructed, service discovery, routing distribution, load balancing and fuse control are performed based on the service registration information set, and a service governance configuration set is constructed;
[0083] A service running layer is constructed, a decoupled function service module is deployed, an independent database and cache are configured, and a microservice running architecture is formed;
[0084] A configuration management mechanism is established, the service starts to pull the configuration, the configuration change is pushed through the message bus and dynamically loaded, and a configuration change request information set is generated;
[0085] Based on the configuration change request information set, a CatBoost model is trained in batches in an ordered manner, and configuration risk level information is output;
[0086] Based on the microservice running architecture and the configuration risk level information, the service components are deployed on the local and cloud according to the sensitivity, and a hybrid deployment result information is obtained;
[0087] Based on the service governance configuration set and the service deployment topology structure, a full-link tracking mechanism is constructed, the Trace-ID record calling chain is injected and transmitted through injection, and a running observation information set is obtained.
[0088] In the embodiment, the construction of the service registration layer, the deployment of the registration center, the collection of the information of each microservice at startup and the processing thereof to obtain the service registration information set specifically comprises:
[0089] The service registration center is deployed, the service registration interface, the health check interface, the heartbeat state management module and the service elimination module are constructed, the empty service list is initialized, and the service registration center structure is obtained;
[0090] At the startup of each microservice instance, the service name, the runtime instance address, the listening port number and the health check interface path of the microservice instance are collected, the above four pieces of information are encapsulated into a group of service metadata in a fixed order, the service metadata generated by multiple microservice instances are uniformly collected, and a service metadata information set is formed;
[0091] Each service metadata in the service metadata information set is sent to the service registry structure through a service registration interface, after the service registry structure receives each service metadata, writes the service metadata into a currently maintained service list, and establishes an index relationship for each service metadata, completes registration of the service instance, and obtains an initial service list containing all registered service metadata;
[0092] The service registry center allocates a corresponding heartbeat state recorder for each registered service metadata, which is used to record the running state of the service instance. Each microservice instance sends a heartbeat request to the service registry center at a set fixed time period during normal operation. The service registry center updates the latest heartbeat timestamp of the corresponding service instance in real time after receiving the heartbeat request, and establishes a mapping relationship between the latest heartbeat timestamp and the corresponding service metadata to form a heartbeat state mapping table.
[0093] The service registry center periodically traverses the heartbeat state mapping table, compares the latest heartbeat timestamp corresponding to each service metadata with the current system time, and when the time difference between the current system time and the timestamp is greater than or equal to a preset invalidation time threshold, determines that the corresponding service instance is in an abnormal state, and marks the service metadata as unavailable to obtain an abnormal service metadata set.
[0094] The service registry center removes all service metadata that has been determined to be in an unavailable state from the initial service list currently maintained according to the abnormal service metadata set, updates the service list content, and retains only service instance information in a normal active state to obtain a service registration information set.
[0095] In the embodiment, the service governance layer is constructed, service discovery, routing distribution, load balancing and fuse control are performed based on the service registration information set, and the service governance configuration set specifically includes:
[0096] The service governance layer is constructed, the service gateway, load balancing component, fuse degradation module and routing management module are deployed, the service governance configuration structure is initialized, and the service governance configuration set is used as a basic framework;
[0097] The service registration information set is called, each service metadata containing a service name, an instance address, a port number and a health check path is traversed, the service metadata is grouped according to the service name, the instance address, the port number and the health state of multiple service instances corresponding to the same service name are combined into an instance list, a one-to-one correspondence is established between the service name and the corresponding instance list, and a service discovery index mapping table is constructed.
[0098] When a client request is received, the target service name is identified according to the service discovery mapping table, and the corresponding service instance set is extracted to obtain a target service candidate instance set.
[0099] performing a load balancing strategy on the target service candidate instance set, the load balancing strategy including a round robin method, a least connection method, or a dynamic response distribution method based on weighted round robin, determining a target service instance, and splicing a target service routing path according to a service name, an instance address, a listening port, and a calling path of the target service instance to generate the target service routing path;
[0100] The round robin method selects a next instance in turn according to a registration order of service instances in the target service candidate instance set, the least connection method selects a service instance with the least number of current concurrent connections as the target service instance, and the dynamic response distribution method based on weighted round robin sets a weight value for each service instance and dynamically distributes total requests according to a weight proportion of each instance.
[0101] forwarding a client request to the selected service instance according to the target service routing path through a service gateway to complete service call distribution;
[0102] In the service call process, the response state of the target service instance is monitored in real time, and when the number of consecutive abnormal times exceeds a set threshold, a fuse logic is triggered, the service instance is removed from the service registration information set, and a service discovery mapping table is updated.
[0103] The current load balancing strategy configuration, routing path mapping, fuse rule parameters, and the latest state of the service registration information set are written into a service governance configuration structure to obtain an updated service governance configuration set.
[0104] In the embodiment, the service running layer is constructed, the decoupled function service modules are deployed, the independent databases and caches are configured, and a micro-service running architecture is formed, specifically including:
[0105] The system is divided according to business functions, function units with single responsibility are extracted, and are defined as independent service modules respectively and recorded as a service module set;
[0106] Each service module in the service module set is subjected to containerization processing, encapsulated as an independently running process, and deployed on a computing node to form a service process set, ensuring that the service modules are mutually isolated at the process level;
[0107] An independent database instance and cache resources are configured for each service process in the service process set, data connection configurations and cache access interfaces are established respectively, ensuring that the service processes are independent of each other in the data storage and reading process, and a complete data support unit set is formed;
[0108] The communication mode between service processes is limited to synchronous-based application programming interface (API) calls or asynchronous message queue mechanisms, where the API calls are used for direct request-response between services, and the message queue mechanisms are used for asynchronous event delivery;
[0109] Based on the communication relationship of each process in the service process set, a process communication topology graph is constructed, which takes the service process as a node in the graph, and the process pair with calling or message passing relationship as a directed edge in the graph, to represent the communication path, direction and dependency structure between each service process in the service running layer;
[0110] Based on the service process set, the data support unit set and the process communication topology graph, a decoupled and autonomous business service set is constructed, which is deployed to the available instances specified by the service governance layer and registers its metadata information to the registration center, finally forming a complete micro-service running architecture.
[0111] In the embodiment, the establishment of the configuration management mechanism, service startup pulling configuration, configuration change pushing through the message bus and dynamic loading, and the generation of the configuration change request information set specifically includes:
[0112] A configuration management mechanism is established, and a configuration server is introduced into the deployment architecture as a unified configuration center for centralized management of the environmental configuration files required by each service instance;
[0113] The configuration files are stored according to service names to ensure that different services load independent configuration content and form a structured configuration file set, which supports distinguishing between deployment environments (such as development, testing and production) and maintaining version control information according to service dimensions;
[0114] A unified interface service is configured for the configuration server to provide configuration file access functions based on service names, and an authentication mechanism is built to control the reading permissions of the configuration files. The interface service supports service processes to initiate remote configuration pulling requests through service names during startup or running, and ensures the integrity and security of configuration data during transmission, thereby forming a service configuration pulling interface set for services to dynamically obtain configuration content;
[0115] When each service process starts, the process first identifies its service name and initiates a request to the configuration server through the configuration pulling interface to obtain the configuration file corresponding to the service name from the configuration server;
[0116] Then the obtained configuration file content is loaded into the context environment of the service runtime as a parameter input for the service initialization phase, completing the configuration initialization of the service process and obtaining an initialization configuration context set containing each configuration item.
[0117] The configuration server continuously monitors the content change state of each configuration file in the stored configuration file set, and when detecting that any configuration file has content modification, immediately constructs a corresponding configuration change event based on a preset configuration broadcast channel, and pushes a message to all registered service processes, thereby forming a continuous configuration broadcast message stream;
[0118] After the service process receives the target configuration change event in the configuration broadcast message stream, the corresponding service runtime performs a configuration context replacement operation, dynamically loads new configuration content, records the change identifier, and completes the configuration hot update process;
[0119] Each configuration file pull and update event is structured and encapsulated to form a configuration change request information, and a configuration change request information set is generated by aggregating the configuration change request information by timestamp and service name. The configuration change request information set includes numerical features and category features, wherein the category features represent discrete fields of configuration items, such as service name, version number, or deployment environment.
[0120] In the embodiment, the configuration change request information set is used to train a batch-ordered CatBoost model, and the output configuration risk level information specifically includes:
[0121] Based on the configuration change request information set, the change events are aggregated in timestamp order, and request information with the same change trigger time window or logical correlation is classified into a batch to obtain a configuration change batch set;
[0122] Based on the sequence-dependent relationship between each batch in the configuration change batch set, a batch-dependent directed acyclic graph is constructed. Each node in the graph represents a configuration change batch. If the configuration change operation of a batch depends on the completed change content in another batch, a directed edge is established from the dependent batch to the current batch in the graph, thereby forming a directed acyclic graph structure that can represent the batch-dependent order;
[0123] Topological sorting is performed on the batch-dependent directed acyclic graph, and the dependency order of all configuration change batches is parsed layer by layer from the nodes with no incoming edges according to the direction relationship of the edges in the graph, and finally a batch topological sorting sequence that does not violate any dependency relationship is obtained;
[0124] The configuration change samples in each batch are organized into a feature vector set, and the feature vector includes configuration field name, field value, service name, current service running state, historical change number, change time interval, change field weight, call chain level, and call frequency;
[0125] binding each feature vector with its corresponding label, the label being a binary variable of whether the current configuration change triggers service failure, 1 indicating triggering failure and 0 indicating not triggering failure, arranging all feature vectors and labels in batches to construct a training data set;
[0126] The batch order promotion mechanism is introduced to improve the CatBoost model, and a predicted risk probability is output.
[0127] After completing the prediction of the risk probability of the current batch of configuration change samples, the predicted risk probability is compared with a pre-set risk level threshold set step by step;
[0128] When the predicted risk probability is lower than the first threshold, the batch is marked as low risk; when the predicted risk probability is greater than or equal to the first threshold and lower than the second threshold, the batch is marked as medium risk; and when the predicted risk probability is greater than or equal to the second threshold, the batch is marked as high risk, thereby generating an explicit risk level label for the configuration change batch;
[0129] The risk level label of each batch is bound with the corresponding service name and configuration field to generate a configuration risk level information set.
[0130] In the embodiment, the introduction of the batch order promotion mechanism to improve the CatBoost model specifically includes:
[0131] The batch order promotion mechanism is introduced to improve the CatBoost model, and an improved CatBoost model is obtained, which is formed by sequentially accumulating a plurality of batch CatBoost sub-models, each CatBoost sub-model being composed of a plurality of ordered decision trees; wherein the batch order promotion mechanism divides the configuration change data into a plurality of sequentially numbered training subsets by batch, trains each subset to obtain a CatBoost sub-model, and only uses the residual information of the previous batch as the input of the current batch to ensure the dependency order between the sub-models, and finally forms a whole prediction model through the sequential accumulation of a plurality of CatBoost sub-models;
[0132] Topological sorting is performed on the configuration change batch set to obtain a batch sequence, and for any target batch, only the residual information of the previous batch is allowed to be used to ensure that the training process satisfies the order constraint, thereby forming a batch residual dependency set;
[0133] Based on the batch residual dependency set, first, the residual of each sample under the current batch is calculated, then the batch weight of the current batch is set according to the risk level information of the configuration change, and the residual is multiplied by the corresponding batch weight to obtain a weighted residual, and finally the weighted residuals of all samples are normalized and arranged to form a batch weighted residual set.
[0134] An ordered target encoding mechanism is used for categorical features, and target statistics are calculated for samples to form a batch ordered feature set:
[0135] ;
[0136] in, This indicates that under the batch-based orderly promotion mechanism, the first... Configuration change sample The calculated target statistic is dimensionless. This indicates the first batch of configuration change batches arranged in topological order. A sample configuration change, dimensionless. Indicates the first in the set of configuration change batches The true risk label value for each configuration change sample is dimensionless. Indicates the smoothing parameter. This represents the global prior probability, obtained through overall statistics based on the configuration change request information set. This indicates the index position of the current configuration change sample in the configuration change batch set, arranged in topological order. This indicates that within the set of configuration change batches, it is located in the current configuration change sample. Previous sample index;
[0137] This formula originates from the definition of the ordered target statistics (TS) in the CatBoost algorithm of machine learning, and belongs to the category of statistical formulas. Its original form is used to address the target leakage problem during model training. This application, based on this, constrains the variables in the formula to a batch-order boosting configuration change risk prediction scenario, thereby achieving batch-wise risk modeling for configuration change samples.
[0138] Based on the batch ordered feature set and the batch weighted residual set, a CatBoost feature splitting gain function is constructed, and the combination of all splitting gain values yields the batch feature splitting gain set:
[0139] ;
[0140] in, Indicates the first In each batch of configuration changes, based on candidate features The splitting gain value is dimensionless. Indicates the ordered feature set in the batch The first selected One candidate feature, dimensionless. a dimensionless number representing a single weighted residual value derived from the set of batch weighted residuals, a dimensionless number representing a candidate feature a dimensionless number representing a reduction in the conditional variance of the set of batch weighted residuals when participating in a split, a dimensionless number representing the number of effective samples participating in training in the th batch,a dimensionless number representing a batch-dependent penalty factor, a dimensionless number representing a batch-dependent constraint function, which takes a value of 1 if the candidate feature satisfies the dependent condition of the set of batch-ordered features , and otherwise takes a value of 0, a set of batch-ordered features;
[0141] The formula is an improved form of the node split gain formula in the CatBoost boosting tree model. The CatBoost batch-ordered boosting mechanism proposed in the present patent introduces the following innovative factors:
[0142] A set of batch weighted residuals, unlike global residuals, this set only counts the current and previous changed batches, ensuring that the model meets the time-dependent structure of the configuration changes;
[0143] A set of batch-ordered features, ensuring that feature selection is only performed within a subset that satisfies the DAG topology constraint;
[0144] A dependent penalty term , a feature dependency control mechanism is introduced on the original CatBoost gain function, which strengthens the generalization ability of the model in the dynamic configuration environment, and finally obtains the CatBoost feature split gain function in the present patent;
[0145] Based on the set of batch feature split gains, select the feature with the maximum gain as the split point to generate a symmetric binary tree node, and repeat the split until the preset tree depth is reached to obtain a batch CatBoost sub-model;
[0146] After completing the training of the current batch CatBoost sub-model, perform a weighted accumulation operation based on the existing last round cumulative prediction value and the prediction result of the current batch sub-model. Specifically, sum the prediction outputs of all decision tree sub-models for the samples in the current batch, multiply by the dynamic learning rate coefficient corresponding to the batch, to obtain the cumulative prediction increment of the current batch. Add the cumulative prediction increment of the current batch to the cumulative prediction value of the last batch to obtain the prediction risk probability of the target batch.
[0147] In the present embodiment, the hybrid deployment result information obtained by deploying the service components according to the sensitivity based on the micro-service running architecture and the configuration risk level information includes:
[0148] Based on the business functions and communication behaviors of each service module in the micro-service running architecture, key sensitivity evaluation features are extracted, including service processing data types, call chain complexity, access permission levels, and external communication frequencies, to obtain a sensitivity feature set;
[0149] Based on the sensitivity feature set and the configuration risk level information set, a sensitivity score is calculated for each micro-service instance, including a static security level and a dynamic risk level. The static security level is calculated by using a weighted scoring method according to the indicators in the sensitivity feature set, and the dynamic risk level is generated according to the predicted risk probability in the configuration risk level information set.
[0150] According to the sensitivity score, each micro-service instance is divided into sensitive service components and non-sensitive service components to form a service sensitivity division result.
[0151] The sensitive service components are deployed on a local server, the non-sensitive service components are deployed on a cloud Kubernetes cluster, and a secure isolated deployment architecture is constructed based on a private network tunnel connecting the local server and the cloud Kubernetes cluster.
[0152] According to the service sensitivity division result and the deployment architecture, a micro-service deployment mapping relationship is established to form a service deployment topology graph, and the micro-service deployment operation is completed according to the service deployment topology graph to obtain hybrid deployment result information.
[0153] In this embodiment, the full-link tracking mechanism is constructed based on the service governance configuration set and the service deployment topology structure, and the running observation information set is obtained by injecting and passing the Trace-ID record call chain, including:
[0154] Based on the service governance configuration set and the service deployment topology structure, a full-link tracking and running observation mechanism is constructed, and a request entry injection logic is configured in the API gateway to generate a globally unique request identifier Trace-ID for each request entering the system to obtain request identification information.
[0155] When service calls are made between micro-services, the upstream service carries the request identification information in the request message, and the downstream service parses and passes it on, finally realizing the transmission of request identification information in the entire call link to obtain link propagation information.
[0156] Based on the link propagation information, the distributed link tracking system collects the start time, target service identifier, response time, call state, and exception flag of each call to construct a multi-hop call node graph and output call link tracking logs to form a call tracking log set.
[0157] The calling trace log set is uploaded to the centralized log analysis system, is grouped and indexed according to a service name, an instance identifier and a time window, a unified structured storage model is constructed, and a calling link monitoring data set is obtained;
[0158] Based on the calling link monitoring data set, performance indicators are calculated, the performance indicators include service average response time, calling success rate, exception rate and calling frequency, and a graphical display view is constructed according to a business view, and an operation observation information set is output.
[0159] Embodiment 1:
[0160] In order to verify the feasibility of the application in implementation, the application is applied to a hybrid cloud service platform reconstruction project of a certain financial technology enterprise. The original system of the enterprise adopts a traditional micro-service deployment architecture, and there are problems such as configuration synchronization delay, difficulty in tracking cross-service link, system stability fluctuation caused by configuration change, and difficulty in supporting business high-concurrency access and flexible expansion requirements.
[0161] In the reconstruction process, first, the service registration layer, the service management layer and the service running layer are constructed according to the method of the application, and the three-layer decoupling deployment of the system is realized. In the service registration layer, the registration center component is used to uniformly manage the service instance life cycle and dynamically maintain the service registration information set. In the service management layer, the Trace-ID is injected through the unified gateway to realize service discovery, load balancing and calling link tracking; the dynamic distribution strategy based on weighted round robin is introduced in the management logic to effectively balance the pressure of different service nodes. In the service running layer, each business module is divided into an independent micro-service, and is deployed and equipped with an independent database and a cache system to improve the service isolation and maintainability.
[0162] In order to further cope with the impact of frequent configuration changes on system stability, the batch ordered CatBoost risk prediction model constructed in the application is used. Through residual analysis of historical configuration change samples, a sub-model is constructed, the risk prediction probability of different change batches is obtained by batch training, and the deployment strategy is dynamically adjusted based on the risk level to realize the risk warning mechanism before the change. Finally, combined with the configuration risk level information output by the model and the micro-service running architecture, a hybrid cloud deployment mode of local + cloud is used to complete the differential deployment of sensitive components and non-sensitive components.
[0163] Through comparison of the running monitoring data in the month before and after the reconstruction, the average response time of the system service instance is reduced from the original 186ms to 103ms, the number of service interruption events caused by configuration changes is reduced from 11 per month to 2, and the calling link tracking success rate is improved from 74.6% to 96.2%. Especially in the risk control dimension, the warning accuracy rate of the model for high-risk change batches reaches 92.8%, which greatly reduces the problem of system unavailability caused by configuration errors.
[0164] Table 1 Comparison of key performance before and after three-layer microservice architecture deployment
[0165]
[0166] As can be seen from the above table, the application has an optimization effect on a plurality of key performance indicators in the microservice system deployment and configuration management process compared with the traditional system architecture. First, in terms of service response efficiency, the average response time of the system is reduced from 186 milliseconds to 103 milliseconds, with an overall decrease of more than 44%, improving user access experience and system throughput capacity. Secondly, in terms of configuration change stability, although the number of configuration changes per month increases slightly from 19 to 23, the service interruption events caused by changes are greatly reduced from 11 per month to 2, indicating that the introduced configuration risk prediction mechanism improves the fault tolerance capability of the system to changes.
[0167] In terms of risk control effect, the batch ordered CatBoost model introduced by the application achieves a high risk warning accuracy of 92.8%, effectively avoiding system abnormalities that may be caused by high-risk configuration changes. In terms of system observation and governance capability, the link tracking success rate is improved from 74.6% to 96.2%, indicating that the established full-link tracking mechanism can more completely reflect the service call path, providing strong support for problem positioning and performance analysis. At the same time, the node-level CPU load fluctuation is reduced from ± 42% to ± 19%, and the request failure rate is reduced from 1.84% to 0.42%, indicating that the load balancing and fuse control strategy is more efficient, and the system stability is stronger
[0168] The above is only the preferred specific embodiment of the application, but the protection scope of the application is not limited thereto, any person skilled in the art within the technical scope disclosed by the application, according to the technical solution and inventive concept of the application, equivalent replacement or change, should be covered within the protection scope of the application.
Claims
1. A three-tier microservices architecture design and deployment method, characterized in that, The method comprises the following steps: A service registration layer is constructed, a registration center is deployed, information of each microservice at startup is collected and processed, and a service registration information set is obtained; A service governance layer is constructed, service discovery, routing distribution, load balancing and fuse control are performed based on the service registration information set, and a service governance configuration set is constructed; A service running layer is constructed, decoupled function service modules are deployed, independent databases and caches are configured, and a microservice running architecture is formed; A configuration management mechanism is established, services pull configurations at startup, configuration changes are pushed through a message bus and dynamically loaded, and a configuration change request information set is generated; Based on the configuration change request information set, a CatBoost model is trained in batches in an ordered manner, and configuration risk level information is output; Based on the microservice running architecture and the configuration risk level information, service components are deployed on the local and cloud according to sensitivity, and a hybrid deployment result information is obtained; Based on the service governance configuration set and the service deployment topology structure, a full-link tracking mechanism is constructed, a Trace-ID is injected and passed to record the call chain, and a running observation information set is obtained; The CatBoost model is trained in batches in an ordered manner based on the configuration change request information set, and the configuration risk level information is output, which specifically comprises: Based on the configuration change request information set, the change events are aggregated in timestamp order to obtain a configuration change batch set; Based on the precedence relationship between each batch in the configuration change batch set, a batch dependency directed acyclic graph is constructed; Topological sorting operation is performed on the batch dependency directed acyclic graph to obtain a batch topological sorting sequence; The configuration change samples in each batch are organized into a feature vector set, each feature vector is bound with the corresponding label, and a training data set is constructed; The CatBoost model is improved by introducing a batch ordered promotion mechanism, and a predicted risk probability is output; The predicted risk probability is compared with a pre-set risk level threshold set in stages, and a risk level label is generated; The risk level label of each batch is bound with the corresponding service name and configuration field to generate a configuration risk level information set. 2.The three-layer microservice architecture design and deployment method of claim 1, wherein, The service registration layer is constructed, the registration center is deployed, the information of each microservice at startup is collected and processed, and the service registration information set is obtained, which specifically comprises: The service registration center is deployed, the service registration interface, the health check interface, the heartbeat state management module and the service elimination module are constructed, and the empty service list is initialized; When each microservice instance starts, the microservice instance information is collected to form a service metadata information set; Each item of service metadata in the service metadata information set is sent to the service registration center through the service registration interface to obtain an initial service list; The service registration center allocates a corresponding heartbeat state recorder for the service metadata, updates the heartbeat timestamp in real time and establishes a mapping relationship to form a heartbeat state mapping table; The service registration center periodically traverses the heartbeat state mapping table, compares the latest heartbeat timestamp corresponding to each item of service metadata with the current system time, and obtains a set of abnormal service metadata. The service registry center excludes all abnormal service metadata from the initial service list according to the abnormal service metadata set to obtain a service registration information set.
3. The three-layer microservice architecture design and deployment method of claim 1, wherein, The service governance layer is constructed, service discovery, route distribution, load balancing and fuse control are performed based on the service registration information set, and the service governance configuration set is constructed, which specifically includes: The service governance layer is constructed, the service gateway, load balancing component, fuse degradation module and route management module are deployed, and the service governance configuration structure is initialized; The service registration information set is called, the service metadata is grouped according to the service name, and a service discovery index mapping table is constructed; When receiving a client request, the target service name is identified according to the service discovery index mapping table, and a target service candidate instance set is obtained; A load balancing strategy is performed on the target service candidate instance set to determine a target service instance, and a target service route path is generated; The client request is forwarded to the selected service instance through the service gateway according to the target service route path; In the service calling process, the response state of the target service instance is monitored in real time, when the number of continuous exceptions exceeds the set threshold, the fuse logic is triggered, the service instance is removed from the service registration information set, and the service discovery index mapping table is updated; The latest state of the current load balancing strategy configuration, route path mapping, fuse rule parameters and service registration information set is written into the service governance configuration structure to obtain an updated service governance configuration set.
4. The three-layer microservice architecture design and deployment method of claim 1, wherein, The service running layer is constructed, the decoupled function service module is deployed, the independent database and cache are configured, and the microservice running architecture is formed, which specifically includes: The service running layer is constructed, the system is service module split according to business functions, and a service module set is obtained; Each service module is containerized and encapsulated and deployed as an independent running process unit to obtain a service process set; An independent database instance and cache node are allocated for each service process, and data access permissions and connection pool parameters are configured to form an independent data support unit set; The inter-service process communication mode is limited to a synchronous API call or an asynchronous message queue mechanism to construct a process communication topology graph; Based on the service process set, the data support unit set and the process communication topology graph, a business service set is constructed; The business service set is deployed to the available instance specified by the service governance layer, and the metadata information is registered to the registry center to form a microservice running architecture.
5. The three-layer microservice architecture design and deployment method of claim 1, wherein, The configuration management mechanism is established, the configuration is pulled by the service start, the configuration change is pushed through the message bus and dynamically loaded, and a configuration change request information set is generated, which specifically includes: The configuration management mechanism is established, the configuration server is deployed to store the environmental configuration file, and a configuration file set is formed; The configuration server is configured with a unified interface service and an authentication mechanism to provide remote pulling capability for accessing configuration content according to service name, forming a service configuration pulling interface set; When each service process starts, the configuration server is accessed through the corresponding configuration pulling interface according to the service name to obtain an initialization configuration context set; The configuration server listens to the content change of the configuration file set to build a configuration broadcast message stream; After receiving the target configuration change event in the configuration broadcast message stream, the service process performs a configuration context replacement operation on the corresponding service runtime, dynamically loads the new configuration content, and records the change identifier; Each configuration file pulling and updating event is structured and encapsulated to form a configuration change request information, and a configuration change request information set is generated by timestamp and service name aggregation.
6. The three-layer microservice architecture design and deployment method of claim 1, wherein, The introduction of the batch order boosting mechanism improves the CatBoost model, and the output prediction risk probability specifically includes: The introduction of the batch order boosting mechanism improves the CatBoost model, and the improved CatBoost model is formed by sequentially accumulating a plurality of batch CatBoost sub-models, each of which is composed of a plurality of ordered decision trees. Topological sorting is performed on the configuration change batch set to obtain a batch sequence, and for any target batch, only the residual information of the previous batch is allowed to be used to form a batch residual dependency set. Based on the batch residual dependency set, first calculate the residual of the sample, and multiply the residual by the corresponding batch weight to obtain the weighted residual. After normalizing the weighted residuals of all samples, they are sorted and aggregated to form a batch weighted residual set. An ordered target encoding mechanism is used for category features, and target statistics are calculated for samples to form a batch ordered feature set. Based on the batch ordered feature set and the batch weighted residual set, a CatBoost feature split gain function is constructed, and all split gain value combinations form a batch feature split gain set. Based on the batch feature split gain set, the feature with the maximum gain is selected as the split point to generate a symmetric binary tree node, and the splitting is repeated until the preset tree depth is reached to obtain a batch CatBoost sub-model. After training the current batch CatBoost sub-model, perform a weighted accumulation operation based on the existing last round cumulative prediction value and the prediction result of the current batch sub-model to obtain the prediction risk probability of the target batch.
7. The three-layer microservice architecture design and deployment method of claim 1, wherein, The hybrid deployment result information is obtained by deploying the sensitive service components locally and the cloud based on the microservice running architecture and configuration risk level information, specifically including: Based on the business functions and communication behaviors of each service module in the microservice running architecture, extract key sensitivity evaluation features to obtain a sensitivity feature set; Based on the sensitivity feature set and the configuration risk level information set, calculate the sensitivity score for each microservice instance; According to the sensitivity score, divide each microservice instance into sensitive service components and non-sensitive service components to form a service sensitivity division result; Deploy the sensitive service components on the local server and the non-sensitive service components on the cloud Kubernetes cluster, and connect the local server and the cloud Kubernetes cluster based on a dedicated network tunnel to build a secure isolated deployment architecture; According to the service sensitivity division result and the deployment architecture, establish a microservice deployment mapping relationship to form a service deployment topology diagram, and complete the microservice deployment operation according to the service deployment topology diagram to obtain the hybrid deployment result information.
8. The three-layer microservice architecture design and deployment method of claim 1, wherein, The service governance configuration set and the service deployment topology are used to construct a full-link tracking mechanism, a Trace-ID record calling chain is injected and transmitted, and a running observation information set is obtained, specifically including: Based on the service governance configuration set and the service deployment topology, a full-link tracking and running observation mechanism is constructed, a request entry injection logic is configured in the API gateway, a globally unique request identifier Trace-ID is generated for each request entering the system, and request identification information is obtained; When service calls are made between microservices, the upstream service carries the request identification information in the request message, and the downstream service parses and transmits it, obtaining link propagation information; Based on the link propagation information, a multi-hop calling node graph is constructed, and calling link tracking logs are output, forming a calling tracking log set; The calling tracking log set is uploaded to a centralized log analysis system, a unified structured storage model is constructed, and a calling link monitoring data set is obtained; Based on the calling link monitoring data set, performance indicators are calculated, and a graphical display view is constructed according to the business view, and a running observation information set is output.
Citation Information
Patent Citations
Ansible-based micro-service deployment method and system
CN115291892A
Systems and methods for recording metadata about microservices for requests to the microservices
US20200366752A1