[go: up one dir, main page]

CN113536159B - A service registration method and an Apache Dubbo system - Google Patents

A service registration method and an Apache Dubbo system

Info

Publication number
CN113536159B
CN113536159B CN202010291514.2A CN202010291514A CN113536159B CN 113536159 B CN113536159 B CN 113536159B CN 202010291514 A CN202010291514 A CN 202010291514A CN 113536159 B CN113536159 B CN 113536159B
Authority
CN
China
Prior art keywords
url
service registration
discovery module
service
attribute
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010291514.2A
Other languages
Chinese (zh)
Other versions
CN113536159A (en
Inventor
贺雪梅
姜宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Huawei Cloud Computing Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd, Huawei Cloud Computing Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010291514.2A priority Critical patent/CN113536159B/en
Publication of CN113536159A publication Critical patent/CN113536159A/en
Application granted granted Critical
Publication of CN113536159B publication Critical patent/CN113536159B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种服务注册方法及一种Apache Dubbo系统,该方法包括:服务注册发现模块获得第一URL,并解析第一URL,确定第一URL为第一类型的URL以及第一URL的第一属性参数的属性值;在第一URL的第一属性参数的属性值指示服务注册发现模块缓存第一URL时,服务注册发现模块缓存第一URL;在第一URL的第一属性参数的属性值指示服务注册发现模块将第一URL与在第一URL到达服务注册发现模块之前缓存的第一类型的URL生成元数据时,服务注册发现模块生成元数据,并向服务注册中心发送元数据。采用上述方法,通过将多个相同类型的URL生成元数据发送至服务注册中心,可以提高服务注册和发现效率。

A service registration method and an Apache Dubbo system are disclosed. The method includes: a service registration and discovery module obtaining a first URL, parsing the first URL, determining that the first URL is a URL of a first type, and the attribute value of a first attribute parameter of the first URL; when the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to cache the first URL, the service registration and discovery module caches the first URL; when the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to generate metadata using the first URL and the first-type URL cached before the first URL reaches the service registration and discovery module, the service registration and discovery module generates metadata and sends the metadata to a service registry. By using the above method, service registration and discovery efficiency can be improved by generating metadata from multiple URLs of the same type and sending it to the service registry.

Description

Service registration method and Apache Dubbo system
Technical Field
The present application relates to the field of computer technologies, and in particular, to a service registration method and a Apache Dubbo system.
Background
With the development of the internet, the scale of the system is continuously expanding, and a distributed service architecture becomes the first choice for constructing large-scale application. Apache Dubbo is an open source Java RPC framework that provides service auto-registration and discovery functionality that can help users quickly build distributed service discovery and service remote invocation systems.
Currently Apache Dubbo supports only piece-by-piece registration and discovery, as shown in fig. 1, URLs of N1 service provider types are registered with a service registry one by one, and URLs of N2 service consumer types are registered with the service registry one by one. Because the communication with the service registration center is rapidly increased in a short time, the service queues which need to be registered and found are too long, network congestion is easy to occur, the service registration and finding efficiency is lower, meanwhile, the network pressure of the service registration center is too high, even a single service registration center is possibly down, further load migration is caused, and larger network congestion is caused, so that the whole service registration center is extremely easy to be unavailable in a chain reaction, and the usability of the system is seriously affected.
Disclosure of Invention
The embodiment of the application provides a service registration method and a Apache Dubbo system, which are used for solving the problem of lower service registration and discovery efficiency caused by rapid increase of communication with a service registration center in a short time.
In a first aspect, an embodiment of the present application provides a service registration method, where the method is applied to a Apache Dubbo system, and the method includes that a service registration discovery module obtains a first URL, parses the first URL, determines that the first URL is a first type URL and an attribute value of a first attribute parameter of the first URL, when the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module caches the first URL, and when the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module generates metadata between the first URL and the first type URL cached before the first URL reaches the service registration discovery module, and sends the metadata to a service registration center.
Therefore, by adopting the method, the waiting time of the service queue can be reduced, the service registration and discovery efficiency can be improved, the network congestion condition can be relieved, and the problem that the service registration and discovery efficiency is lower due to rapid increase of communication with the service registration center in a short time can be solved by sending a plurality of URL generation metadata of the same type to the service registration center.
In one possible design, the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module caches the first URL when the first URL is not the last URL of the first type registered with the service registration center, and indicates that the service registration discovery module generates metadata with the first type of URL cached before the first URL reaches the service registration discovery module when the first URL is the last URL of the first type registered with the service registration center.
By adopting the design, by analyzing the parameter value of the first attribute parameter of the first URL, whether the first URL is the last URL of the first type registered in the service registration center can be judged, so that the service discovery end can determine the URLs of the same type, and metadata can be generated by all the URLs of the same type.
In one possible design, the attribute values of the first attribute parameters corresponding to the M-1 URLs of the first type respectively buffered before the first URL arrives at the service registration discovery module indicate that the service registration discovery module buffers the corresponding URL, the first URL is the mth URL of the first type arriving at the service registration discovery module, the attribute values of the first attribute parameters of the first URL indicate that the service registration discovery module generates metadata between the first URL and the first URL of the first type buffered before the first URL arrives at the service registration discovery module, M is a positive integer greater than or equal to 2, or the first URL is the nth URL of the first type arriving at the service registration discovery module, N < M, N is a positive integer, and the attribute values of the first attribute parameters of the first URL indicate that the service registration discovery module buffers the first URL.
By adopting the design, by analyzing the parameter value of the first attribute parameter of the first URL, whether the first URL is the last URL in M URLs of the first type can be judged, and further metadata can be generated by the service discovery terminal through a plurality of URLs of the same type.
In one possible design, when the attribute value of the first attribute parameter of the first URL is a first preset value, the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module caches the first URL, and when the attribute value of the first attribute parameter of the first URL is a second preset value, the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module generates metadata between the first URL and a first type of URL cached before the first URL reaches the service registration discovery module, wherein the first preset value is different from the second preset value.
In one possible design, the first attribute parameter is an attribute parameter of a new string type in a service profile of the system.
In one possible design, the first type is a service provider or a service consumer.
In one possible design, the first URL is obtained by parsing a first object, where the first object is at least one of an XML document, an interface definition profile, an API, and an annotation.
In a second aspect, an embodiment of the present application provides a Apache Dubbo system, where the system includes a client and a service registry, where the client includes a service configuration module and a service registry discovery module, where the service configuration module is configured to parse a first object to generate a plurality of URLs, configure an attribute value of a first attribute parameter for each URL in the plurality of URLs, and sequentially input the configured plurality of URLs to the service registry discovery module; the service discovery module is used for analyzing a first URL, determining that the first URL is a first type URL and an attribute value of a first attribute parameter of the first URL, wherein the first URL is any one URL among the configured plurality of URLs, caching the first URL when the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module caches the first URL, generating metadata by the service registration discovery module when the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module generates the metadata by the first URL and the first type URL cached before the first URL reaches the service registration discovery module, generating the metadata by the first URL and the first type URL cached before the first URL reaches the service registration discovery module, and sending the metadata to a service registration center, wherein the service registration center is used for obtaining the metadata by the service registration center and the first type URL cached before the first URL reaches the service registration discovery module.
In one possible design, the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module caches the first URL when the first URL is not the last URL of the first type registered with the service registration center, and indicates that the service registration discovery module generates metadata with the first type of URL cached before the first URL reaches the service registration discovery module when the first URL is the last URL of the first type registered with the service registration center.
In one possible design, the attribute values of the first attribute parameters corresponding to the M-1 URLs of the first type respectively buffered before the first URL arrives at the service registration discovery module indicate that the service registration discovery module buffers the corresponding URL, the first URL is the mth URL of the first type arriving at the service registration discovery module, the attribute values of the first attribute parameters of the first URL indicate that the service registration discovery module generates metadata between the first URL and the first URL of the first type buffered before the first URL arrives at the service registration discovery module, M is a positive integer greater than or equal to 2, or the first URL is the nth URL of the first type arriving at the service registration discovery module, the attribute values of the first attribute parameters of the first URL indicate that the service registration discovery module buffers the first URL, and N < M, N is a positive integer.
In one possible design, when the attribute value of the first attribute parameter of the first URL is a first preset value, the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module caches the first URL, and when the attribute value of the first attribute parameter of the first URL is a second preset value, the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module generates metadata between the first URL and a first type of URL cached before the first URL reaches the service registration discovery module, wherein the first preset value is different from the second preset value.
In one possible design, the first attribute parameter is an attribute parameter of a character string type newly added in a service configuration file of the system, and the service configuration module is used for configuring an attribute value of the first attribute parameter for each URL in the plurality of URLs based on the service configuration file.
In one possible design, the first type is a service provider or a service consumer.
In one possible design, the first object is at least one of an XML document, an interface definition profile, an API, an annotation.
It should be understood that the technical effects of the second aspect and the respective designs in the second aspect may refer to the technical effects of the first method and the respective designs in the first aspect, and the repetition is omitted.
In a third aspect, the present application also provides an apparatus, including a processor and a memory, where the memory is configured to store computer-executable instructions, and where the processor is configured to execute the computer-executable instructions stored in the memory, to cause the communications apparatus to perform the method of the first aspect.
In a fourth aspect, the present application also provides an apparatus comprising a processor and interface circuitry for receiving code instructions and transmitting to the processor, the processor executing the code instructions to perform the method of the first aspect described above.
In a fifth aspect, the present application provides a chip coupled to a memory in an electronic device such that the chip, when run, invokes program instructions stored in the memory to perform the method of the first aspect.
In a sixth aspect, the present application also provides a readable storage medium storing instructions that, when executed, cause the method of the first aspect described above to be carried out.
In a seventh aspect, the application also provides a computer program product comprising a program which, when run on a computer, causes the computer to perform the method of the first aspect described above.
Drawings
FIG. 1 is a schematic diagram of service registration in the background of the application;
FIG. 2 is a schematic diagram of a Apache Dubbo system according to an embodiment of the present application;
FIG. 3 is a flowchart outlining a service registration method according to an embodiment of the present application;
FIG. 4 is a flowchart of service registration according to an embodiment of the present application;
Fig. 5 is a schematic diagram of service registration corresponding to fig. 4 in an embodiment of the present application.
Detailed Description
Embodiments of the present application are described below with reference to the accompanying drawings.
Apache Dubbo is a high performance open source Java RPC distributed service framework. The core functions of Apache Dubbo include interface-oriented remote procedure calls, cluster fault tolerance and load balancing, and service automatic registration and discovery. Apache Dubbo use a hierarchical architecture model to enable maximum decoupling between the various layers, abstracting the service into two roles, service provider (service) and service consumer (reference). Wherein the service provider registers its own service with the service registry. The service consumer subscribes to the service from the service registry, which returns an address list of the service provider to the service consumer. The service consumer selects one service provider from the returned address list to call, and if the call fails, selects another service provider to call.
To solve the problem of low service registration and discovery efficiency due to a rapid increase in communication with a service registration center in a short time. The embodiment of the present application is applied to a Apache Dubbo system, as shown in fig. 2, which includes a client 210 and a service registry 220, wherein the client 210 includes a service registration discovery module 211 and a service configuration module 212, and the type of the client 210 may be a service provider or a service consumer.
The service configuration module 212 is configured to parse the first object to generate a plurality of uniform resource locators (uniform resource locator, URLs), configure an attribute value of the first attribute parameter for each URL in the plurality of URLs, and sequentially input the configured plurality of URLs to the service registration discovery module 211.
The service registration discovery module 211 is configured to parse the first URL, determine that the first URL is a first type of URL and an attribute value of a first attribute parameter of the first URL, and store the first URL in a cache when the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module 211 stores the first URL, and store the first URL in a cache before the first URL reaches the service registration discovery module 211 and send metadata to the service registration center 220 when the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module 211 stores the first URL in a cache before the first URL reaches the service registration discovery module 211.
The service registry 220 is configured to parse the metadata to obtain the first URL and the first type of URL cached before the first URL reaches the service registry discovery module 211.
It should be appreciated that the number of service registries 220 may be one or more. Thus, the plurality of URLs that generate metadata are the same type of URL registered to the same service registry. In addition, embodiments of the present application are not limited in how service registry 220 parses and processes metadata.
The first attribute parameter is an attribute parameter of a character string type newly added in a service configuration file of the system. Illustratively, the service configuration file is dubbo.xsd, and the first attribute parameter may be configured by modifying the dubbo.xsd to serviceType and REFERENCETYPE, for example, the first attribute parameter may be last, and the default value of the first attribute parameter may be "false".
Illustratively, the following is a partial code included in dubbo.xsd, the first attribute parameter may be newly added based on the following format.
Further, the service configuration module 212 configures an attribute value of the first attribute parameter for each URL of the plurality of URLs according to the service configuration file.
Wherein the first type is a service provider or a service consumer. The first object is at least one of an extensible markup language (extensible markup language, XML) document, an interface definition configuration file (-ddubbo.properties.file), an application program interface (application programming interface, API), an annotation. It should be understood that the possible forms of the first object described above are only examples and are not intended to limit the present application.
The interface definition configuration file and the XML are text documents, which means that the file formats are different, and both can be used for analyzing the URL.
Example 1 the following is part of the code included in XML, by which the application name is demo-provider (i.e. the first type is the service provider), and the registration address, protocol name and port number are known.
<dubbo:application name="demo-provider"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<dubbo:protocol name="dubbo"port="20890"/>
Example 2 the following is part of the code included in XML, by which the application name is demo-consumer (i.e. the first type is the service consumer), and the registration group and address are known.
<dubbo:application name="demo-consumer"/>
<dubbo:registry group="aaa"address="zookeeper://127.0.0.1:2181"/>
It should be appreciated that in the Apache Dubbo system, the client may also include other modules to implement other functions of the Apache Dubbo system, as the application is not limited in this regard.
Further, as shown in fig. 3, an embodiment of the present application provides a service registration method, which is applied to Apache Dubbo systems, and the method includes:
step 300, the service registration discovery module obtains a first URL.
In step 310, the service registration discovery module parses the first URL, and determines that the first URL is a URL of a first type and an attribute value of a first attribute parameter of the first URL. The service registration discovery end executes step 320A when determining that the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module caches the first URL, and executes step 320B when the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module generates metadata between the first URL and the first type of URL cached before the first URL reaches the service registration discovery module.
Step 320A. When the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module caches the first URL, the service registration discovery module caches the first URL.
The service registration discovery module continues to obtain other URLs and repeats steps 300 and 310.
Step 320B. When the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module generates metadata for the first URL with the first type of URL cached before the first URL reaches the service registration discovery module, the service registration discovery module generates metadata for the first URL with the first type of URL cached before the first URL reaches the service registration discovery module.
And 330, the service registration discovery end sends metadata to the service registration center.
The design of the attribute value of the first attribute parameter of the first URL may include, but is not limited to, the following two ways:
in one possible design, the attribute value of the first attribute parameter of the first URL indicates that the service registration discovery module caches the first URL when the first URL is not the last URL of the first type registered with the service registry. When the first URL is the last URL of the first type registered with the service registry, the attribute value of the first attribute parameter of the first URL instructs the service registry discovery module to generate metadata for the first URL with the first type of URL cached before the first URL reaches the service registry discovery module.
By adopting the design, by analyzing the parameter value of the first attribute parameter of the first URL, whether the first URL is the last URL of the first type registered in the service registration center can be judged, so that the service discovery end can determine the URLs of the same type, and metadata can be generated by all the URLs of the same type.
Illustratively, only one URL of the first type registered with the same service registry is the last URL of the first type registered with the service registry, and the attribute value of the first attribute parameter of the URL indicates that the service registry discovery module generates metadata for the first URL with the first type of URL cached before the first URL reaches the service registry discovery module, and the attribute value of the first attribute parameter of the first type of URL cached before the first URL reaches the service registry discovery module indicates that the service registry discovery module caches the corresponding URL.
In another possible design, the attribute values of the first attribute parameters corresponding to the M-1 URLs of the first type respectively buffered before the first URL arrives at the service registration discovery module indicate that the service registration discovery module buffers the corresponding URL, the first URL is the first URL of the first type arriving at the service registration discovery module, the attribute values of the first attribute parameters of the first URL indicate that the service registration discovery module generates metadata with the first URL and the first URL of the first type buffered before the first URL arrives at the service registration discovery module, M is a positive integer greater than or equal to 2, or the first URL is the first URL of the first type arriving at the service registration discovery module, N < M, N is a positive integer, and the attribute values of the first attribute parameters of the first URL indicate that the service registration discovery module buffers the first URL.
By adopting the design, by analyzing the parameter value of the first attribute parameter of the first URL, whether the first URL is the last URL in M URLs of the first type can be judged, and further metadata can be generated by the service discovery terminal through a plurality of URLs of the same type.
For example, when the value of M is 100, the attribute value of the first attribute parameter corresponding to the 1 st URL indicates that the service registration discovery module caches the 1 st URL, the attribute value of the first attribute parameter corresponding to the 2 nd URL indicates that the service registration discovery module caches the 2 nd URL, the..the..the., the attribute value of the first attribute parameter corresponding to the 99 th URL indicates that the service registration discovery module caches the 99 th URL, and the 100 st URL indicates that the service registration discovery module generates metadata from the cached 99 URLs of the first type and the 100 URLs of the first type.
In addition, the value of M can be changed according to the requirements of users, the actual URL number and other conditions. For example, when the initial value of M is 100, the attribute values of the first attribute parameters corresponding to the 1 st URL of the first type to the 99 th URL of the first type respectively indicate that the service registration discovery module caches the corresponding URLs of the first type, and the 100 th URL of the first type indicates that the service registration discovery module generates metadata from the cached 99 URLs of the first type and the 100 th URL of the first type. If the URLs to be registered are rapidly increased in a short time, the value of M may be adjusted, for example, the value of M may be adjusted to 1000, and then the attribute values of the first attribute parameters corresponding to the 1 st to 999 st URLs indicate that the service registration discovery module caches the corresponding URLs of the first type, and the 1000 st URL indicates that the service registration discovery module generates metadata from the cached 999 URLs of the first type and the 1000 st URL of the first type.
Furthermore, when m=1, the above design is also compatible with prior art solutions.
It should be appreciated that in addition to the attribute value of the first attribute parameter indicating that the service registry discovery module generates metadata for the first URL with the first type of URL cached before the first URL arrives at the service registry discovery module, the first URL and the first type of URL cached before the first URL arrives at the service registry discovery module also need to satisfy the URL that is addressed to the same service registry.
Further, when the attribute value of the first attribute parameter of the first URL is a first preset value, the attribute value of the first attribute parameter of the first URL indicates the service registration discovery module to cache the first URL. When the attribute value of the first attribute parameter of the first URL is a second preset value, the attribute value of the first attribute parameter of the first URL instructs the service registration discovery module to generate metadata between the first URL and the first type of URL cached before the first URL reaches the service registration discovery module. Wherein the first preset value is different from the second preset value.
For example, the first attribute parameter may be last, and the default value of the first attribute parameter may be "false", that is, the first preset value is "false", and the second preset value is "true".
In one example, when the first URL is not the last URL of the first type registered with the service registry, the attribute value of the last attribute of the first URL is a default value of "false". When the first URL is the last URL of the first type registered to the service registry, the last attribute of the first URL has an attribute value of "true".
In another example, when the first URL is an nth URL of the first type to the service registration discovery module, N < M, the attribute value of the last attribute of the first URL is a default value of "false". When the first URL is an mth URL of the first type reaching the service registration discovery module, an attribute value of a last attribute of the first URL is "true".
It should be understood that the first preset value and the second preset value are only examples, and other preset values are also possible, which is not limited by the present application.
Therefore, by adopting the method, the waiting time of the service queue can be reduced, the service registration and discovery efficiency can be improved, the network congestion condition can be relieved, and the problem that the service registration and discovery efficiency is lower due to rapid increase of communication with the service registration center in a short time can be solved by sending a plurality of URL generation metadata of the same type to the service registration center.
As shown in fig. 4 and 5, in the following examples, URLs of N1 service provider types and URLs of N2 service consumer types are obtained by the service configuration module, and N1 and N2 are positive integers, and N1 may be equal to N2 or N1 may not be equal to N2, assuming that one service registry exists.
S401, modifying Apache Dubbo a service configuration file (dubbo.xsd), and adding a character string type attribute last for the service provider type and the service consumer type, wherein the default value of the attribute is 'false'.
Illustratively, an administrator may actively modify Apache Dubbo the service profile (dubbo.xsd).
S402, the service configuration module obtains a plurality of URLs by analyzing at least one of XML, -Ddubbo.properties.file, API and annotation provided by Apache Dubbo, and configures last attribute for each URL.
S403, the service configuration module sequentially inputs the configured plurality of URLs to the service registration discovery module.
S404, the service registration discovery module analyzes the attribute value of the last attribute of each URL input by the service configuration module and judges whether the attribute value of the last attribute of the URL is true. If it is determined that the last attribute of the URL has an attribute value of "true", S406 is executed, otherwise S405 is executed.
S405, when the last attribute of the URL has an attribute value of "false", the service registration discovery module caches the URL classification.
And returning to S404, the service registration discovery module continues to parse the attribute values of last attributes of other URLs input by the service configuration module.
And S406, when the attribute value of the last attribute of the URL is true, the service registration discovery module generates metadata according to the cached URL which is the same as the URL in type and the URL.
Illustratively, as shown in FIG. 5, URLs of N1 service provider types are generated into service provider metadata, and URLs of N2 service consumer types are generated into service consumer metadata.
And S407, the service registration discovery module sends the metadata to the service registration center.
And S408, the service registry receives and analyzes the metadata and stores the analyzed result.
Wherein the service registry can obtain the cached URL and the URL which are the same type as the URL by parsing the metadata.
The embodiments of the present application also provide a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the methods shown in the above embodiments.
The method provided by the embodiment of the application can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, a network device, a user device, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., solid state disk Solid STATE DISK SSD), etc.
The foregoing embodiments are merely used to describe the technical solution of the present application in detail, but the descriptions of the foregoing embodiments are only used to help understand the method of the embodiments of the present application and should not be construed as limiting the embodiments of the present application. Variations or alternatives readily apparent to those skilled in the art are intended to be encompassed within the scope of the embodiments of the present application.

Claims (15)

1.一种服务注册方法,其特征在于,所述方法应用于Apache Dubbo系统,该方法包括:1. A service registration method, characterized in that the method is applied to the Apache Dubbo system, and the method includes: 服务注册发现模块获得第一统一资源定位符URL;The service registration and discovery module obtains the first Uniform Resource Locator (URL); 所述服务注册发现模块解析所述第一URL,确定所述第一URL为第一类型的URL以及所述第一URL的第一属性参数的属性值,所述第一属性参数为所述系统的服务配置文件中新增的字符串类型的属性参数;The service registration and discovery module parses the first URL, determines that the first URL is a first type of URL and the attribute value of the first attribute parameter of the first URL, wherein the first attribute parameter is a string type attribute parameter newly added in the service configuration file of the system; 在所述第一URL的第一属性参数的属性值指示所述服务注册发现模块缓存所述第一URL时,所述服务注册发现模块缓存所述第一URL;When the attribute value of the first attribute parameter of the first URL indicates that the service registration and discovery module should cache the first URL, the service registration and discovery module caches the first URL. 在所述第一URL的第一属性参数的属性值指示所述服务注册发现模块将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据时,所述服务注册发现模块将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据,并向服务注册中心发送所述元数据。When the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to generate metadata for the first URL and the first type of URL cached before the first URL arrives at the service registration and discovery module, the service registration and discovery module generates metadata for the first URL and the first type of URL cached before the first URL arrives at the service registration and discovery module, and sends the metadata to the service registry. 2.如权利要求1所述的方法,其特征在于,在所述第一URL不是最后一个注册到所述服务注册中心的第一类型的URL时,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块缓存所述第一URL;2. The method as described in claim 1, wherein when the first URL is not the last URL of the first type registered to the service registry, the attribute value of the first attribute parameter of the first URL instructs the service registration discovery module to cache the first URL; 在所述第一URL为最后一个注册到所述服务注册中心的第一类型的URL时,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据。When the first URL is the last first type URL registered to the service registry, the attribute value of the first attribute parameter of the first URL instructs the service registration discovery module to generate metadata for the first URL and the first type URL cached before the first URL arrives at the service registration discovery module. 3.如权利要求1所述的方法,其特征在于,在所述第一URL到达所述服务注册发现模块之前缓存的M-1个第一类型的URL分别对应的第一属性参数的属性值指示所述服务注册发现模块缓存相应的URL,所述第一URL是第M个到达所述服务注册发现模块的第一类型的URL,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据,M为大于等于2的正整数;3. The method as described in claim 1, wherein the attribute values of the first attribute parameters corresponding to the M-1 first-type URLs cached before the first URL arrives at the service registration and discovery module instruct the service registration and discovery module to cache the corresponding URLs, the first URL is the Mth first-type URL arriving at the service registration and discovery module, and the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to generate metadata by combining the first URL with the first-type URLs cached before the first URL arrives at the service registration and discovery module, where M is a positive integer greater than or equal to 2; 或者,所述第一URL是第N个到达所述服务注册发现模块的第一类型的URL,N<M,N为正整数,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块缓存所述第一URL。Alternatively, the first URL is the Nth URL of the first type arriving at the service registration and discovery module, where N < M and N is a positive integer, and the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to cache the first URL. 4.如权利要求1-3任一项所述的方法,其特征在于,在所述第一URL的第一属性参数的属性值为第一预设值时,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块缓存所述第一URL;4. The method according to any one of claims 1-3, wherein when the attribute value of the first attribute parameter of the first URL is a first preset value, the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to cache the first URL; 在所述第一URL的第一属性参数的属性值为第二预设值时,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据;When the attribute value of the first attribute parameter of the first URL is a second preset value, the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to generate metadata for the first URL and the first type of URL cached before the first URL arrives at the service registration and discovery module; 其中,所述第一预设值与所述第二预设值不同。The first preset value is different from the second preset value. 5.如权利要求1-4任一项所述的方法,其特征在于,所述第一类型为服务提供者或服务消费者。5. The method according to any one of claims 1-4, wherein the first type is a service provider or a service consumer. 6.如权利要求1-5任一项所述的方法,其特征在于,所述第一URL是通过解析第一对象获得的,所述第一对象为可扩展标记语言XML文档、接口定义配置文件、应用程序编程接口API、注解中至少一种。6. The method according to any one of claims 1-5, wherein the first URL is obtained by parsing a first object, and the first object is at least one of an Extensible Markup Language (XML) document, an interface definition configuration file, an Application Programming Interface (API), and an annotation. 7.一种Apache Dubbo系统,其特征在于,所述系统包括客户端和服务注册中心,所述客户端包括服务配置模块和服务注册发现模块,其中:7. An Apache Dubbo system, characterized in that the system includes a client and a service registry, the client including a service configuration module and a service registration and discovery module, wherein: 所述服务配置模块用于解析第一对象生成多个URL,为所述多个URL中的每个URL配置第一属性参数的属性值,并将配置后的多个URL依次输入至所述服务注册发现模块,所述第一属性参数为所述系统的服务配置文件中新增的字符串类型的属性参数;The service configuration module is used to parse the first object to generate multiple URLs, configure the attribute value of the first attribute parameter for each of the multiple URLs, and input the configured multiple URLs sequentially into the service registration and discovery module. The first attribute parameter is a newly added string type attribute parameter in the service configuration file of the system. 所述服务注册发现模块用于解析第一URL,确定所述第一URL为第一类型的URL以及所述第一URL的第一属性参数的属性值,所述第一URL为所述配置后的多个URL中的任意一个URL;在所述第一URL的第一属性参数的属性值指示所述服务注册发现模块缓存所述第一URL时,缓存所述第一URL;在所述第一URL的第一属性参数的属性值指示所述服务注册发现模块将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据时,将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据,并向服务注册中心发送所述元数据;The service registration and discovery module is used to parse the first URL, determine that the first URL is a first type of URL and the attribute value of the first attribute parameter of the first URL, wherein the first URL is any one of the configured multiple URLs; when the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to cache the first URL, the first URL is cached; when the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to generate metadata by combining the first URL with the first type of URL cached before the first URL arrives at the service registration and discovery module, the first URL with the first type of URL cached before the first URL arrives at the service registration and discovery module generates metadata and sends the metadata to the service registry center; 所述服务注册中心用于解析所述元数据,获得所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL。The service registry is used to parse the metadata to obtain the first URL and a first type of URL cached before the first URL reaches the service registration discovery module. 8.如权利要求7所述的系统,其特征在于,在所述第一URL不是最后一个注册到所述服务注册中心的第一类型的URL时,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块缓存所述第一URL;8. The system as described in claim 7, wherein when the first URL is not the last URL of the first type registered to the service registry, the attribute value of the first attribute parameter of the first URL instructs the service registration discovery module to cache the first URL; 在所述第一URL为最后一个注册到所述服务注册中心的第一类型的URL时,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据。When the first URL is the last first type URL registered to the service registry, the attribute value of the first attribute parameter of the first URL instructs the service registration discovery module to generate metadata for the first URL and the first type URL cached before the first URL arrives at the service registration discovery module. 9.如权利要求7所述的系统,其特征在于,在所述第一URL到达所述服务注册发现模块之前缓存的M-1个第一类型的URL分别对应的第一属性参数的属性值指示所述服务注册发现模块缓存相应的URL,所述第一URL是第M个到达所述服务注册发现模块的第一类型的URL,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据,M为大于等于2的正整数;9. The system as described in claim 7, wherein the attribute values of the first attribute parameters corresponding to the M-1 first-type URLs cached before the first URL arrives at the service registration and discovery module instruct the service registration and discovery module to cache the corresponding URLs, the first URL is the Mth first-type URL arriving at the service registration and discovery module, and the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to generate metadata by combining the first URL with the first-type URLs cached before the first URL arrives at the service registration and discovery module, where M is a positive integer greater than or equal to 2; 或者,所述第一URL是第N个到达所述服务注册发现模块的第一类型的URL,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块缓存所述第一URL,N<M,N为正整数。Alternatively, the first URL is the Nth URL of the first type arriving at the service registration and discovery module, and the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to cache the first URL, where N < M and N is a positive integer. 10.如权利要求7-9任一项所述的系统,其特征在于,在所述第一URL的第一属性参数的属性值为第一预设值时,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块缓存所述第一URL;10. The system according to any one of claims 7-9, wherein when the attribute value of the first attribute parameter of the first URL is a first preset value, the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to cache the first URL; 在所述第一URL的第一属性参数的属性值为第二预设值时,所述第一URL的第一属性参数的属性值指示所述服务注册发现模块将所述第一URL与在所述第一URL到达所述服务注册发现模块之前缓存的第一类型的URL生成元数据;When the attribute value of the first attribute parameter of the first URL is a second preset value, the attribute value of the first attribute parameter of the first URL instructs the service registration and discovery module to generate metadata for the first URL and the first type of URL cached before the first URL arrives at the service registration and discovery module; 其中,所述第一预设值与所述第二预设值不同。The first preset value is different from the second preset value. 11.如权利要求7-10任一项所述的系统,其特征在于,所述服务配置模块用于基于所述服务配置文件为所述多个URL中的每个URL配置第一属性参数的属性值。11. The system according to any one of claims 7-10, wherein the service configuration module is configured to configure the attribute value of the first attribute parameter for each of the plurality of URLs based on the service configuration file. 12.如权利要求7-11任一项所述的系统,其特征在于,所述第一类型为服务提供者或服务消费者。12. The system according to any one of claims 7-11, wherein the first type is a service provider or a service consumer. 13.如权利要求7-12任一项所述的系统,其特征在于,所述第一对象为XML文档、接口定义配置文件、API、注解中至少一种。13. The system according to any one of claims 7-12, wherein the first object is at least one of an XML document, an interface definition configuration file, an API, and an annotation. 14.一种芯片,其特征在于,所述芯片与电子设备中的存储器耦合,使得所述芯片在运行时调用所述存储器中存储的程序指令,实现如权利要求1至6任一所述的方法。14. A chip, characterized in that the chip is coupled to a memory in an electronic device, such that the chip, during operation, calls program instructions stored in the memory to implement the method as described in any one of claims 1 to 6. 15.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括程序指令,当所述程序指令在设备上运行时,使得所述设备执行如权利要求1至6任一项所述的方法。15. A computer-readable storage medium, characterized in that the computer-readable storage medium includes program instructions that, when executed on a device, cause the device to perform the method as described in any one of claims 1 to 6.
CN202010291514.2A 2020-04-14 2020-04-14 A service registration method and an Apache Dubbo system Active CN113536159B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010291514.2A CN113536159B (en) 2020-04-14 2020-04-14 A service registration method and an Apache Dubbo system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010291514.2A CN113536159B (en) 2020-04-14 2020-04-14 A service registration method and an Apache Dubbo system

Publications (2)

Publication Number Publication Date
CN113536159A CN113536159A (en) 2021-10-22
CN113536159B true CN113536159B (en) 2025-11-04

Family

ID=78120010

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010291514.2A Active CN113536159B (en) 2020-04-14 2020-04-14 A service registration method and an Apache Dubbo system

Country Status (1)

Country Link
CN (1) CN113536159B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105554160A (en) * 2016-01-29 2016-05-04 四川长虹电器股份有限公司 Dubbo distributed cluster system architecture method based on nginx load balancing

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9483312B2 (en) * 2010-08-16 2016-11-01 International Business Machines Corporation Locating service endpoints from a service registry
CN104239572A (en) * 2014-09-30 2014-12-24 普元信息技术股份有限公司 System and method for achieving metadata analysis based on distributed cache
US10516672B2 (en) * 2016-08-05 2019-12-24 Oracle International Corporation Service discovery for a multi-tenant identity and data security management cloud service
CN110247944B (en) * 2018-03-09 2022-06-24 阿里巴巴集团控股有限公司 Cross-regional service calling method, device and system and electronic equipment
CN110636093B (en) * 2018-06-25 2022-04-26 中兴通讯股份有限公司 Microservice registration and discovery method, microservice registration and discovery device, storage medium and microservice system
CN109257440A (en) * 2018-10-29 2019-01-22 南京南瑞信息通信科技有限公司 A kind of service discovery and client load equalization methods based on service register center
CN110162456A (en) * 2019-04-12 2019-08-23 深圳壹账通智能科技有限公司 A kind of test method, device, storage medium and the server of DUBBO service
CN110134455B (en) * 2019-04-12 2025-01-21 深圳平安医疗健康科技服务有限公司 Application management system and method
CN110062043B (en) * 2019-04-16 2021-10-29 杭州朗和科技有限公司 Service management method, service management device, storage medium, and electronic device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105554160A (en) * 2016-01-29 2016-05-04 四川长虹电器股份有限公司 Dubbo distributed cluster system architecture method based on nginx load balancing

Also Published As

Publication number Publication date
CN113536159A (en) 2021-10-22

Similar Documents

Publication Publication Date Title
CN107231402B (en) HTTP request processing method, device and system
CN111756795B (en) Service information management method and device, electronic equipment and storage medium
US8984164B2 (en) Methods for reducing latency in network connections and systems thereof
CN111045833B (en) Interface calling method and device
CN1939034A (en) Controlling access to services in a communications system
JP5698327B2 (en) Content categorization method and system
CN106790629A (en) Data synchronization unit and its realize the method for data syn-chronization, client access system
WO2019154353A1 (en) System running parameter query method, matching method and apparatus, and node device
CN102143243A (en) Dynamic routing processing method and dynamic routing processing device and home gateway thereof
WO2009062414A1 (en) Integrate client and method of desktop application communicating with net web application
CN111510330B (en) Interface management device, method and storage medium
CN112261111A (en) Method and system for realizing cross-domain access of browser in application program
CN107818268A (en) The access control method and server of big data platform
CN115080272A (en) A business data processing method, electronic device and storage medium
EP3056047A1 (en) Wireless network service type
CN106792261B (en) Method and device for forwarding streaming media and routing method and device
CN114629972A (en) Data message processing method and device
CN102090039B (en) A method of performing data mediation, and an associated computer program product, data mediation device and information system
CN113079029B (en) Configuration information subscription method and device
CN113536159B (en) A service registration method and an Apache Dubbo system
CN114697306A (en) HTTP client and data communication method
CN115801870A (en) Subscription pushing method, device, communication system and storage medium
WO2008102226A2 (en) Apparatus, method, and computer program product providing enhanced document management
CN113285920B (en) Service access method, device, equipment and storage medium
WO2023045403A1 (en) Gateway-based multi-channel route fast forwarding and intelligent routing method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
TA01 Transfer of patent application right

Effective date of registration: 20220217

Address after: 550025 Huawei cloud data center, jiaoxinggong Road, Qianzhong Avenue, Gui'an New District, Guiyang City, Guizhou Province

Applicant after: Huawei Cloud Computing Technologies Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Applicant before: HUAWEI TECHNOLOGIES Co.,Ltd.

TA01 Transfer of patent application right
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant