Elastic microservice system and implementation method based on distributed and container virtualization

Through distributed and container virtualization technology, the microservice system architecture is designed to solve the performance bottleneck of traditional single application architecture and the complexity of edge computing node deployment, achieve high scalability and stability of the system, and adapt to changes in business needs. And supports heterogeneous node deployment.

CN114422371BActive Publication Date: 2024-10-29CHONGQING UNIV OF POSTS & TELECOMM
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202210066486.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-20
Publication Date
2024-10-29
Estimated Expiration
2042-01-20

AI Technical Summary

Technical Problem

The traditional monolithic application architecture is difficult to adapt to performance bottlenecks when faced with business expansion and demand changes. Moreover, the heterogeneous characteristics of edge computing nodes bring deployment complexity and lack efficient, stable, and flexible heterogeneous node support.

Method used

Use distributed and container virtualization technology to design a system architecture based on microservices, including business logic layer, network topology layer and virtual container layer. Through distributed network topology, service registration mechanism and multiple topology models, combined with container virtualization technology to provide heterogeneous node operation support for microservices and achieve system scalability and stability.

Benefits of technology

It achieves high scalability, stability and portability of the system, can dynamically adjust microservice instances and network topology to adapt to changes in business needs, reduces development costs, and supports heterogeneous node deployment, improving system performance and availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114422371B_ABST
    Figure CN114422371B_ABST
Patent Text Reader

Abstract

The present invention relates to an elastic microservice system and implementation method based on distributed and container virtualization, and belongs to the field of communication technology. The system includes: a business logic layer, a network topology layer and a virtual container layer. The business logic layer is composed of a logic processing module, a data storage module and a message processing module; the network topology layer is composed of an asynchronous message queue communication mechanism, a load balancing mechanism, a service registration mechanism, a request / response model, a publish / subscribe model, a pipeline model, and a composite model; the virtual container layer is composed of a container generation module, an image construction module, an image management module and a container virtualization engine. The present invention overcomes the performance bottleneck and expansion drawbacks of the traditional development model; adopts a distributed network topology structure, a service registration mechanism combined with a variety of topology models to solve the distributed complex network topology deployment problem that may exist in edge computing nodes; and adopts container virtualization technology to provide heterogeneous node operation support for microservices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of communication technology, and relates to the technical field of distributed and container virtualized microservices, and specifically to an elastic microservice system based on distributed and container virtualization and an implementation method thereof. Background Art

[0002] The construction of the modern water conservancy industry is based on digitalization, networking and intelligence, with virtual simulation, accurate prediction and smart decision-making as the path, and digital empowerment is achieved by comprehensively promoting the construction of data, algorithms and computing power. Therefore, there are higher requirements for the advancement, concurrency, security and real-time performance of smart water conservancy systems.

[0003] In the traditional monolithic application architecture, developers can quickly complete the development and deployment of applications with smaller business volumes and requirements. However, as time goes by, factors such as business expansion and demand changes continue to affect the adjustment cost of monolithic applications. At the same time, the performance bottleneck encountered by monolithic applications cannot be linearly increased by simply increasing the number of monolithic application instance nodes in cluster deployment. Therefore, how to adapt to the impact of business expansion and demand changes over time and overcome the performance bottleneck caused by business development is a problem that developers must face during the architecture design stage.

[0004] In addition, with the continuous innovation of virtualization technology in the computer field, especially the emergence of container virtualization technology, new opportunities and challenges have been brought to the software and hardware industries. As edge computing technology is gradually being widely used in traditional industries (such as the water conservancy industry), developers have to pay attention to the heterogeneous characteristics of the edge nodes where the programming language and its dependencies are located while implementing business logic. The existence of container virtualization technology provides efficient, stable and elastic heterogeneous node support, which makes it possible to quickly produce and deploy edge computing nodes.

[0005] Therefore, there is an urgent need for an elastic microservice system based on distribution and container virtualization to solve the problems encountered in the digital construction of traditional industries (such as the water conservancy industry). Summary of the invention

