Addressing methods, apparatus, devices and storage media

By optimizing the addressing method in a multi-tenant microservice architecture and using addressing view data and strategies to determine the target registry address, the problem of low addressing efficiency of DNS+LB+Nginx is solved, and efficient cross-tenant service addressing and governance are achieved.

CN116319966BActive Publication Date: 2026-03-13CHINA CONSTRUCTION BANK +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-15
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In a multi-tenant microservice architecture, existing technologies using DNS+LB+Nginx for addressing result in long traffic paths, leading to low addressing efficiency, significant resource waste, and an inability to effectively utilize the microservice governance system for service governance.

Method used

An addressing method is provided, which receives an addressing request from a terminal device, determines the target addressing instance from multiple addressing instances based on the service identifier, determines the target registry address, sends the target registry address to the terminal device, and optimizes the addressing process using addressing view data and strategies.

Benefits of technology

It improves addressing efficiency, reduces resource waste, simplifies service governance, reduces latency, and enables convenient addressing across tenants.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116319966B_ABST
    Figure CN116319966B_ABST
Patent Text Reader

Abstract

This application belongs to the field of microservice technology, specifically relating to an addressing method, apparatus, device, and storage medium. The method includes: receiving an addressing request sent by a terminal device, the addressing request including a first service identifier of a target service; determining a target addressing instance from multiple addressing instances based on the first service identifier; determining a target registry address corresponding to the first service identifier based on the target addressing instance; and sending the target registry address to the terminal device. This improves addressing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of microservice technology, specifically relating to an addressing method, apparatus, device, and storage medium. Background Technology

[0002] In a microservice multi-tenant architecture, there are scenarios where tenants call each other as well as scenarios where multiple tenants call each other. With different tenants bound to different registry server clusters, service addressing or function addressing will occur between multi-tenant microservices to make business calls.

[0003] In related technologies, service consumers in a multi-tenant environment can find the gateway of the service provider's tenant through DNS+LB+Nginx. The gateway then performs service addressing or function addressing through the registration center server cluster bound to the tenant; alternatively, they can directly find the service provider through DNS+LB+Nginx.

[0004] However, when addressing via DNS+LB+Nginx, the traffic travels through a longer link, resulting in lower addressing efficiency. Summary of the Invention

[0005] This application provides an addressing method, apparatus, device, and storage medium that improves addressing efficiency.

[0006] In a first aspect, embodiments of this application provide an addressing method, including:

[0007] Receive an addressing request sent by a terminal device, wherein the addressing request includes a first service identifier of the target service;

[0008] Based on the first service identifier, the target addressing instance is determined from multiple addressing instances;

[0009] Based on the target addressing instance, determine the target registry address corresponding to the first service identifier;

[0010] Send the target registration center address to the terminal device.

[0011] In one possible implementation, determining the target addressing instance among multiple addressing instances based on the first service identifier includes:

[0012] Determine the plurality of addressing instances, wherein any one of the plurality of addressing instances includes a service identifier and the registry center address corresponding to the service identifier;

[0013] The addressing instance whose service identifier is the same as the first service identifier among the plurality of addressing instances is determined as the target addressing instance.

[0014] In one possible implementation, determining the plurality of addressing instances includes:

[0015] Acquire addressing view data and addressing policy. The addressing view data includes multiple service identifiers, multiple tenants, multiple tenant deployment environments, and multiple registry center addresses. The addressing policy is used to indicate the correspondence between services, tenants, and tenant deployment environments.

[0016] The plurality of addressing instances are determined based on the addressing view data and the addressing strategy.

[0017] In one possible implementation, for any given addressing instance, determining the plurality of addressing instances based on the addressing view data and the addressing policy includes:

[0018] Choose one of the plurality of service identifiers as the candidate service identifier;

[0019] Based on the candidate service identifier and the addressing strategy, determine the registry center address of the candidate service in the addressing view data;

[0020] Store the candidate service identifier and the registration center address of the candidate service as the addressing instance.

[0021] In one possible implementation, determining the registry address of the candidate service in the addressing view data based on the candidate service identifier and the addressing policy includes:

