Service invocation method, device, storage medium and program product

By introducing a service identifier registration server and a load binding server into the distributed system, a mapping relationship between service identifiers and load addresses is established. By using load balancing strategies to forward service requests, the service call problem when the registration center is abnormal is solved, and the reliability and effectiveness of the system are improved.

CN119052242BActive Publication Date: 2025-12-26CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, distributed systems heavily rely on service registration centers. When the registration center fails or there are network anomalies, service calls cannot be effectively handled, leading to service outages.

Method used

By introducing a service identifier registration server and a load balancing server, a one-to-one correspondence between service identifiers and load addresses is established. The load balancing strategy is then used to send service requests to the service instances bound to the load balancing server, reducing the dependence on the registration center.

Benefits of technology

Even when the registry center is malfunctioning, service calls can still be made normally, improving the effectiveness and reliability of service calls and achieving decoupling from the registry center.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119052242B_ABST
    Figure CN119052242B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a service calling method and device, a storage medium and a program product, and relate to the technical field of distribution. The method comprises: obtaining a service request, analyzing the service request to obtain a service identifier, 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 that the load binding server sends 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, so that the first target service instance processes the service request. The method of the embodiments can improve the effectiveness of service calling.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of distributed technology, and particularly relate to a service calling method, device, storage medium and program product. BACKGROUND

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

[0003] In the related art, a plurality of services and a registration center are provided in a distributed system. In order to realize communication between services, a service provider registers a service instance into the registration center when starting. When a service initiator needs to call the service of the service provider, the service initiator queries and obtains a service list containing at least one service instance from the registration center.

[0004] However, in the implementation of the present application, the inventors have found that at least the following problem exists in the prior art: in the above manner, the service registration center is relied on too much. When the service registration center fails or the service requester and the registration center have network anomalies or the service receiver and the registration center have network anomalies, the above manner cannot effectively handle the service going offline. SUMMARY

[0005] 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, embodiments of the present application provide a service calling method, comprising:

[0007] obtaining a service request; analyzing the service request to obtain a service identifier; the service identifier being a unique identifier of a service provider;

[0008] If a service list corresponding to the service request is not obtained from the 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 configured to establish a one-to-one correspondence between a service identifier and a load address; the load address is an address of a corresponding load binding server;

[0009] 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 in a plurality of service instances bound by 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 configured to bind addresses of a plurality of service instances of a corresponding service provider with an address of the load binding server.

[0010] In a possible design, if the service identifier comprises a 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 a load address corresponding to the service identifier according to the address query request; and the service identifier registration server is configured to establish a one-to-one correspondence between the service identifier and the load address, and comprises:

[0011] The load address corresponding to the service domain name is obtained from the service identifier registration server according to the service domain name; and the service identifier registration server is configured 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 comprises a port corresponding to the service provider and a service domain name, 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 a load address corresponding to the service identifier according to the address query request; and the service identifier registration server is configured to establish a one-to-one correspondence between the service identifier and the load address, and comprises:

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

[0014] In a possible design, the service identifier comprises a service domain name, and the service identifier is obtained by parsing the service request, and comprises:

[0015] The relevant information of the service request is added into a corresponding context object by a request information encapsulator;

[0016] If the service domain name is not included in the context object and the service name is included, the service domain name is constructed according to the service name based on a preset rule;

[0017] If the service domain name is included in the context object, the service domain name is obtained from the context object.

[0018] In a possible design, 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 a load address corresponding to the service identifier according to the address query request, and comprises:

[0019] A virtual service instance is constructed according to the service identifier;

[0020] Service request initiation processing is performed based on the virtual service instance;

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

[0022] In a possible design, after the service request initiated by the service initiator is acquired, the method further includes:

[0023] The service request is parsed to obtain address information; the address information includes at least one of a load address corresponding to a service provider or an address of a service instance provided by the service provider.

[0024] If the service list corresponding to the service request is not acquired 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, the third target service instance is determined according to the address information, and includes:

[0026] If the address information includes a load address corresponding to a service provider, the service request is sent to a load binding server corresponding to the load address, so that the third target service instance is determined by the load binding server based on a first load balancing strategy.

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

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

[0029] A query request is sent to the registration center according to the service identity.

[0030] A service list returned by the registration center according to the query request is received; the service list includes at least one service instance provided by a service provider corresponding to the service identity.

[0031] A second target service instance is determined 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 a possible design, the second target service instance is determined from the service list based on the second load balancing strategy, and includes:

[0034] If the number of service instances in the service list is greater than 1, an previous position index is obtained, a current position index is obtained by taking the length of the service list modulo the previous position index;

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

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

[0037] An address query request sent by a service initiator according to the service identifier is received when the service initiator does not obtain a service list corresponding to the service request from a registration center; the service identifier is obtained by the service initiator by analyzing the obtained service request; and the service identifier is a unique identifier of a service provider;

[0038] A load address corresponding to the service identifier is determined 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 a load binding server corresponding to the load address, the service request is sent 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 by the load binding server, and the first target service instance processes the service request; and the load binding server is configured to bind addresses of a plurality of service instances of a corresponding service provider and an address of the load binding server.

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

[0041] A registration request sent by a load binding server corresponding to a service provider is received; the registration request comprises 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 the receiving the address query request sent by the service initiator according to the service identifier, the method further comprises:

[0044] In response to a touch operation on a registration interface, a registration request is generated; the registration request comprises 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, comprising:

[0047] receiving 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 identifier registration server according to a service identifier when a service list corresponding to the service request is not obtained from a registration center; the service identifier is obtained by the service initiator by analyzing the service request; the load address is an address of a corresponding load binding server

[0048] sending 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, so that the first target service instance processes the service request; the load binding server is configured to bind addresses of a plurality of service instances of a corresponding service provider with the address of the load binding server.

[0049] In a possible design, before the 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 comprises addresses of a plurality of service instances provided by the service provider;

[0051] binding, according to the binding request, the addresses of the plurality of service instances provided by the service provider with the address of the load binding server.

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

[0053] generating a binding request in response to a touch operation on a binding interface; the binding request comprises addresses of a plurality of service instances provided by the service provider;

[0054] binding, according to the binding request, the addresses of the plurality of service instances provided by the service provider with the address of the load binding server.

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

[0056] sending, based on a preset period, a binding confirmation information to the service provider, so that the service provider compares the binding confirmation information with addresses of the plurality of service instances currently provided, and returns current addresses of the plurality of service instances currently provided if the addresses are inconsistent; the binding confirmation information comprises addresses of the plurality of service instances bound with the load binding server;

[0057] receive a current address sent by a service provider, and bind the current address with an address of a load binding server.

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

[0059] an obtaining module, configured to obtain a service request, and parse the service request to obtain a service identifier; the service identifier is a unique identifier of a service provider;

[0060] a first sending module, configured to, if a service list corresponding to the service request is not obtained from a registration center, send 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 configured to establish a one-to-one correspondence between a service identifier and a load address; the load address is an address of a corresponding load binding server;

[0061] The first sending module is further configured to 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 a first target service instance in a plurality of service instances bound by the load binding server based on a first load balancing strategy, and the first target service instance processes the service request; the load binding server is configured to bind addresses of a plurality of service instances of a corresponding service provider with an address of the load binding server.

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

[0063] a first receiving module, configured to receive an address query request sent by a service initiation party according to the service identifier when a service list corresponding to the service request is not obtained from a registration center; the service identifier is obtained by the service initiation party by parsing the obtained service request; the service identifier is a unique identifier of a service provider;

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

[0065] The second sending module is configured to send the load address to the service initiator, so that the service initiator sends the service request to a load binding server corresponding to the load address, and the load binding server sends 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, so that the first target service instance processes the service request.

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

[0067] The second receiving module is configured to receive a service request sent by a service initiator based on a load address, wherein the load address is obtained by the service initiator from a service identifier 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, and the service identifier is obtained by the service initiator by analyzing the service request.

[0068] The third sending module is configured 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, so that the first target service instance processes the service request.

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

[0070] The memory stores computer execution instructions.

[0071] The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the method 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, wherein the computer readable storage medium stores computer execution instructions, and when a processor executes the computer execution instructions, the method in the first aspect and various possible designs of the first aspect is implemented.

[0073] In a ninth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, and when a processor executes the computer program, the method in the first aspect and various possible designs of the first aspect is implemented.

[0074] The service calling method, device, storage medium and program product provided by the embodiment, the method comprises: obtaining a service request, analyzing the service request to obtain a service identifier, the service identifier being a unique identifier of a service provider, 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 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 being an address of a corresponding load binding server, and 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 a first target service instance in a plurality of service instances bound by the load binding server based on a first load balancing strategy, so that the first target service instance processes the service request, and the load binding server is used to bind the addresses of a plurality of service instances of the corresponding service provider with the address of the load binding server. The method provided by the embodiment can obtain the load address corresponding to the load binding server corresponding to the service identifier corresponding to the service provider from the service identifier registration server when the registration center cannot provide the 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 a suitable service instance, thereby decoupling from the registration center, reducing the dependence on the registration center, and still being able to normally call services when the registration center is abnormal, improving the effectiveness of service calling. BRIEF DESCRIPTION OF DRAWINGS

[0075] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0076] Figure 1 The scene schematic diagram of the service calling method provided by the embodiment of the present application;

[0077] Figure 2 The flowchart of the service calling method provided by the embodiment of the present application Figure 1 ;

[0078] Figure 3 The interaction flowchart of the service calling method provided by the embodiment of the present application when the registration center is abnormal;

[0079] Figure 4The service calling method provided in the embodiments of the present application is shown in the interaction flowchart when the registration center is normal.

[0080] Figure 5 The flowchart of the service calling method provided in the embodiments of the present application Figure 2 ;

[0081] Figure 6 The flowchart of the service calling method provided in the embodiments of the present application Figure 3 ;

[0082] Figure 7 The service calling method provided in the embodiments of the present application is shown in the interaction flowchart when the registration center is normal.

[0083] Figure 8 The structure diagram of the service initiating device provided in the embodiments of the present application is shown in the structure diagram of the service initiating device provided in the embodiments of the present application.

