CN116074386B - Service calling method and device, service registration method and device - Google Patents

Service calling method and device, service registration method and device Download PDF

Info

Publication number
CN116074386B
CN116074386B CN202310200367.7A CN202310200367A CN116074386B CN 116074386 B CN116074386 B CN 116074386B CN 202310200367 A CN202310200367 A CN 202310200367A CN 116074386 B CN116074386 B CN 116074386B
Authority
CN
China
Prior art keywords
service
target
address information
information
network protocol
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
CN202310200367.7A
Other languages
Chinese (zh)
Other versions
CN116074386A (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.)
Alibaba China Co Ltd
Original Assignee
Alibaba China 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 Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN202310200367.7A priority Critical patent/CN116074386B/en
Publication of CN116074386A publication Critical patent/CN116074386A/en
Application granted granted Critical
Publication of CN116074386B publication Critical patent/CN116074386B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/14Multichannel or multilink protocols

Abstract

The application discloses a service calling method and device, and a service registration method and device. The service calling method comprises the following steps: obtaining a service request message sent by a service requester, determining a target service provider capable of providing services for the service request message, and if the target service provider has target address information of a plurality of network protocol versions and the target address information of the network protocol versions can provide services for the service request message, selecting the target address information of at least one network protocol version from the target address information of the network protocol versions to provide services for the service requester, and sending a service call message to the target service provider, wherein the service call message comprises the target address information of the called at least one network protocol version. In this way, the service call under the multi-stack network environment is completed by determining the target service provider first and then determining at least one piece of target address information from the target address information of the multiple network protocol versions to provide the service for the service requester.

Description

