Multi-registry microservice discovery method and system based on unified access rules

By adopting a multi-registry discovery method based on unified access rules in the microservice architecture, the flexibility problem of service registration and discovery is solved, the natural evolution and efficient operation and maintenance of the microservice architecture are realized, and the cost and complexity of migration are reduced.

CN115514805BActive Publication Date: 2024-09-17SHANGHAI FINANCIAL FUTURES INFORMATION TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202211209535.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2024-09-17
Estimated Expiration
2042-09-30

AI Technical Summary

Technical Problem

Existing technologies cannot meet the flexibility needs of service registration and discovery in the evolution of microservice architecture from a single architecture to a containerized architecture, resulting in high migration costs and complexity, and the inability to effectively cope with the state of multiple registration centers.

Method used

Adopting a multi-registry microservice discovery method based on unified access rules, the registration center controller manages the writing and reading of domain name registration information, provides a unified access interface abstraction layer, shields the differences in service registration and discovery mechanisms, and supports multiple Registration center coexistence and cross-registry access.

Benefits of technology

It achieves flexible management of microservice architecture, reduces service migration costs, ensures the natural evolution and efficient operation and maintenance of the architecture, avoids code adjustments, and improves the flexibility and decoupling of service discovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115514805B
    Figure CN115514805B
Patent Text Reader

Abstract

The present invention discloses a multi-registration center microservice discovery method and system based on unified access rules, so that the switching of registration centers and the parallel operation of registration centers can be flexibly managed, and the microservice architecture can be guaranteed to evolve naturally with the development of the enterprise. Its technical solution is: including the writing and reading of domain name registration information. When a service located in a registration center is started, its own information is registered to the local registration center, and independent services without a registration center configure their own information in the registration center controller in advance; the registration center controller obtains domain name registration information from each local registration center, and then loads the domain name registration information of the independent service, merges to form a complete domain name registration information, and pushes the complete information to each local registration center at the same time; the caller accesses the unified domain name; the target service address is resolved according to the domain name registration information, wherein the domain name registration information of the local registration center or the registration center controller is read; the target address and port are accessed based on the read domain name registration information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a multi-registry center microservice discovery method, and in particular to a multi-registry center microservice discovery method and system based on unified access rules. Background Art

[0002] With the development of information technology and digital economy, many enterprises have started the process of digital transformation. Digital transformation emphasizes people-oriented and rapid delivery of business value. Correspondingly, the application system architecture is also developing rapidly, and has experienced the development from monolithic architecture, microservices to containerized architecture. After the development from monolithic architecture to microservice architecture, the governance of microservices has put forward requirements for the overall architecture design, and put forward requirements such as intelligent clients, automatic registration and discovery of services. However, after the evolution from microservices to containerization, containerization, with the help of Kubernetes' capabilities, provides a better solution in service registration and discovery with less invasiveness, good resilience, and flexible control, which further decouples business development and framework and improves development efficiency.

[0003] However, the application system construction process of most enterprises is usually a gradual evolution. In the early stage of business development, due to the small scale of the company and the relatively simple business, 3 or 5 services may be enough to cover the company's business operations. At this time, due to cost considerations and the rapid implementation of the system, the latest architecture is usually not adopted. It may be that each service configures the address of the accessed service on demand for simple collaboration. As the business develops, the number of services gradually increases from a few to dozens. At this time, the access relationship between services becomes complicated, and the manual configuration mode can no longer meet the needs. So we began to try to establish a traditional microservice automatic registration and discovery mechanism. As the business grows further, the number of microservices reaches hundreds. For more efficient operation and maintenance, more decoupled R&D, and more standardized delivery, the architecture begins to turn to containerization. Only then do we start to consider service registration and discovery based on Kubernetes. This evolution process requires microservices to cope with changes in service registration and discovery methods, which brings high costs to the evolution and migration of microservices. At the same time, microservices are usually migrated in batches. When there are hundreds of microservices, it is difficult to migrate all of them at once. This brings about an intermediate state where multiple registration centers coexist. This complex situation also increases the complexity of microservice migration.