[0006] In view of this, the purpose of the present invention is to provide a flexible microservice system based on distributed and container virtualization, which adopts a microservice development model with finer granularity than the traditional single application development model, overcomes the performance bottleneck and expansion disadvantages of the traditional development model; adopts a distributed network topology structure and a service registration mechanism combined with a variety of topology models to solve the distributed complex network topology deployment problem that may exist in edge computing nodes; and adopts container virtualization technology to provide heterogeneous node operation support for microservices. The microservice framework implemented by the integrated microservice development model, distributed network topology, and container virtualization technology makes the system more portable, more stable, and more focused on core business realization, thereby achieving the purpose of expanding the applicable business field and bringing new application development and deployment models to more traditional fields (such as the water conservancy construction industry).

[0007] In order to achieve the above object, the present invention provides the following technical solutions:

[0008] Technical Solution 1: A distributed and container-virtualized elastic microservice system, including a business logic layer, a network topology layer, and a virtual container layer. The business logic layer, as the highest layer of the system, is responsible for sending and receiving microservice messages, logic processing and data storage, and establishing a connection with the network topology layer through the TCP / IP protocol to become a network node to exchange data with other nodes.

[0009] The network topology layer is integrated into the microservice system as a system middle layer, responsible for providing support for building distributed complex network topologies, receiving data input from the open ports of the virtual container layer, forwarding the data to the business logic layer through service registry query, load balancing and network routing, and sending the processing results of the business logic layer to the container virtual layer through routing, completing the complete process of message request and response;

[0010] The virtual container layer, as the bottom layer of the system, is responsible for providing support for the operation of heterogeneous microservice nodes, and for opening ports to connect the network topology layer inside the virtual container and the outside of the virtual container to establish a communication link with the outside.

[0011] Furthermore, the business logic layer includes: a logic processing module, a data storage module and a message processing module;

[0012] The logic processing module is used to implement business processing work at the business logic layer, provide custom programming language support, and select a suitable programming language to process business logic according to actual needs; the data storage module is used to store temporary data or permanent data generated by the logic processing module, provide custom database support, and select a suitable database to store business processing data according to actual needs; the message processing module is used to receive, send, encode and decode messages, establish a connection with the network topology layer through the TCP / IP protocol, and exchange data.

[0013] Further, the network topology layer includes: asynchronous message queue communication mechanism, load balancing mechanism, service registration mechanism, request / response model, publish / subscribe model, pipeline model and composite model;

[0014] The asynchronous message queue communication mechanism is used to weaken the high concurrency peak that may exist in the communication network through queue caching, reduce the impact on the overall communication network, and use technologies such as epoll and select to design message queues that support asynchronous communication, so that the network topology layer can communicate with other microservices in an asynchronous manner, decouple the data interaction between microservices, and maintain the characteristics of mutual independence and non-interference between microservices;

[0015] The load balancing mechanism is used to centrally receive messages sent by other nodes in the network topology layer to this node, and forward the messages to different instances of the same microservice in a balanced manner in combination with the evaluation microservice performance status indicator, so that good performance is maintained between nodes in the network topology layer;

[0016] The service registration mechanism is used to regularly monitor microservice performance status indicators and flexibly adjust the number of microservice instances. When the system flexibly adjusts the number of microservice instances according to the usage scenario, the routing information such as the node address of the microservice corresponding to the external service will be actively registered in the service registration table. When the network topology layer needs to send data to the target node, the target node microservice routing information is queried according to the service registration mechanism;

[0017] The request / response model is used to establish the constraints that nodes in the same network topology need to follow when sending and receiving messages: the two connected parties are divided into client and server, the party that sends the message is the client, and the party that receives, processes and responds to the message is the server; after the client sends a message, it cannot send the message again before receiving the server's response to the message, and the server must receive the message first, and cannot receive the message again before responding to the message, which is specifically manifested as a question-and-answer situation;

[0018] The publish / subscribe model is used to establish the constraints that nodes in the same network topology need to follow when sending and receiving messages: among all the nodes that establish indirect communication, the node responsible for sending information is called the publishing node, and the node responsible for receiving messages is called the subscribing node; under the rules of this model, messages can only be published by publishers, and all subscribers will receive messages published by publishers, but publishers cannot receive messages from subscribers, and subscribers cannot publish messages to publishers. A one-way communication link is established between publishers and subscribers;