Service calling method and device, service registration method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a service calling method, a device, an electronic device, a storage medium, two service registration methods, a device, an electronic device, a storage medium, and a health checking method, a device, an electronic device, and a storage medium.
Background
The original service node has only one service address of an internet protocol version, and along with the upgrade of user demands and technologies, the existing service node can have the service addresses of a plurality of internet protocol versions at the same time.
Because the existing service node has multiple service addresses of internet protocol versions at the same time, the original service calling method of the service node with only one service address is not applicable. That is, the method of service invocation in a single stack network environment cannot meet the requirements of a multi-stack network environment.
Therefore, service invocation in a multi-stack network environment is a problem to be solved.
Disclosure of Invention
In view of this, the embodiments of the present application provide a service calling method, apparatus, electronic device, and readable storage medium, and also provide two service registration methods, apparatus, electronic device, and storage medium, and also provide a health checking method, apparatus, electronic device, and storage medium. The method provided by the embodiment of the application can solve the problem of service registration in a multi-stack network environment.
The first embodiment of the application provides a service calling method, which comprises the following steps:
obtaining a service request message sent by a service requester;
determining a target service provider that can provide a service for the service request message;
if the target service provider has target address information of a plurality of network protocol versions, and the target address information of the network protocol versions can provide service for the service request message, selecting the target address information of at least one network protocol version from the target address information of the network protocol versions to provide service for the service requester;
and sending a service call message to the target service provider, wherein the service call message comprises the target address information of the at least one called network protocol version.
Optionally, the determining a target service provider that can provide a service for the service request message includes:
a target service provider that can provide a service for the service request message is determined based on the service weight information of the plurality of service providers.
Optionally, the selecting the destination address information of at least one network protocol version from the destination address information of the plurality of network protocol versions provides a service for the service requester, including:
And obtaining service address weight information corresponding to the target address information of the network protocol versions respectively.
Optionally, if the target service provider provides target address information of only one network protocol version, selecting the target address information of the network protocol version to provide service for the service requester.
Optionally, if the target service provider has target address information of multiple network protocol versions, and only one of the target address information of the multiple network protocol versions can provide service for the service request, selecting the target address information that can provide service for the service request to provide service for the service requester.
Optionally, the service request message is used for requesting a target service provider to provide a service for the service requester by using the target address information of the designated network protocol version, and the service call message is used for instructing the target service provider to provide a service for the service requester by using the target address information of the other network protocol version except the designated network protocol version.
Optionally, the method further comprises: information of a service provider provided by a service registry is obtained, wherein the information of the service provider comprises target address information of a plurality of network protocol versions of the service provider.
Optionally, the information of the service provider further includes: service address weight information corresponding to the target address information of the plurality of network protocol versions, respectively.
A second embodiment of the present application provides a service invocation apparatus, including:
an obtaining unit, configured to obtain a service request message sent by a service requester;
a determining unit configured to determine a target service provider that can provide a service for the service request message;
a selecting unit, configured to select, if the target service provider has target address information of multiple network protocol versions, and all of the target address information of the multiple network protocol versions can provide services for the service request message, target address information of at least one network protocol version from the target address information of the multiple network protocol versions to provide services for the service requester;
and the calling unit is used for sending a service calling message to the target service provider, wherein the service calling message comprises the target address information of the at least one called network protocol version.
A third embodiment of the present application provides a service registration method, including:
Obtaining service address information of a target service provider, wherein the service address information comprises target address information of a plurality of network protocol versions, and the service provider can provide service for a service requester through the target address information of at least one network protocol version;
and sending a registration message for registering the information of the target service provider to a service registration center, wherein the registration message comprises target address information of the network protocol versions.
Optionally, the method further comprises: obtaining service address weight information corresponding to the target address information of at least one network protocol version;
the registration message further includes service address weight information corresponding to the target address information of the at least one network protocol version.
Optionally, the obtaining service address weight information corresponding to the target address information of at least one network protocol version includes:
obtaining service weight information of the target service provider;
and obtaining service address weight information corresponding to the target address information of at least one network protocol version according to the service weight information of the target service provider.
Optionally, the obtaining the service weight information of the service provider includes:
Obtaining computing capability information of the target service provider;
and obtaining service weight information of the target service provider according to the computing capacity information of the target service provider.
Optionally, the method further comprises: obtaining target address information of at least one network protocol version, and predicting proportion information of bearing service response in the service provider;
the obtaining service address weight information corresponding to the target address information of at least one network protocol version according to the service weight information of the target service provider includes: and according to the service weight information of the target service provider and the proportion information of the target address information of at least one network protocol version, which is expected to bear the service response quantity in the service provider, obtaining the service address weight information corresponding to the target address information of at least one network protocol version.
A fourth embodiment of the present application provides a service registration apparatus including:
an obtaining unit, configured to obtain service address information of a target service provider, where the service address information includes target address information of multiple network protocol versions, and the service provider may provide a service for a service requester through the target address information of at least one network protocol version;
And the sending unit is used for sending a registration message for registering the information of the target service provider to the service registration center, wherein the registration message comprises the target address information of the network protocol versions.
A fifth embodiment of the present application provides a service registration method, including:
obtaining a registration message sent by a target service provider and used for registering information of the target service provider to a service registration center, wherein the registration message comprises service address information of the target service provider, and the service address information comprises target address information of a plurality of network protocol versions;
registering information of the target service provider to the service registration center, wherein the information of the target service provider comprises target address information of the network protocol versions.
Optionally, the information of the target service provider further includes: service address weight information corresponding to the target address information of at least one network protocol version.
Optionally, the information of the target service provider further includes: and the service weight information of the target service provider.
Optionally, the method further comprises: and sending the information of the target service provider registered in the service registration center to a service calling party.
A sixth embodiment of the present application provides a service registration apparatus, including:
an obtaining unit, configured to obtain a registration message sent by a target service provider and used for registering information of the target service provider to a service registration center, where the registration message includes service address information of the target service provider, and the service address information includes target address information of multiple network protocol versions;
and the registration unit is used for registering the information of the target service provider to the service registration center, wherein the information of the target service provider comprises the target address information of the network protocol versions.
A seventh embodiment of the present application provides a health check method, the method comprising:
obtaining service address information of a target service provider registered in a service registration center, wherein the service address information comprises target address information of a plurality of network protocol versions, and the service provider can provide service for a service requester through the target address information of at least one network protocol version;
and carrying out health check on the available state of the service address information of the target service provider to obtain a check result of the available state of the service address information.
Optionally, the health check on the available state of the service address information of the target service provider includes:
sending detection information to a service address of the service address information;
judging whether the response characteristic of the service address aiming at the detection information accords with a preset response characteristic, if so, determining that the service address is available, otherwise, determining that the service address is unavailable.
Optionally, the health check is performed on the available state of the service address information of the target service provider, and a check result of the service address information is obtained, including:
and if the checking result of the service address information of the target service provider indicates that the service addresses of the target service provider are all in an unavailable state, removing the target service provider.
Optionally, the health check is performed on the available state of the service address information of the target service provider, and a check result of the service address information is obtained, and further includes:
and if the fact that the service address of the target service provider is in the available state is judged by the checking result of part of the service address information in the service address information of the target service provider, the service provider adjusts the service address weight information according to the original service address weight information of the service address information in the available state.
Optionally, the health check is performed on the available state of the service address information of the target service provider, and a check result of the service address information is obtained, and further includes:
and if the fact that the service address information of the target service provider has the checking result of partial service address information indicates that the service address of the target service provider is in an unavailable state is judged, the service address information in the unavailable state is not subjected to service response in the service provider.
An eighth embodiment of the present application provides a health check device, comprising:
an obtaining unit, configured to obtain service address information of a target service provider registered in a service registry, where the service address information includes target address information of multiple network protocol versions, and the service provider may provide a service for a service requester through the target address information of at least one network protocol version;
and the checking unit is used for performing health check on the available state of the service address information of the target service provider to obtain a checking result of the available state of the service address information.
A ninth embodiment of the present application provides an electronic apparatus, including:
A processor;
the method comprises the steps of,
a memory storing a computer program, the apparatus executing the method according to any one of the first, third, fifth, and seventh embodiments after the computer program is executed by the processor.
A tenth embodiment of the present application provides a computer storage medium storing a computer program to be executed by a processor to perform the method according to any one of the first, third, fifth and seventh embodiments.
The service calling method provided by the embodiment of the application obtains the service request message sent by the service request party, determines the target service provider which can provide the service for the service request message, and if the target service provider has the target address information of a plurality of network protocol versions and the target address information of the network protocol versions can provide the service for the service request message, selects the target address information of at least one network protocol version from the target address information of the network protocol versions to provide the service for the service request party, and sends the service calling message to the target service provider, wherein the service calling message comprises the target address information of the at least one called network protocol version. In this way, after obtaining the service request message sent by the service requester, determining a target service provider capable of providing service for the service request from a plurality of service providers, selecting at least one from the target address information of a plurality of network protocol versions of the target service provider to provide service for the service requester, and finally sending a service call message containing the target address information of the network protocol version to the target service provider to complete service call in a multi-stack network environment.
The service registration method provided by the embodiment of the application obtains the service address information of a target service provider, wherein the service address information comprises target address information of a plurality of network protocol versions, and the service provider can provide service for a service requester through the target address information of at least one network protocol version; and sending a registration message for registering the information of the target service provider to a service registration center, wherein the registration message comprises target address information of the network protocol versions. Because the service address information of the service provider includes the target address information of a plurality of network protocol versions, the service registration method provided by the embodiment of the application can register the target address information of a plurality of network protocol versions on the service registration center and provide the target address information of a plurality of network protocol versions of the target service provider for the service calling method.
The health checking method provided by the embodiment of the application obtains the service address information of the target service provider registered in the service registration center, wherein the service address information comprises target address information of a plurality of network protocol versions, and the service provider can provide service for the service requester through the target address information of at least one network protocol version; and carrying out health check on the available state of the service address information of the target service provider to obtain a check result of the available state of the service address information. According to the health checking method provided by the embodiment of the application, as the service address information of the target service provider comprises the target address information of a plurality of network protocol versions, the target address information of the plurality of network protocol versions is checked, and the available target address information of the plurality of network protocol versions of the target service provider can be better provided for the service calling method.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is an exemplary diagram of a service invocation method provided by the present application.
Fig. 2 is a flowchart of a service invocation method provided in an embodiment of the present application.
Fig. 3 is a block diagram of a service invocation apparatus provided by an embodiment of the present application.
Fig. 4 is a flowchart of a service registration method provided in an embodiment of the present application.
Fig. 5 is a block diagram of a service registration apparatus provided in an embodiment of the present application.
Fig. 6 is a flowchart of another service registration method according to an embodiment of the present application.
Fig. 7 is a block diagram of another service registration apparatus provided by an embodiment of the present application.
Fig. 8 is a flowchart of a health check method according to an embodiment of the present application.
Fig. 9 is a block diagram of a health check device provided in an embodiment of the present application.
Fig. 10 is an overall frame diagram provided by an embodiment of the present application.
Fig. 11 is a schematic diagram of a load balancing procedure according to an embodiment of the present application.
Fig. 12 is a schematic logic structure diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a service calling method and device, two service registration methods and devices, and a health checking method and device, which solve the problem of service calling in a multi-stack network environment.
In order that those skilled in the art can better understand the technical solutions of the present application, the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. The application can be practiced in many other ways than those described below, and therefore, based on the examples provided herein, one of ordinary skill in the art will be able to arrive at all other examples that are within the scope of the application without undue burden.
It should be noted that the terms "first," "second," "third," and the like in the claims, description, and drawings of the present application are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. The data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and their variants are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiments of the present application take IPv4 and IPv6 network protocol versions as examples to describe the technical solutions proposed in the present application, but the application field Jing Xian is not limited to IPv4 and IPv6 network protocols, and any scenario where the present application can be used is the scope of the present application, and the present application is not limited by the present description, and therefore the scope of the present application should be defined by the scope of the claims of the present application.
IPv4, a fourth version of the internet protocol (Internet Protocol, IP), uses 32-bit (4-byte) addresses. The network address resource of the current IPv4 address is insufficient, and the application and development of the Internet are severely restricted. For better development, the Internet Engineering Task Force (IETF) was designed to replace the next generation internet protocol IPv6 (Internet Protocol Version 6) of IPv 4. IPv6 uses 128-bit addresses, the number of which is up to 2 128 And the problem of insufficient network address resources is solved.
The upgrade procedure from IPv4 to IPv6 requires a smooth transition procedure to be provided so as to minimize the impact on existing users, and thus may be in a network environment where IPv4 and IPv6 coexist for a considerable period of time. Existing related support services in a single stack network environment cannot be used in a dual stack network environment. The embodiment of the application provides a method for supporting service related to a multi-stack network environment, which can meet the requirement that a dual-stack network simultaneously supports the deployment configuration of IPv4/IPv6 and adds IPv6 service without canceling the IPv4 service.
When the dual-stack network protocol is used, the back-end servers are upgraded from the original IPv4 single stack to the IPv4/IPv6 dual stack, and the service address provided by each back-end server is changed from the original IPv4 single service address to two service addresses coexisting with the existing IPv4 service address and IPv6 service address. The original service discovery capability only supports service registration of a service address of a single IPv4 network protocol version, the original health check strategy in a single-stack environment cannot support the health check requirement in a double-stack environment, and the service call in the single-stack environment cannot meet the uniform forwarding of the service request in the double-stack environment. That is, the existing service calling method in the IPv4 single stack network environment can not solve the problem of service calling in the IPv4/IPv6 dual stack network environment.
Therefore, service invocation in a multi-stack network environment is a highly desirable problem.
The following description will be given of terms related to the technical scheme of the present application.
The service registration may be that the service provider registers the service information on the service registration center.
The health check may be that the service registry checks the available state of the target address information of the target service provider, and adjusts the service address weight information of the target service provider in real time according to the checking result.
The brief procedures of service call, service registration and health check in the single stack network environment in the prior art are as follows:
service calling process: the service calling party obtains the service request message sent by the service request party, determines a target service provider aiming at the service request message according to the service weight information of the service request party, sends the service calling message to the target service provider, and completes the service calling aiming at the service request message.
Registration procedure of service provider: the service provider starts service registration work when a new service node is needed, wherein the new service node is a target service provider, a service address of the target service provider is registered to a service registration center, and the registered service addresses are an IP (Internet Protocol, internet protocol version) address and a Port (Port number); service weight information of a service address of a target service provider is obtained according to the computing capability of the target service provider.
Deletion procedure of service provider: the service registry may directly remove the service provider that needs to be deleted and send the service request message to service providers other than the deleted service provider.
Health check process for service provider: the service registry may discover whether address information of a certain service provider among the service providers is in an abnormal state by detecting. When a certain service provider is found to be abnormal, the abnormal service provider is directly removed, and then a service request message is sent to service providers except the abnormal service provider.
The method is only suitable for a single-stack network environment, the address information of a single network protocol version exists in a multi-stack network environment, and the address information of a plurality of network protocol versions exists at the same time, so that when the address information is the plurality of network protocol versions, the service calling problem in the multi-stack network environment cannot be solved by the method.
An example of a service invocation method provided by the present application is described below. As shown in fig. 1, the present application provides an exemplary diagram of a service invocation method. In order to browse the goods when the user uses the shopping website, if the user wants to access the detail page of the goods or the homepage of the shopping venue or any other service request, the service request message may be an IPv4 service request or an IPv6 service request according to the version of the client or the type of the installed client device, and in this service invocation, the client 101 sends the IPv6 service request 102 message to the service caller, which may be the gateway 103. The gateway 103 includes service weight information, service address information, and service address weight information of the service provider provided by the service registry, and also integrates the load balancing system 104. The gateway 103 determines, through the load balancing system 104, a target service provider, i.e. the service provider 2,105, capable of providing services for the current service request according to the service weight information of each service provider. Further, through health check, the service provider 2 has both IPv4 address information 1051 and IPv6 address information, and both IPv4 address information 1051 and IPv6 address information can provide services for the current service request, and the load balancing system 104 selects the IPv4 address information 1051 to provide services for the current service request according to the service address weight information, and then sends an IPv4 service request 106 including the IPv4 address information 1051 to the service provider 2,105. Eventually, the IPv4 address information 1051 of the target service provider provides services for the client 101, the gateway 103 responds to the IPv4 service response 107 of the service provider 2,105, and the client 101 responds to the IPv4 service response 108 of the gateway 103 to provide services for the service requester. I.e. the user receives on the client 101 a corresponding response content regarding a detail page for accessing the goods or a shopping mall homepage or any other service request. Thus, the service request message can be an IPv4 request or an IPv6 request, and the service call message can be an IPv4 call or an IPv6 call, and the service request message of the client of any network protocol version can complete the service call of the corresponding service provider through the service caller.
The application provides a service calling method, a device, electronic equipment and a storage medium, two service registration methods, a device, the electronic equipment and the storage medium, and a health checking method, a device, the electronic equipment and the storage medium. The technical scheme provided by the application is described below.
The first embodiment of the present application provides a service calling method, and in the following, the service calling method provided by the present application is described in detail with reference to fig. 2. Fig. 2 is a flow chart of a service calling method according to an embodiment of the present application. It should be noted that the steps illustrated in the flowchart may be performed in a computer system, such as a set of computer-executable instructions, and in some cases, the steps illustrated may be performed in a different logical order than illustrated in the flowchart.
As shown in fig. 2, an execution main body of a service calling method provided by an embodiment of the present application is a service calling party, and the service calling method provided by the embodiment of the present application includes the following steps:
step S201, a service request message sent by a service requester is obtained.
This step is used to obtain the service request message sent by the service requester.
The service request message may be a request access message from a client to a server, that is, the service request message may be at least one service request such as a user browsing a web page, a network order, etc.
The service request message includes service request messages of multiple network protocol versions, namely, for one service request, for the existing network protocol, the service request message may be a service request message of an IPv4 network protocol version, a service request message of an IPv6 network protocol version, or a network protocol of a higher level version used in a subsequent continuous upgrading process.
The service request message of the service requester may be at least one service request message of multiple network protocol versions, and for a service request, the service request message is one service request message of one network protocol version, and the current service request may be an IPv4 request or an IPv6 request.
Step S202, determining a target service provider that can provide a service for the service request message.
The step is used for determining a target service provider capable of providing service for the service request message, and determining the target service provider capable of providing service for the service request for one time.
A target service provider for the service request message is determined based on the service weight information for the plurality of service providers.
The service weight information is self attribute characteristics of the service provider and is determined according to the computing capability information of the service provider. Each service provider has own service weight information, and when a service request is made, a plurality of service providers can provide services, and a target service provider for the service request message is determined according to the service weight information of the service providers. In the embodiment of the application, the service provider with the largest service weight information among the plurality of service providers can be used as the target service provider.
For example, the service providers that can provide services for one service request message are the service node 1, the service node 2, and the service node 4, and the service weight information of these three service nodes is 0.4, 0.5, and 0.3 in order, and the service node 2 can be selected as the target service provider.
It is understood that if a service provider having the largest service weight information among the plurality of service providers is temporarily unable to provide a service for various reasons, the service provider having the second largest service weight information may be selected as the target service provider. In this way, the service provider of the third largest, fourth largest, or next largest of the service weight information may be selected as the target service provider.
In the embodiment of the application, the target service provider which can provide the service for the service request message can be determined, or the target service provider can be determined according to the polling and service weight information together, namely the target service provider can be determined according to a weighted polling method.
In step S203, if the target service provider has a plurality of network protocol versions of target address information, and all of the plurality of network protocol versions of target address information can provide services for the service request message, the target address information of at least one network protocol version is selected from the plurality of network protocol versions of target address information to provide services for the service requester.
This step is used for selecting the destination address information of at least one network protocol version from the destination address information of a plurality of network protocol versions to provide service for the service requester if the destination service provider determined in step S202 has the destination address information of the plurality of network protocol versions and the destination address information of the plurality of network protocol versions can all provide service for the service request message.
In the embodiment of the application, the information of the target service provider provided by the service registry is also obtained, and the information of the target service provider comprises the target address information of a plurality of network protocol versions of the target service provider. The information of the target service provider further includes service address weight information corresponding to the target address information of the plurality of network protocol versions, respectively.
Destination address information for multiple network protocol versions of a destination service provider in a service caller is provided through a service registry.
Of course, obtaining the target address information of multiple network protocol versions and the weight information corresponding to the target address information of multiple network protocol versions through the service registry is only one embodiment, and in practical application, the information may also be obtained in multiple manners. For example, the service caller may directly perform a session with the service provider, and the service provider may actively send the information to the service caller, or the service caller may send a request message to the service provider, and obtain the information from the service provider. In addition, the service caller may obtain the information by other third parties who know the information. If a target service provider has target address information of a plurality of network protocol versions, and the target address information of the plurality of network protocol versions can all provide service for a service request message, selecting the target address information of at least one network protocol version from the target address information of the plurality of network protocol versions to provide service for the service requester, comprising:
Obtaining service address weight information corresponding to the target address information of the network protocol versions respectively;
and selecting target address information of at least one network protocol version according to the service address weight information to provide service for the service requester.
The service address weight information is obtained according to the service weight information of a target service provider and the proportion information of at least one network protocol version, which is expected to bear the service response quantity in the service provider.
Continuing with the example in step S202, the service node 2 is selected as the target service provider, the service weight information of the service node 2 is 0.5, if the target address information of the service node 2 is IPv4 service address information and IPv6 service address information, if the ratio information of the IPv4 service address information and the IPv6 address information to the response amount assumed in the service provider is 1:4, the weight information of the IPv4 service address information is 0.5×1/(1+4) =0.5×1/5=0.1, and the weight information of the IPv6 service address information is 0.5×4/(1+4) =0.5×4/5=0.4.
And after obtaining service address weight information respectively corresponding to the target address information of the network protocol versions, selecting the target address information of at least one network protocol version according to the service address weight information to provide service for the service requester.
In the method provided by the embodiment of the application, the target address information of the network protocol version with the largest service address weight information can be selected as the target address information to provide service for the service requester. Of course, in some cases, it is also possible to select the destination address information of the second largest network protocol version of the service address weight information as the destination address information, and it is understood that in some cases, it is also possible to select the destination address information of the third largest network protocol version.
The target address information of at least one network protocol version is selected from the target address information of a plurality of network protocol versions to provide service for a service requester, the target address information can be selected in a polling mode, the target address information can be selected according to an original address hash method, and the target address information can be selected according to a URL (Uniform Resource Locator ) hash method.
The source address hash method is to obtain a numerical value according to the IP address of the client through hash function calculation, and to carry out modular operation on the size of the server list by the numerical value, and the obtained result is the serial number of the server to be accessed by the client.
If the target service provider provides the target address information with only one network protocol version, the target address information of the network protocol version is directly selected as the target address information to provide service for the service requester.
In one example, if the target service provider has only IPv4 target address information, the IPv4 target address information is directly selected as the target address information to provide the service to the service requester. At this time, since one target service provider has only one IPv4 target address information, there is no ratio of a plurality of network protocol versions of target address information to the service response amount in the service provider, in which case there is no service address weight information.
And if the target service provider has target address information of a plurality of network protocol versions, and only one of the target address information of the plurality of network protocol versions can provide service for the service request, selecting the target address information which can provide service for the service request to provide service for the service requester.
In one example, if the target service provider has both IPv4 target address information and IPv6 target address information, but finds that the IPv6 target address information therein is not available in the health check, service cannot be provided, and only the IPv4 target address information can provide service for the service request, the IPv4 target address information is selected as the target address information, and service is provided for the service requester.
The step is used for selecting the target address information of the proper network protocol version from the target service provider, providing service for the service requester and providing basis for subsequent service call.
Step S204, a service invocation message is sent to the target service provider, where the service invocation message includes the invoked target address information of the at least one network protocol version.
This step is for sending a service invocation message to the target service provider, the service invocation message comprising destination address information of the at least one network protocol version invoked. And sending a service calling message comprising the target address information of the called at least one network protocol version to the service provider to complete the service calling process.
In the technical solution provided in the embodiment of the present application, the service request message is used for requesting a target service provider to provide a service for the service requester by using target address information of a specified network protocol version, and the service call message is used for indicating the target service provider to provide a service for the service requester by using target address information of other network protocol versions except the specified network protocol version.
When a service request initiates a service call to a target service provider, the network protocol version of the target address information is irrelevant to the network protocol version of the service requester, and is only relevant to the target address information and the service address weight information of the service provider.
In this example of the present application, the service request message may be an IPv4 request or an IPv6 request; the service invocation message may be an IPv4 request or an IPv6 request. The IPv4 service request message can be called by IPv4 or IPv6 in service call; the IPv6 service request message may be an IPv4 call or an IPv6 call when the service call is made. The network protocol version of the service request message and the network protocol version of the service call message may or may not be identical, and the network protocol version used by the service request message does not affect the network protocol version used by the service call message.
The steps S201 to S204 provide a service invocation method, obtain a service request message sent by a service requester, determine a target service provider that can provide a service for the service request message, and if the target service provider has target address information of a plurality of network protocol versions and the target address information of the plurality of network protocol versions can provide a service for the service request message, select the target address information of at least one network protocol version from the target address information of the plurality of network protocol versions to provide a service for the service requester, send a service invocation message to the target service provider, where the service invocation message includes the target address information of the at least one invoked network protocol version. In this way, after obtaining the service request message sent by the service requester, determining a target service provider capable of providing service for the service request from a plurality of service providers, selecting at least one from the target address information of a plurality of network protocol versions of the target service provider to provide service for the service requester, and finally sending a service call message containing the target address information of the network protocol version to the target service provider to complete service call in a multi-stack network environment. In the above embodiment, a service calling method is provided, and correspondingly, the application also provides a service calling device.
Please refer to fig. 3, which is a schematic diagram of an embodiment of a service invocation apparatus according to the present application. Since this embodiment, i.e. the second embodiment, is substantially similar to the method embodiment, the description is relatively simple, and reference should be made to the description of the method embodiment for relevant points. The device embodiments described below are merely illustrative.
An obtaining unit 301, configured to obtain a service request message sent by a service requester;
a determining unit 302, configured to determine a target service provider that can provide a service for the service request message;
a selecting unit 303, configured to select, if the target service provider has target address information of multiple network protocol versions, and all of the target address information of the multiple network protocol versions can provide services for the service request message, target address information of at least one network protocol version from the target address information of the multiple network protocol versions to provide services for the service requester;
and a calling unit 304, configured to send a service calling message to the target service provider, where the service calling message includes target address information of the at least one called network protocol version.
Optionally, the determining a target service provider that can provide a service for the service request message includes:
a target service provider that can provide a service for the service request message is determined based on the service weight information of the plurality of service providers.
Optionally, the selecting the destination address information of at least one network protocol version from the destination address information of the plurality of network protocol versions provides a service for the service requester, including:
obtaining service address weight information corresponding to the target address information of the network protocol versions respectively;
and selecting target address information of at least one network protocol version according to the service address weight information to provide service for the service requester.
Optionally, if the target service provider provides target address information of only one network protocol version, selecting the target address information of the network protocol version to provide service for the service requester.
Optionally, if the target service provider has target address information of multiple network protocol versions, and only one of the target address information of the multiple network protocol versions can provide service for the service request, selecting the target address information that can provide service for the service request to provide service for the service requester.
Optionally, the service request message is used for requesting a target service provider to provide a service for the service requester by using the target address information of the designated network protocol version, and the service call message is used for instructing the target service provider to provide a service for the service requester by using the target address information of the other network protocol version except the designated network protocol version.
Optionally, the method further comprises: information of a service provider provided by a service registry is obtained, wherein the information of the service provider comprises target address information of a plurality of network protocol versions of the service provider.
Optionally, the information of the service provider further includes: service address weight information corresponding to the target address information of the plurality of network protocol versions, respectively.
A third embodiment of the present application provides a service registration method, and in the following, a detailed description is given of a service registration method provided by an embodiment of the present application with reference to fig. 4. Fig. 4 is a flowchart of a service registration method according to an embodiment of the present application. It should be noted that the steps illustrated in the flowchart may be performed in a computer system, such as a set of computer-executable instructions, and in some cases, the steps illustrated may be performed in a different logical order than illustrated in the flowchart.
As shown in fig. 4, a service registration method provided by an embodiment of the present application includes the following steps:
in step S401, service address information of a target service provider is obtained, where the service address information includes target address information of multiple network protocol versions, and the service provider can provide service for a service requester through the target address information of at least one network protocol version.
The step is used for obtaining service address information of a target service provider, wherein the service address information comprises target address information of a plurality of network protocol versions, and the service provider can provide service for a service requester through the target address information of at least one network protocol version.
Target address information of multiple network protocol versions of a target service provider is obtained, and the service provider can provide service for the service requester through the target address information of at least one network protocol version.
Step S402, a registration message for registering the information of the target service provider to the service registry is sent to the service registry, where the registration message includes target address information of multiple network protocol versions.
The method comprises the steps of sending a registration message for registering information of the target service provider to a service registration center, wherein the registration message comprises target address information of a plurality of network protocol versions.
And sending a registration message for registering the information of the target service provider to the service registration center, wherein the registration message comprises target address information of a plurality of network protocol versions. I.e. registering target address information of multiple network protocol versions of a target service provider to a service registry.
The service registration method provided by the application further comprises the following steps: obtaining service address weight information corresponding to the target address information of at least one network protocol version;
the registration message further includes service address weight information corresponding to the target address information of the at least one network protocol version.
In addition to registering the destination address information of the plurality of network protocol versions to the service registry, service address weight information corresponding to the destination address information may be registered to the service registry.
The obtaining service address weight information corresponding to the target address information of at least one network protocol version includes:
obtaining service weight information of the target service provider;
and obtaining service address weight information corresponding to the target address information of at least one network protocol version according to the service weight information of the target service provider.
The service registration method provided by the application further comprises the following steps: obtaining target address information of at least one network protocol version, and predicting proportion information of bearing service response in the service provider;
the obtaining service address weight information corresponding to the target address information of at least one network protocol version according to the service weight information of the target service provider includes: and according to the service weight information of the target service provider and the proportion information of the target address information of at least one network protocol version, which is expected to bear the service response quantity in the service provider, obtaining the service address weight information corresponding to the target address information of at least one network protocol version.
In one example, if the service weight information of the target service provider is 0.5, the target service provider has two network protocol versions of target address information, which are IPv4 address information and IPv6 address information in sequence, and the ratio information of the service response amounts expected to be borne by the two network protocol versions of target address information in the service provider is 1:4, the service address weight information of the IPv4 address information may be obtained as 0.1, and the service address weight information of the IPv6 address information may be obtained as 0.4.
The service address weight information is related to the service weight information of the target service provider, and is also related to the proportion of the target address information of the target service provider to bear service response in the service provider, and the sum of the service address weight information corresponding to the target address information of a plurality of network protocol versions of one target service provider is the service weight information of the target service provider.
The service weight information of the service provider is obtained in the service registration method provided by the application, which comprises the following steps:
obtaining computing capability information of the target service provider;
and obtaining service weight information of the target service provider according to the computing capacity information of the target service provider.
The service weight information of the service provider is an attribute characteristic of the service provider and is determined according to the computing capability of the service provider. The method comprises the steps of obtaining computing capability information of a target service provider, and obtaining service weight information of the target service provider according to the computing capability information of the target service provider.
According to the service registration method provided by the third embodiment of the application, the service address information of the target service provider is obtained, the service address information comprises target address information of a plurality of network protocol versions, the service provider can serve as a service requester through the target address information of at least one network protocol version, a registration message for registering the information of the target service provider to the service registration center is sent to the service registration center, and the registration message comprises the target address information of the plurality of network protocol versions. Because the service address information of the service provider includes the target address information of a plurality of network protocol versions, the service registration method provided by the embodiment of the application can register the target address information of a plurality of network protocol versions on the service registration center, and provide the target address information of a plurality of network protocol versions of the target service provider for the service calling method so as to meet the registration requirements of a plurality of target addresses of a single target service provider in a multi-stack network environment.
The service registration method provided in the third embodiment is from the perspective of a service provider, the service provider is the execution subject of the service registration method provided in the third embodiment, and the service provider sends a registration message to the service registration center, and the registration message includes destination address information of multiple network protocol versions of the destination service provider.
In the above embodiment, a service registration method is provided, and correspondingly, the application also provides a service registration device. Please refer to fig. 5, which is a schematic diagram of an embodiment of a service registration device of the present application. Since this embodiment, the fourth embodiment, is substantially similar to the method embodiment, the description is relatively simple, and reference will be made to the partial explanation of the method embodiment for the relevant points. The device embodiments described below are merely illustrative.
An obtaining unit 501, configured to obtain service address information of a target service provider, where the service address information includes target address information of multiple network protocol versions, and the service provider may provide a service for a service requester through the target address information of at least one network protocol version;
a sending unit 502, configured to send a registration message to a service registry for registering information of the target service provider to the service registry, where the registration message includes target address information of the multiple network protocol versions.
Optionally, obtaining service address weight information corresponding to the target address information of at least one network protocol version;
the registration message further includes service address weight information corresponding to the target address information of the at least one network protocol version.
Optionally, the obtaining service address weight information corresponding to the target address information of at least one network protocol version includes:
obtaining service weight information of the target service provider;
and obtaining service address weight information corresponding to the target address information of at least one network protocol version according to the service weight information of the target service provider.
Optionally, the obtaining the service weight information of the service provider includes:
obtaining computing capability information of the target service provider;
and obtaining service weight information of the target service provider according to the computing capacity information of the target service provider.
Optionally, obtaining target address information of at least one network protocol version, and predicting proportion information of bearing service response in the service provider;
the obtaining service address weight information corresponding to the target address information of at least one network protocol version according to the service weight information of the target service provider includes: and according to the service weight information of the target service provider and the proportion information of the target address information of at least one network protocol version, which is expected to bear the service response quantity in the service provider, obtaining the service address weight information corresponding to the target address information of at least one network protocol version.
The fifth embodiment of the present application further provides a service registration method, and in the following, another service registration method provided by the embodiment of the present application will be described in detail with reference to fig. 6. Fig. 6 is a flowchart of another service registration method according to an embodiment of the present application. It should be noted that the steps illustrated in the flowchart may be performed in a computer system, such as a set of computer-executable instructions, and in some cases, the steps illustrated may be performed in a different logical order than illustrated in the flowchart.
The service registration method provided by the fifth embodiment is from the viewpoint of a service registration center, which is an execution subject of the service registration method provided by the fifth embodiment, registering information of a service providing direction to the service registration center.
As shown in fig. 6, a service registration method provided by an embodiment of the present application includes the following steps:
in step S601, a registration message sent by a target service provider and used for registering information of the target service provider to a service registration center is obtained, where the registration message includes service address information of the target service provider, and the service address information includes target address information of multiple network protocol versions.
The method comprises the steps of obtaining a registration message sent by a target service provider and used for registering information of the target service provider to a service registration center, wherein the registration message comprises service address information of the target service provider, and the service address information comprises target address information of a plurality of network protocol versions.
Step S602, registering the information of the target service provider to the service registry, where the information of the target service provider includes target address information of the multiple network protocol versions.
The method includes registering information of the target service provider to the service registry, wherein the information of the target service provider includes target address information of the plurality of network protocol versions.
That is, destination address information of a plurality of network protocol versions of a destination service provider is registered with a service registry.
The service registration method provided by the embodiment of the application, the information of the target service provider further comprises: service address weight information corresponding to the target address information of at least one network protocol version.
The information of the target service provider comprises the service weight information of the service provider in addition to the target address information of a plurality of network protocol versions.
After the service registration center finishes the information registration of the target service provider, the information of the target service provider registered in the service registration center is sent to the service calling party, so that the service calling party can call the target service provider according to the information of the target service provider, and service is provided for the service requesting party.
In the service registration method provided by the fifth embodiment of the present application, a registration message sent by a target service provider and used for registering information of the target service provider to a service registration center is obtained, where the registration message includes service address information of the target service provider, and the service address information includes target address information of multiple network protocol versions; registering information of the target service provider to the service registration center, wherein the information of the target service provider comprises target address information of the network protocol versions. According to the service registration method provided by the embodiment of the application, as the service address information of the service provider comprises the target address information of a plurality of network protocol versions, the target address information of the network protocol versions can be registered on the service registration center, and the target address information of the network protocol versions of the target service provider is provided for the service calling method.
In the above embodiment, a service registration method is provided, and correspondingly, the application also provides a service registration device. Please refer to fig. 7, which is a diagram illustrating an embodiment of a service registration apparatus according to the present application. Since this embodiment, i.e., the sixth embodiment, is substantially similar to the method embodiment, the description is relatively simple, and reference will be made to the description of the method embodiment for relevant points. The device embodiments described below are merely illustrative.
An obtaining unit 701, configured to obtain a registration message sent by a target service provider and used for registering information of the target service provider to a service registration center, where the registration message includes service address information of the target service provider, and the service address information includes target address information of multiple network protocol versions;
a registration unit 702, configured to register information of the target service provider to the service registry, where the information of the target service provider includes target address information of the multiple network protocol versions.
Optionally, the information of the target service provider further includes: service address weight information corresponding to the target address information of at least one network protocol version.
Optionally, the information of the target service provider further includes: service weight information of the service provider.
Optionally, the method further comprises: and sending the information of the target service provider registered in the service registration center to a service calling party.
A seventh embodiment of the present application provides a health check method, and in the following, a detailed description of the health check method provided by the embodiment of the present application is given with reference to fig. 8. Fig. 8 is a flowchart of a health checking method according to an embodiment of the present application. It should be noted that the steps illustrated in the flowchart may be performed in a computer system, such as a set of computer-executable instructions, and in some cases, the steps illustrated may be performed in a different logical order than illustrated in the flowchart.
In step S801, service address information of a target service provider registered in a service registry is obtained, where the service address information includes target address information of multiple network protocol versions, and the service provider can provide a service for a service requester through the target address information of at least one network protocol version.
The step is used for obtaining service address information of a target service provider registered in a service registration center, wherein the service address information comprises target address information of a plurality of network protocol versions, and the service provider can provide service for a service requester through the target address information of at least one network protocol version.
Step S802, performing health check on the available state of the service address information of the target service provider, and obtaining a check result of the available state of the service address information.
The method comprises the steps of carrying out health check on the available state of the service address information of the target service provider, and obtaining a check result of the available state of the service address information.
The health check on the available state of the service address information of the target service provider includes:
sending detection information to a service address of the service address information;
judging whether the response characteristic of the service address aiming at the detection information accords with a preset response characteristic, if so, determining that the service address is available, otherwise, determining that the service address is unavailable.
The health check of the availability status of the service address information of the target service provider may be performed by means of probing, i.e. by periodically polling probing all service addresses of the service provider, e.g. once at fixed intervals, and if several consecutive probing fails, indicating that the service address is not available.
The health check on the available state of the service address information of the target service provider may be that when the service caller discovers the service request message sent to a certain service address for several times, the service request cannot complete service call, and the service address may be considered to be faulty, and the service address is not available.
The health check on the available state of the service address information of the target service provider may also be that the service provider provides an interactive heartbeat to the registry at a timing, and if the interactive heartbeat is in a normal state, the service address information of the target service provider is indicated to be available. The health check for the available state of the service address information of the target service provider, to obtain the check result of the service address information, includes:
and if the checking result of the service address information of the target service provider indicates that the service addresses of the target service provider are all in an unavailable state, removing the target service provider.
And carrying out health check on the available state of the service address information of the target service provider, wherein the service address information of the target service provider is the service address information of a plurality of network protocol versions, checking the service address information of each network protocol version of the target service provider, and if the checking result of each service address information shows that each service address information is unavailable, directly removing the target service provider.
The health check is performed on the available state of the service address information of the target service provider, and a check result of the service address information is obtained, and the method further comprises:
and if the fact that the service address of the target service provider is in the available state is judged by the checking result of part of the service address information in the service address information of the target service provider, the service provider adjusts the service address weight information according to the original service address weight information of the service address information in the available state.
And if the fact that the service address information of the target service provider has the checking result of partial service address information indicates that the service address of the target service provider is in an unavailable state is judged, the service address information in the unavailable state is not subjected to service response in the service provider.
If the checking result of partial service address information is available in the plurality of service address information of the target service provider, and the checking result of partial service address information is unavailable, the service address information in an unavailable state does not bear service response quantity in the service provider, and at the moment, the original service address weight information is invalid, and the service address weight information is redistributed according to the service address weight information of the available target address information.
In one example, if the target service provider has IPv4 service address information and IPv6 service address information, the service weight information of the target service provider is 0.5, the service weight information of the IPv4 service address information is 0.1, the service weight information of the IPv6 service address information is 0.4, and if the IPv6 service address information is found to be unavailable by performing health check on the service address information, only the IPv4 service address information is available in the target service provider at this time, the originally allocated service weight information fails, and for the target service provider, the service weight information of the IPv4 service address information is the service weight information 0.5 of the target service provider, and the service weight information is used as available service weight information, and is provided for the service requester through the service weight information.
The health checking method provided by the embodiment of the application is applied to the service registration center, and after the service registration center obtains the checking result of the available state of the service address information, the checking result is sent to the service calling party to complete the service calling work in cooperation with the service calling party.
The health checking method provided by the application obtains the service address information of a target service provider, wherein the service address information comprises target address information of a plurality of network protocol versions, and the service provider can provide service for a service requester through the target address information of at least one network protocol version; and carrying out health check on the available state of the service address information of the target service provider to obtain a check result of the available state of the service address information. According to the technical scheme of health examination, the service address information of the target service provider comprises the target address information of a plurality of network protocol versions, and the target address information of the plurality of network protocol versions is examined, so that the available target address information of the plurality of network protocol versions of the target service provider can be better provided for the service calling method.
In the above embodiment, a health method is provided, and correspondingly, the application also provides a health checking device. Please refer to fig. 9, which is a schematic diagram of a health device according to an embodiment of the present application. Since this embodiment, the eighth embodiment, is substantially similar to the method embodiment, the description is relatively simple, and the relevant points are referred to in the description of the method embodiment. The device embodiments described below are merely illustrative.
An obtaining unit 901, configured to obtain service address information of a target service provider registered in a service registry, where the service address information includes target address information of multiple network protocol versions, and the service provider may provide a service for a service requester through at least one of the target address information of the network protocol versions;
and the checking unit 902 is configured to perform health check on the available state of the service address information of the target service provider, and obtain a check result of the available state of the service address information.
Optionally, the health check on the available state of the service address information of the target service provider includes:
Sending detection information to a service address of the service address information;
judging whether the response characteristic of the service address aiming at the detection information accords with a preset response characteristic, if so, determining that the service address is available, otherwise, determining that the service address is unavailable.
Optionally, the health check is performed on the available state of the service address information of the target service provider, and a check result of the service address information is obtained, including:
and if the checking result of the service address information of the target service provider indicates that the service addresses of the target service provider are all in an unavailable state, removing the target service provider.
Optionally, the health check is performed on the available state of the service address information of the target service provider, and a check result of the service address information is obtained, and further includes:
and if the fact that the service address of the target service provider is in the available state is judged by the checking result of part of the service address information in the service address information of the target service provider, the service provider adjusts the service address weight information according to the original service address weight information of the service address information in the available state.
Optionally, the health check is performed on the available state of the service address information of the target service provider, and a check result of the service address information is obtained, and further includes:
and if the fact that the service address information of the target service provider has the checking result of partial service address information indicates that the service address of the target service provider is in an unavailable state is judged, the service address information in the unavailable state is not subjected to service response in the service provider.
In order to more clearly understand the present application, the technical solutions provided by the embodiments of the present application are described below with reference to fig. 10 and 11. FIG. 10 is a block diagram of an embodiment of the present application; FIG. 11 is a schematic diagram of a load balancing process in a service call. Where the IPv4 network protocol version and the IPv6 network protocol version are currently commonly used network protocol versions, the subsequent use of higher level network protocol versions is not precluded.
The service requester 1001 is a client, and specifically may be an application client, a browser client, an instant messaging client, or the like. The client is installed on an intelligent terminal with a network connection function, and the intelligent terminal can be a smart phone, a tablet computer, a notebook computer, a touch screen, a personal computer (Personal Computer, PC), a personal digital assistant (Personal Digital Assistant, PDA) and the like. The user sends a service request message to a service caller by using a client of the intelligent terminal, the service caller may be a gateway 1003, and the sent service request message may be a service request message 10021 of an IPv4 network protocol version or a service request message 10022 of an IPv6 network protocol version. The gateway 1003 converts the service request message sent by the service requester 1001 into a back-end call of the service caller, and the service request message of the IPv4 network protocol version can be converted into target address information of the IPv4 network protocol version or into target address information of the IPv6 network protocol version; the service request message of the IPv6 network protocol version can be converted into the target address information of the IPv4 network protocol version, and also can be converted into the target address information of the IPv6 network protocol version. The service invoker, i.e., the gateway 1003, has the load balancing system 1004 integrated therein, and the gateway 1003 also includes service address information, service weight information, and service address weight information 1007 of the service provider 1006 obtained from the service registry 1005. The gateway 1003 determines a target address of a target service provider that provides a service for the service request, based on the service address information, the service weight information, the service address weight information 1007, and the load balancing system 1004 of the service provider 1006. The gateway 1003 further sends a service request to the target service provider, which may be a service request message 10021 of the IPv4 network protocol version or a service request message 10022 of the IPv6 network protocol version. The gateway 1003 responds to the IPv4 request or IPv6 request of the target service provider, i.e., IPv4 response 10081 or IPv6 response 10082, and the service requester 1001 responds to the IPv4 request or IPv6 request of the gateway 1003, i.e., IPv4 response 10081 or IPv6 response 10082, to provide the service to the service requester 1001.
As shown in fig. 11, a flow chart of the load balancing process is shown. Step 1101, the load balancing system obtains information of the service provider from the service registry; step S1102, selecting a target service provider capable of providing a service from the service providers according to the service weight information of each service provider; step S1103, determining whether the target service provider has target address information of multiple network protocol versions; step S1104, if yes, discovering that the target address information of multiple network protocol versions can provide service for the service request message through health check; step S1105, selecting a network protocol version of target address information to provide service for a service requester according to the service address weight information corresponding to the target address information; in step S1106, a service call message is sent to the target service provider, where the service call message includes the target address information of the called network protocol version.
Step S1107, after step S1103, of determining that the target service provider does not have the target address information of multiple network protocol versions, where the target service provider has only the target address information of one network protocol version; in step S1106, a service call message is sent to the target service provider, where the service call message includes the target address information of the network protocol version.
Step S1108, after step S1104, the health check finds that only the target address information of one network protocol version can provide service for the service request message; in step S1106, a service call message is sent to the target service provider, where the service call message includes target address information of the service to be provided.
In addition to completing the service call to the service request message through the load balancing system as described above, a service registration 1010 is required for the newly added service provider of the service provider. When a newly added service provider is online, registration of relevant information such as service address information, service weight information, service address weight information 1007, and the like of the service provider 1006 is completed in the service registry 1005. The gateway 1003 obtains the related information of the service provider registered in the service registration center 1003, and performs health check and weight update on the service address information of the service provider 1006. Specifically, the response characteristic of the service address to the detection information can be judged whether to conform to the preset response characteristic by sending the detection information to the service address of the service address information, if so, the service address is determined to be available, otherwise, the service address is determined to be unavailable. If judging that the service addresses of the target service provider are not available, directly moving out of the target service provider; and if the target service provider is judged to have available part of service addresses and the other part of service addresses are not available, adjusting the service address weight information of the service addresses, namely updating the weight of the service address weight information. By the method, service call under the multi-stack network environment is completed.
An electronic device according to a ninth embodiment of the present application is shown in fig. 12, which is a schematic diagram of the electronic device according to the present application. The electronic device includes:
a processor 1201;
the method comprises the steps of,
a memory 1202 for storing a computer program, the apparatus executing the method according to any one of the first, third, fifth and seventh embodiments after the computer program is executed by the processor.
A tenth embodiment of the present application provides a computer storage medium storing a computer program to be executed by a processor to perform the method according to any one of the first, third, fifth and seventh embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
It should be noted that, in the embodiment of the present application, the use of user data may be involved, and in practical application, the user specific personal data may be used in the solution described herein within the scope allowed by the applicable legal regulations in the country under the condition of meeting the applicable legal regulations in the country (for example, the user explicitly agrees to the user to notify practically, etc.).
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
1. Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer readable media, as defined herein, does not include non-transitory computer readable media (transmission media), such as modulated data signals and carrier waves.
2. It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
While the application has been described in terms of preferred embodiments, it is not intended to be limiting, but rather, it will be apparent to those skilled in the art that various changes and modifications can be made herein without departing from the spirit and scope of the application as defined by the appended claims.