[0084] Figure 9 The structure diagram of the service identification registration server provided in the embodiments of the present application is shown in the structure diagram of the service identification registration server provided in the embodiments of the present application.

[0085] Figure 10 The structure diagram of the service identification registration server provided in the embodiments of the present application is shown in the structure diagram of the service identification registration server provided in the embodiments of the present application.

[0086] Figure 11 The hardware structure diagram of the electronic device provided in the embodiments of the present application is shown in the hardware structure diagram of the electronic device provided in the embodiments of the present application. DETAILED DESCRIPTION

[0087] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some, but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0088] In the technical solutions of the present application, the collection, storage, use, processing, transmission, provision and disclosure of the information such as financial data or user data comply with the relevant legal regulations and do not violate public order and good customs.

[0089] It should be noted that in the embodiments of the present application, some industry existing solutions, components, models, etc. may be mentioned, which should be considered as exemplary, and the purpose is only to illustrate the feasibility of the implementation of the technical solutions 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 composed of a group of computer nodes that communicate over a network and coordinate their work to accomplish a common task. With the development of internet technology and the increasing complexity of its applications, distributed systems are becoming increasingly prevalent. Service registration and discovery, and inter-service communication are crucial aspects of distributed systems.

[0091] In related technologies, frameworks such as Spring Cloud can be used to implement distributed systems. Within this, components like Nacos can be used to build a dynamic service discovery, configuration management, and service management platform for native applications—essentially a service registry. During implementation, service nodes can interact with each other, with one node acting as a service initiator and the other as a service provider. Specifically, the service provider registers its service instance with the registry upon startup. When the service initiator needs to invoke a service from the service provider, it queries the registry to obtain a list of services containing at least one service instance.

[0092] However, the above methods rely heavily on the service registry. When the service registry fails, or when there is a network problem between the service requester and the registry, or when there is a network problem between the service recipient and the registry, causing the service to go offline, the above methods cannot effectively handle the situation.

[0093] Figure 1 This is a schematic diagram illustrating a service invocation method provided in an embodiment of this application. For example... Figure 1 As shown, the system includes a service initiator, a service provider, a registry center, a service identifier registration server, and a load balancing server. The service initiator is used to establish communication connections with the domain name registration device, the load balancing device, the registry center, and the service provider, respectively.

[0094] In the implementation process, the service initiator acquires a service request, parses the service request to obtain a service identifier, the service identifier is a unique identifier of a service provider, if a service list corresponding to the service request is not acquired from the 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, the load address is an address of a corresponding load binding server, the service request is sent to the load binding server corresponding to the load address, so that the service request is sent 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 by the load binding server, so that the first target service instance processes the service request, and the load binding server is used to bind the addresses of a plurality of service instances of the corresponding service provider and the address of the load binding server. The service calling method provided in the embodiment can acquire the load address corresponding to the load binding server corresponding to the service identifier corresponding to the service provider from the service identifier registration server when the registration center cannot provide the 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 a suitable service instance, thereby decoupling from the registration center, reducing the dependence on the registration center, and still being able to normally call services when the registration center is abnormal, and improving the effectiveness of service calling.

[0095] It should be noted that Figure 1 The scene diagram shown is only an example, and the service calling method and the scene described in the embodiments of the application are used to more clearly illustrate the technical solutions of the embodiments of the application, and do not constitute a limitation on the technical solutions provided by the embodiments of the application. Those skilled in the art can know that the technical solutions provided by the embodiments of the application are also applicable to similar technical problems as the system evolves and new business scenarios appear.

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

[0097] Figure 2 Flowchart of the service calling method provided by the embodiments of the application Figure 1 As shown in Figure 2 , the method comprises the following steps.

[0098] 201, acquiring a service request, parsing the service request to obtain a service identifier, the service identifier being a unique identifier of a service provider.

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

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

[0101] In some embodiments, when the service identifier at least contains a service domain name, when the service request only carries a service name, and the service domain name is needed in the service identifier, the corresponding service domain name can be obtained based on the service name by a preset rule. The service identifier can include a service domain name, and the service request is parsed to obtain the service identifier, which can include: adding related information of the service request to a corresponding context object by a request information encapsulator; if the context object does not include a service domain name and includes a service name, a service domain name is constructed based on a preset rule according to the service name; if the context object includes a service domain name, the service domain name is obtained from the context object.

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

[0103] For example, the domain name can comply with the following convention: service name.internal.com. For example, the service name of a user manager is usermanager, and its domain name is usermanager.internal.com. This domain name is the service identifier of the service provider registered to the registration center, which is used to uniquely identify the service by the service requester, the registration center, and the service provider.

[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; and the load address is the address of the corresponding load binding server.

[0105] Specifically, when the service request is acquired, the service list can be acquired from the registration center based on the service identifier first. If the service list cannot be acquired, for example, the acquired service list is empty, the forwarding of the service request can be performed based on the registration of the server and the load binding server, so as to realize the service calling.

[0106] In some embodiments, the service identifier can be various. In a possible implementation, the service identifier can include the service domain name corresponding to the service provider. The sending of the 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, and the service identifier registration server for establishing the one-to-one correspondence between the service identifier and the load address can include: acquiring the load address corresponding to the service domain name from the service identifier registration server according to the service domain name; and the service identifier registration server for establishing the 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 the service domain name corresponding to the service provider, the sending of the 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, and the service identifier registration server for establishing the one-to-one correspondence between the service identifier and the load address can include: acquiring the load address corresponding to the service domain name and the port from the service identifier registration server according to the service domain name and the port, and the service identifier registration server for establishing the 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 acquired, that is, the service list is empty, a virtual service instance can be constructed to perform subsequent steps such as the domain name-based load address query. Specifically, the sending of the 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 can include: constructing a virtual service instance according to the service identifier; performing service request initiation processing based on the virtual service instance; and in the service request initiation processing, 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.

[0109] For example, Figure 3As shown, the service initiator initiates a service request, parses the service domain name from the request data corresponding to the service request, retrieves the service list from the registry center based on the service domain name, and if the registry center cannot return a 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 invocation, the service provider returns the service result to the load binding device, and the load binding device returns the result to the requesting party.

[0110] 203. 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 multiple service instances of the corresponding service provider to the address of the load binding server.

[0111] Specifically, after the service initiator obtains the load balancer address, it can send the service request to the load balancing device based on that address. The load balancing device then forwards the service request to one of the multiple service instances provided by the service provider bound to it. Selecting a target service instance from the multiple service instances can employ a load balancing strategy, such as round-robin, weighted load balancing, or least-connections load balancing. This embodiment does not limit this approach.

[0112] The service invocation method provided in this embodiment, by setting up a service identifier registration server and a load binding server, can obtain the load address of the load binding server corresponding to the service identifier of the service provider from the service identifier registration server when the registration center cannot provide the service list. Then, based on the load address, the service request is sent to the load binding server, so that the load binding server forwards the service request to the appropriate service instance. This decouples the method from the registration center, reduces the dependence on the registration center, and ensures that service invocation can still be performed normally when the registration center is abnormal, thereby improving the effectiveness of service invocation.

[0113] In some embodiments, after obtaining the service request initiated by the service initiator in step 201, the method can further include: parsing the service request to obtain address information; the address information includes at least one of a load address corresponding to a service provider or 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 according to 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 request information encapsulator can put the relevant information of the service request into the context of the service request, and the relevant information can include an address, such as a load address of a load binding server corresponding to a service provider or an address of a service instance provided by the service provider (the service request is generated by specifying that the service instance processes the service request, and the IP address of the service instance is put into the service request).

[0115] In some embodiments, determining the third target service instance according to the address information can 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 that the load binding server determines the third target service instance based on a first load balancing strategy; and 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 is working normally, i.e., the service list is obtained from the registration center, the service list includes at least one service instance. After step 201, the method can further 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 a service provider corresponding to the service identifier; determining a second target service instance from the service list based on a second load balancing strategy; and sending the service request to the second target service instance, so that the second target service instance processes the service request.

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

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

[0119] Figure 5 Flowchart of a service calling method provided by an embodiment of the application Figure 2 As shown in Figure 5 , the method comprises:

[0120] 501. Receiving an address query request sent by a service initiator 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 being obtained by the service initiator by analyzing the service request.

[0121] The execution subject of the embodiment can be a service identifier registration server.

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

[0123] 503. Sending the load address to the service initiator, so that the service initiator sends the service request to a load binding server corresponding to the load address, and sends 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, so that the first target service instance processes the service request; the load binding server being configured to bind the addresses of a plurality of service instances of a corresponding service provider with the address of the load binding server.

[0124] The implementation process of the service calling method provided by the embodiment can refer to the above embodiments, for example Figure 2 the introduction of the embodiment, which will not be described here.

[0125] In some embodiments, the service identification registration server can pre-establish the correspondence between the service identification and the load address of the domain name and the like to implement the registration of the service identification of the domain name and the like. The registration mode can be various. In an implementable mode, the automatic registration mode can be adopted. Specifically, before receiving the address query request sent by the service initiator according to the service identification, the method further can include: receiving a registration request sent by the load binding server corresponding to the service provider; the registration request includes the load address corresponding to the load binding server and the service identification corresponding to the service provider; and according to the registration request, establishing the correspondence between the service identification corresponding to the service provider and the load address.

[0126] In another implementable mode, the manual registration mode can be adopted. Specifically, before receiving the address query request sent by the service initiator according to the service identification, the method further can include: in response to a touch operation acting on a registration interface, generating a registration request; the registration request includes the load address corresponding to the load binding server and the service identification corresponding to the service provider; and according to the registration request, establishing the correspondence between the service identification corresponding to the service provider and the load address.

[0127] The service calling method provided by the embodiment can obtain the load address corresponding to the load binding server corresponding to the service identification of the service provider from the service identification registration server when the registration center cannot provide the 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 a suitable service instance, thereby decoupling from the registration center, reducing the dependence on the registration center, and still being able to normally call the service when the registration center is abnormal, and improving the effectiveness of service calling.

[0128] Figure 6 Flowchart of the service calling method provided by the embodiment Figure 3 As shown in Figure 2 , the method includes:

[0129] 601, receiving 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 a service list corresponding to the service request is not obtained from a registration center; the service identification is obtained by the service initiator by analyzing the service request; and the load address is an address of a corresponding load binding server.

[0130] 602、sending the service request to a first target service instance in the plurality of service instances bound by the load binding server according to the first load balancing strategy, so that the first target service instance processes the service request; the load binding server is configured to bind addresses of the plurality of service instances of the corresponding service provider with an address of the load binding server.

[0131] The execution subject of the embodiment can be a load binding server.

[0132] In some embodiments, the load binding server can bind the plurality of service instances of the service provider with the load address in advance, and the binding manner can be various. In an implementable manner, automatic binding can be performed to save manual work. Specifically, 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 the service provider; the binding request includes addresses of the plurality of service instances provided by the service provider; and binding the addresses of the plurality of service instances provided by the service provider with the address of the load binding server according to the binding request.

[0133] In another implementable manner, 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 a binding interface; the binding request includes addresses of the plurality of service instances provided by the service provider; and binding the addresses of the plurality of 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, the service provider can be initiated to verify. Specifically, the binding confirmation information can be sent to the service provider based on a preset period, so that the service provider compares the binding confirmation information with the addresses of the plurality of service instances currently provided, and if they are inconsistent, returns the current addresses of the plurality of service instances currently provided; the binding confirmation information includes addresses of the plurality of service instances bound with the load binding server; and the current addresses sent by the service provider are received and bound with the address of the load binding server.

[0135] The implementation process of the service calling method provided by the embodiment can refer to the above-mentioned embodiments, for example Figure 7 The above-mentioned embodiments are introduced, and details are not described herein.

[0136] The service calling method provided in the embodiment can obtain the load address corresponding to the load binding server corresponding to the service identifier corresponding to the service provider from the service identifier registration server when the registration center cannot provide the 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 decoupling from the registration center, reducing the dependence on the registration center, and still being able to normally call the service when the registration center is abnormal, and improving the effectiveness of service calling.

[0137] Figure 7 The interaction flow diagram of the service calling method provided in the embodiment is shown in FIG. Figure 2 The method comprises the following steps.

[0138] 701. The service initiating device obtains a service request, analyzes the service request to obtain a service identifier, and 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 registration center returns that the service list 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 configured to establish a one-to-one correspondence between the service identifier and the load address, and 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 the first target service instance in the plurality of 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, and the load binding server is configured to bind the addresses of the plurality of service instances of the corresponding service provider with the address of the load binding server.

[0146] The implementation process of the service calling method provided in the embodiment can refer to the above-mentioned embodiments, for example, the introduction of the embodiment shown in FIG. Figure 8 The detailed description of the embodiment is omitted here.

[0147] The service calling method provided by the embodiment can obtain the load address corresponding to the load binding server corresponding to the service identifier corresponding to the service provider from the service identifier registration server when the registration center cannot provide the 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 decoupling from the registration center, reducing the dependence on the registration center, and still being able to normally call the service when the registration center is abnormal, and improving the effectiveness of the service calling.

[0148] Figure 8 The structural schematic diagram of the service initiation device provided by the embodiment of the application is shown in the figure. Figure 9 As shown in the figure, the service calling device 80 comprises an acquisition module 801 and a first sending module 802.

[0149] The acquisition module 801 is configured to acquire a service request, analyze the service request to obtain a service identifier, and the service identifier is the unique identifier of a service provider.

[0150] The first sending module 802 is configured to send an address query request to a service identifier registration server according to the service identifier if the service list corresponding to the service request is not acquired from the registration center, 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 configured to establish a one-to-one correspondence between the service identifier and the load address; and the load address is the address of a corresponding load binding server.

[0151] The first sending module 802 is further configured to 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 a first target service instance in a plurality of service instances bound by the load binding server based on a first load balancing strategy, so that the first target service instance processes the service request; and the load binding server is configured to bind the addresses of a plurality of service instances of a corresponding service provider with the address of the load binding server.

[0152] The service network initiating device provided by the embodiments of the present application can obtain the load address corresponding to the load binding server corresponding to the service identifier of the service provider from the service identifier registration server when the registration center cannot provide the 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 decoupling from the registration center, reducing the dependence on the registration center, and still being able to normally call the service when the registration center is abnormal, and improving the effectiveness of service calling.

[0153] In some embodiments, the first sending module 802 is specifically configured to: if the service identifier includes the service domain name corresponding to the service provider, obtain the load address corresponding to the service domain name from the service identifier registration server according to the service domain name; and the service identifier registration server is configured 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 configured to: if the service identifier includes the service domain name corresponding to the service provider, obtain the load address corresponding to the service domain name from the service identifier registration server according to the service domain name; and the service identifier registration server is configured to establish a one-to-one correspondence between the service domain name and the load address.

[0155] In some embodiments, the obtaining module 801 is specifically configured to: add the related information of the service request into the corresponding context object through a request information encapsulator; if the service domain name is not included in the context object and the service name is included, construct the service domain name based on a preset rule according to the service name; and if the service domain name is included in the context object, obtain the service domain name from the context object.

[0156] In some embodiments, the first sending module 802 is specifically configured to: construct a virtual service instance according to the service identifier; perform service request initiating processing based on the virtual service instance; and during the service request initiating 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 further configured to: parse the service request to obtain address information; the address information comprises at least one of a load address corresponding to a service provider or 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, determine a third target service instance according to 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 configured to: if the address information comprises a load address corresponding to a service provider, send the service request to a load binding server corresponding to the load address, so that the third target service instance is determined by the load binding server based on a first load balancing strategy; and if the address information comprises an address of a 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 configured to: send a query request to the registration center according to the service identity; receive a service list returned by the registration center according to the query request; the service list comprises at least one service instance provided by a service provider corresponding to the service identity; 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 configured to: if the number of service instances in the service list is greater than 1, obtain a previous position index, obtain a current position index by taking the length of the service list modulo the previous 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 by the embodiments of the present application can be used to execute the method embodiments described above, and has similar implementation principles and technical effects, which will not be described here again.

[0162] Figure 9 The structure diagram of the service identity registration server provided by the embodiments of the present application is shown in FIG. 9. As shown in FIG. 9, the service calling device 90 comprises a first receiving module 901, a determining module 902 and a second sending module 903. Figure 10

[0163] ​The first receiving module 901 is configured to receive an address query request sent by a service initiator 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 analyzing the obtained service request; and the service identifier is a unique identifier of a service provider.

[0164] The determining module 902 is configured to determine a load address corresponding to the service identifier according to the address query request.

[0165] The second sending module 903 is configured to send the load address to the service initiator, so that the service initiator sends the service request to a load binding server corresponding to the load address, sends 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, and enables the first target service instance to process the service request; and the load binding server is configured to bind addresses of a plurality of service instances of a corresponding service provider with an address of the load binding server.

[0166] The service identifier registration server provided by the embodiment can obtain a load address corresponding to a load binding server corresponding to a service identifier of a service provider from the service identifier registration server when the registration center fails to provide a service list, and then send a service request to the load binding server based on the load address, so that the load binding server forwards the service request to a suitable service instance, thereby decoupling from the registration center, reducing the dependence on the registration center, and enabling normal service calling when the registration center is abnormal, thereby improving the effectiveness of service calling.

[0167] In some embodiments, the first receiving module 901 is further configured 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 a corresponding relationship between the service identifier corresponding to the service provider and the load address is established according to the registration request.

[0168] In some embodiments, the first receiving module 901 is further configured to generate a registration request in response to a touch operation on a 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 a corresponding relationship between the service identifier corresponding to the service provider and the load address is established according to the registration request.

[0169] The service calling device provided by the embodiment can be used to execute the method embodiments described above, and has similar implementation principles and technical effects, which will not be described here again.

[0170] Figure 10 A structural diagram of a service identifier registration server is provided in the embodiments of the present application. As shown in the figure, the service calling device 100 comprises a second receiving module 1001 and a third sending module 1002. Figure 11

[0171] The second receiving module 1001 is configured to receive a service request sent by a service initiator based on a load address, wherein the load address is obtained by the service initiator from the service identifier 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, and the service identifier is obtained by the service initiator by analyzing the obtained service request; the load address is an address of a corresponding load binding server

[0172] The third sending module 1002 is configured 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, so that the first target service instance processes the service request; the load binding server is configured to bind addresses of a plurality of service instances of a corresponding service provider with the address of the load binding server.

[0173] The service identifier registration server provided by the embodiments of the present application can obtain a load address corresponding to a load binding server corresponding to a service identifier corresponding to a service provider from the service identifier registration server when the registration center fails to provide a service list, and then send a service request to the load binding server based on the load address, so that the load binding server forwards the service request to a suitable service instance, thereby decoupling from the registration center, reducing the dependence on the registration center, and still being able to normally call services when the registration center is abnormal, thereby improving the effectiveness of service calling.

[0174] In some embodiments, the second receiving module 1001 is further configured to receive a binding request sent by a service provider; the binding request comprises addresses of a plurality of service instances provided by the service provider; and the addresses of the plurality of service instances provided by the service provider are bound with the address of the load binding server according to the binding request.

[0175] In some embodiments, the second receiving module 1001 is further configured to generate a binding request in response to a touch operation on a binding interface; the binding request comprises addresses of a plurality of service instances provided by the service provider; and the addresses of the plurality of service instances provided by the service provider are bound with the address of the load binding server according to the binding request.

[0176] ​In some embodiments, the third sending module 1002 is further configured to send, to the service provider, a binding confirmation information based on a preset period, so that the service provider compares the binding confirmation information with addresses of the plurality of service instances currently provided, and returns a current address of the plurality of service instances currently provided if the binding confirmation information is inconsistent with the addresses; the binding confirmation information comprises addresses of the plurality of service instances bound with the load binding server; and the current address sent by the service provider is received and bound with an address of the load binding server.

[0177] The service calling device provided by the embodiments of the present application can be used to execute the method embodiments described above, and has similar implementation principles and technical effects, which will not be described here again.

[0178] ​ The hardware structure schematic diagram of the electronic device provided by the embodiments of the present application is shown in the figure. The device can be a computer, a tablet device, a server, etc.

[0179] The device 110 can include one or more of the following components: a processing component 1101, a memory 1102, a power supply 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 usually controls the overall operation of the device 110, such as operations associated with displaying, making phone calls, data communications, camera operations and recording operations. The processing component 1101 can include one or more processors 1109 to execute instructions to complete all or part of the steps of the methods described above. In addition, the processing component 1101 can include one or more modules to facilitate the interaction between the processing component 1101 and other components. For example, the processing component 1101 can 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 the operation of the device 110. Examples of these data include instructions for any application or method operating on the device 110, contact data, phonebook data, messages, pictures, videos, etc. The memory 1102 can be realized by any type of volatile or non-volatile storage device or their combination, 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 storage, flash memory, magnetic disk or optical disk.

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

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

[0184] Audio component 1105 is configured to output and / or input audio signals. For example, audio component 1105 includes a microphone (MIC) configured to receive external audio signals when device 110 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in memory 1102 or transmitted via communication component 1108. In some embodiments, 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 can be a keyboard, a click wheel, buttons, and the like. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0186] The sensor component 1107 includes one or more sensors for providing status assessments for various aspects of the device 110. For example, the sensor component 1107 can detect an on / off status of the device 110, relative positioning of components of the device 110, such as a display and a keypad of the device 110, a change in position of the device 110 or a component of the device 110, presence or absence of user contact with the device 110, orientation or acceleration / deceleration / g-force and temperature changes of the device 110. The sensor component 1107 can include an accelerometer, a gyroscope, a magnetometer, 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 another device. 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 further 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 technology.