[0019] The pipeline model is used to establish the constraints that nodes in the same network topology need to follow when sending and receiving messages: all nodes that establish connections are divided into three types. The node that is initially responsible for generating tasks is called a production node, and the node that is responsible for receiving and processing tasks is called a consumption node. A pipeline model is established between production nodes and consumption nodes, and the consumption node maintains a message pipeline: the production node is connected to the message pipeline of the consumption node, and pushes the task to the far end of the message pipeline of the consumption node through the PUSH operation. The consumption node pulls the latest task from the near end of the message pipeline of the consumption node through the PULL operation and starts processing. After the processing is completed, the next task is pulled from the pipeline.

[0020] The composite model is used to construct a distributed complex network topology structure by combining the basic request / response model, the publish / subscribe model and the pipeline model according to actual needs.

[0021] Furthermore, the microservice performance status indicators include: number of messages processed per unit time, idle time ratio, memory occupancy rate, network channel packet loss rate, CPU occupancy rate and network connection delay.

[0022] Further, the virtual container layer includes: a container generation module, an image construction module, an image management module and a container virtualization engine;

[0023] The container generation module is used for image file instantiation, converting a static image file into a dynamically running virtual container. The network topology layer and the business logic layer run inside the container generated by the container generation module, forming an independent operating environment.

[0024] The image building module is used to generate an image file according to the standard image building instructions, and is responsible for processing operations such as referencing images and file copying, and building a static environment independent of the host node by executing the image building instructions;

[0025] The image management module is used to manage the images generated by all image building modules, including operations such as image update, image acquisition or image deletion;

[0026] The container virtualization engine serves as the underlying support of the virtual container layer, and is used to abstract the operating system and hardware platform externally, and to abstract the programming language and other tools that implement core functions internally. It plays an important role in improving the impact of the deployment of different microservices on the same node on the global environment, and in supporting the heterogeneity of the software and hardware platforms of the nodes on which the microservices are located.

[0027] Furthermore, when the image management module performs image update, image acquisition or image deletion, it needs to carry a token with authentication information to initiate a request; when the image management module receives a request for an image operation, it first checks whether the request is legal. If the request does not carry a token, the token is forged, the token has expired or the token does not have the authority to perform the operation, the image management module will refuse to execute the request and return an error prompt; if the request passes the legality check, the image management module will perform the specified operation according to the message protocol of the request.

[0028] Technical Solution 2: A method for implementing a distributed and container-virtualized elastic microservice system, specifically comprising the following steps:

[0029] S1: Analyze the core business requirements of microservices, determine the appropriate programming language to implement business processing at the business logic layer, determine the appropriate data storage tool to store important temporary or permanent data, and use programming languages ​​to build message processing logic;

[0030] S2: The message processing logic constructed according to step S1 includes the specific implementation of message reception, transmission, encoding and decoding and joins the network topology structure through the TCP / IP protocol to exchange data with other network nodes;

[0031] S3: Test the completeness of the core business functions of the microservice. After initially completing the implementation of the core business logic of the microservice, join the topology network and conduct network connectivity tests with the test nodes, core business function tests, database connection tests, and message concurrency tests.

[0032] S4: After passing the integrity test of the core business functions in step S3, actively register with the network topology layer through the service registration mechanism to become a formal microservice node, and prepare for the subsequent reception and processing of external incoming messages;

[0033] S5: After registering as a formal microservice node, build the image and update the image to the image management module, and instantiate and deploy the built image through the container generation module;

[0034] S6: The service registration mechanism regularly detects the number of messages processed per unit time, idle time ratio, memory occupancy, network channel packet loss rate, CPU occupancy, and network connection delay of each registered microservice, and generates the corresponding microservice performance status indicator;

[0035] S7: According to the microservice performance status indicator of step S6, the microservice system elastically adjusts the number of instantiations of a single microservice or dynamically adjusts the appropriate network topology.

[0036] Further, in step S7, the specific steps of elastic adjustment of the microservice system are as follows:

[0037] S71: Service registration mechanism microservice performance status indicator, judging whether the performance status indicator of a single instantiation object of a microservice is healthy according to the load balancing mechanism;