Claims (18)

1. A service invocation method for a service caller, the method comprising:
obtaining a service request message sent by a service requester;
determining a target service provider that can provide a service for the service request message;
if the target service provider has a plurality of network protocol versions of target address information, and all of the plurality of network protocol versions of target address information are available to provide service for the service request message, selecting at least one network protocol version of target address information from the plurality of network protocol versions of target address information to provide service for the service requester, comprising: obtaining service address weight information corresponding to the target address information of the network protocol versions; selecting target address information of at least one network protocol version according to the service address weight information to provide service for the service requester; the service address weight information is obtained according to the service weight information of a target service provider and the proportion information of at least one network protocol version, which is expected to bear the service response in the service provider;
Sending a service invocation message to the target service provider, the service invocation message including destination address information of the at least one invoked network protocol version;
the service request message is used for requesting a target service provider to provide services for the service requester by using target address information of a designated network protocol version, and the service call message is used for indicating the target service provider to provide services for the service requester by using target address information of other network protocol versions except the designated network protocol version.
2. The service invocation method of claim 1, wherein said determining a target service provider that can provide a service for said service request message comprises:
a target service provider that can provide a service for the service request message is determined based on the service weight information of the plurality of service providers.
3. The service invocation method of claim 1, wherein if the target service provider provides target address information of only one network protocol version, selecting the target address information of the network protocol version to provide service for the service requester.
4. The service invocation method of claim 1, wherein if the target service provider has a plurality of network protocol versions of target address information, and only one of the plurality of network protocol versions of target address information is available to provide service for the service request, selecting the service-request-available target address information to provide service for the service request provider.
5. The service invocation method of claim 1, wherein the method further comprises:
information of a service provider provided by a service registry is obtained, wherein the information of the service provider comprises target address information of a plurality of network protocol versions of the service provider.
6. The service invocation method of claim 5, wherein the service provider information further comprises: service address weight information corresponding to the target address information of the plurality of network protocol versions, respectively.
7. A service registration method, applied to a service provider, comprising:
obtaining service address information of a target service provider, wherein the service address information comprises target address information of a plurality of network protocol versions, and the service provider can provide service for a service requester through the target address information of at least one network protocol version;
Transmitting a registration message for registering information of the target service provider to a service registry, the registration message including target address information of the plurality of network protocol versions;
further comprises: obtaining service address weight information corresponding to the target address information of at least one network protocol version; the registration message further includes service address weight information corresponding to the target address information of the at least one network protocol version;
obtaining the destination address information of the at least one network protocol version, including: obtaining service address weight information corresponding to the target address information of the network protocol versions; selecting target address information of at least one network protocol version according to the service address weight information to provide service for the service requester; the service address weight information is obtained according to the service weight information of a target service provider and the proportion information of at least one network protocol version, which is expected to bear the service response quantity, in the service provider.
8. The service registration method according to claim 7, wherein obtaining service address weight information corresponding to destination address information of at least one network protocol version, comprises:
Obtaining service weight information of the target service provider;
and obtaining service address weight information corresponding to the target address information of at least one network protocol version according to the service weight information of the target service provider.
9. The service registration method according to claim 8, wherein the obtaining service weight information of the service provider includes:
obtaining computing capability information of the target service provider;
and obtaining service weight information of the target service provider according to the computing capacity information of the target service provider.
10. The service registration method according to claim 8, further comprising: obtaining target address information of at least one network protocol version, and predicting proportion information of bearing service response in the service provider;
the obtaining service address weight information corresponding to the target address information of at least one network protocol version according to the service weight information of the target service provider includes: and according to the service weight information of the target service provider and the proportion information of the target address information of at least one network protocol version, which is expected to bear the service response quantity in the service provider, obtaining the service address weight information corresponding to the target address information of at least one network protocol version.
11. A service registration method, applied to a service registry, the method comprising:
obtaining a registration message sent by a target service provider and used for registering information of the target service provider to a service registration center, wherein the registration message comprises service address information of the target service provider, and the service address information comprises target address information of a plurality of network protocol versions;
registering information of the target service provider to the service registration center, wherein the information of the target service provider comprises target address information of the network protocol versions; the information of the target service provider further includes: service address weight information corresponding to the target address information of at least one network protocol version; the information of the target service provider further includes: service weight information of the target service provider;
wherein obtaining the destination address information of the at least one network protocol version includes: obtaining service address weight information corresponding to the target address information of the network protocol versions; selecting target address information of at least one network protocol version according to the service address weight information to provide service for the service requester; the service address weight information is obtained according to the service weight information of a target service provider and the proportion information of at least one network protocol version, which is expected to bear the service response quantity, in the service provider.
12. The service registration method according to claim 11, characterized in that the method further comprises:
and sending the information of the target service provider registered in the service registration center to a service calling party.
13. A method of health checking, for application to a service registry, the method comprising:
obtaining service address information of a target service provider registered in a service registration center, wherein the service address information comprises target address information of a plurality of network protocol versions, and the service provider can provide service for a service requester through the target address information of at least one network protocol version; obtaining the destination address information of the at least one network protocol version, including: obtaining service address weight information corresponding to the target address information of the network protocol versions; selecting target address information of at least one network protocol version according to the service address weight information to provide service for the service requester; the service address weight information is obtained according to the service weight information of a target service provider and the proportion information of at least one network protocol version, which is expected to bear the service response in the service provider;
Health examination is carried out on the available state of the service address information of the target service provider, and an examination result of the available state of the service address information is obtained, wherein the health examination comprises the following steps: sending detection information to a service address of the service address information; judging whether the response characteristic of the service address aiming at the detection information accords with a preset response characteristic, if so, determining that the service address is available, otherwise, determining that the service address is unavailable; wherein the probe information transmitted includes a timed poll probe for service address information of the target service provider.
14. The health check method as set forth in claim 13, wherein the health check of the availability status of the service address information of the target service provider, obtaining the check result of the service address information, includes:
and if the checking result of the service address information of the target service provider indicates that the service addresses of the target service provider are all in an unavailable state, removing the target service provider.
15. The health check method as set forth in claim 13, wherein the health check of the availability status of the service address information of the target service provider, obtaining the check result of the service address information, further includes:
And if the fact that the service address of the target service provider is in the available state is judged by the checking result of part of the service address information in the service address information of the target service provider, the service provider adjusts the service address weight information according to the original service address weight information of the service address information in the available state.
16. The health check method as set forth in claim 13, wherein the health check of the availability status of the service address information of the target service provider, obtaining the check result of the service address information, further includes:
and if the fact that the service address information of the target service provider has the checking result of partial service address information indicates that the service address of the target service provider is in an unavailable state is judged, the service address information in the unavailable state is not subjected to service response in the service provider.
17. An electronic device, comprising: a processor, a memory, and computer program instructions stored on the memory and executable on the processor; the processor, when executing the computer program instructions, implements the service invocation method of any of the above claims 1-6, the service registration method of any of the claims 7-10, the service registration method of any of the claims 11-12, or the health check method of any of the claims 13-16.
18. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein computer executable instructions for implementing the service invocation method according to any of the preceding claims 1-6, the service registration method according to any of the claims 7-10, the service registration method according to any of the claims 11-12 or the health check method according to any of the claims 13-16 when executed by a processor.
CN202310200367.7A 2023-02-27 2023-02-27 Service calling method and device, service registration method and device Active CN116074386B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310200367.7A CN116074386B (en) 2023-02-27 2023-02-27 Service calling method and device, service registration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310200367.7A CN116074386B (en) 2023-02-27 2023-02-27 Service calling method and device, service registration method and device

Publications (2)

Publication Number Publication Date
CN116074386A CN116074386A (en) 2023-05-05
CN116074386B true CN116074386B (en) 2023-09-26

Family

ID=86178580

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310200367.7A Active CN116074386B (en) 2023-02-27 2023-02-27 Service calling method and device, service registration method and device

Country Status (1)

Country Link
CN (1) CN116074386B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101262445A (en) * 2008-04-10 2008-09-10 国家广播电影电视总局广播科学研究院 Stream media server and realization method for self-adaptability to IPv4/IPv6
CN101651718A (en) * 2009-08-27 2010-02-17 中国电信股份有限公司 Method and system for changing IP flow protocol stack
CN101815104A (en) * 2010-03-19 2010-08-25 中兴通讯股份有限公司 Network protocol address feedback method and domain name resolution server
CN102546845A (en) * 2010-12-17 2012-07-04 中国移动通信集团公司 Business access method, device and system
CN112583952A (en) * 2020-12-09 2021-03-30 北京金山云网络技术有限公司 Redirection scheduling processing method, device and system, related equipment and storage medium
CN113452811A (en) * 2021-08-30 2021-09-28 阿里巴巴达摩院(杭州)科技有限公司 Data communication method, device, computer storage medium and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102075445B (en) * 2011-02-28 2013-12-25 杭州华三通信技术有限公司 Load balancing method and device
CN102833362B (en) * 2012-08-16 2018-01-09 中兴通讯股份有限公司 The collocation method of dns server and the drive device of wireless data access equipment
CN102938940A (en) * 2012-11-02 2013-02-20 中兴通讯股份有限公司 Wireless data terminal and method for supporting internet protocol version 4 (IPv4)/internet protocol version 6 (IPV6) double stacks
US9185071B2 (en) * 2012-12-31 2015-11-10 Telefonaktiebolaget L M Ericsson (Publ) Methods and systems for seamless network communications between devices running internet protocol version 6 and internet protocol version 4

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101262445A (en) * 2008-04-10 2008-09-10 国家广播电影电视总局广播科学研究院 Stream media server and realization method for self-adaptability to IPv4/IPv6
CN101651718A (en) * 2009-08-27 2010-02-17 中国电信股份有限公司 Method and system for changing IP flow protocol stack
CN101815104A (en) * 2010-03-19 2010-08-25 中兴通讯股份有限公司 Network protocol address feedback method and domain name resolution server
CN102546845A (en) * 2010-12-17 2012-07-04 中国移动通信集团公司 Business access method, device and system
CN112583952A (en) * 2020-12-09 2021-03-30 北京金山云网络技术有限公司 Redirection scheduling processing method, device and system, related equipment and storage medium
CN113452811A (en) * 2021-08-30 2021-09-28 阿里巴巴达摩院(杭州)科技有限公司 Data communication method, device, computer storage medium and system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Ericsson, ST-Ericsson / Christer.C1-100900 "DTMF Info Package definition".3GPP tsg_cn\wg1_mm-cc-sm_ex-cn1.2010,(tsgc1_63_san-francisco),全文. *
Nokia, Nokia Siemens Networks.S2-083208 "23.401 CR0196R1: Signalling of PDN Address Policy during Attach and UE Requested PDN Connectivity".3GPP tsg_sa\WG2_Arch.2008,(TSGS2_65_Prague),全文. *
吴贤国 ; 刘敏 ; 李忠诚 ; .面向NAT用户的IPv6隧道技术研究.计算机学报.2007,(01),全文. *

Also Published As

Publication number Publication date
CN116074386A (en) 2023-05-05

Similar Documents

Publication Publication Date Title
CN109547570B (en) Service registration method, device, registration center management equipment and storage medium
US7366523B2 (en) Method and system for providing location-based services
JP4762658B2 (en) Method and apparatus for providing distributed SLF routing functionality in an internet multimedia subsystem (IMS) network
US7263086B2 (en) Method and system for providing location-based services in multiple coverage area environments
US9277490B2 (en) System and method of locating wireless connection among a plurality of wireless connections
TW201029422A (en) Methods, apparatuses, and computer program products for determining a network interface to access a network resource
CN105791344A (en) Grayscale release service processing method, system, load balancer and service bus device
KR20120087857A (en) Method and apparatus for determining a server which should respond to a service request
CN108256069A (en) A kind of method and apparatus of the cross-domain access of the page
CN112565406B (en) Gray release method, gray release system and electronic equipment
CN107872548A (en) Web page interlinkage method, apparatus and readable storage medium storing program for executing
CN107172214A (en) A kind of service node with load balancing finds method and device
KR100901281B1 (en) Method for ubiquitous web service
CN111556135A (en) Request scheduling method, system and device and electronic equipment
CN110677475A (en) Micro-service processing method, device, equipment and storage medium
CN114244654A (en) URL forwarding method, device, equipment and computer storage medium
CN112637126B (en) Service registration method and Pod
CN113608877A (en) Load balancing scheduling method for IPV4 and IPV6 resource pools of content providers
CN116074386B (en) Service calling method and device, service registration method and device
CN110830492B (en) Method and system for mutually scheduling edge applications based on CoreDNS registration service
CN115277816B (en) Service adaptation method, device, system and computer readable medium
US7743091B2 (en) Context management system for a network including a heterogenous set of terminals
CN111262779A (en) Method, device, server and system for acquiring data in instant messaging
CN108124021A (en) Internet protocol IP address obtains, the method, apparatus and system of website visiting
JP2008134914A (en) Composite service providing system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant