Service calling method and device, storage medium and program product

Through the service identification combination of the registration server and the load binding server, the load address is obtained and the service request is forwarded, which solves the service call failure caused by the registration center failure or network exception in the distributed system, and realizes the high reliability and effectiveness of service calls sex.

CN119052242AActive Publication Date: 2024-11-29CHINA CONSTRUCTION BANK +1

Patent Information

Application Number
CN202411102418.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-29
Estimated Expiration
2044-08-12

AI Technical Summary

Technical Problem

In a distributed system, when the service registration center fails or network exceptions, the prior art cannot effectively handle it, resulting in the failure of the service call.

Method used

By setting up the service identification registration server and the load binding server, obtain the load address of the service provider, and forward service requests to the appropriate service instance based on the load balancing policy, reducing dependence on the registry center.

Benefits of technology

When the registration center is abnormal, service calls can be made normally, improving the effectiveness and reliability of service calls, and reducing dependence on the registration center.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119052242A_ABST
    Figure CN119052242A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a service calling method and device, a storage medium and a program product, and relates to the field of distributed technologies. The method comprises the steps of obtaining a service request, analyzing the service request to obtain a service identifier, and if a service list corresponding to the service request is not obtained from a registration center, sending an address query request to a service identifier registration server according to the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier, and sending the service request to a load binding server corresponding to the load address, so as to send the service request to a first target service instance in a plurality of service instances bound by the load binding server based on a first load balancing strategy through the load binding server, thereby enabling the first target service instance to process the service request. According to the method, the effectiveness of service calling can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of distributed technology, and in particular, to a service calling method, device, storage medium, and program product. Background Art

[0002] In a distributed system, service registration and discovery, and inter-service communication are very important links.

[0003] In the related technology, multiple services and registration centers are set up in a distributed system. In order to realize communication between services, the service provider registers the service instance in the registration center at startup. When the service initiator needs to make a service call to the service provider, it queries and obtains a service list containing at least one service instance from the registration center.

[0004] However, in the process of implementing this application, the inventors found that there are at least the following problems in the prior art: the above method is heavily dependent on the service registration center. When the service registration center fails or the network between the service requester and the registration center is abnormal, or the network between the service receiver and the registration center is abnormal, causing the service to go offline, the above method cannot be effectively handled. Summary of the invention

[0005] The embodiments of the present application provide a service calling method, device, storage medium and program product to improve the effectiveness of service calling.

[0006] In a first aspect, an embodiment of the present application provides a service calling method, including:

[0007] Obtaining a service request; parsing the service request to obtain a service identifier; the service identifier is a unique identifier of the service provider;

[0008] If the service list corresponding to the service request is not obtained from the registration center, an address query request is sent to the service identification registration server according to the service identification, so that the service identification registration server returns the load address corresponding to the service identification according to the address query request; the service identification registration server is used to establish a one-to-one correspondence between the service identification and the load address; the load address is the address of the corresponding load binding server;

[0009] The service request is sent to the load binding server corresponding to the load address, so that the load binding server sends the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0010] In a possible design, if the service identifier includes a service domain name corresponding to a service provider; sending an address query request to a service identifier registration server according to the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier according to the address query request; the service identifier registration server is used to establish a one-to-one correspondence between the service identifier and the load address, including:

[0011] The load address corresponding to the service domain name is obtained from the service identification registration server according to the service domain name; the service identification registration server is used to establish a one-to-one correspondence between the service domain name and the load address.

[0012] In a possible design, if the service identifier includes a port and a service domain name corresponding to the service provider; sending an address query request to a service identifier registration server according to the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier according to the address query request; the service identifier registration server is used to establish a one-to-one correspondence between the service identifier and the load address, including:

[0013] The load address corresponding to the service domain name and the port is obtained from the service identification registration server according to the service domain name and the port, and the service identification registration server is used to establish a one-to-one correspondence between the combination of the service domain name and the port and the load address.

[0014] In a possible design, the service identifier includes a service domain name, and the step of parsing the service request to obtain the service identifier includes:

[0015] Adding the relevant information of the service request to the corresponding context object through the request information encapsulator;

[0016] If the context object does not include a service domain name but includes a service name, then based on a preset rule, constructing a service domain name according to the service name;

[0017] If the context object includes a service domain name, the service domain name is obtained from the context object.

[0018] In a possible design, sending an address query request to a service identifier registration server according to the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier according to the address query request, includes:

[0019] Constructing a virtual service instance according to the service identifier;

[0020] Based on the virtual service instance, a service request is initiated and processed;

[0021] During the service request initiation process, an address query request is sent to a service identifier registration server according to the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier according to the address query request.

[0022] In a possible design, after obtaining the service request initiated by the service initiator, the process further includes:

[0023] Parsing the service request to obtain address information; the address information includes at least one of the following: a load address corresponding to the service provider, and an address of a service instance provided by the service provider;

[0024] If the service list corresponding to the service request is not obtained from the registration center, a third target service instance is determined according to the address information, and the service request is sent to the third target service instance so that the third target service instance processes the service request.

[0025] In a possible design, determining the third target service instance according to the address information includes:

[0026] If the address information includes a load address corresponding to the service provider, the service request is sent to a load binding server corresponding to the load address, so as to determine a third target service instance through the load binding server based on the first load balancing strategy;

[0027] If the address information includes the address of a service instance provided by the service provider, the service instance corresponding to the address is determined as the third target service instance.

[0028] In one possible design, the method further includes:

[0029] Sending a query request to the registration center according to the service identifier;

[0030] Receiving a service list returned by the registration center according to the query request; the service list includes at least one service instance provided by the service provider corresponding to the service identifier;

[0031] Determine a second target service instance from the service list based on a second load balancing strategy;

[0032] The service request is sent to the second target service instance, so that the second target service instance processes the service request.

[0033] In one possible design, determining the second target service instance from the service list based on the second load balancing strategy includes:

[0034] If the number of service instances in the service list is greater than 1, obtain the previous position index, and modulo the length of the service list according to the previous position index to obtain the current position index;

[0035] A second target service instance is determined from the service list according to the current location index.

[0036] In a second aspect, an embodiment of the present application provides a service calling method, including:

[0037] The receiving service initiator sends an address query request according to the service identifier when the service initiator fails to obtain the service list corresponding to the service request from the registration center; the service identifier is obtained by the service initiator by parsing the obtained service request; the service identifier is a unique identifier of the service provider;

[0038] Determine the load address corresponding to the service identifier according to the address query request;

[0039] The load address is sent to the service initiator so that the service initiator sends the service request to the load binding server corresponding to the load address, and the load binding server sends the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0040] In a possible design, before receiving the address query request sent by the service initiator according to the service identifier, the method further includes:

[0041] Receive a registration request sent by a load binding server corresponding to a service provider; the registration request includes a load address corresponding to the load binding server and a service identifier corresponding to the service provider;

[0042] According to the registration request, a corresponding relationship between the service identifier corresponding to the service provider and the load address is established.

[0043] In a possible design, before receiving the address query request sent by the service initiator according to the service identifier, the method further includes:

[0044] In response to a touch operation on the registration interface, a registration request is generated; the registration request includes a load address corresponding to the load binding server and a service identifier corresponding to the service provider;

[0045] According to the registration request, a corresponding relationship between the service identifier corresponding to the service provider and the load address is established.

[0046] In a third aspect, an embodiment of the present application provides a service calling device, including:

[0047] Receive a service request sent by a service initiator based on a load address; the load address is obtained by the service initiator from a service identification registration server according to a service identification when the service initiator fails to obtain a service list corresponding to the service request from a registration center; the service identification is obtained by the service initiator by parsing the obtained service request; the load address is the address of the server bound to the corresponding load

[0048] Based on the first load balancing strategy, the service request is sent to the first target service instance among the multiple service instances bound to the load binding server, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0049] In a possible design, before receiving the service request sent by the service initiator based on the load address, the method further includes:

[0050] Receiving a binding request sent by a service provider; the binding request includes addresses of multiple service instances provided by the service provider;

[0051] According to the binding request, the addresses of the multiple service instances provided by the service provider are bound to the address of the load binding server.

[0052] In a possible design, before receiving the service request sent by the service initiator based on the load address, the method further includes:

[0053] In response to a touch operation on the binding interface, generating a binding request; the binding request includes addresses of multiple service instances provided by the service provider;

[0054] According to the binding request, the addresses of the multiple service instances provided by the service provider are bound to the address of the load binding server.

[0055] In one possible design, the method further includes:

[0056] Based on a preset period, a binding confirmation message is sent to a service provider, so that the service provider compares the binding confirmation message with the addresses of the multiple service instances currently provided, and if they are inconsistent, returns the current addresses of the multiple service instances currently provided; the binding confirmation message includes the addresses of the multiple service instances bound to the load binding server;

[0057] The current address sent by the service provider is received, and the current address is bound to the address of the load binding server.

[0058] In a fourth aspect, an embodiment of the present application provides a service initiating device, including:

[0059] The acquisition module is used to acquire a service request; parse the service request to obtain a service identifier; the service identifier is a unique identifier of the service provider;

[0060] The first sending module is used to send an address query request to a service identification registration server according to the service identification if the service list corresponding to the service request is not obtained from the registration center, so that the service identification registration server returns the load address corresponding to the service identification according to the address query request; the service identification registration server is used to establish a one-to-one correspondence between the service identification and the load address; the load address is the address of the corresponding load binding server;

[0061] The first sending module is also used to send the service request to the load binding server corresponding to the load address, so that the service request can be sent to the first target service instance among the multiple service instances bound to the load binding server through the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0062] In a fifth aspect, an embodiment of the present application provides a service identification registration server, including:

[0063] A first receiving module is used to receive an address query request sent by a service initiator according to the service identifier when the service initiator fails to obtain a service list corresponding to the service request from a registration center; the service identifier is obtained by the service initiator by parsing the obtained service request; the service identifier is a unique identifier of the service provider;

[0064] A determination module, configured to determine a load address corresponding to the service identifier according to the address query request;

[0065] The second sending module is used to send the load address to the service initiator so that the service initiator sends the service request to the load binding server corresponding to the load address, and the load binding server sends the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0066] In a sixth aspect, an embodiment of the present application provides a load binding server, including:

[0067] The second receiving module is used to receive a service request sent by a service initiator based on a load address; the load address is obtained from a service identification registration server according to a service identifier when the service initiator fails to obtain a service list corresponding to the service request from a registration center; the service identifier is obtained by the service initiator by parsing the obtained service request; the load address is the address of the server bound to the corresponding load

[0068] The third sending module is used to send the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0069] In a seventh aspect, an embodiment of the present application provides a service calling device, including: at least one processor and a memory;

[0070] The memory stores computer-executable instructions;

[0071] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method described in the first aspect and various possible designs of the first aspect.

[0072] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the method described in the first aspect and various possible designs of the first aspect are implemented.

[0073] In a ninth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method described in the first aspect and various possible designs of the first aspect.

[0074] The service calling method, device, storage medium and program product provided in this embodiment include obtaining a service request, parsing the service request to obtain a service identifier, where the service identifier is a unique identifier of a service provider. If a service list corresponding to the service request is not obtained from a registration center, an address query request is sent to a service identifier registration server according to the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier according to the address query request. The service identifier registration server is used to establish a one-to-one correspondence between the service identifier and the load address, where the load address is the address of a corresponding load binding server. The service request is sent to a load binding server corresponding to the load address, so that the load binding server sends the service request to a first target service instance among multiple service instances bound to the load binding server based on a first load balancing strategy, so that the first target service instance processes the service request. The load binding server is used to bind the addresses of multiple service instances of the corresponding service provider to the address of the load binding server. The method provided in this embodiment sets a service identification registration server and a load binding server. When the registration center cannot provide a service list, the method can obtain the load address corresponding to the load binding server corresponding to the service identification corresponding to the service provider from the service identification registration server, and then send the service request to the load binding server based on the load address, so that the load binding server forwards the service request to the appropriate service instance, thereby decoupling from the registration center and reducing dependence on the registration center. When an exception occurs in the registration center, the service call can still be performed normally, thereby improving the effectiveness of the service call. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0076] Figure 1 A schematic diagram of a scenario of a service calling method provided in an embodiment of the present application;

[0077] Figure 2 Schematic diagram of the service calling method provided in the embodiment of the present application Figure 1 ;

[0078] Figure 3 A schematic diagram of the interaction process of the service calling method provided in an embodiment of the present application when the registration center is abnormal;

[0079] Figure 4A schematic diagram of the interaction process of the service calling method provided in the embodiment of the present application when the registration center is normal;

[0080] Figure 5 Schematic diagram of the service calling method provided in the embodiment of the present application Figure 2 ;

[0081] Figure 6 Schematic diagram of the service calling method provided in the embodiment of the present application Figure 3 ;

[0082] Figure 7 A schematic diagram of the interaction process of the service calling method provided in an embodiment of the present application;

[0083] Figure 8 A schematic diagram of the structure of a service initiating device provided in an embodiment of the present application;

[0084] Fig. 9 A schematic diagram of the structure of the service identification registration server provided in the embodiment of the present application;

[0085] Fig.10 A schematic diagram of the structure of the service identification registration server provided in the embodiment of the present application;

[0086] Fig.11 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0087] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0088] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved shall comply with the provisions of relevant laws and regulations and shall not violate public order and good morals.

[0089] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0090] A distributed system is a system consisting of a group of computer nodes that communicate over a network and coordinate their work to complete a common task. With the development of Internet technology and the increasing complexity of applications, distributed systems are becoming more and more common. In a distributed system, service registration and discovery, and communication between services are very important links.

[0091] In the related technology, frameworks such as Spring Cloud can be used to implement distributed systems. Among them, dynamic service discovery, configuration management, and service management platforms for native applications, namely, registration centers, can be built based on components such as Nacos. In the implementation process, each service node can act as a service initiator and a service provider to make service calls. Specifically, the service provider registers the service instance in the registration center at startup. When the service initiator needs to make a service call to the service provider, it queries and obtains a service list containing at least one service instance from the registration center.

[0092] However, the above method is heavily dependent on the service registration center. When the service registration center fails or the network between the service requester and the registration center is abnormal, or the network between the service receiver and the registration center is abnormal, resulting in the service being offline, the above method cannot be effectively handled.

[0093] Figure 1 A schematic diagram of a scenario of a service calling method provided in an embodiment of the present application. Figure 1 As shown, the system includes a service initiator, a service provider, a registration center, a service identifier registration server and a load binding server. The service initiator is used to communicate with the domain name registration device, the load binding device, the registration center and the service provider respectively.

[0094] In the specific implementation process, the service initiator obtains a service request, parses the service request to obtain a service identifier, and the service identifier is a unique identifier of the service provider. If the service list corresponding to the service request is not obtained from the registration center, an address query request is sent to the service identifier registration server according to the service identifier, so that the service identifier registration server returns the load address corresponding to the service identifier according to the address query request. The service identifier registration server is used to establish a one-to-one correspondence between the service identifier and the load address. The load address is the address of the corresponding load binding server. The service request is sent to the load binding server corresponding to the load address, so that the load binding server sends the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request. The load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider to the address of the load binding server. The service calling method provided in this embodiment sets a service identification registration server and a load binding server. When the registration center cannot provide a service list, it can obtain the load address corresponding to the load binding server corresponding to the service identification corresponding to the service provider from the service identification registration server, and then send the service request to the load binding server based on the load address, so that the load binding server forwards the service request to the appropriate service instance, thereby decoupling from the registration center and reducing dependence on the registration center. When an exception occurs in the registration center, the service call can still be performed normally, thereby improving the effectiveness of the service call.

[0095] It should be noted that Figure 1 The scenario diagram shown is only an example. The service calling method and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.

[0096] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0097] Figure 2 Schematic diagram of the service calling method provided in the embodiment of the present application Figure 1 .like Figure 2 As shown, the method includes:

[0098] 201. Obtain a service request; parse the service request to obtain a service identifier; the service identifier is a unique identifier of a service provider.

[0099] The execution subject of this embodiment may be a server or other device corresponding to the service initiator. The server may be a cloud server, a cluster server, or the like.

[0100] Specifically, a service in a distributed system receives a service request from a user, such as a click operation on the interface of a service terminal, and then generates a service request. The service initiator initiates a request for a service call to a service provider. The service request may include a service identifier for uniquely identifying the service provider. Optionally, the service identifier may be a single identifier or a combination of multiple identifiers, which is not limited in this embodiment as long as it is unique.

[0101] In some embodiments, when the service identifier includes at least a service domain name, when the service request carries only a service name, and the service identifier requires a service domain name, a corresponding service domain name can be constructed based on the service name using preset rules. The service identifier may include a service domain name, and the parsing of the service request to obtain the service identifier may include: adding relevant information of the service request to a corresponding context object through a request information encapsulator; if the context object does not include a service domain name, but includes a service name, constructing a service domain name based on the service name based on preset rules; if the context object includes a service domain name, obtaining the service domain name from the context object.

[0102] Specifically, the relevant information may include the domain name of the service provider and at least one of the following: the requested protocol, address information, service name, port, interface address, parameters, request method, and request header.

[0103] For example, the domain name can follow the following convention: service name.internal.com. For example, if the service name of user management is usermanager, its domain name is usermanager.internal.com. This domain name is the service identifier registered by the service provider to the registration center. The service requester, the registration center, and the service provider uniquely identify the service through this identifier.

[0104] 202. If the service list corresponding to the service request is not obtained from the registration center, an address query request is sent to the service identifier registration server according to the service identifier, so that the service identifier registration server returns the load address corresponding to the service identifier according to the address query request; the service identifier registration server is used to establish a one-to-one correspondence between the service identifier and the load address; the load address is the address of the corresponding load binding server.

[0105] Specifically, after obtaining a service request, you can first obtain a service list from the registration center based on the service ID. If it cannot be obtained, for example, the obtained service list is empty, you can forward the service request based on the service ID registration server and the load binding server to implement the service call.

[0106] In some embodiments, there may be multiple service identifiers. In one possible implementation, the service identifier may include a service domain name corresponding to a service provider; an address query request is sent to a service identifier registration server based on the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier based on the address query request; the service identifier registration server is used to establish a one-to-one correspondence between the service identifier and the load address, which may include: obtaining the load address corresponding to the service domain name from the service identifier registration server based on the service domain name; the service identifier registration server is used to establish a one-to-one correspondence between the service domain name and the load address.

[0107] In another possible implementation, if the service identifier includes the port and service domain name corresponding to the service provider; the address query request is sent to the service identifier registration server according to the service identifier, so that the service identifier registration server returns the load address corresponding to the service identifier according to the address query request; the service identifier registration server is used to establish a one-to-one correspondence between the service identifier and the load address, which may include: obtaining the service domain name and the load address corresponding to the port from the service identifier registration server according to the service domain name and the port, and the service identifier registration server is used to establish a one-to-one correspondence between the combination of the service domain name and the port and the load address.

[0108] In some embodiments, in order to reduce the development workload, when the service list cannot be obtained, that is, the service list is empty, a virtual service instance can be constructed by itself to perform subsequent steps such as querying the load address based on the domain name. Specifically, sending an address query request to a service identification registration server according to the service identifier so that the service identification registration server returns the load address corresponding to the service identifier according to the address query request, can include: constructing a virtual service instance according to the service identifier; initiating service request processing based on the virtual service instance; during the service request initiation processing, sending an address query request to a service identification registration server according to the service identifier so that the service identification registration server returns the load address corresponding to the service identifier according to the address query request.

[0109] For example, Figure 3As shown, the service initiator initiates a service request, parses the request data corresponding to the service request to obtain the service domain name, obtains the service list from the registration center according to the service domain name, and the registration center cannot return the result. The service initiator obtains the load address from the domain name registration device (corresponding to the service identifier registration server), and then initiates a service request to the load binding device (corresponding to the load binding server) based on the load address. The load binding device forwards the service request to the service instance of the service provider for service call. The service provider returns the service result to the load binding device, and the load binding device returns the result to the request initiator.

[0110] 203. Send the service request to the load binding server corresponding to the load address, so that the load binding server sends the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0111] Specifically, after the service initiator obtains the load address, it can send a service request to the load binding device based on the load address, and the load binding device forwards the service request to one of the multiple service instances provided by the service provider bound to the load binding device. A load balancing strategy can be used to select a target service instance from multiple service instances. For example, a polling load balancing strategy, a weighted load balancing strategy, a least-connected load balancing strategy, etc. This embodiment does not limit this.

[0112] The service calling method provided in this embodiment, by setting a service identification registration server and a load binding server, can obtain the load address corresponding to the load binding server corresponding to the service identification corresponding to the service provider from the service identification registration server when the registration center cannot provide a service list, and then send the service request to the load binding server based on the load address, so that the load binding server forwards the service request to the appropriate service instance, thereby being decoupled from the registration center and reducing dependence on the registration center. When an exception occurs in the registration center, the service call can still be performed normally, thereby improving the effectiveness of the service call.

[0113] In some embodiments, after obtaining the service request initiated by the service initiator in step 201, it can also include: parsing the service request to obtain address information; the address information includes at least one of the following: a load address corresponding to the service provider and an address of a service instance provided by the service provider; if the service list corresponding to the service request is not obtained from the registration center, determining a third target service instance based on the address information, and sending the service request to the third target service instance, so that the third target service instance processes the service request.

[0114] Specifically, after obtaining the service request, the relevant information of the service request can be placed in the context of the service request through the request information encapsulator. The relevant information may include an address, such as the load address of the load binding server corresponding to the service provider, or the address of a service instance provided by the service provider (when the service request is generated, it specifies which service instance will be used to process it, and the IP address of the service instance is placed in the service request).

[0115] In some embodiments, determining the third target service instance based on the address information may include: if the address information includes a load address corresponding to a service provider, sending the service request to a load binding server corresponding to the load address, so as to determine the third target service instance based on the first load balancing strategy through the load binding server; if the address information includes an address of a service instance provided by the service provider, determining the service instance corresponding to the address as the third target service instance.

[0116] In some embodiments, when the registration center can work normally, a service list can be obtained from the registration center, and the service list includes at least one service instance. Step 201 may also include: sending a query request to the registration center according to the service identifier; receiving a service list returned by the registration center according to the query request; the service list includes at least one service instance provided by the service provider corresponding to the service identifier; determining a second target service instance from the service list based on a second load balancing strategy; sending the service request to the second target service instance so that the second target service instance processes the service request.

[0117] For example, Figure 4 As shown, the service initiator initiates a service request, parses the request data corresponding to the service request to obtain the service domain name, obtains the service list from the registration center according to the service domain name, and the registration center returns the result. The service initiator then selects a service instance from the service list to initiate a request, initiates a service request to the service instance of the service provider, and the service provider returns the request result.

[0118] In some embodiments, determining the second target service instance from the service list based on the second load balancing strategy may include: if the number of service instances in the service list is greater than 1, obtaining the previous position index, taking the modulus of the length of the service list according to the previous position index, and obtaining the current position index; and determining the second target service instance from the service list according to the current position index.

[0119] Figure 5 Schematic diagram of the service calling method provided in the embodiment of the present application Figure 2 .like Figure 5 As shown, the method includes:

[0120] 501. When a service initiator fails to obtain a service list corresponding to the service request from a registration center, the service initiator receives an address query request sent according to the service identifier; the service identifier is obtained by parsing the obtained service request; the service identifier is a unique identifier of the service provider.

[0121] The execution subject of this embodiment may be a service identification registration server.

[0122] 502. Determine a load address corresponding to the service identifier according to the address query request.

[0123] 503. Send the load address to the service initiator so that the service initiator sends the service request to the load binding server corresponding to the load address, and the load binding server sends the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0124] The implementation process of the service calling method provided in this embodiment can refer to the above embodiments, for example Figure 2 The description of the illustrated embodiment will not be repeated here.

[0125] In some embodiments, a service identifier registration server may pre-establish a correspondence between a service identifier such as a domain name and a load address to implement registration of a service identifier such as a domain name. There may be multiple registration methods. In one implementable method, an automatic registration method may be used. Specifically, before receiving an address query request sent by a service initiator according to the service identifier, it may also include: receiving a registration request sent by a load binding server corresponding to a service provider; the registration request includes the load address corresponding to the load binding server and the service identifier corresponding to the service provider; and according to the registration request, establishing a correspondence between the service identifier corresponding to the service provider and the load address.