[0038] S72: When the microservice performance status indicator is high load, the service registration mechanism actively sends a request to the underlying container virtual layer, requesting the container generation module to search the image management module for the image file built by the corresponding microservice, and instantiate the image file into a specific microservice container instance;

[0039] S73: After the image is instantiated into a specific microservice container instance, the service registration mechanism registers the new microservice container instance and then shares the message processing pressure of different instances of the same microservice through the load balancing mechanism, thereby improving the overall message processing capability and overall performance of the microservice system through elastic expansion.

[0040] The beneficial effects of the present invention are:

[0041] (1) Under the development model of the microservice system of the present invention, developers can deal with changes in system requirements more calmly. The increase or decrease of a single requirement can be abstracted into the increase or decrease of microservices. With the excellent characteristics of mutual independence and low coupling of microservices, developers can easily unravel the system business and demand changes. At the same time, to complete the development of a system with complex business volume and large scale, it is not required that all personnel involved in the system development fully master the structure of the system. Instead, the core functions are realized through modular development. Each team or developer implements the single core function of the system decomposition and interacts with other microservices through certain specifications or standards.

[0042] (2) The microservice system of the present invention is not equivalent to a component. A microservice is a specific implementation of a single core function that has been assembled and can be used in a production environment, while a component is an element that needs further processing and is used to constitute a complete system or a single link. Microservices packaged in containers can be deployed to various heterogeneous nodes quickly, conveniently, stably, and across platforms. Once a new business chain is generated, if most or all of the core business functions of the new business chain after splitting exist in a complete and specific microservice implementation, the independent deployment characteristics of microservices combined with container virtualization technology can be quickly deployed to new nodes and put into production.

[0043] (3) The distributed elastic microservice based on the elastic network structure of the present invention has good dynamic scalability. According to different actual usage scenarios, a microservice can flexibly deploy one instance or multiple instances, and combine the service registration mechanism to regularly detect the registered service performance status indicators, dynamically expand or reduce the number of edge computing nodes or microservice instantiation objects, and improve the overall stability and efficiency of the system.

[0044] (4) The present invention is an elastic microservice system based on distribution and container virtualization, which effectively serves the construction of the modern water conservancy industry with digitalization, networking and intelligence as the main lines. The convenient microservice system development model abstracts the programming language and its dependent tools, and the heterogeneous support for software and hardware platforms provided by container virtualization provides a basic guarantee for comprehensively promoting the construction of data, algorithms, and computing power in the modern water conservancy industry and ultimately realizing the digital empowerment of the industry; the elastic distributed network foundation provided by various network topology models meets the requirements of the advancement, concurrency, security, and real-time performance of the smart water conservancy system, which is one of the core of the construction of the modern water conservancy industry.

[0045] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:

[0047] Figure 1 This is a framework diagram of the elastic microservice system based on distribution and container virtualization of the present invention;

[0048] Figure 2 It is a flowchart of the message processing module of the present invention;

[0049] Figure 3 It is a block diagram of the load balancing mechanism of the present invention;

[0050] Figure 4 This is a functional block diagram of the service registration mechanism of the present invention;

[0051] Figure 5 It is a flowchart of the request / response model of the present invention;

[0052] Figure 6 It is a flowchart of the publish / subscribe model of the present invention;

[0053] Figure 7 It is a pipeline model flow chart of the present invention;

[0054] Figure 8 This is a flowchart of the image management module authentication process of the present invention. DETAILED DESCRIPTION

[0055] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.

[0056] See also Figures 1 to 8 , Figure 1 The elastic microservice system based on distributed and container virtualization provided by the present invention specifically includes a business logic layer, a network topology layer and a virtual container layer.

[0057] As an architectural middle layer, the network topology layer is integrated into the microservice architecture. It is responsible for providing support for building distributed complex network topologies, receiving data input from the open ports of the virtual container layer, forwarding the data to the business logic layer through service registry query, load balancing, and network routing, and sending the processing results of the business logic layer to the container virtual layer through routing, completing the complete process of message request and response.

[0058] As the bottom layer of the architecture, the virtual container layer is responsible for providing support for the operation of heterogeneous microservice nodes, opening ports to the outside, connecting the network topology layer inside the virtual container and the outside of the virtual container, and establishing communication links with the outside.

