A microservice design method based on model-driven architecture
Through the method based on model-driven architecture, the microservice design process is automated, which solves the problems of difficulty and low accuracy in microservice design, achieves the consistency and information integrity of the domain model and the microservice architecture model, reduces labor costs and improves to assess efficiency.
Patent Information
- Application Number
- CN202311451469.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2043-11-02
AI Technical Summary
In the existing technology, microservice design is difficult, accurate, and efficient. The separation of the domain model and the microservice architecture model designer leads to information loss or misunderstanding. There is a lack of a unified microservice model representation method. Model evaluation relies on manual labor, which results in time and resources. waste.
Adopt a microservice design method based on model-driven architecture, divide the microservice context scope in use case diagrams and entity diagrams by expanding the demand model, generate a microservice architecture model, and define underlying elements through EMF, automate evaluation and iterative adjustments, and provide visual feedback .
Simplify and accelerate domain model division, ensure process consistency and information integrity, reduce labor costs, and improve the speed and accuracy of model evaluation.
Smart Images

Figure CN117539433B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software engineering technology, and in particular to a microservice design method based on a model-driven architecture. Background Art
[0002] Microservices architecture promotes the concept of decomposing applications into small, well-defined services, each tailored around a specific business function. This fine-grained approach facilitates independent deployment of each service through a fully automated process, leading to accelerated deployment cycles, improved scalability, and clear division of service responsibilities. However, the effectiveness of microservices architecture depends on accurately identifying the right microservices. A structured balance is needed to emphasize the importance of accurate service identification, making it a critical success factor in microservices implementation.
[0003] In today's complex software development environment, the combination of microservices and domain-driven design (DDD) has gradually become the core. Domain-driven design provides a strategy for modeling and designing complex systems, aiming to capture the core complexity of the system and establish a model that matches actual business operations. Among them, bounded context is a key concept in microservices and domain-driven design. It defines a specific responsibility boundary and ensures that the model within this boundary is consistent. In a microservice architecture, each microservice usually exists in a well-defined bounded context, thereby ensuring the independence and autonomy of microservices. Entities and value objects represent objects with unique identifiers and unidentified, immutable objects, respectively. These objects are usually persisted in a microservice environment and interact through interfaces. Aggregates and aggregate roots provide structures to ensure data integrity and consistency. Aggregates are a group of entities and value objects that are persisted as a whole; aggregate roots are an entity within an aggregate and the only way for external objects to interact with aggregates. Domain events are a key concept that represents specific events that occur in the domain. Microservices use domain events to interact asynchronously with other services to avoid direct service-to-service calls. Meanwhile, repositories are used to get aggregates from the persistence layer, factories are used to create aggregates, and services represent the implementation of domain logic in microservices and domain-driven design.
[0004] Microservices and domain-driven design also recommend structuring the system into domain layers, application layers, and infrastructure layers. The domain layer focuses on the core business logic and models, the application layer focuses on the application's usage scenarios, and the infrastructure layer handles the interaction with external systems. In the microservice architecture, this multi-layer architecture can be implemented within a service or across multiple services.
[0005] In the prior art, as shown in the attached manual Figure 1As shown in the figure, architects often follow two core steps in the decomposition of microservices, namely designing the domain model and designing the microservice model. First, they will design the domain model. This usually starts with an in-depth requirements analysis, working closely with business owners to deeply understand and collect business requirements through interviews and discussions. This ensures that the designed model can truly reflect the core logic of the business. Subsequently, the architect will identify the various domains and responsibilities of the system, and establish a clear bounded context for each domain to reduce the complexity of the model and ensure its internal consistency. On this basis, the key entities and value objects and the relationships between them are identified and defined. At the same time, for important events in the business process, corresponding domain events will also be defined to prepare for subsequent communication between microservices. Subsequently, based on the domain model, the architect will further design the microservice model. This includes determining the boundaries of the microservices, usually each bounded context will correspond to a microservice. The responsibilities of the microservices will also be clearly divided to ensure that each microservice follows the single responsibility principle. In order to ensure effective communication between microservices, the communication mechanism between microservices will also be designed based on domain events and defined entity relationships. This may be synchronous or asynchronous, event-driven, etc. Finally, choosing an appropriate data persistence strategy is also a key part of microservice design. Choose the most suitable data storage solution for each microservice, taking into account factors such as data consistency, availability, and latency.
[0006] In the process of domain-driven design and microservice architecture design, the existing technical methods and practices have at least the following shortcomings:
[0007] First, the initial division of the domain model is difficult. Establishing a reasonable domain model is a rather challenging task for designers. Although business requirements may have been exhaustively listed and described, it often takes a lot of time and effort to transform these requirements into a clear, consistent, and actionable domain model. This process is not only time-consuming, but also extremely inefficient in many cases because it requires in-depth business understanding and technical insights.
[0008] Second, information from the domain model to the microservice architecture model may be missing. In many cases, the designer of the domain model and the designer of the microservice architecture model may not be the same person. Such separation may lead to loss or misunderstanding of information. For example, certain key decisions or considerations in the domain model may be overlooked or misunderstood when converted to the microservice architecture model. This will not only increase the time of the entire design and development process, but also may lead to inconsistencies and information asymmetry between the two models.
[0009] Third, there is a lack of a unified method for representing microservice models. Although microservice architecture has been widely adopted and practiced, there is currently no recognized, standardized method for representing microservice models. This complicates the design and implementation process of microservices because designers must rely on a variety of different tools and technologies that may not always be compatible or consistent.
[0010] Fourth, the model evaluation process is time-consuming and labor-intensive. After the microservice design is completed, the model usually needs to be evaluated to ensure its quality and accuracy. However, in existing technologies, this process is mainly done manually. This not only consumes a lot of time and resources, but also may lead to inconsistency in evaluation results, because different evaluators may have different judgments and insights. Summary of the invention
[0011] In view of this, an embodiment of the present invention provides a microservice design method based on a model-driven architecture to solve the technical problems of high difficulty, low accuracy and low efficiency in microservice design in existing methods. The method includes:
[0012] Obtain an extended demand model based on the demand model, divide the context scope of the microservice in the use case diagram and the entity diagram according to the extended demand model, and obtain a preliminary division result of the domain model;
[0013] Generate a microservice architecture model according to the preliminary division result, wherein the microservice architecture model includes a microservice component diagram, a microservice internal concept class diagram, and a dynamic communication diagram between microservices;
[0014] Evaluate the generated microservice architecture model and provide feedback of the evaluation results to the user in a visual manner;
[0015] The preliminary division result is iteratively adjusted according to the evaluation result to obtain the optimized microservice architecture model.
[0016] Furthermore, EMF is used to define the underlying elements of the microservice architecture model.
[0017] Furthermore, dividing the context scope of the microservices in the use case diagram and the entity diagram according to the extended requirement model includes:
[0018] The context scope of microservices is divided in the use case diagram based on UseCaseContext, and the context scope of microservices is divided in the entity diagram based on EntityContext.
[0019] Furthermore, dividing the context scope of the microservices in the use case diagram and the entity diagram according to the extended requirement model to obtain a preliminary division result of the domain model also includes:
[0020] Put the use cases in which users participate into the same microservice according to the demand model;
[0021] Extracting the dependency graph from the use case to the entity from the system sequence diagram, the contract and the domain model respectively, and obtaining the preliminary division result of the domain model;
[0022] The microservice architecture model is generated according to the preliminary division result.
[0023] Furthermore, generating a microservice architecture model according to the preliminary division result includes:
[0024] Convert the boundaries, entities and entity relationships in the conceptual class diagram of the preliminary division result diagram of the domain model to obtain a microservice structure diagram;
[0025] Generate user call interface and microservice interface;
[0026] Generate a microservice communication graph according to the user call interface and the microservice interface;
[0027] The microservice architecture model is generated by combining the microservice structure diagram and the microservice communication diagram.
[0028] Furthermore, the types of microservice interfaces include:
[0029] Interfaces for associated entities, interfaces for providing access to other microservice entities, and interfaces for calling other microservices.
[0030] Further, generating the microservice communication graph includes:
[0031] Traverse all system operations in the system sequence diagram in order and obtain their corresponding contracts, wherein the system sequence diagram corresponds to each use case in the requirement model;
[0032] Determine microservice boundaries;
[0033] Generate a call relationship according to the system operation, the contract and the microservice boundary;
[0034] The microservice communication graph is generated according to the generated call relationship.
[0035] Furthermore, the indicators for evaluating the generated microservice architecture model include: average number of interfaces, stability, cohesion and modularity quality.
[0036] Compared with the prior art, at least one of the above-mentioned technical solutions adopted in the embodiments of this specification can achieve at least the following beneficial effects: the present invention provides a microservice design method based on a model-driven architecture, and provides a method for simplifying and accelerating the division of domain models, which is completed through automated means between domain models and microservice architecture models, ensuring the consistency of the process and the integrity of information, and greatly reducing labor costs; at the same time, the model evaluation process is automated, thereby improving the speed and accuracy of model evaluation. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 It is a schematic diagram of the splitting of microservices provided in the background technology part of the present invention;
[0039] Figure 2 It is an overall flow chart of a microservice design method based on a model-driven architecture provided by an embodiment of the present invention;
[0040] Figure 3 is a schematic diagram of an extended demand model metamodel provided by an embodiment of the present invention;
[0041] Figure 4 It is a schematic diagram of an expanded use case diagram provided by an embodiment of the present invention;
[0042] Figure 5 is a schematic diagram of an expanded conceptual class diagram provided by an embodiment of the present invention;
[0043] Figure 6 It is a schematic diagram of the metamodel of the microservice architecture model provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0045] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, 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 application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0046] The present invention provides a microservice design method based on a model-driven architecture, and provides a method for simplifying and accelerating the division of domain models. It is completed between domain models and microservice architecture models through automated means, ensuring process consistency and information integrity, and greatly reducing labor costs; at the same time, it automates the model evaluation process and improves the speed and accuracy of model evaluation.
[0047] In an embodiment of the present invention, a microservice design method based on a model-driven architecture includes:
[0048] Step S100: obtaining an extended demand model based on the demand model, dividing the context scope of the microservice in the use case diagram and the entity diagram according to the extended demand model, and obtaining a preliminary division result of the domain model;
[0049] Specifically, if Figure 2 As shown, a microservice design method based on a model-driven architecture provided in this embodiment can analyze the functional data dependencies of system requirements, and generate corresponding interfaces and inter-microservice call information based on the results of the artificial microservice architecture, so as to realize rapid iteration of microservice design. Among them, an extended requirement model is initially obtained through the requirement model, and the extended requirement model is used to represent the division structure of subsequent microservices, which expands the original requirement model to describe the decomposition of functions and databases. The extended model divides the context scope of microservices in the use case diagram and the entity diagram. The metamodel of the extended requirement model is defined as follows: Figure 3 As shown in the figure, the expanded use case diagram is as follows Figure 4 As shown in the figure, the expanded concept class diagram is as follows Figure 5 shown.
[0050] Furthermore, the context scope of microservices is divided in the use case diagram based on UseCaseContext, and the context scope of microservices is divided in the entity diagram based on EntityContext.
[0051] UseCaseContext: The focus of microservices should be on business functionality, with use cases as a means of describing system functionality from the user's perspective. UseCaseContext determines which use cases fall within the scope of microservice functionality. By decomposing the system into a collection of use cases, microservices can be dedicated to specific business functionality, thereby enhancing their understanding, development, and maintenance.
[0052] EntityContext: Entity boundaries mark the isolation of data entities, as dictated by the "each service has its own database" principle in the microservices architecture. These demarcated data entities are stored in their respective subordinate microservices.
[0053] Furthermore, users can directly determine the boundary on the use case diagram or drag and drop other use cases into the microservice boundary. After that, a boundary with the same name will be automatically generated on the conceptual class diagram. Users only need to drag and drop the classes required by the microservice into the boundary to complete the conceptual boundary.
[0054] Furthermore, step S100 also includes:
[0055] Step S110: putting the use cases in which the user participates into the same microservice according to the demand model;
[0056] Step S120: extracting the dependency graph from the use case to the entity from the system sequence diagram, the contract and the domain model respectively, and obtaining the preliminary division result of the domain model;
[0057] Step S130: Generate the microservice architecture model according to the preliminary division result.
[0058] Specifically, first, an initial solution is generated based on the initial demand model. This solution provides architects with a basic division rule, that is, to put the use cases involved by the same user into the same microservice. For example, put the use cases involved by users "Cashier" and "StoreManager" into the same microservice. Then extract the dependency graph from use cases to entities from the system sequence diagram, contract, and domain model. The graph is a four-layer tree structure, including participants, use cases, system operations, entities, and the relationships between them.
[0059] Among them, extracted from the system sequence diagram: In the requirement model, each use case corresponds to a system sequence diagram representing its system function. The system sequence diagram consists of a series of system operations. In addition, we can obtain the corresponding relationship between the use case and a series of system operations;
[0060] Extract from the contract and domain model: The contract defines the state that the system should satisfy before and after performing the system operation. The state is defined by the conceptual class diagram, and the change of state involves the creation of entities, the modification of attributes, and the creation and removal of links between entities. The entities operated by the system operation can then be found based on the system operation contract.
[0061] The dependency graphs from the use case to the entity are extracted from the system sequence diagram, contract, and domain model respectively. Based on the dependency graphs from the use case to the entity, an initial domain model partitioning result can be generated. This partitioning result specifies which entities should belong to which microservice. Based on the dependency relationships, related entities are divided into the same microservice to meet the access and operation requirements of the use case to the entity.
[0062] Step S200: Generate a microservice architecture model according to the preliminary division result, wherein the microservice architecture model includes a microservice component diagram, a microservice internal concept class diagram, and a dynamic communication diagram between microservices;
[0063] Specifically, the microservice architecture model metamodel is as follows Figure 6 As shown, the microservice architecture model is divided into three parts, including a microservice component diagram, a microservice internal concept class diagram, and a dynamic communication diagram between microservices. This embodiment uses EMF (Eclipse Modeling Framework) to define the underlying elements of MSAModel, and expands on the component diagram, class diagram, and communication diagram of UML. The microservice component diagram and microservice comprehensively present an architecture, describing all the microservices in the system and the dependencies between them, and are extended based on the component diagram and class diagram of UML. The microservice component diagram consists of multiple components "Microservice" and the interface "Interface" to which the components belong. The interface is divided into "Provided" and "Required", which represent the interface provided by the service and the interface that the service depends on, respectively. A method like a component diagram can clearly show the overall structure of the microservice system and the dependencies and call relationships between different services. In order to represent the entities within each service and the relationships between them, each service has a microservice internal concept class diagram "Domainmodel". This concept class diagram is extended based on the class diagram of UML and consists of multiple entities "Entity" and the relationship "Reference" between them. Through the microservice component diagram and the microservice internal concept class diagram, the call information of the entire microservice system and the entities within the service can be clearly displayed.
[0064] Furthermore, the dynamic communication diagram between microservices is intended to better describe the cooperative relationship between microservices. This diagram is based on the communication diagram of UML and is extended to clearly describe the communication mode between microservices, such as the interface calling method, the message transmission sequence, and the calling order of the service interface. This helps to show how data and control flow are transmitted between different microservices. In order to more accurately and conveniently display the call information, the component "lifeline" and the information transmission "Message" between components are defined in this application. Among them, the component represents a microservice, which will initiate a request to one or more microservices. These requests include specific operations, sequence numbers and judgment conditions. The communication diagram between microservices supplements the static information of the previous microservice architecture diagram, and clearly shows the cooperative relationship and interface call sequence of microservices. The outermost layer of the microservice architecture diagram is composed of component diagrams. Inside each microservice, there is a conceptual class diagram to represent the entity information therein, and the internal call sequence of the interface is represented by a communication diagram on the interface.
[0065] Furthermore, in step S200, generating a microservice architecture model according to the preliminary division result includes:
[0066] Step S210: converting the boundaries, entities and entity relationships in the conceptual class diagram in the preliminary division result diagram of the domain model to obtain a microservice structure diagram;
[0067] Step S220: Generate a user call interface and an interface between microservices;
[0068] Step S230: generating a microservice communication graph according to the user call interface and the microservice interface;
[0069] Step S240: Generate the microservice architecture model by combining the microservice structure diagram and the microservice communication diagram.
[0070] Specifically, when generating a microservice architecture model according to the preliminary division results, the conceptual class diagram is first converted. First, according to the conceptual class diagram, a one-to-one mapping conversion is performed on the boundaries, entities, and entity relationships. This step maps the elements in the conceptual class diagram to the corresponding concepts in the microservice architecture design. This may include mapping boundaries to microservices, mapping entities to resources or data models within microservices, and mapping entity relationships to interaction methods between microservices. Secondly, according to the converted conceptual class diagram, the interface information is further derived to obtain a complete microservice architecture design. For each microservice, the algorithm finds a set of use cases within the same functional boundary. Each use case has a system sequence diagram to show a more detailed interaction process. Through the system sequence diagram, a set of "operations" can be obtained, that is, the operation steps involved in the use case. Therefore, a use case can correspond to a series of system operations. The system operation set of a microservice is a combination of the operation sets corresponding to all use cases within it.
[0071] Furthermore, the types of the inter-microservice interfaces include: interfaces for associated entities, interfaces for providing access to other microservice entities, and interfaces for calling other microservices.
[0072] Further, a set of system operations corresponding to each microservice is obtained, and these system operations are combined into an interface, namely a user call interface, which can be directly provided to users for calling, as shown. In addition, an interface between microservices is generated. The interface between microservices is generated in the following three ways:
[0073] Interfaces of associated entities: In a microservice architecture, sometimes there is an association relationship between two classes (entities) in the domain model, but due to the split of microservices, they are divided into different microservices. In order to realize the transmission of entity information, an interface for transmitting entity information needs to be generated. The algorithm will generate a bidirectional interface or a unidirectional interface based on the association relationship. For a bidirectional relationship, a bidirectional interface is generated so that the two microservices can access and operate each other's entities. For a unidirectional relationship, a unidirectional interface is generated in which one microservice can access and operate the entities of another microservice. This interface is usually named "Management" plus "Entity Name" and contains entity creation, retrieval, update, and deletion (CRUD) operations;
[0074] Provide an interface to access other microservice entities: In some cases, the entity required by a use case is not in the microservice to which it belongs. In order to meet the needs of this use case, the microservice where the entity class is located needs to provide an interface so that other microservices can access this entity. The role of this interface is to allow other microservices to obtain the required entity data by calling this interface, so that the entity can be shared and accessed among multiple microservices;
[0075] Calling operations of other microservice interfaces: In a microservice architecture, different microservices may need to call certain operations of other microservices. If a microservice needs to call an operation in another microservice, and the operation is not included in the interface provided by the microservice, then the microservice needs to call the corresponding interface of the microservice where the operation is located. This calling relationship is presented as an association between a "provided interface" and a "required interface", where one microservice provides an interface for other microservices to call, and the other microservice requires an interface in order to be called by other microservices.
[0076] The system interface element is defined for the interaction between microservices. The system interface represents the interaction between objects in different boundary contexts in the domain model. The generation algorithm of the microservice interface is shown in Table 1.
[0077] Table 1: Microservice interface algorithm generation
[0078]
[0079]
[0080] Further, in step S230, generating the microservice communication graph includes:
[0081] Step S231: traverse all system operations in the system sequence diagram in order and obtain their corresponding contracts, wherein the system sequence diagram corresponds to each use case in the requirement model;
[0082] Step S232: Determine microservice boundaries;
[0083] Step S233: Generate a call relationship according to the system operation, the contract and the microservice boundary;
[0084] Step S234: Generate the microservice communication graph according to the generated call relationship.
[0085] Specifically, each use case generates a microservice communication diagram representing the microservice call relationship, that is, a microservice needs to call the operations of other microservices when performing a certain operation. An ordered pair set is defined in the embodiment of the present application, referred to as a call. Each call element is a vector containing four elements: invo(A, B, Op1, Op2), where A represents the caller microservice, B represents the callee microservice, Op1 represents the operation of the callee microservice, and Op2 represents the operation performed by the caller microservice. By using an ordered pair set of calls, the call relationship between microservices can be represented. For example, invo(A, B, Op1, Op2) means that when performing the Op2 operation, microservice A needs to call the Op1 operation of microservice B. Such a call relationship can be displayed in a microservice communication diagram to help understand and analyze the interaction between microservices.
[0086] When generating a microservice communication diagram, first traverse the system sequence diagram: traverse all system operations in the system sequence diagram in order and obtain their corresponding contracts; secondly, determine the microservice boundary: for the entities involved, determine the microservice to which they belong. If an entity is inconsistent in microservice x, you need to find the microservice y to which it belongs and name it y; next, generate the call relationship: for each system operation, find the operation op1 that needs to read the entity information in microservice x, and find the corresponding read operation op2 provided by microservice y. Add the call relationship invo(A, B, Op1, Op2) to the call; next, recursively transform: when microservice x executes op1, if op2 is included in the code logic of op1 and does not belong to microservice x, you need to find the microservice y to which op2 belongs. Then, add the call relationship invo(A, B, Op1, Op2) to the call. For operation op1 executed by microservice y, it is also necessary to further find the microservices that may be called and perform the same transformation. This is a recursive transformation process; Generate microservice communication graph: Based on the obtained calling relationship, generate the communication graph between microservices.
[0087] Specifically, the generation algorithm of the microservice communication graph is shown in Table 2 below.
[0088] Table 2: Microservice communication diagram generation
[0089]
[0090]
[0091] Step S300: Evaluate the generated microservice architecture model, and feed back the evaluation result to the user in a visual manner;
[0092] Furthermore, the software architecture evaluation mainly focuses on measuring the coupling and cohesion of the microservice architecture. The indicators for evaluating the generated microservice architecture model include: average number of interfaces, stability, cohesion and modularity quality.
[0093] Specifically, the average number of interfaces is described as the average number of interfaces in the system. The smaller the value, the better. The calculation method is as follows: (1), where i and N represent the number of interfaces:
[0094]
[0095] Stability represents the ratio of the number of interfaces provided by a microservice to the sum of the number of interfaces it provides and the number of interfaces required. i Represents the number of interfaces provided by the i-th microservice and the required interfaces i Represents the interface required by the i-th microservice, and is calculated as shown in formula (2):
[0096]
[0097] Cohesion measures the degree of cohesion of the interfaces provided by microservices at the entity domain level. The higher the value, the better. In the following formula (3), N represents the number of microservices, f(operation k ) and f(operation m ) represent the number of entities involved in all system operations in microservice k and the number of entities involved in all system operations in microservice m, respectively.
[0098]
[0099] Modularity quality represents the difference between the average correlation of the domain model within a microservice and the average correlation of the domain model between microservices. In the following formula (4), N represents the number of all system operations in the microservice, and the calculation method is shown in the following formula (4). h(operation) and h(operation) represent the entity domains involved in the i-th system operation and the j-th system operation, respectively.
[0100]
[0101] Step S400: iteratively adjusting the preliminary division result according to the evaluation result to obtain the optimized microservice architecture model.
[0102] Furthermore, EMF is used to define the underlying elements of the microservice architecture model.
[0103] In summary, the embodiments of the present invention achieve the following technical effects:
[0104] The present invention provides a microservice design method based on a model-driven architecture, and provides a method for simplifying and accelerating the division of domain models. It is completed between domain models and microservice architecture models through automated means, ensuring process consistency and information integrity, and greatly reducing labor costs; at the same time, it automates the model evaluation process and improves the speed and accuracy of model evaluation.
[0105] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A microservice design method based on model-driven architecture, characterized in that: The method comprises: Obtain an extended demand model based on the demand model, divide the context scope of the microservice in the use case diagram and the entity diagram according to the extended demand model, and obtain a preliminary division result of the domain model; Convert the boundaries, entities and entity relationships in the conceptual class diagram in the preliminary division result diagram to obtain a microservice structure diagram; Generate a user call interface and an interface between microservices, and generate a microservice communication graph according to the user call interface and the interface between microservices; The microservice architecture model is generated by combining the microservice structure diagram and the microservice communication diagram, wherein the microservice architecture model includes a microservice component diagram, a microservice internal concept class diagram, and a dynamic communication diagram between microservices; Evaluate the generated microservice architecture model and provide the evaluation results to the user in a visual manner, wherein the evaluation indicators of the microservice architecture model include the average number of interfaces, stability, cohesion and modularity quality; The preliminary division result is iteratively adjusted according to the evaluation result to obtain the optimized microservice architecture model.
2. According to a microservice design method based on model-driven architecture according to claim 1, it is characterized in that: The dividing the context scope of the microservices in the use case diagram and the entity diagram according to the extended requirement model includes: The context scope of microservices is divided in the use case diagram based on UseCaseContext, and the context scope of microservices is divided in the entity diagram based on EntityContext.
3. According to a microservice design method based on model-driven architecture according to claim 1, it is characterized in that: The step of dividing the context scope of the microservices in the use case diagram and the entity diagram according to the extended requirement model to obtain a preliminary division result of the domain model also includes: Put the use cases in which users participate into the same microservice according to the demand model; Extracting the dependency graph from the use case to the entity from the system sequence diagram, the contract and the domain model respectively, and obtaining the preliminary division result of the domain model; The microservice architecture model is generated according to the preliminary division result.
4. According to a microservice design method based on model-driven architecture according to claim 1, it is characterized in that: The underlying elements of the microservice architecture model are defined using EMF.
5. According to a microservice design method based on model-driven architecture according to claim 1, it is characterized in that: The types of microservice interfaces include: Interfaces for associated entities, interfaces for providing access to other microservice entities, and interfaces for calling other microservices.
6. According to a microservice design method based on model-driven architecture according to claim 1, it is characterized in that: Generating the microservice communication graph includes: Traverse all system operations in the system sequence diagram in order and obtain their corresponding contracts, wherein the system sequence diagram corresponds to each use case in the requirement model; Determine microservice boundaries; Generate a call relationship according to the system operation, the contract and the microservice boundary; The microservice communication graph is generated according to the generated call relationship.
Citation Information
Patent Citations
System and method for realizing Restful service graphical service orchestration based on micro-service architecture
CN110764752A
Single system micro-service splitting method based on domain event driving
CN113961173A
Micro-service splitting method based on demand model
CN114089956A
Micro-service system construction method and device based on domain-driven design, and medium
CN114201144A
Micro-service extraction method and system, medium, equipment and information processing terminal
CN115309634A
