Independent micro-service free combination method and system

By dividing and combining microservices according to needs, using dependency packages and service agents to achieve seamless integration of microservices, the problem of large workload and difficulty in ensuring the accuracy of microservice architecture when transforming into a single architecture in the existing technology is solved, and the problem of high workload and difficulty in ensuring the accuracy of microservice architecture is improved. Combination flexibility and response speed.

CN119254825APending Publication Date: 2025-01-03WUHAN SOUTH SAGITTARIUS INTEGRATION CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411331804.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

When the prior art transforms microservice architecture into a monolithic architecture, the workload is huge and the accuracy and availability of services after integration are difficult to guarantee, and there is a lack of flexible and efficient combination methods.

Method used

By dividing microservices according to needs, creating combined microservices and loading them in dependency packages, using service agents and Docker containers for management, providing API services after microservice combinations, achieving seamless integration and free combination between microservices.

Benefits of technology

It simplifies dependencies and code replication among services, improves the flexibility and response speed of service combinations, and meets the needs of rapid development and deployment in different business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254825A_ABST
    Figure CN119254825A_ABST
Patent Text Reader

Abstract

The independent micro-service free combination method comprises the following steps: determining a plurality of micro-services needing to be combined according to requirements; creating a combined micro-service, and loading a plurality of micro-services needing to be combined in a dependent package form; and performing initialization operation on the combined micro-service, and providing an API service after the micro-service combination. According to the independent micro-service free combination method disclosed by the invention, seamless integration and free combination among micro-services are realized through a service combination technology, so that dependency and code copying type combination among the services are simplified, the flexibility and the response speed of service combination are improved, and rapid development and deployment requirements under different business scenes are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer software technology, and in particular to a method and system for freely combining independent microservices. Background Art

[0002] With the rapid development of cloud computing and containerization technology, microservice architecture has become the mainstream way to build large distributed systems. Microservice architecture improves the scalability, maintainability and testability of the system by splitting the application into a series of small, autonomous services. Therefore, the core idea of ​​microservices is the splitting and decoupling of business services, which splits different businesses into independent microservice modules. It is obviously different from the monolithic service architecture with only one service: ① Number of services: The number of services in the microservice architecture is much larger than that in the monolithic service architecture ② Virtual machine resource requirements: The requirements of the microservice architecture are much larger than those of the monolithic architecture.

[0003] Therefore, microservice architecture is suitable for products and applications with large scale and high concurrency, while monolithic architecture is more suitable for products and applications with small scale and small budget. At the same time, the current technical solutions for realizing the transformation from microservice architecture to monolithic architecture are to integrate all microservices at the code level, that is, to copy all microservice codes into one project. This solution not only has a huge workload, but also has difficulty in ensuring the accuracy and availability of services after integration. Summary of the invention

[0004] In view of the above problems, the present invention is proposed to provide a method and system for free combination of independent microservices that overcomes the above problems or at least partially solves the above problems.

[0005] In order to solve the above technical problems, the embodiments of the present application disclose the following technical solutions:

[0006] In a first aspect, an embodiment of the present invention discloses a method for freely combining independent microservices, including:

[0007] S100. Determine multiple microservices that need to be combined according to demand;

[0008] S200. Create a composite microservice and load multiple microservices that need to be combined in the form of dependency packages;

[0009] S300: Initialize the combined microservices and provide API services after the microservices are combined.

[0010] Furthermore, in S100, multiple microservices that need to be combined are determined according to demand, and the specific methods include: dividing microservices according to the natural boundaries of microservice business logic; dividing microservices according to the correlation of microservice data models; dividing microservices according to microservice team structure and skill expertise; and determining that microservices are combined together to provide complete business functions based on the dependencies between microservices.

[0011] Furthermore, in S200, a composite microservice is created, and multiple microservices to be combined are loaded in the form of dependency packages. The specific method includes: creating a composite microservice, mounting multiple microservices to be combined by referencing independent jar packages, and realizing rapid combination of multiple microservices.

[0012] Furthermore, multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method includes: calling the APIs of other microservices through HTTP requests or other protocols, writing client code to send requests to these microservices, and processing their responses.

[0013] Furthermore, multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method also includes: if the functions of the microservices are encapsulated into a reusable library or framework, and the library or framework is provided in the form of a jar package, then the microservice jar package is introduced as a dependency in the service project.

[0014] Furthermore, multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method also includes: creating a service proxy, which is responsible for routing requests to different microservices and aggregating their responses; the service proxy is an independent microservice or a part of an existing service that wants to integrate other microservice functions; in the service proxy, specifying how to call other microservices by programming or configuration.

[0015] Furthermore, multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method also includes: if the microservices exist in the form of jar packages and the customer wants to deploy them in a more flexible and scalable way, they are packaged into Docker containers and managed using Kubernetes and Docker Compose container orchestration tools.