[0188] In an exemplary embodiment, the device 110 can be implemented using 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, micro-controllers, microprocessors or other electronic elements, to perform the above-described methods.

[0189] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 1102 including instructions, is also provided, which can be executed by the processor 1109 of the device 110 to perform the above-described methods. 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 disc, and an optical data storage device, etc.

[0190] The computer readable storage medium described above can be implemented by any type of volatile or nonvolatile storage devices 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 storage, 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 the processor, so that the processor can read information from the readable storage medium, and can write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the device.

[0192] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The foregoing program can be stored in a computer readable storage medium. The program executes to perform the steps of the above-mentioned method embodiments; and the foregoing storage medium includes ROM, RAM, magnetic disk or optical disk and various storage media that can store program codes.

[0193] The embodiments of the present application also provide a computer program product, comprising a computer program, which is executed by a processor to implement the service calling method performed by the 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, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A service invocation method, characterized by, The method comprises: obtaining a service request; and parsing the service request to obtain a service identifier; 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 configured to establish a one-to-one correspondence between the service identifier and the load address; and the load address is an address of a 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 a first target service instance in a plurality of service instances bound by the load binding server based on a first load balancing strategy, and the first target service instance processes the service request; the load binding server is configured to bind addresses of a plurality of service instances of a corresponding service provider with the address of the load binding server; 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, comprising: constructing a virtual service instance according to the service identifier; processing the service request initiation based on the virtual service instance; during the service request initiation processing, 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.

2. The method of claim 1, wherein, If the service identifier includes a 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 configured to establish a one-to-one correspondence between the service identifier and the load address, comprising: obtaining the load address corresponding to the service domain name from the service identifier registration server according to the service domain name; the service identifier registration server is configured to establish a one-to-one correspondence between the service domain name and the load address.

3. The method of claim 1, wherein, If the service identifier includes a port and a 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 configured to establish a one-to-one correspondence between the service identifier and the load address, comprising: obtaining the load address corresponding to the service domain name and the port from the service identifier registration server according to the service domain name and the port, and the service identifier registration server is configured to establish a one-to-one correspondence between a combination of the service domain name and the port and the load address.

4. The method of claim 1, wherein, The service identifier includes a service domain name, and the service identifier is obtained by parsing the service request, comprising: adding, by a request information encapsulator, related information of the service request into a corresponding context object; if the service domain name is not included in the context object and the service name is included, constructing the service domain name based on a preset rule according to the service name; if the service domain name is included in the context object, obtaining the service domain name from the context object.

5. The method according to any one of claims 1 to 4, characterized in that, After the service request initiated by the service initiator is obtained, 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 a 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 according to 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.

6. The method of claim 5, wherein, The method further includes: if the address information includes the load address corresponding to the service provider, sending the service request to a load binding server corresponding to the load address, so that the load binding server determines the third target service instance based on a first load balancing strategy; if the address information includes the address of the service instance provided by the service provider, determining the service instance corresponding to the address as the third target service instance.

7. The method according to any one of claims 1 to 4, characterized in that, The method further includes: 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 a 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.

8. The method according to any one of claims 1 to 4, characterized in that, The method further includes: if the number of service instances in the service list is greater than 1, obtaining a previous position index, taking a modulus of the length of the service list according to the previous position index to obtain a current position index; determining the second target service instance from the service list according to the current position index.

9. A service invocation method, characterized by, The method further includes: receiving an address query request sent by the service initiator according to a service identifier when the service list corresponding to the service request is not obtained from the registration center; the service identifier is obtained by the service initiator by parsing the service request; the service identifier is a unique identifier of the service provider; the address query request is sent by the service initiator according to the service identifier in a service request initiation processing process based on a virtual service instance; the virtual service instance is constructed according to the service identifier; determining a 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 a load binding server corresponding to the load address, and sending the service request to a first target service instance in a plurality of 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 configured to bind the addresses of the plurality of service instances of the corresponding service provider with the address of the load binding server.

10. The method of claim 9, wherein, Before the receiving service initiator sends the address query request according to the service identifier, the method further includes: receiving a registration request sent by a load binding server corresponding to the 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, the corresponding relationship between the service identifier corresponding to the service provider and the load address is established.

11. The method of claim 9, wherein, Before the receiving service initiator sends the address query request 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, the corresponding relationship between the service identifier corresponding to the service provider and the load address is established.