[0004] From the perspective of architecture evolution, a more flexible way of automatic registration and discovery of microservices must be designed, so that the architecture can naturally transition to an ideal state. However, from the perspective of development, the service registration and discovery solutions of the technical community cannot meet the above requirements. Whether it is SpringCloud or the implementation solution based on ZooKeeper, it cannot meet the flexibility requirements brought by architecture migration. Once migration is required, it will always bring greater intrusion to the service, and it lacks sufficient flexibility to deal with the multi-registration center status during the parallel transition of the architecture. From the actual process, some enterprises are limited by the lack of flexibility of the service registration mechanism after containerization, and they have never been able to decouple the service registration capability to Kubernetes. Summary of the invention

[0005] A brief summary of one or more aspects is given below to provide a basic understanding of these aspects. This summary is not an exhaustive overview of all conceived aspects, and is neither intended to identify the key or critical elements of all aspects nor to define the scope of any or all aspects. Its only purpose is to give some concepts of one or more aspects in a simplified form as a prelude to a more detailed description that will be given later.

[0006] The purpose of the present invention is to solve the above problems and provide a multi-registry center microservice discovery method and system based on unified access rules, so that more flexible management can be performed in terms of registration center switching and registration center parallelism, ensuring that the microservice architecture can evolve naturally with the development of the enterprise.

[0007] The technical solution of the present invention is as follows: The present invention discloses a multi-registry microservice discovery method based on unified access rules, the method includes two aspects: writing domain name registration information and reading registration information, wherein:

[0008] The writing of domain name registration information is completed by the registration center controller, which further includes:

[0009] Step 1.1: When a service located in a registration center is started, the service information is registered to the local registration center. Independent services without a registration center configure their own information in the registration center controller in advance;

[0010] Step 1.2: The registry controller obtains domain name registration information from each local registry, then loads the domain name registration information of the independent service from the configuration file of the registry controller, merges the two parts of registration information to form the complete domain name registration information, and pushes the complete domain name registration information to each local registry;

[0011] The reading of domain name registration information is implemented by the caller, and further includes:

[0012] Step 2.1: The caller accesses the unified domain name;

[0013] Step 2.2: The caller resolves the target service address according to the domain name registration information, and reads the domain name registration information of the local registry or the registry controller during the resolution process;

[0014] Step 2.3: The caller accesses the target address and port based on the domain name registration information read.

[0015] According to an embodiment of the multi-registry center microservice discovery method based on unified access rules of the present invention, the service itself information at the time of startup in step 1.1 includes the address and port information of the registration center.

[0016] According to an embodiment of the multi-registry center microservice discovery method based on unified access rules of the present invention, step 2.3 is access based on unified access rules. The unified access rules include unified access through a domain name consistent with the service name, and a unified access interface abstraction layer is provided through a unified underlying framework to shield the differences brought by the service registration and discovery mechanisms.

[0017] The present invention also discloses a multi-registration center microservice discovery system based on unified access rules, the system comprising a domain name registration information writing device and a domain name registration information reading device, wherein:

[0018] The domain name registration information writing device further includes a registration configuration module and a loading and pushing module, wherein:

[0019] The registration configuration module is configured as follows: when a service located in a registration center is started, the service information itself is registered to the local registration center, and independent services without a registration center configure their own information in advance in the registration center controller;

[0020] The loading and pushing module is configured as follows: the registry controller obtains domain name registration information from each local registry, then loads the domain name registration information of the independent service from the configuration file of the registry controller, merges the two parts of registration information to form complete domain name registration information, and pushes the complete domain name registration information to each local registry;

[0021] The domain name registration information reading device includes a calling module, a parsing module, and an access module, wherein:

[0022] The calling module is configured as follows: the caller accesses the unified domain name;

[0023] The resolution module is configured as follows: the caller resolves the target service address according to the domain name registration information, and reads the domain name registration information of the local registration center or the registration center controller during the resolution process;

[0024] The access module is configured as follows: the caller accesses the target address and port based on the read domain name registration information.

[0025] According to an embodiment of the multi-registry center microservice discovery system based on unified access rules of the present invention, in the registration configuration module, the service itself information at startup includes the address and port information of the registration center.

[0026] According to an embodiment of a multi-registry center microservice discovery system based on unified access rules of the present invention, in an access module, access is performed based on unified access rules. The unified access rules include unified access through a domain name consistent with the service name, and a unified access interface abstraction layer is provided through a unified underlying framework to shield the differences brought about by the service registration and discovery mechanisms.

[0027] Compared with the prior art, the present invention has the following beneficial effects: The innovative points of the solution of the present invention are mainly reflected in: 1) Multiple registration centers: supporting multiple registration centers, supporting the coexistence and communication of registration centers; 2) Unified access rules: by providing a unified access mode and abstract interface, the impact of service migration is shielded and the cost of service migration is reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The above features and advantages of the present invention can be better understood after reading the detailed description of the embodiments of the present disclosure in conjunction with the following drawings. In the drawings, the components are not necessarily drawn to scale, and components with similar related properties or features may have the same or similar reference numerals.

[0029] Figure 1 A schematic diagram showing the difficulty of microservices under different registration centers accessing each other.

[0030] Figure 2 A schematic diagram showing service registration and discovery supporting cross-registry access is shown.

[0031] Figure 3 A schematic diagram showing that service access rules are not affected by service migration.

[0032] Figure 4 A schematic diagram of a cross-registry center access scenario of an application example of the multi-registry center microservice discovery method based on unified access rules of the present invention is shown.

[0033] Figure 5 A flowchart of an embodiment of a multi-registry microservice discovery method based on unified access rules of the present invention is shown.

[0034] Figure 6 A schematic diagram of an embodiment of a multi-registry microservice discovery system based on unified access rules of the present invention is shown. DETAILED DESCRIPTION

[0035] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. Note that the aspects described below in conjunction with the accompanying drawings and specific embodiments are only exemplary and should not be construed as limiting the scope of protection of the present invention in any way.

[0036] In the traditional microservice model, services under the same registry can be accessed more easily. Figure 1 As shown, access to services that are not in the same registry due to reasons such as migration is often handled differently or cannot be accessed at all.

[0037] The multi-registry microservice discovery method based on unified access rules of the present invention can provide a more flexible service discovery method, such as Figure 2 As shown in the figure, it can support flexible access of microservices across registration centers. Figure 2 The cross-registry registration and discovery of microservices is shown in the figure, thus solving the communication problem, but it does not solve the migration and evolution problem. For example, if a service is migrated from one registry to another one day, it is also important to ensure that the original scenario of calling this service is not affected. The multi-registry microservice discovery method based on unified access rules of the present invention can effectively solve this problem. Figure 3 As shown in the figure, after service b is migrated, the access rules of service a to service b remain unchanged, and no code adjustment is required.

[0038] by Figure 4 Take the scenario shown as an example. Figure 4 A scenario of service discovery is described as follows:

[0039] Caller Callee Calling method Callee registration method service-a service-a2 http: / / servcie-a2 / Kubernetes service-a service-b http: / / servcie-b / Z service-a service-c http: / / servcie-c / none service-a other Kubernetes (default)

[0040] In this scenario, since service-a migrated before service-b, the two services are located in different registries. Since service-c is in another environment and has a relatively simple architecture, it is not suitable to establish a separate registry. The goal of this solution is to enable transparent calls to services in these multiple registries. When the registration mechanism of the called service changes, transparent automatic discovery can be achieved by changing the configuration information or environment variables without changing the caller's code.

[0041] The multi-registry center microservice discovery method based on unified access rules of the present invention includes two aspects of design: one is multi-registry center service registration and discovery, and the other is unified access rules.

[0042] In terms of multi-registry service registration and discovery, when a service starts, it registers itself with the local registry (to facilitate transparent discovery by other services), and when calling other services, it discovers other services transparently just like calling from the local registry.

[0043] In terms of unified access rules, unified access is achieved through domain names consistent with the service names, without having to worry about ports or deployment environments. Through a unified underlying framework (HTTP access SDK), a unified access interface abstraction layer is provided to shield differences in service registration and discovery mechanisms, and shield the impact of changes in registration methods during migration. For example, access can be based on the following abstract interface:

[0044] public interface Object accessService(String serviceName);

[0045] It can be seen that the access rules are highly unified.

[0046] Figure 5 The process of an embodiment of the multi-registry microservice discovery method based on unified access rules of the present invention is shown. Figure 5 , the implementation steps of the method of this embodiment are described in detail as follows.

[0047] The method of this embodiment includes two aspects: writing and reading domain name registration information.

[0048] The writing of domain name registration information is completed by the registration center controller, including the following processing steps.

[0049] Step 1.1: When a service located in a certain registration center is started, it registers its own information (address, port) to the local registration center; independent services (without registration center) configure their own information in the registration center controller in advance.

[0050] Step 1.2: The registry controller obtains domain name registration information from each local registry, then loads the domain name registration information of the independent service from the configuration file of the registry controller, and merges the two parts of information to form the complete domain name registration information. At the same time, the complete domain name registration information is pushed to each local registry, so that each local registry can "see" the services that are not originally located in the registry. This mechanism of dynamically obtaining from each local registry has good adaptability and can effectively solve the problem of environmental changes caused by the migration of services across registries.

[0051] The reading of domain name registration information is implemented by the caller and includes the following processing steps.

[0052] Step 2.1: The caller accesses the unified domain name.

[0053] Step 2.2: The caller resolves the target service address based on the domain name registration information. In this process, the domain name registration information of the local registry (if any) or the registry controller (if there is no local registry) is read. In this process, since the registration information is registered uniformly, the caller does not need to know the specific environment information of the target service (registration center of the target service, address and port information of the target service). From the caller's point of view, calling services from other registries is as simple as calling services from this registry. As to why the target service information is not directly resolved from the registry controller but obtained from the local registry, it is mainly because each type of registry will accumulate some differentiated capabilities (such as load balancing), and calling from the local registry can make full use of these capabilities.

[0054] Step 2.3: The caller accesses the target address and port based on the domain name registration information read.

[0055] Figure 6 The principle of an embodiment of the multi-registry microservice discovery system based on unified access rules of the present invention is shown. Figure 6 The system includes a domain name registration information writing device and a domain name registration information reading device.

[0056] The domain name registration information writing device further includes a registration configuration module and a loading and pushing module.

[0057] The registration configuration module is further configured as follows: when a service located in a registration center is started, the service information is registered to the local registration center, and independent services without a registration center configure their own information in the registration center controller in advance. The service information at startup includes the address and port information of the registration center.

[0058] The loading and pushing module is further configured as follows: the registry controller obtains domain name registration information from each local registry, then loads the domain name registration information of the independent service from the configuration file of the registry controller, merges the two parts of the registration information to form a complete domain name registration information, and pushes the complete domain name registration information to each local registry, so that each local registry can "see" the service that is not originally located in the registry. This mechanism of dynamically obtaining from each local registry has good adaptability and can effectively solve the problem of environmental changes caused by the migration of services across registries.

[0059] The domain name registration information reading device further includes a calling module, a parsing module, and an access module.

[0060] The calling module is further configured as follows: the caller accesses the unified domain name.

[0061] The resolution module is further configured as follows: the caller resolves the target service address according to the domain name registration information, and reads the domain name registration information of the local registry or the registry controller during the resolution process. In this process, since the registration information is registered uniformly, the caller does not need to know the specific environment information of the target service (the registry of the target service, the address and port information of the target service). From the caller's point of view, calling services from other registries is as simple as calling services from this registry. As to why the target service information is not directly resolved from the registry controller but obtained from the local registry, it is mainly because each type of registry will accumulate some differentiated capabilities (such as load balancing), and calling from the local registry can make full use of these capabilities.

[0062] The access module is further configured such that the caller accesses the target address and port based on the read domain name registration information.

[0063] Although the above methods are illustrated and described as a series of actions for simplicity of explanation, it should be understood and appreciated that these methods are not limited by the order of the actions, because according to one or more embodiments, some actions may occur in a different order and / or concurrently with other actions from those illustrated and described herein or not illustrated and described herein but understandable to those skilled in the art.

[0064] Those skilled in the art will further appreciate that the various illustrative logic blocks, modules, circuits, and algorithm steps described in conjunction with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or a combination of the two. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. The technician may implement the described functionality in different ways for each specific application, but such implementation decisions should not be interpreted as resulting in a departure from the scope of the present invention.

[0065] The various illustrative logic blocks, modules, and circuits described in conjunction with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in cooperation with a DSP core, or any other such configuration.

[0066] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software module may reside in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read and write information from / to the storage medium. In an alternative, a storage medium may be integrated into a processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In an alternative, the processor and the storage medium may reside in a user terminal as discrete components.

[0067] In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented as a computer program product in software, each function may be stored on or transmitted by a computer-readable medium as one or more instructions or codes. Computer-readable media include both computer storage media and communication media, including any medium that facilitates the transfer of a computer program from one place to another. Storage media may be any available medium that can be accessed by a computer. As an example and not limitation, such a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer. Any connection is also properly referred to as a computer-readable medium. For example, if the software is transmitted from a website, a server, or other remote source using a coaxial cable, a fiber optic cable, a twisted pair, a digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwaves, the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwaves are included in the definition of the medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, wherein disk often reproduces data magnetically, while disc reproduces data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0068] The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be apparent to those skilled in the art, and the general principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein, but should be granted the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A multi-registry microservice discovery method based on unified access rules, characterized in that: The method includes two aspects: writing domain name registration information and reading registration information, wherein: The writing of domain name registration information is completed by the registration center controller, which further includes: Step 1.1: When a service located in a registration center is started, the service information is registered to the local registration center. Independent services without a registration center configure their own information in the registration center controller in advance; Step 1.2: The registry controller obtains domain name registration information from each local registry, then loads the domain name registration information of the independent service from the configuration file of the registry controller, merges the two parts of registration information to form the complete domain name registration information, and pushes the complete domain name registration information to each local registry; The reading of domain name registration information is implemented by the caller, and further includes: Step 2.1: The caller accesses the unified domain name; Step 2.2: The caller resolves the target service address according to the domain name registration information, and reads the domain name registration information of the local registry or the registry controller during the resolution process; Step 2.3: The caller accesses the target address and port based on the domain name registration information read.

2. The multi-registry microservice discovery method based on unified access rules according to claim 1 is characterized in that: The service information at startup in step 1.1 includes the address and port information of the registration center.

3. The multi-registry microservice discovery method based on unified access rules according to claim 1 is characterized in that: Step 2.3 is to access based on unified access rules. The unified access rules include unified access through domain names consistent with the service names, and provide a unified access interface abstraction layer through a unified underlying framework to shield the differences brought by service registration and discovery mechanisms.

4. A multi-registry microservice discovery system based on unified access rules, characterized in that: The system includes a domain name registration information writing device and a domain name registration information reading device, wherein: The domain name registration information writing device further includes a registration configuration module and a loading and pushing module, wherein: The registration configuration module is configured as follows: when a service located in a registration center is started, the service information itself is registered to the local registration center, and independent services without a registration center configure their own information in advance in the registration center controller; The loading and pushing module is configured as follows: the registry controller obtains domain name registration information from each local registry, then loads the domain name registration information of the independent service from the configuration file of the registry controller, merges the two parts of registration information to form complete domain name registration information, and pushes the complete domain name registration information to each local registry; The domain name registration information reading device includes a calling module, a parsing module, and an access module, wherein: The calling module is configured as follows: the caller accesses the unified domain name; The resolution module is configured as follows: the caller resolves the target service address according to the domain name registration information, and reads the domain name registration information of the local registration center or the registration center controller during the resolution process; The access module is configured as follows: the caller accesses the target address and port based on the read domain name registration information.

5. The multi-registry microservice discovery system based on unified access rules according to claim 4 is characterized in that: In the registration configuration module, the service information at startup includes the address and port information of the registration center.

6. The multi-registry microservice discovery system based on unified access rules according to claim 4, characterized in that: In the access module, access is based on unified access rules. The unified access rules include unified access through a domain name consistent with the service name, and a unified access interface abstraction layer is provided through a unified underlying framework to shield the differences brought about by the service registration and discovery mechanisms.

Citation Information

Patent Citations

  • Microservice invocation method, apparatus, system and device and readable storage medium

    CN109246251A

  • Microservice management system, method and device, computer equipment and storage medium

    CN109714319A

  • Multi-type micro-service registration center management system and method

    CN112311869A

  • Micro-service calling method and device, computer equipment and storage medium

    CN112887279A

  • Micro-service system and micro-service registration, discovery and keep-alive method

    CN114650317A