[0016] Furthermore, in S300, the combined microservice is initialized to provide API services after the microservice combination. The specific method includes: in the combined microservice configuration file, the microservice service unique identifier and jar package name are added to read and distinguish the configuration and interface address information of each service in the integration process; all service codes of the microservice are uniformly read, identified and instantiated through the Java class loader, and the configuration is injected to collect all external service interfaces, and the content of microservices A, B, and C is independently instantiated; a unified service port is provided to the outside world, request interception is performed, and identification and matching are performed according to the microservice unique identifier, and finally the corresponding service method is called, and the microservice unique identifier is returned.

[0017] In a second aspect, an embodiment of the present invention discloses a system for free combination of independent microservices, including: a microservice determination unit, a combined microservice creation unit and an API service provision unit; wherein:

[0018] A microservice determination unit is used to determine multiple microservices that need to be combined according to demand;

[0019] The composite microservice creation unit is used to create a composite microservice and load multiple microservices that need to be combined in the form of dependency packages;

[0020] The API service providing unit is used to initialize the combined microservices and provide API services after the microservices are combined.

[0021] In a third aspect, an embodiment of the present invention discloses an electronic device, including:

[0022] one or more processors;

[0023] A memory for storing one or more programs;

[0024] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for freely combining microservices.

[0025] The beneficial effects of the above technical solution provided by the embodiment of the present invention include at least:

[0026] The present invention discloses a method for free combination of independent microservices, including: determining multiple microservices to be combined according to needs; creating a combined microservice, and loading multiple microservices to be combined in the form of a dependency package; initializing the combined microservice, and providing an API service after the microservice combination. The present invention discloses a method for free combination of independent microservices, which realizes seamless integration and free combination between microservices through service combination technology, thereby simplifying inter-service dependency and copy code combination, improving the flexibility and response speed of service combination, and meeting the rapid development and deployment requirements in different business scenarios.

[0027] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0029] Figure 1 This is a flow chart of a method for freely combining independent microservices in Embodiment 1 of the present invention;

[0030] Figure 2 This is a schematic diagram of the structure of an electronic device in Example 3 of the present invention. DETAILED DESCRIPTION

[0031] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0032] In order to solve the problems existing in the prior art, an embodiment of the present invention provides a method and system for freely combining independent microservices.

[0033] Example 1

[0034] The present invention discloses a method for freely combining independent microservices, such as Figure 1 ,include:

[0035] S100. Determine the multiple microservices that need to be combined according to the needs; Microservices is a software architecture design pattern that decomposes applications into small, autonomous service units that can be independently deployed, expanded, and maintained. Each service unit is a microservice, and they interact with each other through lightweight communication mechanisms (such as HTTP REST API). The software architecture style formed based on microservices is called Microservices Architecture, which covers a full set of principles, patterns, and best practices for building applications using microservices.

[0036] In S100 of this embodiment, multiple microservices that need to be combined are determined according to demand. The specific method includes: dividing microservices according to the natural boundaries of microservice business logic. For example, in an e-commerce system, it can be divided into microservices such as orders, goods, inventory, and payment; dividing microservices according to the relevance of microservice data models. If two services share a large amount of data and the changes to these data need to be highly consistent, then they should probably be divided into the same microservice; dividing microservices according to the microservice team structure and skill expertise. Each team can be responsible for one or more microservices to ensure independent development and maintenance of services; and determining that microservices are combined together to provide complete business functions based on the dependencies between microservices. For example, in an e-commerce system, a payment service may need to rely on an order service and an inventory service to complete the payment process.

[0037] For example, suppose a product application adopts a microservice architecture, which includes three independent microservices, namely: Microservice A, Microservice B, and Microservice C. Due to the small user scale in the early stage of product application implementation, considering the resources and operation and maintenance costs, the three microservices A, B, and C are initially considered to be combined and integrated into a unified microservice for deployment, which greatly reduces resource usage and the number of operation and maintenance services.

[0038] S200. Create a combined microservice, and load multiple microservices that need to be combined in the form of a dependency package; In S200 of this embodiment, a combined microservice is created, and multiple microservices that need to be combined are loaded in the form of a dependency package. The specific method includes: creating a combined microservice, mounting multiple microservices that need to be combined by referencing independent jar packages, and realizing rapid combination of multiple microservices.

[0039] In this embodiment, microservices A, B, and C are combined and integrated to form a unified microservice principle:

[0040] Currently, Java is the mainstream language for microservice development, and Java programs support the use of programs developed by others by referencing independent jar packages, that is, the integration of different modules can be achieved through module reference mounting.

[0041] Since it is necessary to ensure that the microservice architecture development model does not change, a new service program, namely microservice D, can be built to reference and mount the microservice programs A, B, and C that need to be combined now, so as to achieve rapid combination of the three services without invading or modifying any code of the three services. All development is carried out by installing the microservice architecture, which meets the current needs of the monolithic architecture and is in line with the development trend of the microservice architecture in the future.