[0059] As the highest layer of the architecture, the business logic layer provides microservice message sending and receiving, logic processing, and data storage functions, and establishes a connection with the network topology layer through the TCP / IP protocol, becoming a network node to exchange data with other nodes.

[0060] Specifically, the business logic layer includes a message processing module, a logic processing module, and a data storage module.

[0061] like Figure 2As shown, the message processing module is the basic module for data exchange between the business logic layer and the middle layer network topology layer, and is responsible for receiving data from the network through the TCP / IP communication protocol and decoding the obtained data. As a preferred embodiment, this embodiment stipulates the use of JSON format strings for network communication, so the message processing module is responsible for decoding the binary data received from the network topology layer into JSON format strings. Before sending the data to the network topology layer, the message processing module is responsible for encoding the JSON format strings of the business logic layer into binary data that can be transmitted in the network topology layer.

[0062] As a preferred embodiment, the logic processing module uses a suitable programming language such as Python, C / C++, Go, and Java to implement the business processing logic, so as to realize the convenient, efficient, and stable microservices described in the present invention.

[0063] As a preferred embodiment, the data storage module uses a suitable database such as MySQL, Redis, Mongodb, and PostgreSQL to implement data storage, and is used to provide microservices with important temporary and permanent data writing, querying, reading, and modifying functions.

[0064] The network topology layer includes asynchronous message queue communication mechanism, load balancing mechanism, service registration mechanism, request / response model, publish / subscribe model, and pipeline model.

[0065] As a preferred embodiment, the asynchronous message queue communication mechanism uses epoll, select and other technologies to provide support, and uses queue cache to weaken the high concurrency peak that may exist in the communication network, reducing the impact on the overall communication network; using asynchronous methods to communicate with other microservices, decoupling the communication interactions between microservices, and maintaining the characteristics of mutual independence and non-interference between microservices.

[0066] As a preferred embodiment, the load balancing mechanism is used to centrally receive messages sent to this node by other nodes in the network topology layer, and forward the messages to different instances of the same microservice in a balanced manner in combination with the evaluation of the microservice performance status indicator, so that good performance is maintained between the nodes in the network topology layer; further, the load balancing mechanism principle block diagram is shown in Figure 3 shown.

[0067] The service registration mechanism is used to periodically detect microservice performance status indicators and flexibly adjust the number of microservice instances. When the system flexibly adjusts the number of microservice instances according to the usage scenario, the routing information such as the node address of the microservice that provides services to the outside world will be actively registered in the service registry. When the network topology layer needs to send data to the target node, the target node microservice routing information is queried according to the service registration mechanism. Microservice performance status indicators include the number of messages processed per unit time, idle time ratio, memory occupancy, network channel packet loss rate, CPU occupancy, and network connection delay. The principle block diagram of the service registration mechanism is as follows: Figure 4 shown.

[0068] The request / response model is used to establish the constraints that nodes in the same network topology must follow when sending and receiving messages: the two connected parties are divided into client and server. The party that sends the message is the client, and the party that receives, processes and responds to the message is the server. After the client sends a message, it cannot send the message again before receiving the server's response to the message. The server must receive the message first and cannot receive the message again before responding to the message. It is specifically a question-and-answer situation. The flowchart of the request / response model is as follows: Figure 5 shown.

[0069] The publish / subscribe model is used to establish the constraints that nodes in the same network topology need to follow when sending and receiving messages: among all the nodes that establish indirect communication, the node responsible for sending information is called the publishing node, and the node responsible for receiving messages is called the subscribing node; under the rules of this model, messages can only be published by publishers, and all subscribers will receive messages published by publishers, but publishers cannot receive messages from subscribers, and subscribers cannot publish messages to publishers. A one-way communication link is established between publishers and subscribers. The flowchart of the publish / subscribe model is as follows: Figure 6 shown.