[0022] Based on the candidate service identifier, determine the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs in the addressing view data;

[0023] Based on the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs, the registry address of the candidate service is determined in the addressing view data. The addressing instance also includes the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs.

[0024] In one possible implementation, the method further includes:

[0025] Receive updated addressing view data and addressing strategy;

[0026] The multiple addressing instances are updated based on the updated addressing view data and addressing strategy.

[0027] Secondly, embodiments of this application provide an addressing device, including a receiving module, a first determining module, a second determining module, and a transmitting module, wherein...

[0028] The receiving module is used to receive an addressing request sent by a terminal device, wherein the addressing request includes a first service identifier of the target service;

[0029] The first determining module is used to determine the target addressing instance among multiple addressing instances based on the first service identifier;

[0030] The second determining module is used to determine the target registration center address corresponding to the first service identifier based on the target addressing instance;

[0031] The sending module is used to send the target registration center address to the terminal device.

[0032] In one possible implementation, the first determining module is specifically used for:

[0033] Determine the plurality of addressing instances, wherein any one of the plurality of addressing instances includes a service identifier and the registry center address corresponding to the service identifier;

[0034] The addressing instance whose service identifier is the same as the first service identifier among the plurality of addressing instances is determined as the target addressing instance.

[0035] In one possible implementation, the first determining module is specifically used for:

[0036] Acquire addressing view data and addressing policy. The addressing view data includes multiple service identifiers, multiple tenants, multiple tenant deployment environments, and multiple registry center addresses. The addressing policy is used to indicate the correspondence between services, tenants, and tenant deployment environments.

[0037] The plurality of addressing instances are determined based on the addressing view data and the addressing strategy.

[0038] In one possible implementation, for any addressing instance, the first determining module is specifically used for:

[0039] Choose one of the plurality of service identifiers as the candidate service identifier;

[0040] Based on the candidate service identifier and the addressing strategy, determine the registry center address of the candidate service in the addressing view data;

[0041] Store the candidate service identifier and the registration center address of the candidate service as the addressing instance.

[0042] In one possible implementation, the first determining module is specifically used for:

[0043] Based on the candidate service identifier, determine the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs in the addressing view data;

[0044] Based on the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs, the registry address of the candidate service is determined in the addressing view data. The addressing instance also includes the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs.

[0045] In one possible implementation, the device further includes an update module, which is used to:

[0046] Receive updated addressing view data and addressing strategy;

[0047] The multiple addressing instances are updated based on the updated addressing view data and addressing strategy.

[0048] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory;

[0049] The memory stores computer-executed instructions;

[0050] The processor executes computer execution instructions stored in the memory, causing the processor to perform the addressing method as described in any of the first aspects.

[0051] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the addressing method described in any of the first aspects.

[0052] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, can implement the addressing method described in any of the first aspects.

[0053] This application provides an addressing method, apparatus, device, and storage medium. The method involves receiving an addressing request from a terminal device, the addressing request including a first service identifier of a target service; determining a target addressing instance from multiple addressing instances based on the first service identifier; determining a target registry address corresponding to the first service identifier based on the target addressing instance; and sending the target registry address to the terminal device. This improves addressing efficiency. Attached Figure Description

[0054] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0055] Figure 1This is a schematic diagram of an application scenario provided by an embodiment of this application;

[0056] Figure 2 This application provides a schematic diagram of the structure of a microservice system according to an embodiment of the present application.

[0057] Figure 3 A flowchart illustrating an addressing method provided in an embodiment of this application;

[0058] Figure 4 A flowchart illustrating the process of determining an addressing instance, provided as an embodiment of this application;

[0059] Figure 5 This is a schematic diagram of an addressing device provided in an embodiment of this application;

[0060] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0061] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0062] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the embodiments of this application. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0063] The collection, storage, use, processing, transmission, provision, and disclosure of user data and other information involved in the embodiments of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0064] It should be noted that although the terms "first," "second," etc., are used to describe various data in the embodiments of this application, this information should not be limited to these terms. These terms are only used to distinguish data of the same type from each other. Optionally, without departing from the scope of this application, first data may also be referred to as second data, and similarly, second data may also be referred to as first data.