[0042] In this embodiment, multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method includes: calling APIs of other microservices through HTTP requests or other protocols, writing client code to send requests to these microservices, and processing their responses.

[0043] In some preferred embodiments, multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method also includes: if the functions of the microservices are encapsulated into a reusable library or framework, and the library or framework is provided in the form of a jar package, then the microservice jar package is introduced into the service project as a dependency.

[0044] In some preferred embodiments, multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method also includes: creating a service proxy, which is responsible for routing requests to different microservices and aggregating their responses; the service proxy is an independent microservice or a part of an existing service that wants to integrate other microservice functions; in the service proxy, specifying how to call other microservices by programming or configuration.

[0045] In some preferred embodiments, multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method also includes: if the microservices exist in the form of jar packages and the customer wants to deploy them in a more flexible and scalable way, they are packaged into Docker containers and managed using Kubernetes and Docker Compose container orchestration tools.

[0046] S300. Initialize the combined microservices and provide the API service after the microservices are combined. In S300 of this embodiment, the combined microservices are initialized and the API service after the microservices are combined is provided. The specific method includes: in the combined microservice configuration file, add the service unique identifier and jar package name of the microservice to read and distinguish the configuration and interface address information of each service in the integration process; use the Java class loader to uniformly read, identify and instantiate all the service codes of the microservices, inject the configuration, collect all the external service interfaces, and complete the independent instantiation of the contents of microservices A, B, and C; provide a unified service port to the outside, intercept requests, and identify and match according to the microservice unique identifier, and finally call the corresponding service method and return the microservice unique identifier.

[0047] Through the above steps, you can successfully initialize the composite microservice and provide a powerful API service to meet business needs. This service will be able to take advantage of multiple microservices and provide richer and more flexible functions.

[0048] This embodiment discloses a method for free combination of independent microservices, including: determining multiple microservices that need to be combined according to needs; creating a combined microservice, and loading multiple microservices that need to be combined in the form of a dependency package; initializing the combined microservice, and providing an API service after the microservice combination. The present invention discloses a method for free combination of independent microservices, which realizes seamless integration and free combination between microservices through service combination technology, thereby simplifying inter-service dependency and copy code combination, improving the flexibility and response speed of service combination, and meeting the rapid development and deployment requirements in different business scenarios.

[0049] Example 2

[0050] Based on the same inventive concept, the embodiment of the present disclosure also provides a system for free combination of independent microservices, including: a microservice determination unit, a combined microservice creation unit and an API service provision unit; wherein:

[0051] A microservice determination unit is used to determine multiple microservices that need to be combined according to demand;

[0052] The composite microservice creation unit is used to create a composite microservice and load multiple microservices that need to be combined in the form of dependency packages;

[0053] The API service providing unit is used to initialize the combined microservices and provide API services after the microservices are combined.

[0054] Among them, the specific working methods of the microservice determination unit, the combined microservice creation unit and the API service providing unit have been recorded in detail in Example 1, and will not be repeated in this embodiment.

[0055] Example 3

[0056] Based on the same inventive concept, an embodiment of the present disclosure also provides an electronic device. Figure 2 FIG. 1 is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. Figure 2 As shown, an embodiment of the present disclosure provides an electronic device including: one or more processors 101, a memory 102, and one or more I / O interfaces 103. The memory 102 stores one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any optimization method in the above embodiments; the one or more I / O interfaces 103 are connected between the processor and the memory, and are configured to implement information interaction between the processor and the memory.

[0057] Among them, the processor 101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU), etc.; the memory 102 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) 103 is connected between the processor 101 and the memory 102, and can realize information interaction between the processor 101 and the memory 102, including but not limited to a data bus (Bus), etc.

[0058] In some embodiments, the processor 101 , the memory 102 , and the I / O interface 103 are connected to each other via a bus 104 , and further connected to other components of the computing device.

[0059] In some embodiments, the one or more processors 101 include a field programmable gate array.

[0060] According to an embodiment of the present disclosure, a computer-readable medium is further provided, wherein a computer program is stored on the computer-readable medium, wherein when the program is executed by a processor, the steps in any optimization method in the above-mentioned embodiment are implemented.

[0061] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of protection of the present disclosure. The attached method claims present the elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.

[0062] In the above detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are clearly stated in each claim. On the contrary, as reflected in the appended claims, the invention is in a state of having less than all the features of the disclosed individual embodiments. Therefore, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.

[0063] Those skilled in the art will also appreciate that the various illustrative logic blocks, modules, circuits, and algorithmic steps described in conjunction with the embodiments herein can all be implemented as electronic hardware, computer software, or a combination thereof. In order to clearly illustrate the interchangeability between hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above around their functions. Whether such functions are implemented as hardware or software depends on specific applications and the design constraints imposed on the entire system. A skilled person can implement the described functions in an alternative manner for each specific application, but such implementation decisions should not be interpreted as departing from the scope of protection of the present disclosure.

[0064] The steps of the method or algorithm described in conjunction with the embodiments herein may be directly embodied as hardware, a software module executed by a processor, or a combination thereof. The software module may be located in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a mobile disk, a CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and the storage medium may be located in an ASIC. The ASIC may be located in a user terminal. Of course, the processor and the storage medium may also be present in a user terminal as discrete components.

[0065] For software implementation, the techniques described in this application can be implemented with modules (e.g., procedures, functions, etc.) that perform the functions described in this application. These software codes can be stored in a memory unit and executed by a processor. The memory unit can be implemented within the processor or outside the processor. In the latter case, it is coupled to the processor in a communication manner via various means, which are well known in the art.

[0066] The above description includes examples of one or more embodiments. Of course, it is impossible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it should be recognized by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications and variations that fall within the scope of protection of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, the word is covered in a manner similar to the term "including", just as "including," is explained as a transitional word in the claims. In addition, any term "or" used in the specification of the claims is intended to mean "non-exclusive or".

Claims

1. A method for freely combining independent microservices, characterized in that: include: S100. Determine multiple microservices that need to be combined according to demand; S200. Create a composite microservice and load multiple microservices that need to be combined in the form of dependency packages; S300: Initialize the combined microservices and provide API services after the microservices are combined.

2. A method for freely combining independent microservices as claimed in claim 1, characterized in that: In S100, multiple microservices that need to be combined are determined according to needs. The specific methods include: dividing microservices according to the natural boundaries of microservice business logic; dividing microservices according to the relevance of microservice data models; dividing microservices according to microservice team structure and skill expertise; and determining that microservices are combined together to provide complete business functions based on the dependencies between microservices.

3. A method for freely combining independent microservices as claimed in claim 1, characterized in that: In S200, a composite microservice is created, and multiple microservices to be combined are loaded in the form of dependency packages. The specific method includes: creating a composite microservice, mounting multiple microservices to be combined by referencing independent jar packages, and realizing rapid combination of multiple microservices.

4. A method for freely combining independent microservices as claimed in claim 3, characterized in that: Multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific methods include: calling the APIs of other microservices through HTTP requests or other protocols, writing client code to send requests to these microservices, and processing their responses.

5. A method for freely combining independent microservices as claimed in claim 3, characterized in that: Multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method also includes: if the functions of the microservices are encapsulated into a reusable library or framework, and the library or framework is provided in the form of a jar package, then the microservice jar package is introduced as a dependency in the service project.

6. A method for freely combining independent microservices as claimed in claim 3, characterized in that: Multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method also includes: creating a service proxy, which is responsible for routing requests to different microservices and aggregating their responses; the service proxy is an independent microservice or a part of an existing service that wants to integrate other microservice functions; in the service proxy, specify how to call other microservices by programming or configuration.

7. A method for freely combining independent microservices as claimed in claim 3, characterized in that: Multiple microservices that need to be combined are mounted by referencing independent jar packages. The specific method also includes: If the microservices exist in the form of jar packages and the customer wants to deploy them in a more flexible and scalable way, package them into Docker containers and use Kubernetes and Docker Compose container orchestration tools to manage them.

8. A method for freely combining independent microservices as claimed in claim 1, characterized in that: In S300, the combined microservice is initialized to provide the API service after the microservice is combined. The specific method includes: in the combined microservice configuration file, the service unique identifier and jar package name of the microservice are added to read and distinguish the configuration and interface address information of each service in the integration process; all service codes of the microservice are uniformly read, identified and instantiated through the Java class loader, and the configuration is injected to collect all external service interfaces, and the content of microservices A, B, and C is independently instantiated; a unified service port is provided to the outside world, request interception is performed, and identification and matching are performed according to the microservice unique identifier, and finally the corresponding service method is called, and the microservice unique identifier is returned.

9. A system of independent microservices freely combined, characterized in that: include: The microservice determination unit combines the microservice creation unit and the API service provision unit; among which: A microservice determination unit is used to determine multiple microservices that need to be combined according to demand; The composite microservice creation unit is used to create a composite microservice and load multiple microservices that need to be combined in the form of dependency packages; The API service providing unit is used to initialize the combined microservices and provide API services after the microservices are combined.

10. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for free combination of microservices in claims 1-8.

Citation Information

Patent Citations

  • An application structure modularization construction method based on a micro-service architecture

    CN109597610A

  • Micro-service deployment method and device, electronic equipment and storage medium

    CN115048112A

  • Industrial software micro-service merging method and system

    CN115827100A

  • Configuration for Application Using Microservices

    US20190220289A1