[0126] In another possible implementation, a manual registration method may be used. Specifically, before receiving the address query request sent by the service initiator according to the service identifier, the method may also include: generating a registration request in response to a touch operation on the registration interface; the registration request includes the load address corresponding to the load binding server and the service identifier corresponding to the service provider; and establishing a corresponding relationship between the service identifier corresponding to the service provider and the load address according to the registration request.

[0127] The service calling method provided in this embodiment, by setting a service identification registration server and a load binding server, can obtain the load address corresponding to the load binding server corresponding to the service identification corresponding to the service provider from the service identification registration server when the registration center cannot provide a service list, and then send the service request to the load binding server based on the load address, so that the load binding server forwards the service request to the appropriate service instance, thereby being decoupled from the registration center and reducing dependence on the registration center. When an exception occurs in the registration center, the service call can still be performed normally, thereby improving the effectiveness of the service call.

[0128] Figure 6 Schematic diagram of the service calling method provided in the embodiment of the present application Figure 3 .like Figure 6 As shown, the method includes:

[0129] 601. Receive a service request sent by a service initiator based on a load address; the load address is obtained by the service initiator from a service identification registration server according to a service identifier when the service initiator fails to obtain a service list corresponding to the service request from a registration center; the service identifier is obtained by the service initiator by parsing the obtained service request; the load address is the address of a server bound to the corresponding load.

[0130] 602. Based on the first load balancing strategy, the service request is sent to the first target service instance among the multiple service instances bound to the load binding server, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0131] The execution subject of this embodiment may be a load binding server.

[0132] In some embodiments, the load binding server can pre-bind multiple service instances of the service provider with the load address. There can be multiple binding methods. In one practicable method, automatic binding can be performed to save labor. Specifically, before receiving the service request sent by the service initiator based on the load address, it also includes: receiving a binding request sent by the service provider; the binding request includes the addresses of multiple service instances provided by the service provider; according to the binding request, the addresses of the multiple service instances provided by the service provider are bound to the address of the load binding server.

[0133] In another possible implementation, manual binding can be performed. Before receiving the service request sent by the service initiator based on the load address, the method further includes: generating a binding request in response to a touch operation on the binding interface; the binding request includes the addresses of multiple service instances provided by the service provider; and binding the addresses of the multiple service instances provided by the service provider with the address of the load binding server according to the binding request.

[0134] In some embodiments, in order to ensure that the binding relationship maintained in the load binding server is correct, verification can be initiated with the service provider. Specifically, based on a preset period, binding confirmation information can be sent to the service provider, so that the service provider compares the binding confirmation information with the addresses of the multiple service instances currently provided. If they are inconsistent, the current addresses of the multiple service instances currently provided are returned; the binding confirmation information includes the addresses of the multiple service instances bound to the load binding server; the current address sent by the service provider is received, and the current address is bound to the address of the load binding server.

[0135] The implementation process of the service calling method provided in this embodiment can refer to the above embodiments, for example Figure 2 The description of the illustrated embodiment will not be repeated here.

[0136] The service calling method provided in this embodiment, by setting a service identification registration server and a load binding server, can obtain the load address corresponding to the load binding server corresponding to the service identification corresponding to the service provider from the service identification registration server when the registration center cannot provide a service list, and then send the service request to the load binding server based on the load address, so that the load binding server forwards the service request to the appropriate service instance, thereby being decoupled from the registration center and reducing dependence on the registration center. When an exception occurs in the registration center, the service call can still be performed normally, thereby improving the effectiveness of the service call.

[0137] Figure 7 The following is a schematic diagram of the interactive process of the service calling method provided in the embodiment of the present application. Figure 7 As shown, the method includes:

[0138] 701. A service initiating device obtains a service request; and parses the service request to obtain a service identifier; the service identifier is a unique identifier of a service provider.

[0139] 702. The service initiating device sends a query request to the registration center.

[0140] 703. The service list returned by the registration center is empty.

[0141] 704. The service initiating device sends an address query request to the service identifier registration server according to the service identifier.

[0142] 705. The service identifier registration server returns the load address corresponding to the service identifier according to the address query request; the service identifier registration server is used to establish a one-to-one correspondence between the service identifier and the load address; the load address is the address of the corresponding load binding server.

[0143] 706. The service initiating device sends the service request to the load binding server corresponding to the load address.

[0144] 707. The load binding server sends the service request to a first target service instance among multiple service instances bound to the load binding server based on a first load balancing strategy.

[0145] 708. The first target service instance processes the service request; the load binding server is used to bind the addresses of multiple service instances of the corresponding service provider to the address of the load binding server.

[0146] The implementation process of the service calling method provided in this embodiment can refer to the above embodiments, for example Figure 2 The description of the illustrated embodiment will not be repeated here.

[0147] The service calling method provided in this embodiment, by setting a service identification registration server and a load binding server, can obtain the load address corresponding to the load binding server corresponding to the service identification corresponding to the service provider from the service identification registration server when the registration center cannot provide a service list, and then send the service request to the load binding server based on the load address, so that the load binding server forwards the service request to the appropriate service instance, thereby being decoupled from the registration center and reducing dependence on the registration center. When an exception occurs in the registration center, the service call can still be performed normally, thereby improving the effectiveness of the service call.

[0148] Figure 8 This is a schematic diagram of the structure of the service initiation device provided in the embodiment of the present application. Figure 8 As shown, the service calling device 80 includes: an acquisition module 801 and a first sending module 802 .

[0149] The acquisition module 801 is used to acquire a service request; parse the service request to obtain a service identifier; the service identifier is a unique identifier of the service provider.

[0150] The first sending module 802 is used to send an address query request to the service identification registration server according to the service identification if the service list corresponding to the service request is not obtained from the registration center, so that the service identification registration server returns the load address corresponding to the service identification according to the address query request; the service identification registration server is used to establish a one-to-one correspondence between the service identification and the load address; the load address is the address of the corresponding load binding server.

[0151] The first sending module 802 is also used to send the service request to the load binding server corresponding to the load address, so that the load binding server can send the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance can process the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider to the address of the load binding server.

[0152] The service network initiating device provided in the embodiment of the present application, by setting a service identification registration server and a load binding server, can obtain the load address corresponding to the load binding server corresponding to the service identification corresponding to the service provider from the service identification registration server when the registration center cannot provide a service list, and then send the service request to the load binding server based on the load address, so that the load binding server forwards the service request to the appropriate service instance, thereby being decoupled from the registration center and reducing dependence on the registration center. When an abnormality occurs in the registration center, service calls can still be made normally, thereby improving the effectiveness of the service calls.

[0153] In some embodiments, the first sending module 802 is specifically used to obtain the load address corresponding to the service domain name from the service identification registration server according to the service domain name if the service identification includes a service domain name corresponding to the service provider; the service identification registration server is used to establish a one-to-one correspondence between the service domain name and the load address.

[0154] In some embodiments, the first sending module 802 is specifically used to obtain the load address corresponding to the service domain name and the port from the service identification registration server according to the service domain name and the port if the service identification includes the port and service domain name corresponding to the service provider, and the service identification registration server is used to establish a one-to-one correspondence between the combination of the service domain name and the port and the load address.

[0155] In some embodiments, the acquisition module 801 is specifically used to: add the relevant information of the service request to the corresponding context object through the request information encapsulator; if the context object does not include the service domain name, but includes the service name, then based on the preset rules, construct the service domain name according to the service name; if the context object includes the service domain name, then obtain the service domain name from the context object.

[0156] In some embodiments, the first sending module 802 is specifically used to: construct a virtual service instance according to the service identifier; perform service request initiation processing based on the virtual service instance; during the service request initiation processing, send an address query request to the service identifier registration server according to the service identifier, so that the service identifier registration server returns the load address corresponding to the service identifier according to the address query request.

[0157] In some embodiments, the first sending module 802 is also used to: parse the service request to obtain address information; the address information includes at least one of the following: a load address corresponding to the service provider and an address of a service instance provided by the service provider; if the service list corresponding to the service request is not obtained from the registration center, then determine a third target service instance based on the address information, and send the service request to the third target service instance so that the third target service instance processes the service request.

[0158] In some embodiments, the first sending module 802 is specifically used to: if the address information includes the load address corresponding to the service provider, send the service request to the load binding server corresponding to the load address, so as to determine the third target service instance based on the first load balancing strategy through the load binding server; if the address information includes the address of the service instance provided by the service provider, determine the service instance corresponding to the address as the third target service instance.

[0159] In some embodiments, the first sending module 802 is specifically used to: send a query request to the registration center according to the service identifier; receive a service list returned by the registration center according to the query request; the service list includes at least one service instance provided by the service provider corresponding to the service identifier; determine a second target service instance from the service list based on a second load balancing strategy; and send the service request to the second target service instance so that the second target service instance processes the service request.

[0160] In some embodiments, the first sending module 802 is specifically used to: if the number of service instances in the service list is greater than 1, obtain the previous position index, take the modulus of the length of the service list according to the previous position index, and obtain the current position index; and determine the second target service instance from the service list according to the current position index.

[0161] The service calling device provided in the embodiment of the present application can be used to execute the above-mentioned method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0162] Fig. 9 This is a schematic diagram of the structure of the service identification registration server provided in the embodiment of the present application. Fig. 9 As shown, the service calling device 90 includes: a first receiving module 901 , a determining module 902 and a second sending module 903 .

[0163] The first receiving module 901 is used to receive an address query request sent by a service initiator according to the service identifier when the service initiator fails to obtain a service list corresponding to the service request from the registration center; the service identifier is obtained by the service initiator by parsing the obtained service request; the service identifier is a unique identifier of the service provider;

[0164] A determination module 902, configured to determine a load address corresponding to the service identifier according to the address query request;

[0165] The second sending module 903 is used to send the load address to the service initiator so that the service initiator sends the service request to the load binding server corresponding to the load address, and the load binding server sends the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0166] The service identification registration server provided in the embodiment of the present application can, when the registration center is unable to provide a service list, obtain the load address corresponding to the load binding server corresponding to the service identification corresponding to the service provider from the service identification registration server, and then send the service request to the load binding server based on the load address, so that the load binding server forwards the service request to the appropriate service instance, thereby being decoupled from the registration center and reducing dependence on the registration center. When an exception occurs in the registration center, service calls can still be made normally, thereby improving the effectiveness of the service calls.

[0167] In some embodiments, the first receiving module 901 is also used to: receive a registration request sent by a load binding server corresponding to a service provider; the registration request includes a load address corresponding to the load binding server and a service identifier corresponding to the service provider; and establish a correspondence between the service identifier corresponding to the service provider and the load address according to the registration request.

[0168] In some embodiments, the first receiving module 901 is also used to: generate a registration request in response to a touch operation on the registration interface; the registration request includes a load address corresponding to the load binding server and a service identifier corresponding to the service provider; and establish a correspondence between the service identifier corresponding to the service provider and the load address according to the registration request.

[0169] The service calling device provided in the embodiment of the present application can be used to execute the above-mentioned method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0170] Fig.10 This is a schematic diagram of the structure of the service identification registration server provided in the embodiment of the present application. Fig.10 As shown, the service calling device 100 includes: a second receiving module 1001 and a third sending module 1002 .

[0171] The second receiving module 1001 is used to receive a service request sent by a service initiator based on a load address; the load address is obtained by the service initiator from a service identification registration server according to a service identification when the service initiator fails to obtain a service list corresponding to the service request from a registration center; the service identification is obtained by the service initiator by parsing the obtained service request; the load address is the address of the corresponding load binding server

[0172] The third sending module 1002 is used to send the service request to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is used to bind the addresses of the multiple service instances of the corresponding service provider with the address of the load binding server.

[0173] The service identification registration server provided in the embodiment of the present application can, when the registration center is unable to provide a service list, obtain the load address corresponding to the load binding server corresponding to the service identification corresponding to the service provider from the service identification registration server, and then send the service request to the load binding server based on the load address, so that the load binding server forwards the service request to the appropriate service instance, thereby being decoupled from the registration center and reducing dependence on the registration center. When an exception occurs in the registration center, service calls can still be made normally, thereby improving the effectiveness of the service calls.

[0174] In some embodiments, the second receiving module 1001 is also used to receive a binding request sent by a service provider; the binding request includes the addresses of multiple service instances provided by the service provider; according to the binding request, the addresses of the multiple service instances provided by the service provider are bound to the address of the load binding server.

[0175] In some embodiments, the second receiving module 1001 is also used to generate a binding request in response to a touch operation on the binding interface; the binding request includes the addresses of multiple service instances provided by the service provider; according to the binding request, the addresses of the multiple service instances provided by the service provider are bound to the address of the load binding server.

[0176] In some embodiments, the third sending module 1002 is also used to send binding confirmation information to the service provider based on a preset period, so that the service provider compares the binding confirmation information with the addresses of multiple service instances currently provided. If there is inconsistency, the current addresses of the multiple service instances currently provided are returned; the binding confirmation information includes the addresses of multiple service instances bound to the load binding server; the current address sent by the service provider is received, and the current address is bound to the address of the load binding server.

[0177] The service calling device provided in the embodiment of the present application can be used to execute the above-mentioned method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0178] Fig.11 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application, which device may be a computer, a tablet device, a server, etc.

[0179] Device 110 may include one or more of the following components: a processing component 1101 , a memory 1102 , a power component 1103 , a multimedia component 1104 , an audio component 1105 , an input / output (I / O) interface 1106 , a sensor component 1107 , and a communication component 1108 .

[0180] The processing component 1101 generally controls the overall operation of the device 110, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1101 may include one or more processors 1109 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 1101 may include one or more modules to facilitate the interaction between the processing component 1101 and other components. For example, the processing component 1101 may include a multimedia module to facilitate the interaction between the multimedia component 1104 and the processing component 1101.

[0181] The memory 1102 is configured to store various types of data to support operations on the device 110. Examples of such data include instructions for any application or method operating on the device 110, contact data, phone book data, messages, pictures, videos, etc. The memory 1102 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0182] The power supply component 1103 provides power to the various components of the device 110. The power supply component 1103 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 110.

[0183] The multimedia component 1104 includes a screen that provides an output interface between the device 110 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1104 includes a front camera and / or a rear camera. When the device 110 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0184] The audio component 1105 is configured to output and / or input audio signals. For example, the audio component 1105 includes a microphone (MIC), and when the device 110 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1102 or sent via the communication component 1108. In some embodiments, the audio component 1105 also includes a speaker for outputting audio signals.

[0185] I / O interface 1106 provides an interface between processing component 1101 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0186] The sensor assembly 1107 includes one or more sensors for providing various aspects of status assessment for the device 110. For example, the sensor assembly 1107 can detect the open / closed state of the device 110, the relative positioning of components, such as the display and keypad of the device 110, and the sensor assembly 1107 can also detect the position change of the device 110 or a component of the device 110, the presence or absence of user contact with the device 110, the orientation or acceleration / deceleration of the device 110, and the temperature change of the device 110. The sensor assembly 1107 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1107 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1107 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0187] The communication component 1108 is configured to facilitate wired or wireless communication between the device 110 and other devices. The device 110 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1108 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1108 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0188] In an exemplary embodiment, the device 110 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0189] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1102 including instructions, and the instructions can be executed by a processor 1109 of the device 110 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0190] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0191] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0192] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0193] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the service calling method executed by the above service calling device.

[0194] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A service calling method, characterized in that: include: Obtaining a service request; parsing the service request to obtain a service identifier; The service identifier is a unique identifier of the service provider; If the service list corresponding to the service request is not obtained from the registration center, an address query request is sent to the service identification registration server according to the service identification, so that the service identification registration server returns the load address corresponding to the service identification according to the address query request; The service identification registration server is used to establish a one-to-one correspondence between the service identification and the load address; the load address is the address of the corresponding load binding server; Sending the service request to the load binding server corresponding to the load address, so that the load binding server sends the service request to a first target service instance among multiple service instances bound to the load binding server based on a first load balancing strategy, so that the first target service instance processes the service request; The load binding server is used to bind the addresses of multiple service instances of the corresponding service provider to the address of the load binding server.

2. The method according to claim 1, characterized in that If the service identifier includes a service domain name corresponding to the service provider; sending an address query request to a service identifier registration server according to the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier according to the address query request; The service identification registration server is used to establish a one-to-one correspondence between the service identification and the load address, including: Acquire a load address corresponding to the service domain name from a service identifier registration server according to the service domain name; The service identification registration server is used to establish a one-to-one correspondence between the service domain name and the load address.

3. The method according to claim 1, characterized in that: If the service identifier includes the port and service domain name corresponding to the service provider; sending an address query request to the service identifier registration server according to the service identifier, so that the service identifier registration server returns the load address corresponding to the service identifier according to the address query request; The service identification registration server is used to establish a one-to-one correspondence between the service identification and the load address, including: The load address corresponding to the service domain name and the port is obtained from the service identification registration server according to the service domain name and the port, and the service identification registration server is used to establish a one-to-one correspondence between the combination of the service domain name and the port and the load address.

4. The method according to claim 1, characterized in that: The service identifier includes a service domain name, and the step of parsing the service request to obtain the service identifier includes: Adding the relevant information of the service request to the corresponding context object through the request information encapsulator; If the context object does not include a service domain name but includes a service name, then based on a preset rule, constructing a service domain name according to the service name; If the context object includes a service domain name, the service domain name is obtained from the context object.

5. The method according to claim 1, characterized in that The sending an address query request to a service identifier registration server according to the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier according to the address query request, includes: Constructing a virtual service instance according to the service identifier; Based on the virtual service instance, a service request is initiated and processed; During the service request initiation process, an address query request is sent to a service identifier registration server according to the service identifier, so that the service identifier registration server returns a load address corresponding to the service identifier according to the address query request.

6. The method according to any one of claims 1 to 5, characterized in that: After obtaining the service request initiated by the service initiator, the method further includes: Parsing the service request to obtain address information; the address information includes at least one of the following: a load address corresponding to the service provider, and an address of a service instance provided by the service provider; If the service list corresponding to the service request is not obtained from the registration center, a third target service instance is determined according to the address information, and the service request is sent to the third target service instance so that the third target service instance processes the service request.

7. The method according to claim 6, characterized in that The determining the third target service instance according to the address information includes: If the address information includes a load address corresponding to the service provider, the service request is sent to a load binding server corresponding to the load address, so as to determine a third target service instance through the load binding server based on the first load balancing strategy; If the address information includes the address of a service instance provided by the service provider, the service instance corresponding to the address is determined as the third target service instance.

8. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Sending a query request to the registration center according to the service identifier; Receiving a service list returned by the registration center according to the query request; the service list includes at least one service instance provided by the service provider corresponding to the service identifier; Determine a second target service instance from the service list based on a second load balancing strategy; The service request is sent to the second target service instance, so that the second target service instance processes the service request.

9. The method according to any one of claims 1 to 5, characterized in that: The determining the second target service instance from the service list based on the second load balancing strategy includes: If the number of service instances in the service list is greater than 1, obtain the previous position index, and modulo the length of the service list according to the previous position index to obtain the current position index; A second target service instance is determined from the service list according to the current location index.

10. A service calling method, characterized in that: include: receiving an address query request sent by a service initiator according to the service identifier when the service initiator fails to obtain a service list corresponding to the service request from a registration center; The service identifier is obtained by the service initiator by parsing the obtained service request; The service identifier is a unique identifier of the service provider; Determine the load address corresponding to the service identifier according to the address query request; Sending the load address to the service initiator so that the service initiator sends the service request to the load binding server corresponding to the load address, and sending the service request to a first target service instance among multiple service instances bound to the load binding server based on a first load balancing strategy through the load binding server, so that the first target service instance processes the service request; The load binding server is used to bind the addresses of multiple service instances of the corresponding service provider to the address of the load binding server.

11. The method according to claim 10, characterized in that Before receiving the address query request sent by the service initiator according to the service identifier, the method further includes: Receive a registration request sent by a load binding server corresponding to a service provider; the registration request includes a load address corresponding to the load binding server and a service identifier corresponding to the service provider; According to the registration request, a corresponding relationship between the service identifier corresponding to the service provider and the load address is established.

12. The method according to claim 10, characterized in that Before receiving the address query request sent by the service initiator according to the service identifier, the method further includes: In response to a touch operation on the registration interface, a registration request is generated; the registration request includes a load address corresponding to the load binding server and a service identifier corresponding to the service provider; According to the registration request, a corresponding relationship between the service identifier corresponding to the service provider and the load address is established.

13. A service calling method, characterized in that: include: Receive a service request sent by a service initiator based on a load address; The load address is obtained from the service identifier registration server according to the service identifier when the service initiator fails to obtain the service list corresponding to the service request from the registration center; the service identifier is obtained by the service initiator by parsing the obtained service request; the load address is the address of the corresponding load binding server Sending the service request to a first target service instance among the multiple service instances bound to the load binding server based on a first load balancing strategy, so that the first target service instance processes the service request; The load binding server is used to bind the addresses of multiple service instances of the corresponding service provider to the address of the load binding server.

14. The method according to claim 13, characterized in that Before receiving the service request sent by the service initiator based on the load address, the method further includes: Receiving a binding request sent by a service provider; the binding request includes addresses of multiple service instances provided by the service provider; According to the binding request, the addresses of the multiple service instances provided by the service provider are bound to the address of the load binding server.

15. The method according to claim 13, characterized in that Before receiving the service request sent by the service initiator based on the load address, the method further includes: In response to a touch operation on the binding interface, generating a binding request; the binding request includes addresses of multiple service instances provided by the service provider; According to the binding request, the addresses of the multiple service instances provided by the service provider are bound to the address of the load binding server.

16. The method according to claim 14 or 15, characterized in that The method further comprises: Based on a preset period, a binding confirmation message is sent to a service provider, so that the service provider compares the binding confirmation message with the addresses of the multiple service instances currently provided, and if they are inconsistent, returns the current addresses of the multiple service instances currently provided; the binding confirmation message includes the addresses of the multiple service instances bound to the load binding server; The current address sent by the service provider is received, and the current address is bound to the address of the load binding server.

17. A service initiating device, characterized in that: include: The acquisition module is used to acquire a service request; parse the service request to obtain a service identifier; The service identifier is a unique identifier of the service provider; The first sending module is used to send an address query request to a service identification registration server according to the service identification if the service list corresponding to the service request is not obtained from the registration center, so that the service identification registration server returns the load address corresponding to the service identification according to the address query request; the service identification registration server is used to establish a one-to-one correspondence between the service identification and the load address; the load address is the address of the corresponding load binding server; The first sending module is further used to send the service request to the load binding server corresponding to the load address, so that the service request is sent to the first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy through the load binding server, so that the first target service instance processes the service request; The load binding server is used to bind the addresses of multiple service instances of the corresponding service provider to the address of the load binding server.

18. A service identification registration server, characterized in that: include: A first receiving module, configured to receive an address query request sent by a service initiator according to the service identifier when the service initiator fails to obtain a service list corresponding to the service request from a registration center; The service identifier is obtained by the service initiator by parsing the obtained service request; The service identifier is a unique identifier of the service provider; A determination module, configured to determine a load address corresponding to the service identifier according to the address query request; A second sending module is used to send the load address to the service initiator, so that the service initiator sends the service request to the load binding server corresponding to the load address, and the load binding server sends the service request to a first target service instance among multiple service instances bound to the load binding server based on a first load balancing strategy, so that the first target service instance processes the service request; The load binding server is used to bind the addresses of multiple service instances of the corresponding service provider to the address of the load binding server.

19. A load binding server, characterized in that: include: A second receiving module is used to receive a service request sent by a service initiator based on a load address; The load address is obtained from the service identifier registration server according to the service identifier when the service initiator fails to obtain the service list corresponding to the service request from the registration center; the service identifier is obtained by the service initiator by parsing the obtained service request; the load address is the address of the corresponding load binding server A third sending module is used to send the service request to a first target service instance among the multiple service instances bound to the load binding server based on the first load balancing strategy, so that the first target service instance processes the service request; The load binding server is used to bind the addresses of multiple service instances of the corresponding service provider to the address of the load binding server.

20. An electronic device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the service calling method according to any one of claims 1 to 16.

21. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the service calling method according to any one of claims 1 to 16 is implemented.

22. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the service calling method according to any one of claims 1 to 16 is implemented.

Citation Information

Patent Citations

  • Service invocation method, device and system

    CN109542641A

  • Application service calling system, method and device

    CN109788015A

  • Load balancing method and device based on micro-service, equipment and storage medium

    CN111464592A

  • Google remote procedure call load balancing system and method, equipment and medium

    CN117311979A

  • Resource data acquisition method and apparatus, computer device and storage medium

    WO2021051880A1

Cited By

  • Service calling method and device, equipment, medium and program product

    CN119676285A