[0065] It should be understood that the terms "comprising" or "including" indicate the presence of the stated features, steps, or operations, but do not preclude the presence, occurrence, or addition of one or more other features, steps, or operations.

[0066] The microservices involved in this application embodiment are software applications primarily focused on business functions. Each microservice has autonomously running business functions and an application programming interface (API) that is not limited by language. The API may include RESTful APIs, function codes (function identifiers), etc. Common microservices include business instances that provide business capabilities and gateway instances that provide traffic forwarding proxies.

[0067] In a microservice architecture, a request between microservices typically involves two roles: service provider and service consumer. The process by which a service consumer instance finds a service provider instance is called addressing. There are generally several addressing methods: service identifier addressing, method identifier addressing, and function identifier addressing (which abstracts functions into multiple corresponding function identifiers for unbinding services and functions, so that the service consumer only needs to know which specific function to call without needing to know the specific service).

[0068] The tenant involved in the embodiments of this application is a logical concept, referring to a user organization that uses system or computing resources. For example, different departments or different R&D centers within an organizational structure. All data contained within a tenant on an organizational node, such as microservice information created in the system, and independent or shared data resources assigned and bound to the tenant in the system, all fall within the scope of a tenant.

[0069] To facilitate understanding, the following will be combined with... Figure 1 The application scenarios applicable to the embodiments of this application will be described.

[0070] Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of this application. Please refer to... Figure 1 It includes multiple registry server clusters and multiple terminal devices, with microservices configured on the terminal devices. Terminal devices 1, 2, and 3 belong to tenant 1, while terminal devices 4, 5, and 6 belong to tenant 2. The terminal devices in tenant 1 are connected to registry server cluster A, and the terminal devices in tenant 2 are connected to registry server cluster B.

[0071] Figure 1 This is merely an illustrative diagram of one application scenario and does not constitute a limitation on the application scenarios of the technical solutions provided in this application. For example, the application scenario of this application embodiment may include a gateway, or it may also include other numbers of terminal devices or other numbers of servers.

[0072] Terminal devices within the same tenant can call microservices deployed on each other's terminals, and terminal devices from different tenants can also call microservices deployed on each other's terminals. During the call process, the service consumer first needs to determine the service provider's registry address. In related technologies, service consumers in multi-tenant environments can find the gateway of the service provider's tenant through DNS+LB+Nginx. The gateway then uses the registry server cluster bound to its tenant for service or function addressing; alternatively, it can directly find the service provider through DNS+LB+Nginx.

[0073] However, addressing via DNS+LB+Nginx has the following disadvantages:

[0074] 1. Waste of resources;

[0075] 2. Inability to effectively utilize microservice governance systems for service governance, such as fault tolerance between specific multi-tenant services;

[0076] 3. The traffic travels through a longer path, involves more dependencies, and increases latency. Sometimes, using a gateway to develop external interfaces is to avoid maintaining multiple service provider domains. However, this adds another layer of gateway time for convenience, which poses a significant pain point for high-performance, low-latency services.

[0077] 4. Serving consumers requires maintaining a large number of service provider information domains;

[0078] 5. Changes to the service provider's domain name / data center / environment may also require notification to all service consumers.

[0079] To address the aforementioned technical problems, embodiments of this application provide an addressing method that receives an addressing request sent by a terminal device, the addressing request including a first service identifier of a target service; determines a target addressing instance from multiple addressing instances based on the first service identifier; determines a target registry address corresponding to the first service identifier based on the target addressing instance; and sends the target registry address to the terminal device. This improves addressing efficiency.

[0080] The technical solutions shown in this application will now be described in detail through specific embodiments. It should be noted that the following embodiments may exist independently or in combination with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0081] Figure 2 This is a schematic diagram of the structure of a microservice system provided in an embodiment of this application. Please refer to [link / reference]. Figure 2The microservice system includes an addressing view module, a platform module, a metadata module, a governance center module, a registry module, and an agent probe module. The addressing view module and the metadata module belong to the same entity module, while the platform module, governance center module, and registry module are all entity modules. The governance center module can include multiple governance center components.

