CN113360295A - Micro-service architecture optimization method based on intelligent arrangement - Google Patents
Micro-service architecture optimization method based on intelligent arrangement Download PDFInfo
- Publication number
- CN113360295A CN113360295A CN202110656715.2A CN202110656715A CN113360295A CN 113360295 A CN113360295 A CN 113360295A CN 202110656715 A CN202110656715 A CN 202110656715A CN 113360295 A CN113360295 A CN 113360295A
- Authority
- CN
- China
- Prior art keywords
- micro
- service
- services
- service combination
- optimization method
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 22
- 238000005457 optimization Methods 0.000 title claims abstract description 17
- 230000008859 change Effects 0.000 claims abstract description 13
- 230000006870 function Effects 0.000 claims description 20
- 238000012508 change request Methods 0.000 claims description 4
- 230000003068 static effect Effects 0.000 claims description 3
- 238000004891 communication Methods 0.000 abstract description 13
- 238000013461 design Methods 0.000 description 10
- 238000012545 processing Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 4
- 238000012544 monitoring process Methods 0.000 description 3
- 238000005192 partition Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000033772 system development Effects 0.000 description 2
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000013499 data model Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000002688 persistence Effects 0.000 description 1
- 230000004083 survival effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Abstract
The invention discloses a micro-service architecture optimization method based on intelligent arrangement, which comprises the following steps: the system realizes the flexibility of micro-service combination through a message queue, and realizes data communication between micro-services by using a Kafka message queue; uniformly describing the service combination strategy, and intelligently arranging each micro service according to the service combination strategy; the micro-service combination hot update control platform provides a platform for a user to define a service combination strategy; and the daemon thread monitors the change of the combination strategy in real time, and changes the data flow direction among the micro services by changing the message channel Topic subscribed by the micro services. The invention realizes the automatic configuration of the micro-service combination and the hot updating mode without shutdown and restart, and improves the efficiency of changing the data flow direction between services.
Description
Technical Field
The invention belongs to the field of micro-service architectures, and particularly relates to a micro-service architecture optimization method based on intelligent arrangement.
Background
The micro-service is a new software architecture style, in a micro-service architecture, the application can be decomposed into a plurality of smaller services, and each service can be developed and deployed by an independent team. With the advent of micro-service architecture, more and more large-scale application programs are deployed and run in a micro-service manner, and a traditional single-body architecture application is split into a plurality of micro-services with independent functions. The micro-service has high platform interoperability, dynamic expansion capability, strong fault tolerance capability and the like, and is greatly concerned by the engineering and academic circles.
In the micro-service architecture, usually, a single micro-service can only realize a simple function, and when a complex service function is realized, each independent micro-service in the system needs to be flexibly combined to meet richer service requirements. The micro-service architecture solves the problem of poor expansibility and maintainability of a single architecture, but how to effectively perform cooperative combination work on a plurality of micro-services creates a new problem, and micro-service combination also becomes a considerable research focus in the micro-service architecture.
Traditional organizational models can describe automated arrangements, coordination, and management between middleware and various services in a complex computer system, which is typically a centralized model. The method can better control the global state of the business process, but the coupling degree between services is high, the control center is fragile, the fault tolerance rate of the system is low, and the problems of mathematical confusion, boundary ambiguity and the like between functional modules can occur in some relatively complex business scenes, so that the quality of the service is reduced, and a large number of redundant codes occur. The emerging distributed orchestration model uses a decentralized model, where each service involved knows when to perform its own operations and when to interact with another service. At present, the micro-service combination method is basically based on a predefined service combination interaction sequence mode such as a workflow model, and therefore, it is particularly important to research an automatic micro-service intelligent arrangement of service combination configuration.
Disclosure of Invention
The purpose of the invention is as follows: aiming at the characteristics of high cost and restarting requirement of service arrangement combination change in a complex micro-service environment, an intelligent arrangement scheme with automatic data flow configuration and non-stop configuration update is researched and provided, so that automatic service combination configuration is realized, and the efficiency of changing the data flow direction between services is improved.
The technical scheme is as follows: the invention relates to a micro-service architecture optimization method based on intelligent arrangement, which comprises the following steps:
(1) controlling data flow;
(2) uniformly describing a service combination strategy;
(3) a micro-service combined hot update control platform;
(4) intelligently arranging;
further, the data flow control design in step (1) includes using Kafka message queue to implement data communication between the micro services, and then implementing the change of data flow between the micro services by changing the message channel Topic subscribed by the micro services.
Further, the service combination policy unified description in the step (2) includes a unified description of the involved service combination policies, so that a subsequent software developer or a policy maker can participate in system development conveniently. The design of the data structure in the micro-service combination strategy comprises two aspects of service combination information and system function. The service combination information is used for customizing the static attributes of the micro-service combination strategy, and comprises a micro-service name, micro-service message channel information, micro-service publishing and subscribing topic information and the like, and the system function comprises a function of exception handling and a function of returning result processing.
Further, the design of the micro-service combined hot-update control platform in the step (3) includes performing corresponding configuration on the combination policy, and meanwhile, the micro-service combined information after the configuration becomes effective can be seen. The hot update control platform abstracts the micro services into node information, abstracts the data link relation among the micro services into a linked list, and generates a corresponding topological graph to clearly show the link calling relation among the micro services.
Further, the intelligent layout design in the step (4) comprises the following steps:
(4-1) setting a public module to carry out rationality judgment on a micro-service combination strategy change request issued by a micro-service hot update control platform;
(4-2) setting a daemon thread to monitor relevant information of all configuration strategies of the microservice, and updating a message channel Topic subscribed by the microservice in real time;
(4-3) effecting a change of the service data link through the kafka message queue.
Has the advantages that: compared with the prior art, the invention provides a microservice architecture optimization scheme with automatic data flow configuration and updating non-stop configuration, realizes service request and call among microservices through a message queue, realizes change of data flow among the microservices by changing a message channel subject subscribed by the microservices, realizes automatic service arrangement configuration, and improves the efficiency of changing the direction of the data flow among the services.
Drawings
Fig. 1 is a logic design block diagram of a micro-service architecture optimization method based on intelligent orchestration.
FIG. 2 is a micro-service hot-refresh control platform.
Fig. 3 is a system block diagram of a micro-service architecture optimization method based on intelligent orchestration.
Detailed Description
The present invention will be further described below. The invention relates to a micro-service architecture optimization method based on intelligent arrangement, which comprises the following steps:
step 1: and controlling data flow.
As shown in fig. 1, in the micro-service architecture optimization method based on intelligent orchestration, we first implement data communication between micro-services through Kafka message queues, and then implement changes in data flow between micro-services by changing the message channel Topic subscribed by the micro-services. The communication mode among all the microservices in the system is changed from the traditional HTTP type API into the message queue communication based on the subscription and publishing mode, and the Kafka message queue which is the most widely used in the industry at present is adopted as a communication pipeline among the microservices. Kafka is used as a distributed, partitioned and multi-copy distributed MQ system, can provide message persistence capability in a time complexity O (1) mode, and can simultaneously realize single-machine support of 100K messages per second, thereby laying a foundation for robustness and high availability of communication among microservices.
All the micro services are connected with a server node browser of Kafka, the browser is responsible for ensuring the survival, data communication and data consistency of the micro services, meanwhile, the micro services open own message channels by selecting different message themes Topic, and divide the data in the Topic into one or more partitions. Data under the N partitions are stored in a plurality of brokers in a scattered mode, high availability is guaranteed, and meanwhile the consumption sequence of each partition is guaranteed by using index files corresponding to a plurality of segments.
In a data communication scheme based on a kafka message queue, firstly, each micro service is assigned with a corresponding topic, each micro service only issues data to the corresponding topic, and when other micro services subscribe to a certain topic, the data flow of the micro service corresponding to the topic to the micro service subscribed to the topic can be realized. For example, with microservice A, B, C, when microservice B subscribes to topic of microservice a, and microservice C subscribes to topic of microservice B, data flow from a to B to C can be achieved.
Step 2: and uniformly describing the service combination strategy.
After data communication between the micro-services is realized by using the Kafka message queue, the combination mode between the micro-services can be changed by changing the topic published by the subscription of the micro-services. The combination mode among the microservices is required to meet certain specifications, so that the related service combination strategies are uniformly described at first, and a subsequent software developer or a strategy maker can conveniently participate in system development.
In order to unify the code style of the project and make the program and the program have good readability, the system adopts the international universal identifier naming specification: 1) the identifier can be in a usable character range, and English letters (A-Z a-z) and numbers (0-9) are only used as punctuation marks; 2) the identifier requires that the beginning of the english letter is necessary; 3) identifiers are strictly case-sensitive and must comply with a hump form; 4) the identifier has no strict length limitation, but the length of the identifier is limited according to actual requirements; 5) the identifier group needs to be known by name, and adopts a bingo structure.
The basic data types of the Java language are eight types, namely char, byte, short, int, long, float, double and borolean, and can be used for the specification description of the data model. The enumeration type Enum of the Java language has simplicity, safety and convenience, is realized by inheriting a Java.
The design of the data structure in the micro-service combination strategy comprises two aspects of service combination information and system function. The service combination information is used for customizing the static attributes of the micro-service combination strategy, and comprises a micro-service name, micro-service message channel information, micro-service publishing and subscribing topic information and the like, and the system function comprises a function of exception handling and a function of returning result processing.
The microservice composition information comprises JSONSchema, subsTopic and sendTopic, and is described in Table 1. The micro name represents a concrete name of the micro service in the description system; the subsTopic is a message channel and describes a message topic subscribed by the microservice; sendclient is in the message channel and describes the message topic published by the microservice.
TABLE 1 micro-service combinations information description
The table corresponding to the hot update control platform is shown in table 2, the micro-service name and the subscribed and published message topics adopt the Json format, and the subscribed/published message topic list can be obtained from the system.
Table 2 user information description
The system function is an exception handling function set for system stability and a handling function returned for a service composition policy result. The exception handling data structure design is shown in table 3 below, and the return result data structure design is shown in table 4.
In the exception handling data structure, the exception enumerates data types by using the Enum in the Java language, service exceptions are specified as specific constants, codes are used for representing exception types as code numbers, and msg is used for describing exception information context, so that exception occurrence positions are conveniently located.
Table 3 exception handling function description
In the returned result data structure, status represents the state value of the returned result, generally 0 represents success, and other values represent failure; the errorMsg is used for describing error information in a returned result, and when the status field is 0, the errorMsg is success; the data adopts the extensive type in Java language, can be compatible with different types, and English records return the participation of the body message.
Table 4 returns a description of the results
And step 3: and the micro service combination hot update control platform.
After the service combination strategy is described in a unified way, all the micro services can be combined according to the established strategy. The hot update control platform is used as a visual operation platform, can configure corresponding service combination strategies, and issues the service combination strategies to the system background. And the thread monitoring module of the system background can monitor the change of the service combination relation in real time, and can switch a data flow link between the micro services and change the flow direction of the data according to the updated micro service information and the corresponding subscription topic information.
In addition, the hot update control platform abstracts the micro-services into node information, abstracts the data link relation among the micro-services into a linked list, records the father node ID of each node information, and draws a topological graph of the micro-service data link by identifying the father node IDs of all the nodes. And generating a parent-child relationship of the micro service subscription through the acquired micro service subscription information to form an object array which is used as data input of the topological graph. When the data link between the micro-services is changed, the topological graph is redrawn. The topological graph can clearly show the link calling relation among the micro services. Referring to fig. 2, in the micro-service hot-update control platform, a user may formulate a corresponding micro-service combination policy. The microservices are combined through a strategy configured by a user, and a topological graph in the graph is a topological graph of data links among the microservices.
And 4, step 4: and (4) intelligently arranging.
As shown in fig. 3, the back-end system is mainly responsible for receiving a new micro-service combination policy issued by the micro-service combination hot-update control platform and implementing a change of a data flow direction. The back-end system mainly comprises three parts, namely a public module, a daemon thread and a kafka message queue.
(1) Common module
The common module serving as a system design hub is responsible for request processing and distribution of the whole system, including but not limited to functions of checking request parameters, capturing exceptions, processing returned results and the like, and meanwhile, a common tool module is provided for other micro-services, so that stable operation of the system is guaranteed. In the service combination strategy updating process, the public module is mainly responsible for receiving a service combination strategy updating request and judging the rationality of the request, the service combination strategy updating request meeting the requirements is forwarded to the daemon thread module, and the daemon thread realizes the modification of the data circulation direction.
(2) Daemon thread
The daemon thread plays a role of a sentinel in the system, monitors the occurrence of events and realizes and serves the change of data flow direction among the events. In the present system, an event refers to a change in the microservice composition policy. Since Kafka does not support topic for automatically switching subscriptions, we implement dynamically changing topic for microservice subscriptions by way of real-time monitoring by a daemon thread. The specific process is as follows: in the program, a thread is started to monitor a topic variable subscribed by the micro-service, when the topic variable changes, an original consumer is closed in the thread, and a consumer is reinitialized (when the consumer is initialized, the topic to which the consumer subscribes is configured), so that the switching of subscribing topic is realized. The micro-service combination strategy issued by the hot update control platform and judged by the rationality of the public management module is monitored and captured by the daemon thread, and then the daemon thread informs the micro-service to update the message subscription theme of the micro-service according to the combination strategy, and all the above processes do not need to restart a machine or modify system codes, so that the hot update implementation mode is realized.
(3) Kafka message queue
And after the daemon thread receives the service combination strategy change request and completes the processing, the kafka can realize the change of the data circulation direction according to the modified subscription topic relation. For example, with microservice A, B, C, the original data link relationship is a to B to C; when the microservice C subscribes to the topic of the microservice A and the microservice B subscribes to the topic of the microservice C, the data flow direction can be changed from A to C to B, and therefore a data flow link between the microservices is changed. As a communication foundation among the micro-services, the high throughput, high availability and high performance of the Kafka message queue ensure the stability of the communication among the micro-services; the message Topic of the message queue and the subscription and release mode enable the data flow between the micro services to be more flexible and meet any service combination strategy.
In the design of the micro-service architecture optimization method based on intelligent arrangement, a public module is responsible for carrying out rationality judgment on a micro-service combination strategy change request issued by a micro-service hot-update control platform; the daemon thread under the microservice is responsible for monitoring the updating of the combined strategy and hot updating without shutdown; and the Kafka message queue is responsible for data communication between services. These together implement a microservice architecture optimization method based on intelligent orchestration.
The technical means disclosed by the invention are not limited to the technical means disclosed by the technical means, and also comprise technical schemes formed by equivalent replacement of the technical features. The present invention is not limited to the details given herein, but is within the ordinary knowledge of those skilled in the art.
Claims (5)
1. A micro-service architecture optimization method based on intelligent arrangement is characterized by comprising the following steps:
(1) controlling data flow;
(2) unified description of service composition policies;
(3) a micro-service combined hot update control platform;
(4) and (4) intelligently arranging.
2. The intelligent orchestration based microservice architecture optimization method of claim 1, wherein: the data flow control in the step (1) comprises the steps of realizing service request and call among the micro services through a message queue, and realizing the change of data flow among the micro services by changing a message channel subject subscribed by the micro services.
3. The intelligent orchestration based microservice architecture optimization method of claim 1, wherein: the unified description of the service combination policy in the step (2) includes unified description of the related service combination policy, including service combination information and system functions, where the service combination information is used to customize the static attributes of the micro-service combination policy, including the name of the micro-service, information of the micro-service message channel, information of the micro-service publishing and subscribing topic, and the system functions include a function of handling exception and a function of returning a result.
4. The intelligent orchestration based microservice architecture optimization method of claim 1, wherein: and (3) correspondingly configuring the combination strategy by the micro-service hot-update control platform in the step (3), and simultaneously seeing the micro-service combination information after the configuration is effective, wherein the micro-service hot-update control platform abstracts the micro-services into node information, abstracts the data link relation among the micro-services into a linked list, and generates a corresponding topological graph to clearly show the link calling relation among the micro-services.
5. The intelligent orchestration based microservice architecture optimization method of claim 1, wherein: the intelligent arrangement in the step (4) comprises the following steps:
(4-1) setting a public module to carry out rationality judgment on a micro-service combination strategy change request issued by a micro-service hot update control platform;
(4-2) setting a daemon thread to monitor relevant information of all configuration strategies of the microservice, and updating a message channel Topic subscribed by the microservice in real time;
and (4-3) the change of the service data link is realized through the kafka message queue, and the automatic configuration of data flow and the hot update of non-stop machine combined configuration are realized.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110656715.2A CN113360295A (en) | 2021-06-11 | 2021-06-11 | Micro-service architecture optimization method based on intelligent arrangement |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110656715.2A CN113360295A (en) | 2021-06-11 | 2021-06-11 | Micro-service architecture optimization method based on intelligent arrangement |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113360295A true CN113360295A (en) | 2021-09-07 |
Family
ID=77534017
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110656715.2A Pending CN113360295A (en) | 2021-06-11 | 2021-06-11 | Micro-service architecture optimization method based on intelligent arrangement |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113360295A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100162260A1 (en) * | 2008-12-18 | 2010-06-24 | Veda Technology Limited | Data Processing Apparatus |
CN109191008A (en) * | 2018-09-30 | 2019-01-11 | 江苏农牧科技职业学院 | A kind of micro services frame system for fish quality supervisory systems |
CN110310034A (en) * | 2019-06-28 | 2019-10-08 | 京东数字科技控股有限公司 | A kind of service orchestration applied to SaaS, business flow processing method and apparatus |
CN110942387A (en) * | 2018-09-25 | 2020-03-31 | 上海宝信软件股份有限公司 | Method and system for establishing electric ticket business function based on micro-service |
CN111611089A (en) * | 2020-02-07 | 2020-09-01 | 中国海洋大学 | Asynchronous declaration type micro-service scheduling method |
CN112817565A (en) * | 2021-01-20 | 2021-05-18 | 中国银联股份有限公司 | Micro-service combination method, device, equipment and storage medium |
-
2021
- 2021-06-11 CN CN202110656715.2A patent/CN113360295A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100162260A1 (en) * | 2008-12-18 | 2010-06-24 | Veda Technology Limited | Data Processing Apparatus |
CN110942387A (en) * | 2018-09-25 | 2020-03-31 | 上海宝信软件股份有限公司 | Method and system for establishing electric ticket business function based on micro-service |
CN109191008A (en) * | 2018-09-30 | 2019-01-11 | 江苏农牧科技职业学院 | A kind of micro services frame system for fish quality supervisory systems |
CN110310034A (en) * | 2019-06-28 | 2019-10-08 | 京东数字科技控股有限公司 | A kind of service orchestration applied to SaaS, business flow processing method and apparatus |
CN111611089A (en) * | 2020-02-07 | 2020-09-01 | 中国海洋大学 | Asynchronous declaration type micro-service scheduling method |
CN112817565A (en) * | 2021-01-20 | 2021-05-18 | 中国银联股份有限公司 | Micro-service combination method, device, equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
杨成荣;刘峻松;孙新杰;吴超;: "基于微服务架构的数据一致性方法研究", 电脑知识与技术, no. 08, 15 March 2020 (2020-03-15) * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102467411B (en) | Workflow processing and workflow agent method, device and system | |
CN112667362B (en) | Method and system for deploying Kubernetes virtual machine cluster on Kubernetes | |
CN101834750B (en) | Method for monitoring common service | |
CN112463211A (en) | System architecture transformation method compatible with multiple development architectures and system architecture | |
CN101478445B (en) | General monitoring model technique used for information system monitoring | |
CN102968303A (en) | Program design system and program design method | |
CN112527523A (en) | Distributed message transmission method and system for high-performance computing multiple clouds | |
CN111064626B (en) | Configuration updating method, device, server and readable storage medium | |
CN110134533B (en) | System and method capable of scheduling data in batches | |
CN112099930A (en) | Quantum computer cluster distributed queue scheduling method | |
CN102387137B (en) | Implementation method and system of intelligent operation logic of a plurality of network devices | |
CN112073499A (en) | Dynamic service method of multi-machine type cloud physical server | |
CN113360295A (en) | Micro-service architecture optimization method based on intelligent arrangement | |
CN109683875B (en) | Application framework system of MVC (model view controller) pattern in distributed environment and method thereof | |
CN115499300B (en) | Embedded equipment clustering operation architecture system, construction method and construction device | |
CN111274018A (en) | Distributed training method based on DL framework | |
CN115056234B (en) | RPA controller scheduling method and system based on event-driven and infinite state machine | |
CN116011943A (en) | Robot automation flow service system, method and medium based on low codes | |
CN102467504B (en) | Design method of relational database-based workflow engine system | |
CN111782363A (en) | Method and flow system for supporting multi-service scene calling | |
CN102681881B (en) | Across machine dispatching method and system thereof | |
CN105187244A (en) | Access management system of digital communication equipment supporting multiple management modes | |
CN110795489A (en) | System and method for managing and controlling process of operation unit | |
CN113472590B (en) | QoS configuration method based on machine learning in DDS | |
CN110991676B (en) | Operation and maintenance management platform based on modularized design |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |