A method, system, device and medium for coexistence of multiple versions of microservice architecture

By adding version information attributes and load balancing mechanisms to the registration center, the problem of multi-version coexistence in the microservice architecture is solved, efficient service matching and invocation is achieved, the process is simplified, and high availability and load balancing are ensured.

CN117389606BActive Publication Date: 2024-09-17SHENZHEN YLINK COMPUTING SYST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311298386.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-08
Publication Date
2024-09-17
Estimated Expiration
2043-10-08

AI Technical Summary

Technical Problem

In a microservice architecture, existing technologies are difficult to effectively implement multi-version coexistence, resulting in complex and inefficient service calls, especially without adding additional equipment.

Method used

By adding service metadata attributes in the registration center to represent the version information of the Provider and Consumer, the Consumer sends a service discovery request to the registration center to obtain instance information, and filters out qualified Providers through load balancing and custom tagsFilter to achieve specified version of the call.

Benefits of technology

It realizes the coexistence of multiple versions of the microservice architecture without adding additional equipment, simplifies the service invocation process, ensures high availability and load balancing, and improves the accuracy and efficiency of service matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117389606B
    Figure CN117389606B
Patent Text Reader

Abstract

The present invention relates to the field of communication technology, and specifically to a method, system, device and medium for coexistence of multiple versions of a microservice architecture, which dynamically obtains information such as client version from a configuration center, registers information such as server version with a registration center, sends a service discovery request to the registration center to obtain information such as server instance version, performs load balancing and information filtering to select specific services, and achieves the purpose of calling a specified version. The method can realize the sharing of common resources by services of different versions, supports application scenarios such as blue-green release, gray release, A / B testing, and does not require the addition of additional equipment. The method can be deployed in a registration center equipped in all microservice devices to realize the coexistence of multiple versions of a microservice architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technologies, and in particular to a method, system, device and medium for coexistence of multiple versions of a microservice architecture. Background Art

[0002] Microservice Architecture is a software development model that decomposes a complex application into multiple independent, reusable, scalable, and deployable services. Each service is responsible for a specific function or business area, and services communicate and collaborate through network protocols.

[0003] The main advantages of microservice architecture include distributed storage, high availability, scalability, intelligent operation and maintenance, etc., which can make up for the shortcomings of traditional SOA (service-oriented architecture). In the microservice architecture, the system is divided into multiple microservices, which are independently deployed in a loosely coupled manner, and each microservice only needs to complete its own tasks with high quality.

[0004] In the existing microservices multi-version coexistence technology, the mainstream solution is to parse the service request, obtain the microservice information contained in the service request and the dependency relationship of each microservice to generate corresponding routing information to implement the microservice call and version selection, and then connect to the external microservice and exchange data. External microservices usually require service routing combined with API gateways to achieve, but the present invention does not need to add additional equipment, and can achieve multi-version coexistence of microservice architecture by deploying this method in the registration center equipped in all microservice devices.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention. Summary of the invention

[0006] In order to solve the technical problem that some services can be shared when multiple versions coexist in a microservice architecture, the purpose of the present invention is to provide a method, system, device and medium for the coexistence of multiple versions of a microservice architecture, by sending a service discovery request to a registration center to obtain instance information, performing load balancing and information filtering to select specific services, and achieving the purpose of calling a specified version.

[0007] To achieve the above object, the present invention adopts the following technical solutions:

[0008] According to one aspect of the present invention, a method for coexistence of multiple versions of a microservice architecture is provided, comprising the following steps:

[0009] Add new attributes in the service metadata to indicate the version information of the Provider and Consumer;

[0010] The Consumer sends a service discovery request to the registry, and the registry returns the instance information of the Provider;

[0011] Load balancing between multiple Provider instances;

[0012] tagsFilter filters the version information by the attribute to obtain the Provider that meets the conditions;

[0013] The Consumer transmits the instruction to the qualified Provider via a network protocol.

[0014] Optionally, the attribute includes but is not limited to tags.asProvider and tags.asConsumer, and the value of the attribute is a string.

[0015] Optionally, the instance information of the Provider includes but is not limited to an address and related metadata.

[0016] Optionally, the specific method of the load balancing is: determine whether tags.asConsumer is empty; if so, do not enter the tagsFilter; otherwise, enter the tagsFilter.

[0017] Optionally, the filtering method is: when generating a callable Provider list in the tagsFilter process, a tagsFilter is customized, and tags.asProvider is matched according to the tags.asConsumer property set by the current Consumer, to filter out the version information that does not match.

[0018] Optionally, the specific strategies of the load balancing include but are not limited to polling, random, minimum connection, area weighting, and Hash consistency.

[0019] Optionally, the instructions include but are not limited to establishing a connection and serializing parameters.

[0020] According to one aspect of the present invention, a system for coexistence of multiple versions of a microservice architecture is provided, comprising the following modules:

[0021] Service metadata module, used to describe and define the attributes, characteristics and additional information of services;

[0022] The registration center module is used to receive and return requests and obtain data;

[0023] The configuration center module is used to configure specific version information for each service;

[0024] The load balancing module is used to help Consumers balance load among multiple Provider instances and select available Provider instances based on policies;

[0025] The request transmission module is used to transmit the request to the Provider.

[0026] According to one aspect of the present invention, there is provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for coexistence of multiple versions of the microservice architecture is implemented.

[0027] According to one aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for coexistence of multiple versions of the microservice architecture is implemented.

[0028] It can be seen from the above technical solution that compared with the prior art, the present invention has at least the following advantages and positive effects:

[0029] 1. No additional equipment is needed. The coexistence of multiple versions of the microservice architecture can be achieved by deploying this method in the registration center equipped in all microservice devices.

[0030] 2. Through the configuration center and registration center, dynamic discovery and load balancing of services are realized, which ensures high availability and load balancing of services and simplifies the service calling process.

[0031] 3. Provide a method, system, device and medium for coexistence of multiple versions of a microservice architecture. Consumers can directly obtain instance information of providers that meet version requirements in each microservice through the registration center;

[0032] 4. Through custom tagsFilter, service matching is achieved efficiently and accurately. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0034] Figure 1 This is a flow chart of a method for coexistence of multiple versions of a microservice architecture provided by an embodiment of the present invention;

[0035] Figure 2It is a flow chart of a system in a service discovery phase to which an embodiment of the present invention can be applied, provided by an embodiment of the present invention;

[0036] Figure 3 This is a flow chart of a load balancing stage in which tagsFilter of an embodiment of the present invention can be applied, provided by an embodiment of the present invention;

[0037] Figure 4 It is a system module diagram of a microservice architecture with multiple versions coexisting, provided by an embodiment of the present invention, to which an embodiment of the present invention can be applied;

[0038] Figure 5 It is a relationship diagram of service calls in a specific application scenario provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below in conjunction with the drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Example implementations will now be described more fully with reference to the drawings. However, the example implementations can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these implementations are provided so that the present invention will be more comprehensive and complete, and the concepts of the example implementations will be fully conveyed to those skilled in the art.

[0040] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solution of the present invention can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.

[0041] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0042] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0044] Example 1

[0045] Figure 1 A method for coexistence of multiple versions of a microservice architecture to which an embodiment of the present invention can be applied is shown, and the method includes the following steps:

[0046] In the microservice architecture, service metadata is a collection of attributes, features, and additional information that describe and define a service. In the microservice architecture, service metadata provides more information and descriptions about services, enabling services to be discovered, dynamically configured, and used. In one embodiment of the present invention, the tags.asProvider and tags.asConsumer attributes are added to the service metadata to indicate the version information of the Provider and Consumer.

[0047] It should be noted that the newly added attributes include but are not limited to tags.asProvider and tags.asConsumer, and the values ​​of the attributes are strings;

[0048] For example, when adding the tags.asProvider attribute and using version 1.2 as a provider, the value of the newly added attribute is V1.2, and the newly added attribute is "tags.asProvider=V1.2"; if this provider also supports version 1.3, V1.3 is added, and the service attribute is "tags.asProvider=V1.2,V1.3". Multiple versions are separated by commas, and the service tags.asProvider can support multiple versions.

[0049] Added the tags.asConsumer attribute. When acting as a Consumer, the version number used is 1.2, so the value of the newly added attribute is V1.2, and the newly added attribute is "tags.asConsumer = V1.2".

[0050] Therefore, each service can be matched and called according to its own version information and the version information of other services.

[0051] Furthermore, the Consumer sends a service discovery request to the registration center, and the registration center returns the instance information of the Provider, where the instance information of the Provider includes but is not limited to the address and related metadata.

[0052] In the microservice architecture, the Consumer first needs to obtain the instance information of the Provider through the service registration center (such as Eureka, Consul, Nacos, etc.). The Consumer can send a service discovery request to the registration center and obtain the address and related metadata of the Provider according to the service name or other specific identifiers. The embodiment of the present invention uses the configuration center to synchronize the version routing information to the local memory of the service at the same time when it changes, avoiding the overhead and delay of using an API gateway or other middleware to obtain and transmit routing information.

[0053] For example, the configuration center can configure specific version information "tags.asProvider = V1.1" as the service Provider version and "tags.asConsumer = V1.1" as the service Consumer version for each specific service; when the service sends a service discovery request to the registration center as a Consumer, the registration center returns the Provider instance information containing the tags.asProvider attribute to the Consumer.

[0054] Furthermore, load balancing is performed between multiple Provider instances. If a Provider has multiple instances, the Consumer needs to select an instance to initiate a call.

[0055] The load balancer can help Consumer balance the load among multiple Provider instances and select an available Provider instance according to a certain strategy.

[0056] For example, common load balancing algorithms include polling, random, least connection, area weighted, Hash consistency, etc. In this embodiment, the use of which load balancer and load balancing algorithm does not affect the technical effect of this embodiment.

[0057] Specifically, determine whether tags.asConsumer is empty; if so, do not enter tagsFilter; otherwise enter tagsFilter; when the callable Provider list is generated during the tagsFilter process, customize a tagsFilter, match tags.asProvider according to the tags.asConsumer property set by the current Consumer, filter out the version information that does not match, and get the Provider that meets the conditions.

[0058] For example, when a Consumer sets tags.asConsumer = V1.2, it will go through a series of filters in the load balancing process. When the callable Provider list is generated in the Filter process, a tagsFilter is customized to match the tags.asProvider attribute according to the tags.asConsumer attribute set by the current Consumer, and filter out the Provider instances that do not meet the conditions. Specifically, determine whether tags.asConsumer is empty; if so, do not enter tagsFilter; otherwise enter tagsFilter; in the tagsFilter process, loop the Provider instance list to determine whether all characters of tags.asConsumer can be matched from left to right in tags.asProvider; if matched, retain the Provider instance; if not matched, remove this Provider instance. In this way, the Consumer can match and call according to its own version information and the version information of other services, ensuring that the Consumer can call the Provider service that best suits its needs and compatibility.

[0059] Furthermore, the Consumer transmits the instruction to the qualified Provider via a network protocol.

[0060] Specifically, after the Consumer passes through the load balancing link and selects a specific Provider, it transmits instructions to the Provider through network protocols (such as HTTP, gRPC, etc.). This includes steps such as establishing a connection, serializing parameters, and sending requests. In this way, the Consumer can call the specified version of the Provider and complete the service interaction.

[0061] The embodiment of the present invention achieves the purpose of coexistence and calling of services of different versions in a microservice distributed architecture by adding a version information attribute to the service metadata and adding a version filter in the load balancing link. Compared with the existing technical solutions, the embodiment of the present invention has the following advantages: the embodiment of the present invention synchronizes routing information to the local memory of the service through the configuration center, avoiding the overhead and delay of using API gateways or other middleware to obtain and transmit routing information; the embodiment of the present invention filters out Provider services that do not meet the conditions through left matching, ensuring that Consumers can call the Provider service that best suits their needs and compatibility.

[0062] Example 2

[0063] Figure 2A flow chart of a system in a service discovery phase to which an embodiment of the present invention can be applied is shown, and the flow specifically includes:

[0064] In a microservices architecture, service metadata is a collection of attributes, characteristics, and additional information that describes and defines a service. In a microservices architecture, service metadata provides more understanding and description of services, enabling services to be discovered, dynamically configured, and used.

[0065] An embodiment of the present invention uses a registration / configuration center to synchronize version routing information to the local memory of the service when it changes, thereby avoiding the overhead and delay of using an API gateway or other middleware to obtain and transmit routing information.

[0066] Furthermore, in the microservice architecture, during the service discovery phase, the Consumer sends a service discovery request to the registration center through the configuration center, and obtains the address and related metadata based on the service name or other specific identifiers.

[0067] For example, in Figure 2 In the flowchart shown, there are two Consumer services A of versions V1.2 and V1.3, which respectively add two properties, tags.asConsumer=V1.2 and tags.asConsumer=V1.3. There are two Provider services B of versions V1.2 and V1.3, which respectively add two properties, tags.asProvider=V1.2 and tags.asProvider=V1.3. The two Consumer services A obtain the registration information of the two Provider services B from the registration / configuration center.

[0068] Example 3

[0069] Figure 3 A flow chart of a tagsFilter in a load balancing stage to which an embodiment of the present invention can be applied is shown, and the flow specifically includes:

[0070] If the Provider has multiple instances, the Consumer needs to select an instance to initiate a call. The load balancer can help the Consumer balance the load between multiple Provider instances and select an available Provider instance based on a certain strategy.

[0071] The embodiment of the present invention adds a version filter (tagsFilter) in the load balancing link, matches the tags.asProvider attribute according to the tags.asConsumer attribute set by the current Consumer, filters out the Provider instances that do not meet the conditions, and obtains a list of Provider instances that meet the conditions.

[0072] Specifically, determine whether tags.asConsumer is empty; if so, do not enter tagsFilter; otherwise enter tagsFilter; in the tagsFilter process, loop the Provider instance list to determine whether all characters in tags.asConsumer can be matched from left to right in tags.asProvider; if matched, retain the Provider instance; if not matched, remove this Provider instance. Consumer can match and call according to its own version information and the version information of other services, ensuring that Consumer can call the Provider service that best suits its needs and compatibility.

[0073] exist Figure 3 The flowchart shown describes the registration information of two Provider services B obtained by a V1.2 version of Consumer service A from the registration / configuration center, which are the two attributes tags.asProvider=V1.2 and tags.asProvider=V1.3. In the load balancing link, a series of filters will be passed. When the callable Provider list is generated during the Filter process, a tagsFilter is customized to match the tags.asProvider attribute according to the tags.asConsumer attribute set by the current Consumer, and filter out Provider instances that do not meet the conditions. Therefore, the attribute of service A with tags.asConsumer=V1.2 version is not empty and needs to be filtered by tagsFilter. The condition of tagsFilter is defined as tags.asProvider=V1.2. Therefore, the Provider instance retained after filtering is service B with tags.asProvider=V1.2.

[0074] After the Consumer passes the load balancing link and selects a specific Provider, it transmits the instruction to the Provider through the network protocol (such as HTTP, gRPC, etc.). This includes steps such as establishing a connection, serializing parameters, and sending requests. In this way, the Consumer can call the specified version of the Provider and complete the service interaction. In this embodiment, the V1.2 version of the Consumer service A finally calls the V1.2 version of the Provider service B.

[0075] The embodiment of the present invention achieves the purpose of coexistence and calling of services of different versions in a microservice distributed architecture by adding a version filter in the load balancing link.

[0076] Example 4

[0077] Figure 4 A system for coexistence of multiple versions of a microservice architecture to which an embodiment of the present invention can be applied is shown. The system includes a service metadata module 401, a registration center module 402, a configuration center module 403, a load balancing module 404, and a request transmission module 405. The specific functions of each module are as follows:

[0078] The service metadata module 401 is used to describe and define the properties, characteristics and additional information of the service, including the newly added tags.asProvider and tags.asConsumer properties, which are used to indicate the version information of the Provider and Consumer;

[0079] The registration center module 402 is used to receive and return requests and obtain data, including configuring specific version information for each service, such as tags.asProvider=V1.1 and tags.asConsumer=V1.1, and returning this information to the Consumer service;

[0080] Configuration center module 403, used to configure specific version information for each service, such as tags.asProvider = V1.1 and tags.asConsumer = V1.1, and synchronize this information to the local memory of the service;

[0081] The load balancing module 404 is used to help the Consumer perform load balancing among multiple Provider instances, select an available Provider instance according to the policy, and cut in front of the load balancer through a custom tagsFilter, and filter out Provider services that do not meet the conditions by using a left match method according to the tags.asConsumer version information set by the Consumer service;

[0082] The request transmission module 405 is used to transmit the request to the Provider, including steps such as establishing a connection, serializing parameters, and sending a request.

[0083] Specifically, the workflow between modules is as follows:

[0084] When Consumer service A calls Provider service B as a Consumer, it first adds the tags.asConsumer attribute to the service metadata module 401, and then sends a service discovery request to the registration center module 402 to obtain the address and related metadata of Provider service B according to the service name or other specific identifiers.

[0085] The registration center module 402 returns the instance information of the Provider service B including the tags.asProvider and tags.asConsumer properties to the Consumer service A according to the configuration information of the configuration center module 403 .

[0086] Before calling a specific Provider service B, Consumer service A performs load balancing among multiple Provider service B instances through load balancing module 404, and uses tagsFilter to filter out Provider service B instances that do not meet the conditions by using a left matching method according to the tags.asConsumer version information set by itself, and obtains a list of Provider service B instances that meet the conditions.

[0087] Consumer service A transmits the request to the selected Provider service B instance through the request transmission module 405 via a network protocol (such as HTTP, gRPC, etc.) and receives the return result.

[0088] Example 5

[0089] Figure 5 A relationship diagram of service calls in a specific application scenario is shown, and the scenario specifically includes:

[0090] In one embodiment, a specific application scenario is provided: suppose there is an online education platform that provides a variety of courses and services, such as video courses, live courses, homework grading, and test grading. The platform adopts a microservice distributed architecture, splitting different functional modules into multiple microservices, such as video services, live services, homework services, and test services. Each microservice has its own development team and release cycle, and can be deployed and updated independently. In order to ensure the stability of the platform and user experience, the platform needs to support the coexistence of multiple versions of microservices in the same environment, and use different versions according to different businesses or user groups.

[0091] In order to achieve this requirement, the platform applies a method, system device and medium for coexistence of multiple versions of a microservice architecture proposed by the present invention. The specific steps are as follows:

[0092] S1: Service metadata stage: The platform adds tags.asProvider and tags.asConsumer properties to each microservice to describe and define the version information of the service.

[0093] For example, the video service has two versions: V1.0 and V2.0. V1.0 is the old version that only supports ordinary video playback; V2.0 is the new version that supports intelligent video playback and can recommend suitable video content based on the user's learning progress and preferences. When the video service registers with the registration center, it will set its tags.asProvider property to V1.0 or V2.0, indicating which version of the Provider it is and which versions of the Consumer it can call; at the same time, it will set its tags.asConsumer property to V1.0 or V2.0 or empty, indicating which version of the Consumer it is and which versions of the Provider it can call.

[0094] For example, the tags.asProvider property of the video service V1.0 is V1.0, and the tags.asConsumer property is empty, which means that it can call other microservices of any version; the tags.asProvider property of the video service V2.0 is V2.0, and the tags.asConsumer property is V2.1, which means that it can only call other microservices of version V2.1.

[0095] S2: Service discovery phase: When a microservice calls another microservice as a Consumer, it obtains the instance information of the target microservice through the configuration center during the service discovery phase. The configuration center returns the instance information of the target microservice that meets the conditions based on the tags.asConsumer version information set by the Consumer microservice, and includes its tags.asProvider and tags.asConsumer properties.

[0096] For example, Figure 5 The service call relationship of the application scenario described in this embodiment is shown. When the video service V2.0 calls the job service, there are two job service instances in the configuration center: job service V1.1 and job service V2.1. The tags.asProvider attribute of job service V1.1 is V1.1, and the tags.asConsumer attribute is empty; the tags.asProvider attribute of job service V2.1 is V2.1, and the tags.asConsumer attribute is V2.1. The configuration center will return the instance information of job service V2.1 based on the tags.asConsumer attribute of video service V2.0 being V2.1 and V2.2, but will not return the instance information of job service V1.1 because it does not meet the version requirements.

[0097] S3: Load balancing stage: When the video service V2.0 calls the job service, there are two job service instances in the load balancer: job service V2.1 and job service V2.2. The tags.asProvider property of job service V2.1 is V2.1, and the tags.asConsumer property is V2.1; the tags.asProvider property of job service V2.2 is V2.2, and the tags.asConsumer property is V2.2. The tags.asConsumer property of video service V2.0 is V2.1 and V2.2. The instance information of job service V2.1 and job service V2.2 is retained in tagsFilter because they both meet the version requirements.

[0098] S4: Request transmission stage: After the Consumer microservice goes through the load balancing stage, it selects a specific target microservice instance and transmits the request to the target microservice through the network protocol, ultimately achieving the purpose of calling the specified version.

[0099] For example, when the video service V2.0 calls the job service, the instance of the job service V2.1 is selected in the load balancer, the request is transmitted to the job service V2.1 through the HTTP protocol, and a response result is obtained. In this way, the video service V2.0 calls the job service V2.x version.

[0100] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, a method for coexistence of multiple versions of a microservice architecture provided by the present invention is implemented.

[0101] In one embodiment, a computer-readable storage medium is also provided, such as a memory including instructions, and the instructions can be executed by a processor to complete a method for coexistence of multiple versions of a microservice architecture in the above embodiment.

[0102] For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0103] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present invention, which follows the general principles of the present invention and includes common knowledge or customary techniques in the art that are not disclosed by the present invention. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present invention are indicated by the claims. It should be understood that the present invention 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 the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A method for coexistence of multiple versions of a microservice architecture. Features: Add new attributes to the service metadata to indicate the version information of the Provider and Consumer; the service metadata is a collection of attributes, features, and additional information that describe and define the service; in a microservices architecture, service metadata provides an understanding and description of the service so that the service can be discovered, dynamically configured, and used; The Consumer sends a service discovery request to the registration center, and the registration center returns the Provider instance information; wherein the Provider instance information includes an address and related metadata; the Provider instance information returned by the registration center specifically includes: The Consumer sends a service discovery request to the registration center, obtains the address and related metadata of the Provider according to the service name or identifier, and synchronizes it to the local memory of the service through the configuration center when the version routing information changes; Perform load balancing among multiple Provider instances; tagsFilter filters the version information through the attribute to obtain qualified Providers; wherein the specific strategies of the load balancing include polling, random, minimum connection, regional weighting, and Hash consistency; the specific method of the load balancing is: determine whether tags.asConsumer is empty; if so, do not enter the tagsFilter; otherwise enter the tagsFilter; the filtering of the version information specifically includes: when the callable Provider list is generated in the tagsFilter process, customize a tagsFilter, match tags.asProvider according to the tags.asConsumer attribute set by the current Consumer, and filter out the unmatched version information; The Consumer transmits the instruction to the qualified Provider via a network protocol.

2. The method for coexistence of multiple versions of microservice architecture according to claim 1, It is characterized in that The attributes include tags.asProvider and tags.asConsumer, and the value of the attribute is a string.

3. The method for coexistence of multiple versions of microservice architecture according to claim 1, It is characterized in that The instructions include establishing a connection and serializing parameters.

4. A system for the method for coexistence of multiple versions of a microservice architecture as described in any one of claims 1 to 3, It is characterized in that Includes the following modules: Service metadata module, used to describe and define the attributes, characteristics and additional information of services; The registration center module is used to receive and return requests and obtain data; The configuration center module is used to configure specific version information for each service; The load balancing module is used to help Consumers balance load among multiple Provider instances and select available Provider instances based on policies; The request transmission module is used to transmit the request to the Provider.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method for coexistence of multiple versions of a microservice architecture as described in any one of claims 1 to 3 is implemented.

6. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method for coexistence of multiple versions of a microservice architecture as described in any one of claims 1 to 3 is implemented.