[0070] The pipeline model is used to establish the constraints that nodes in the same network topology need to follow when sending and receiving messages: all nodes that establish connections are divided into three types. The node that is initially responsible for generating tasks is called a production node, and the node that is responsible for receiving and processing tasks is called a consumer node. A pipeline model is established between production nodes and consumer nodes, and consumer nodes maintain a message pipeline: the production node is connected to the message pipeline of the consumer node, and pushes the task to the far end of the message pipeline of the consumer node through the PUSH operation. The consumer node pulls the latest task from the near end of the message pipeline of the consumer node through the PULL operation and starts processing. After the processing is completed, it pulls the next task from the pipeline. The pipeline model flow chart is as follows Figure 6 shown.

[0071] The virtual container layer includes a container generation module, an image construction module, an image management module, and a container virtualization engine.

[0072] The container generation module is used to instantiate the image file, converting the static image file into a dynamically running virtual container. The network topology layer and the business logic layer in the microservice framework run inside the container generated by the container generation module, forming an independent operating environment. The container generation module uses the podman container virtualization tool, which is used in the elastic microservice system based on distributed and container virtualization of the present invention, providing a mature, simple and stable container virtualization deployment solution.

[0073] The image building module is used to generate an image file according to the standard image building instructions. The image building module is responsible for processing operations such as reference images and file copies and building a static environment independent of the host node by executing building instructions. As a preferred embodiment, the image building module uses the buildah image building tool, which is used in the virtual container layer of the present invention to provide a solution for image building command parsing and execution.

[0074] The image management module is used to manage the images generated by all image modules, including image update, image acquisition, image deletion and other operations. When executing the image update, image acquisition and image deletion modules, the image management module needs to carry a token with authentication information to initiate a request. When the image management module receives a request for an image operation, it first checks whether the request is legal. If the request does not carry a token, the token is forged, the token has expired, or the token does not have permission to perform the operation, the image management module will refuse to execute the request and return an error message. If the request passes the legitimacy check, the image management module will perform the specified operation according to the requested message protocol. The authentication flow chart of the image management module is shown below. Figure 8 shown.

[0075] The container virtualization engine is used to abstract the operating system and hardware platform externally, and to abstract the programming language and other tools that implement the core functions internally. As the underlying support of the virtual container layer, the container virtualization engine plays an important role in improving the impact of the deployment of different microservices on the same node on the global environment and the support of microservices for the heterogeneous software and hardware platforms of the nodes. As a preferred embodiment, podman is used as the container virtualization engine for the elastic microservice system based on distributed and container virtualization of the present invention, providing a mature underlying support for container virtualization.

[0076] The implementation method of the elastic microservice system based on distributed and container virtualization provided by the present invention specifically includes the following steps:

[0077] Step 1: Analyze the core business requirements of microservices, determine the appropriate programming language to implement business processing at the business logic layer, determine the appropriate data storage tool to store important temporary or permanent data, and use programming languages ​​to build message processing logic;

[0078] Step 2: According to the message processing logic of step 1, including the specific implementation of message reception, transmission, encoding, and decoding, and joining the network topology through the TCP / IP protocol to exchange data with other network nodes;

[0079] Step 3: Test the completeness of the core business functions of the microservice. After initially completing the implementation of the core business logic of the microservice, join the topology network and conduct network connectivity tests, core business function tests, database connection tests, and message concurrency tests with the test nodes.

[0080] Step 4: According to the microservice in step 3, after passing the integrity test of the core business functions, actively register with the network topology layer through the service registration mechanism to become a formal microservice node and prepare for subsequent reception and processing of external incoming messages;

[0081] Step 5: According to the microservice in step 4, after registering as a formal microservice node, build the image, update the image to the image management module, and instantiate and deploy the built image through the container generation module;

[0082] Step 6: The service registration mechanism periodically detects the number of messages processed per unit time, idle time ratio, memory occupancy, network channel packet loss rate, CPU occupancy, and network connection delay of each registered microservice, and generates corresponding performance status indicators;

[0083] Step 7: Based on the performance status indicators in step 6, combined with the service registration mechanism, container generation module, and image management module, the number of instantiations of a single microservice will be elastically adjusted and the appropriate network topology will be dynamically adjusted.

[0084] Specifically, the specific steps for elastic adjustment of the microservice architecture in step 7 are as follows:

[0085] 1) The service registration mechanism microservice performance status indicator determines whether the performance status indicator of a single instantiation object of a microservice is healthy based on the load balancing mechanism.

[0086] 2) When the microservice performance status indicator is high load, the service registration mechanism actively sends a request to the underlying container virtual layer, requesting the container generation module to search the image management module for the image file built by the corresponding microservice, and instantiate the image into a specific microservice container instance.

[0087] 3) After the image is instantiated into a specific microservice container instance, the service registration mechanism registers the new microservice container instance, and then shares the message processing pressure of different instances of the same microservice through the load balancing mechanism, thereby improving the overall message processing capability and overall performance of the microservice architecture through elastic expansion.

[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.

Claims

1. An elastic microservice system based on distribution and container virtualization, characterized in that: The system includes a business logic layer, a network topology layer, and a virtual container layer; The business logic layer, as the highest layer of the system, is responsible for sending and receiving microservice messages, logic processing and data storage, and establishing a connection with the network topology layer through the TCP / IP protocol, becoming a network node to exchange data with other nodes; the business logic layer includes: a logic processing module, a data storage module and a message processing module; the logic processing module is used to implement the business processing work of the business logic layer, provide custom programming language support, and select a programming language to process business logic; the data storage module is used to store temporary data or permanent data generated by the logic processing module, provide custom database support, and select an appropriate database according to actual needs to store business processing data; the message processing module is used to receive, send, encode and decode messages, establish a connection with the network topology layer through the TCP / IP protocol and exchange data; The network topology layer, as the middle layer of the system, is responsible for providing support for building distributed complex network topologies, receiving data input from the open ports of the virtual container layer, forwarding the data to the business logic layer through service registry query, load balancing and network routing, and sending the processing results of the business logic layer to the container virtual layer through routing, completing the complete process of message request and response; the network topology layer includes: asynchronous message queue communication mechanism, load balancing mechanism, service registration mechanism, request / response model, publish / subscribe model, pipeline model and composite model; The asynchronous message queue communication mechanism is used to reduce the high concurrency peak that may exist in the communication network through queue caching. The message queue that supports asynchronous communication is designed to enable the network topology layer to communicate with other microservices in an asynchronous manner. The load balancing mechanism is used to centrally receive messages sent by other nodes in the network topology layer to this node, and forward the messages to different instances of the same microservice in a balanced manner in combination with the evaluation of microservice performance status indicators; The service registration mechanism is used to regularly monitor microservice performance status indicators and flexibly adjust the number of microservice instances. When the system flexibly adjusts the number of microservice instances according to the usage scenario, the routing information of the node address corresponding to the microservice that provides services to the outside world will be actively registered in the service registration table. When the network topology layer needs to send data to the target node, the target node microservice routing information is queried according to the service registration mechanism. The request / response model is used to establish the constraints that nodes in the same network topology need to follow when sending and receiving messages: the two connected parties are divided into client and server, the party that sends the message is the client, and the party that receives, processes and responds to the message is the server; after the client sends a message, it cannot send the message again before receiving the server's response to the message, and the server must receive the message first, and cannot receive the message again before responding to the message, which is specifically manifested as a question-and-answer situation; The publish / subscribe model is used to establish the constraints that nodes in the same network topology need to follow when sending and receiving messages: among all the nodes that establish indirect communication, the node responsible for sending information is called the publishing node, and the node responsible for receiving messages is called the subscribing node; under the rules of this model, messages can only be published by publishers, and all subscribers will receive messages published by publishers, but publishers cannot receive messages from subscribers, and subscribers cannot publish messages to publishers. A one-way communication link is established between publishers and subscribers; The pipeline model is used to establish the constraints that nodes in the same network topology need to follow when sending and receiving messages: all nodes that establish connections are divided into three types. The node that is initially responsible for generating tasks is called a production node, and the node that is responsible for receiving and processing tasks is called a consumption node. A pipeline model is established between production nodes and consumption nodes, and the consumption node maintains a message pipeline: the production node is connected to the message pipeline of the consumption node, and pushes the task to the far end of the message pipeline of the consumption node through the PUSH operation. The consumption node pulls the latest task from the near end of the message pipeline of the consumption node through the PULL operation and starts processing. After the processing is completed, the next task is pulled from the pipeline. The composite model is used to construct a distributed complex network topology structure by combining the basic request / response model, the publish / subscribe model and the pipeline model according to actual needs; The virtual container layer, as the bottom layer of the system, is responsible for providing support for the operation of heterogeneous nodes of microservices, and opening ports to the outside to connect the network topology layer inside the virtual container and the outside of the virtual container to establish a communication link with the outside; the virtual container layer includes: a container generation module, an image construction module, an image management module and a container virtualization engine; the container generation module is used for image file instantiation, converting static image files into dynamically running virtual containers, and the network topology layer and the business logic layer run inside the container generated by the container generation module to form an independent operating environment; the image construction module is used to generate image files according to standard image construction instructions, and is responsible for processing reference images, file copies and building a static environment independent of the host node by executing image construction instructions; the image management module is used to manage all images generated by the image construction modules, including image update, image acquisition or image deletion; the container virtualization engine, as the bottom layer support of the virtual container layer, is used to abstract the operating system and hardware platform externally, and abstract the programming language and other tools for implementing core functions internally.

2. The elastic microservice system according to claim 1, characterized in that: The microservice performance status indicators include: number of messages processed per unit time, idle time ratio, memory occupancy rate, network channel packet loss rate, CPU occupancy rate and network connection delay.

3. The elastic microservice system according to claim 1, characterized in that: When the image management module executes image update, image acquisition or image deletion, it needs to carry a token with authentication information to initiate a request; When the image management module receives a request for an image operation, it first checks whether the request is legal. If the request does not carry a token, the token is forged, the token has expired, or the token does not have permission to perform the operation, the image management module will refuse to execute the request and return an error prompt; If the request passes the validity check, the image management module will perform the specified operation according to the requested message protocol.

4. A method for implementing a distributed and container virtualized elastic microservice system as claimed in claim 1, characterized in that: The method specifically comprises the following steps: S1: Analyze the core business requirements of microservices, determine the programming language to implement business processing at the business logic layer, determine the data storage tool to store temporary or permanent data, and use the programming language to build message processing logic; S2: The message processing logic constructed according to step S1 includes the specific implementation of message reception, transmission, encoding and decoding and joins the network topology structure through the TCP / IP protocol to exchange data with other network nodes; S3: Test the completeness of the core business functions of the microservice. After initially completing the implementation of the core business logic of the microservice, join the topology network and conduct network connectivity tests with the test nodes, core business function tests, database connection tests, and message concurrency tests. S4: After passing the integrity test of the core business functions in step S3, actively register with the network topology layer through the service registration mechanism to become a formal microservice node, and prepare for the subsequent reception and processing of external incoming messages; S5: After registering as a formal microservice node, build the image and update the image to the image management module, and instantiate and deploy the built image through the container generation module; S6: The service registration mechanism regularly detects the number of messages processed per unit time, idle time ratio, memory occupancy, network channel packet loss rate, CPU occupancy, and network connection delay of each registered microservice, and generates the corresponding microservice performance status indicator; S7: According to the microservice performance status indicator of step S6, the microservice system elastically adjusts the number of instantiations of a single microservice or dynamically adjusts the network topology; The specific steps for adjusting the elasticity of the microservice system are as follows: S71: Service registration mechanism microservice performance status indicator, judging whether the performance status indicator of a single instantiation object of a microservice is healthy according to the load balancing mechanism; S72: When the microservice performance status indicator is high load, the service registration mechanism actively sends a request to the underlying container virtual layer, requesting the container generation module to search the image management module for the image file built by the corresponding microservice, and instantiate the image file into a specific microservice container instance; S73: After the image is instantiated into a specific microservice container instance, the service registration mechanism registers the new microservice container instance and then shares the message processing pressure of different instances of the same microservice through the load balancing mechanism.

Citation Information

Patent Citations

  • Microservice deployment method, apparatus, device, and readable storage medium

    CN109144485A

  • Internet of Things platform construction method based on micro-service architecture

    CN110149396A

  • Data stream processing method, system and computer readable storage medium

    CN110716744A

  • Integrated enterprise data processing system and method based on micro-service

    CN110737653A

  • Container micro-service IT monitoring system and method

    CN111314455A