[0082] The functions and roles of each module are explained in detail below:

[0083] Addressing view module:

[0084] The global addressing view enables the opening and management of global service provider addressing policies, including configuration of fields such as tenant, tenant deployment environment, service identifier, and function identifier, as well as the smooth replacement of tenant, tenant deployment environment, and bound registry center.

[0085] Addressing data is synchronized to the governance center module.

[0086] Platform Modules:

[0087] Component-based management functionality for the governance center module and the registration center module;

[0088] Tenant management functionality;

[0089] The binding component functionality between tenants and tenant deployment environments.

[0090] Metadata module:

[0091] Metadata management function for service information of each tenant;

[0092] Configure service providers that have been published in the addressing view module to serve consumers.

[0093] Governance Center Module:

[0094] Agent probe module management functions;

[0095] The function of synchronizing addressing data (including addressing view data and addressing policies) to the agent probe module.

[0096] Registration Center Module:

[0097] Registration service function and discovery service function.

[0098] agent probe module:

[0099] Receive addressing data synchronized from the governance center module and put it into the cache;

[0100] Multi-tenant service addressing and warm-up addressing capabilities;

[0101] The non-intrusive bytecode enhancement interface enables multi-registry and multi-service addressing capabilities.

[0102] Based on the modules described above, the addressing process will be explained in detail below.

[0103] Figure 3 This is a flowchart illustrating an addressing method provided in an embodiment of this application. Please refer to [link / reference]. Figure 3 The method includes:

[0104] S301. Receive an addressing request sent by the terminal device. The addressing request includes the first service identifier of the target service.

[0105] The execution entity of this application embodiment can be a server or an addressing device set in the server. The addressing device can be implemented by software or by a combination of software and hardware.

[0106] In the microservices domain, traditional applications are considered overly bloated. Designers break down complex traditional applications into multiple core functions, each called a service. These services can be built and deployed independently, ensuring that they do not affect each other during operation (or failure). Multiple applications can include the same functionality.

[0107] A target service can refer to a single service or a target function.

[0108] The first service identifier includes the identifier of the target service or the identifier of the target function.

[0109] S302. Determine the target addressing instance among multiple addressing instances based on the first service identifier.

[0110] In one possible implementation, the target addressing instance can be determined from multiple addressing instances based on the first service identifier in the following way:

[0111] Multiple addressing instances are identified, and any one of the multiple addressing instances includes a service identifier and the registration center address corresponding to the service identifier; the addressing instance whose service identifier is the same as the first service identifier is identified as the target addressing instance.

[0112] In one possible implementation, the addressing instance may include a service identifier, a tenant, a tenant deployment environment, and a registry address.

[0113] S303. Based on the target addressing instance, determine the target registry address corresponding to the first service identifier.

[0114] The target registry address can be the registry address of the target service.

[0115] In one possible implementation, since the target addressing instance includes a service identifier and the corresponding registry address, if the first service identifier is the same as the service identifier in the target addressing instance, the registry address in the target addressing instance can be directly determined as the target registry address.

[0116] S304. Send the target registration center address to the terminal device.

[0117] After receiving the target registry address, the microservices on the terminal device can call the corresponding microservices or functions based on the target registry address.

[0118] exist Figure 3 In the illustrated embodiment, a lookup request is received from a terminal device, the lookup request including a first service identifier of the target service; based on the first service identifier, a target lookup instance is determined from multiple lookup instances; based on the target lookup instance, a target registry address corresponding to the first service identifier is determined; and the target registry address is sent to the terminal device. This improves lookup efficiency.

[0119] exist Figure 3 Based on the illustrated embodiment, the following details how to determine the addressing instance.

[0120] Figure 4 This is a schematic flowchart illustrating the process of determining an addressing instance, as provided in an embodiment of this application. Please refer to... Figure 4 The method includes:

[0121] S401. Obtain addressing view data and addressing strategy.

[0122] Address view data can include multiple service identifiers, multiple tenants, multiple tenant deployment environments, and multiple registry addresses.

[0123] Addressing policies can be used to indicate the correspondence between services, tenants, and tenant deployment environments.

[0124] The tenant deployment environment can refer to a logical environment on the platform, specifically the specific environment information for service deployment.

[0125] S402. Based on the addressing view data and addressing strategy, determine multiple addressing instances.

[0126] In one possible implementation, for any addressing instance, it can be determined in the following way:

[0127] Select one of the multiple service identifiers as a candidate service identifier; determine the registry center address of the candidate service in the addressing view data based on the candidate service identifier and the addressing strategy; and store the candidate service identifier and the registry center address of the candidate service as an addressing instance.

[0128] In one possible implementation, the registry address of a candidate service can be determined from the addressing view data based on the candidate service identifier and addressing strategy, including:

[0129] Based on the candidate service identifier, determine the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs in the addressing view data; based on the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs, determine the registry center address of the candidate service in the addressing view data.

[0130] In one possible implementation, the addressing instance may include the candidate service identifier, the tenant to which the candidate service belongs, the tenant deployment environment to which the tenant belongs, and the registry address.

[0131] For example, after obtaining the addressing view data and addressing policy, the addressing policy corresponding to the service identifier can be found in the addressing policy based on the candidate service identifier. Then, the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs are determined according to the addressing policy. Then, the service identifier that is the same as the candidate service identifier, the tenant that is the same as the candidate service, and the tenant deployment environment that is the same as the tenant to which the tenant belongs are found in the addressing view data. At the same time, since the tenant and the tenant deployment environment are bound to the registry center in advance, after determining the tenant that is the same as the candidate service and the tenant deployment environment to which the tenant belongs, the registry center address of the candidate service can be determined according to the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs.

[0132] In one possible implementation, upon receiving updated addressing view data and addressing policy, multiple addressing instances can be updated based on the updated addressing view data and addressing policy to avoid inaccurate addressing caused by changes in service provider information transmission.

[0133] exist Figure 4 In the embodiment shown, multiple addressing instances can be pre-established using addressing view data and addressing strategies. In the subsequent actual addressing process, the registry center address of the target service can be quickly determined based on the first service identifier of the target service.

[0134] Based on any of the above embodiments, the addressing process of this application will be specifically described below in conjunction with the above modules.

[0135] 1. New platform modules: Added registration center and governance center components. The registration center component includes the registration center module, and the governance center component includes the governance center module.

[0136] The component information for each component includes the component's service domain name address, component type, and component name.

[0137] 2. The platform module adds multiple tenants and tenant deployment environments, and binds different registry center components and governance center components to different tenants and tenant deployment environments.

[0138] For example, if new registry components A and B, and governance components C and D are added, and there are tenant deployment environments 1 and 2 respectively, registry components A and governance components C can be bound to tenant deployment environment 1, and registry components B and governance components D can be bound to tenant deployment environment 2.

[0139] 3. Under the newly added tenant in the platform module, add multiple different service consumers and service providers under the service catalog function in the metadata module. Each service consumer or service provider includes information such as service identifier and service name.

[0140] 4. In the Addressing View module, publish the service provider's information to the Addressing View module and add new addressing view data: Select the tenant to be published, select the service to be published under the tenant, and then register the service to the corresponding tenant deployment environment to generate an addressing policy. Through the tenant and tenant deployment environment, the bound multi-registration center information can be found in the platform module, thus making the registration center transparent. This step publishes all information about the service provider globally.

[0141] 5. Mount the Java agent to start the service provider and service consumer. Through bytecode enhancement, after the service starts and Spring initialization is complete, add post-processing code to register the service provider and service consumer with different registry center components of different tenants. Simultaneously, the agent and governance center component maintain a long-lived connection using bidirectional streaming gRPC.