12. A service invocation method, characterized by, It includes: receiving a service request sent by a service initiator based on a load address; The load address is obtained by the service identifier registration server according to the address query request returned by the service initiator when the service initiator does not obtain a service list corresponding to the service request from the registration center; The service identifier is obtained by the service initiator by analyzing the service request; the load address is the address of the corresponding load binding server; the address query request is sent by the service initiator according to the service identifier in the service request initiation process based on a virtual service instance; the virtual service instance is constructed according to the service identifier; sending the service request to a first target service instance in a plurality of 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 configured to bind the addresses of the plurality of service instances of the corresponding service provider with the address of the load binding server.

13. The method of claim 12, wherein, Before the receiving service initiator sends the service request based on the load address, the method further includes: receiving a binding request sent by a service provider; the binding request includes the addresses of a plurality of service instances provided by the service provider; According to the binding request, the addresses of the plurality of service instances provided by the service provider are bound with the address of the load binding server.

14. The method of claim 12, wherein, Before the receiving service initiator sends the service request based on the load address, the method further includes: In response to a touch operation on the binding interface, a binding request is generated, wherein the binding request comprises addresses of the plurality of service instances provided by the service provider; According to the binding request, the addresses of the plurality of service instances provided by the service provider are bound with the address of the load binding server.

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

16. A service initiating device, characterized by Comprise: The acquisition module is used for acquiring a service request; and the service request is parsed to obtain a service identifier; The service identifier is a unique identifier of a service provider; The first sending module is used for sending an address query request to a service identifier registration server according to the service identifier if a service list corresponding to the service request is not acquired from a registration center, 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 for establishing a one-to-one correspondence between a service identifier and a load address; and the load address is an address of a corresponding load binding server; The first sending module is also used for sending the service request to the load binding server corresponding to the load address, so that the service request is sent to a first target service instance in a plurality of service instances bound with the load binding server by the load binding server based on a first load balancing strategy, and the first target service instance processes the service request; and the load binding server is used for binding the addresses of the plurality of service instances of the corresponding service provider with the address of the load binding server; The first sending module is specifically used for constructing a virtual service instance according to the service identifier; Service request initiation processing is performed based on the virtual service instance; During the service request initiation processing, 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 a load address corresponding to the service identifier according to the address query request.

17. A service identification registration server, characterized by Comprise: The first receiving module is used for receiving an address query request sent by a service initiator according to a service identifier when a service list corresponding to a service request is not acquired from a registration center; The service identifier is obtained by the service initiator by parsing the service request; the service identifier is a unique identifier of a service provider; and the address query request is sent by the service initiator according to the service identifier during service request initiation processing based on a virtual service instance; The virtual service instance is constructed according to the service identifier; The determining module is used for determining a load address corresponding to the service identifier according to the address query request; and The first sending module is used for sending the service request to the load binding server corresponding to the load address, so that the service request is sent to a first target service instance in a plurality of service instances bound with the load binding server by the load binding server based on a first load balancing strategy, and the first target service instance processes the service request; and the load binding server is used for binding the addresses of the plurality of service instances of the corresponding service provider with the address of the load binding server. The second sending module is configured to send the load address to the service initiator, so that the service initiator sends the service request to a load binding server corresponding to the load address, and sends the service request to a first target service instance in a plurality of 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 configured to bind addresses of a plurality of service instances of a corresponding service provider to an address of the load binding server.

18. A load binding server, characterized by The method comprises: The second receiving module is configured to receive a service request sent by a service initiator based on a load address. The load address is obtained by the service initiator according to a service identifier when the service initiator fails to obtain a service list corresponding to the service request from a registration center, and sends an address query request to a service identifier registration server according to the service identifier, so that the service identifier registration server returns an address query request obtained according to the address query request. The service identifier is obtained by the service initiator by analyzing the obtained service request; the load address is an address of a corresponding load binding server; and the address query request is sent by the service initiator according to the service identifier in a service request initiation processing process based on a virtual service instance. The virtual service instance is constructed according to the service identifier. The third sending module is configured to send the service request to a first target service instance in a plurality of 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 configured to bind addresses of a plurality of service instances of a corresponding service provider to an address of the load binding server.

19. An electronic device, comprising: The method comprises: At least one processor and a memory; The memory stores computer execution instructions; The at least one processor executes the computer execution 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 15.

20. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, the service calling method according to any one of claims 1 to 15 is realized.

21. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to realize the service calling method according to any one of claims 1 to 15.

Citation Information

Patent Citations

  • Service invocation method, device and system

    CN109542641A

  • Application service calling system, method and device

    CN109788015A