[0142] 6. When a service consumer subscribes to a service provider under the addressing view module, configure the global consumption service in the service consumer details of the metadata module, select the service that has already been published under the addressing view module, and then confirm.

[0143] 7. The metadata module distributes the service provider information required by the service consumer, such as service identifier, registry address, tenant, and environment information, to the governance center component of the tenant deployment environment where the service consumer is located.

[0144] 8. The governance center pushes information from service providers to service consumer agents via bidirectional streaming gRPC.

[0145] 9. After receiving information from the service provider, the service consumer agent assembles multiple hash sets and stores them in the data cache: the service identifier is stored as a key cache storage format, the service information is stored as a value cache storage format; the tenant + environment is stored as a key cache storage format, and the registry center address is stored as a value cache storage format, thus reducing memory usage and improving data retrieval efficiency.

[0146] 10. After the service consumer agent data is successfully cached, the service identifier hash value is used to obtain the tenant and the tenant deployment environment; the tenant and the tenant deployment environment are used to obtain the registration center address, and then the open API is encapsulated for pre-warming addressing. After successful addressing, a hash set is formed to store the addressing instance cache, and a timed addressing instance cache update task is started, thus completing the addressing pre-warming.

[0147] 11. When a service consumer initiates a request, the agent enhances the REST template or adds pre-code to a custom interface to intercept the service identifier or function identifier and directly retrieves the addressing instance from the addressing instance cache, thus completing the microservice multi-tenant addressing method.

[0148] 12. When a service provider needs to modify information such as the registry center, it can repeat the 4 steps to update the addressing view module. After the update, the data will still be synchronized according to steps 6, 7 and 8: Addressing View → Service Consumer Metadata → Governance Center → Agent Probe.

[0149] The platform layer first modularizes resources such as the registry center server cluster, and then binds these components with information such as tenants and their deployment environments. This allows different registry centers to be used in different tenant deployment environments. Simultaneously, the gateway is also registered to the corresponding tenant's Nacos registry center server cluster.

[0150] Establish an addressing view to connect business call relationships between different tenants and achieve cross-tenant addressing capabilities. Functionally, services can be developed to establish a mapping between service identifiers / function identifiers and tenants, and tenant deployment environments. After configuration, when a service consumer under any tenant uses the service identifier / function identifier for addressing, it will address the service instance (business instance or gateway instance) within the tenant and tenant deployment environment configured for this function. Furthermore, if the addressing strategy of a service is modified, all service consumers calling that service will automatically be aware of and update the policy.

[0151] At the same time, global consumption service identifiers / function identifiers can be configured in the service information section. Only service identifiers that are already open in the addressing view can be configured. Then, service information is obtained, the tenant and tenant deployment environment bound to the corresponding service are obtained through the addressing view, and information such as the registration center address is obtained through the tenant and tenant deployment environment. Then, the Java agent of the corresponding service is sent for pre-addressing, and then used for actual service addressing.

[0152] Service addressing leverages Java agent capabilities for bytecode enhancement and allows for custom addressing strategies. When addressing a service identifier or function identifier, global addressing information is obtained to perform addressing across different Nacos registry centers before sending a request.

[0153] The technical solution provided in this application has the following advantages:

[0154] 1. Multi-tenant service providers generate addressing policies based on service publication using the addressing view module, while multi-tenant service consumers subscribe to these policies to complete multi-tenant service addressing. Applications can easily perform cross-tenant addressing without needing to know anything about the service provider, avoiding the waste of resources such as DNS calls between multi-tenant services and the increased latency from multiple network hops.

[0155] 2. In a non-intrusive manner, it provides multi-registration center addressing and addressing preheating functions for applications developed based on mainstream microservice frameworks. Applications do not need to add code or dependencies, nor do they need to be recompiled and packaged, which greatly reduces the threshold for use and has a high degree of flexibility in terms of ease of use.

[0156] 3. Components such as the registry center are abstracted. By finding the bound registry center information through information such as tenants and tenant deployment environments, the registry center is made transparent, thereby improving visualization capabilities.

[0157] Figure 5 This is a schematic diagram of an addressing device provided in an embodiment of this application. Please refer to... Figure 5 The addressing device 10 includes a receiving module 11, a first determining module 12, a second determining module 13, and a transmitting module, wherein...

[0158] The receiving module 11 is used to receive an addressing request sent by the terminal device, wherein the addressing request includes a first service identifier of the target service;

[0159] The first determining module 12 is used to determine the target addressing instance among multiple addressing instances based on the first service identifier;

[0160] The second determining module 13 is used to determine the target registration center address corresponding to the first service identifier based on the target addressing instance;

[0161] The sending module 14 is used to send the target registration center address to the terminal device.

[0162] In one possible implementation, the first determining module 12 is specifically used for:

[0163] Determine the plurality of addressing instances, wherein any one of the plurality of addressing instances includes a service identifier and the registry center address corresponding to the service identifier;

[0164] The addressing instance whose service identifier is the same as the first service identifier among the plurality of addressing instances is determined as the target addressing instance.

[0165] In one possible implementation, the first determining module 12 is specifically used for:

[0166] Acquire addressing view data and addressing policy. The addressing view data includes multiple service identifiers, multiple tenants, multiple tenant deployment environments, and multiple registry center addresses. The addressing policy is used to indicate the correspondence between services, tenants, and tenant deployment environments.

[0167] The plurality of addressing instances are determined based on the addressing view data and the addressing strategy.

[0168] In one possible implementation, for any addressing instance, the first determining module 12 is specifically used for:

[0169] Choose one of the plurality of service identifiers as the candidate service identifier;

[0170] Based on the candidate service identifier and the addressing strategy, determine the registry center address of the candidate service in the addressing view data;

[0171] Store the candidate service identifier and the registration center address of the candidate service as the addressing instance.

[0172] In one possible implementation, the first determining module 12 is specifically used for:

[0173] Based on the candidate service identifier, determine the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs in the addressing view data;

[0174] Based on the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs, the registry address of the candidate service is determined in the addressing view data. The addressing instance also includes the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs.

[0175] In one possible implementation, the device 10 further includes an update module, which is used to:

[0176] Receive updated addressing view data and addressing strategy;

[0177] The multiple addressing instances are updated based on the updated addressing view data and addressing strategy.

[0178] The addressing device 10 provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.

[0179] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Please refer to... Figure 6 The electronic device 20 may include a transceiver 21, a memory 22, and a processor 23. The transceiver 21 may include a transmitter and / or a receiver. The transmitter may also be referred to as a transmitter, transmitter port, or transmitter interface, etc., and the receiver may also be referred to as a receiver, receiver port, or receiver interface, etc. Exemplarily, the transceiver 21, memory 22, and processor 23 are interconnected via a bus 24.

[0180] Memory 22 is used to store program instructions;

[0181] The processor 23 is used to execute the program instructions stored in the memory so that the electronic device 20 performs any of the addressing methods shown above.

[0182] The transceiver 21 is used to perform the transmission and reception functions of the electronic device 20.

[0183] Figure 6 The electronic device shown in the embodiments can execute the technical solutions shown in the above method embodiments. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0184] This application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement any of the above-mentioned addressing methods.

[0185] This application provides a computer program product, including a computer program that, when executed by a processor, can implement any of the above-described addressing methods.

[0186] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0187] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. An addressing method, characterized by, The method comprises the following steps: receiving an addressing request sent by a terminal device, the addressing request comprising a first service identifier of a target service; obtaining addressing view data and an addressing policy, the addressing view data comprising a plurality of service identifiers, a plurality of tenants, a plurality of tenant deployment environments and a plurality of registry center addresses, and the addressing policy being used to indicate a correspondence relationship between services, tenants and tenant deployment environments; wherein the tenants and the tenant deployment environments have a binding relationship with the registry center; selecting one of the plurality of service identifiers as a candidate service identifier; determining, according to the candidate service identifier, a corresponding addressing policy of the candidate service identifier in the addressing policy, and determining a tenant to which the candidate service belongs and a tenant deployment environment to which the tenant belongs according to the corresponding addressing policy; determining, in the addressing view data, a service identifier identical to the candidate service identifier, a tenant identical to the tenant to which the candidate service belongs, and a tenant deployment environment identical to the tenant deployment environment to which the tenant belongs; determining, according to the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs, a registry center address of the candidate service in the addressing view data; storing the candidate service identifier and the registry center address of the candidate service as an addressing instance to obtain a plurality of addressing instances, any one of the plurality of addressing instances comprising a service identifier and a corresponding registry center address of the service identifier; determining, as a target addressing instance, an addressing instance in the plurality of addressing instances whose service identifier is identical to the first service identifier, and determining a registry center address in the target addressing instance as a target registry center address of the target service; sending the target registry center address to the terminal device, the target registry center address being used by the terminal device to call a corresponding microservice or function.

2. The method of claim 1, wherein, The method further comprises: receiving updated addressing view data and an updated addressing policy; updating the plurality of addressing instances according to the updated addressing view data and the updated addressing policy.

3. An addressing device, characterized by The apparatus comprises a receiving module, a first determining module, a second determining module and a sending module, wherein: the receiving module is configured to receive an addressing request sent by a terminal device, the addressing request comprising a first service identifier of a target service; the first determining module is configured to obtain addressing view data and an addressing policy, the addressing view data comprising a plurality of service identifiers, a plurality of tenants, a plurality of tenant deployment environments and a plurality of registry center addresses, and the addressing policy being used to indicate a correspondence relationship between services, tenants and tenant deployment environments; wherein the tenants and the tenant deployment environments have a binding relationship with the registry center; one of the plurality of service identifiers is selected as a candidate service identifier; according to the candidate service identifier, a corresponding addressing policy of the candidate service identifier is determined in the addressing policy, and a tenant to which the candidate service belongs and a tenant deployment environment to which the tenant belongs are determined according to the corresponding addressing policy; in the addressing view data, a service identifier identical to the candidate service identifier, a tenant identical to the tenant to which the candidate service belongs, and a tenant deployment environment identical to the tenant deployment environment to which the tenant belongs are determined; according to the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs, a registry center address of the candidate service is determined in the addressing view data; the candidate service identifier and the registry center address of the candidate service are stored as an addressing instance to obtain a plurality of addressing instances, any one of the plurality of addressing instances comprising a service identifier and a corresponding registry center address of the service identifier; an addressing instance in the plurality of addressing instances whose service identifier is identical to the first service identifier is determined as a target addressing instance, and a registry center address in the target addressing instance is determined as a target registry center address of the target service; the target registry center address is sent to the terminal device, the target registry center address being used by the terminal device to call a corresponding microservice or function. determining, in the addressing view data, a service identity same as the candidate service identity, a tenant same as a tenant to which the candidate service belongs, and a tenant deployment environment same as a tenant deployment environment to which the tenant belongs; determining, in the addressing view data, a registration center address of the candidate service according to the tenant to which the candidate service belongs and the tenant deployment environment to which the tenant belongs; storing the candidate service identity and the registration center address of the candidate service as an addressing instance to obtain a plurality of addressing instances, any one of the plurality of addressing instances comprising a service identity and a registration center address corresponding to the service identity; and determining, as the target addressing instance, an addressing instance of the plurality of addressing instances in which the service identity is same as the first service identity; the second determining module is configured to determine the registration center address in the target addressing instance as a target registration center address of the target service; the sending module is configured to send the target registration center address to the terminal device, the target registration center address being used by the terminal device to call a corresponding micro service or function.

4. An electronic device, comprising: comprising a processor and a memory; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, so that the processor executes the addressing method according to any one of claims 1-2.

5. A computer readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, when the computer execution instructions are executed by the processor, the computer execution instructions are used to implement the addressing method according to any one of claims 1-2.

6. A computer program product, characterised in that, comprising a computer program, when the computer program is executed by the processor, the computer program can implement the addressing method according to any one of claims 1-2.

Citation Information

Patent Citations

  • Uniform resource locator addressing method and device and network system

    CN110505318A