WO2023273240A1 - Micro-service calling method and apparatus, electronic device, and readable storage medium - Google Patents
Micro-service calling method and apparatus, electronic device, and readable storage medium Download PDFInfo
- Publication number
- WO2023273240A1 WO2023273240A1 PCT/CN2021/140935 CN2021140935W WO2023273240A1 WO 2023273240 A1 WO2023273240 A1 WO 2023273240A1 CN 2021140935 W CN2021140935 W CN 2021140935W WO 2023273240 A1 WO2023273240 A1 WO 2023273240A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- microservice
- node
- instance
- chain
- list
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 230000004044 response Effects 0.000 claims abstract description 8
- 238000001514 detection method Methods 0.000 claims description 37
- 230000002159 abnormal effect Effects 0.000 claims description 20
- 238000012546 transfer Methods 0.000 claims description 12
- 238000003780 insertion Methods 0.000 claims description 5
- 230000037431 insertion Effects 0.000 claims description 5
- 238000004590 computer program Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 7
- 238000012545 processing Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 230000005540 biological transmission Effects 0.000 description 4
- 238000010276 construction Methods 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 230000001360 synchronised effect Effects 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000000644 propagated effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/51—Discovery or management thereof, e.g. service location protocol [SLP] or web services
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
Definitions
- the present application relates to the field of computer technology, and in particular to a microservice calling method, device, electronic equipment, and computer-readable storage medium.
- the microservice architecture provides the discovery function of microservices by introducing a registration center.
- the registration center as the overall server, provides microservice registration and client discovery, while microservice callers and microservice providers are implemented by the client.
- the microservice caller obtains the required microservice list from the microservice registration center, caches it locally and periodically requests the registration center to update the state of the local cache, and after obtaining the microservice list, according to the microservice
- the name obtains the specific microservice instance and the access information of the instance, so as to further determine the selected instance to implement the call according to the load balancing strategy.
- a method for invoking a microservice including: in response to the invocation request of the target microservice sent by the microservice invocation end, obtaining a list of microservice instances matching the invocation request, the microservice list It is used to record the microservice information of all nodes on the microservice instance chain, and the microservice instance chain includes at least one of the microservice nodes; the microservice instance list is sent to the microservice calling end, that is, the The calling end calls the target microservice based on the microservice instance list.
- the microservice invocation end before obtaining the list of microservice instances matching the invocation request in response to the invocation request of the target microservice sent by the microservice invocation end, it further includes: based on the IP segment scanning operation, At least one of the microservice nodes is configured as the microservice instance chain; and the microservice instance list is generated based on the transfer operation of the microservice information of the microservice nodes along the microservice instance chain.
- the IP segment-based scanning operation constructs at least one of the microservice nodes as the microservice instance chain, which specifically includes: when receiving the registration information of the node to be registered, from the The IP segment information of the node to be registered is extracted from the registration information, and the node to be registered is the microservice node to be registered; when the microservice instance chain is an empty chain, based on the IP segment information, the The nodes to be registered are sorted to construct the microservice instance chain; when the microservice instance chain is a non-empty chain, the IP segment scan is performed on the microservice instance chain of the non-empty chain to determine the Describe the original front node and the original back node of the node to be registered, insert the said to-be-registered node between the original front node and the original back node, and record it as an insertion node, wherein the first IP of the original front node
- the segment information is the largest IP segment in the microservice instance chain that is smaller than the IP segment information, and the second IP
- the method further includes: returning registration success information to the node to be registered.
- the microservice instance chain is a circular instance chain.
- generating the microservice instance list based on the transfer operation of the microservice information of the microservice node along the microservice instance chain specifically includes: When the instance chain is an empty chain, keep the microservice information of the node to be registered in the microservice instance list; when the microservice instance chain is a non-empty chain, transfer the microservice information of the inserted node to the original rear node, so that the original rear node updates the microservice instance list, and passes the updated microservice instance list along the ring instance chain until it is passed to the insertion node, wherein , the microservice information includes at least one of node IP segment information, node port, microservice name, instance name, and instance detection interface.
- the method further includes: detecting the status of nodes in the microservice instance chain based on a preset detection frequency.
- a microservice invocation method including: sending a microservice invocation request to a microservice node; receiving a microservice instance list fed back by the microservice node based on the invocation request, the The microservice list is used to record the instance information of at least one microservice node, and the at least one microservice node forms a chain structure; select the target microservice node from the microservice instance list based on the load balancing strategy; The access information of the service node invokes the target microservice.
- an electronic device including: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute any of the above-mentioned first aspects by executing the executable instructions.
- a processor including: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute any of the above-mentioned first aspects by executing the executable instructions.
- an electronic device including: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute any of the above-mentioned second aspects by executing the executable instructions.
- a processor including: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute any of the above-mentioned second aspects by executing the executable instructions.
- a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, any one of the microservice calling methods above is implemented.
- the microservice invocation scheme provided by the embodiment of the present application configures a microservice instance chain by using at least one microservice provider terminal as a microservice node, so that the microservice information belonging to all nodes on the microservice instance chain can be chained In this way, each microservice node can save the latest component status of all microservice nodes in the way of saving microservice information. Further, based on random transmission or polling transmission, the microservice provider terminal as a microservice node directly receives the target microservice invocation request sent by the microservice invocation terminal, so that the microservice provider terminal directly sends the microservice invocation terminal The microservice instance list that can realize the target microservice is fed back, so that the microservice calling terminal realizes the invocation of the target microservice based on the microservice instance list.
- the above request and call process does not require the participation of the registration center, that is to say, it gets rid of the strong dependence on the registration center, so the call failure will not be caused by the failure of the registration center, thereby improving the micro service.
- Reliability of service calls when the microservice instance chain includes multiple microservice nodes, since each microservice node stores a list of microservice instances, even if there is a faulty node, it can be fed back by other normal nodes. The list of instances and the calls to execute microservices can further improve the reliability of microservice calls.
- FIG. 1 shows a flow chart of a method for invoking a microservice in an embodiment of the present application
- FIG. 2 shows a flow chart of another microservice calling method in the embodiment of the present application
- FIG. 3 shows a flowchart of another microservice calling method in the embodiment of the present application
- FIG. 4 shows a schematic structural diagram of a microservice instance chain in an embodiment of the present application
- FIG. 5 shows a flow chart of another microservice calling method in the embodiment of the present application.
- FIG. 6 shows a flow chart of another microservice calling method in the embodiment of the present application.
- FIG. 7 shows a flow chart of another microservice calling method in the embodiment of the present application.
- FIG. 8 shows a flowchart of another microservice calling method in the embodiment of the present application.
- FIG. 9 shows a flow chart of another microservice calling method in the embodiment of the present application.
- FIG. 10 shows a schematic diagram of a microservice calling system in the embodiment of the present application.
- FIG. 11 shows a schematic diagram of a microservice invocation device in the embodiment of the present application.
- FIG. 12 shows a schematic diagram of another microservice invocation device in the embodiment of the present application.
- FIG. 13 shows a schematic diagram of an electronic device in an embodiment of the present application.
- Fig. 14 shows a schematic diagram of a computer-readable storage medium in an embodiment of the present application.
- Example embodiments will now be described more fully with reference to the accompanying drawings.
- Example embodiments may, however, be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the concepts of example embodiments to those skilled in the art.
- the described features, structures or properties may be combined in any suitable manner in one or more embodiments.
- numerous specific details are provided in order to give a thorough understanding of embodiments of the present application.
- those skilled in the art will appreciate that the technical solutions of the present application can be practiced without one or more of the specified details, or other components, devices, steps, etc. can be adopted.
- well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the application.
- the microservice provides the terminal to execute the microservice calling method, including the following steps:
- Step S102 in response to the invocation request of the target microservice sent by the microservice caller, obtain a list of microservice instances matching the invocation request.
- the microservice list is used to record the microservice information of all nodes on the microservice instance chain.
- the microservice instance A chain includes at least one microservice node.
- the microservice invocation terminal directly receives the invocation request of the target microservice sent by the microservice invocation terminal, that is, the invocation request of the target microservice sent by the microservice invocation terminal.
- the microservice provider terminal of the service instance is the microservice node.
- the microservice instance chain is to sort multiple microservice nodes according to the specified sorting method, so that information can be exchanged between the microservice nodes, so that each microservice node can store all the microservice instances on the microservice instance chain.
- microservice instance chain does not exclude the situation that there is only one microservice node.
- microservice instance chain can be an open chain structure or a closed chain structure.
- Step S104 sending the microservice instance list to the microservice calling end, that is, the calling end invokes the target microservice based on the microservice instance list.
- At least one microservice provider terminal is used as a microservice node to configure a microservice instance chain, so that the microservice information belonging to all nodes on the microservice instance chain can be transmitted in a chain, so that each Each microservice node can save the latest component status of all microservice nodes in the way of saving microservice information.
- the microservice provider terminal as a microservice node directly receives the target microservice invocation request sent by the microservice invocation terminal, so that the microservice provider terminal directly sends the microservice invocation terminal Feedback can realize the microservice instance list of the target microservice, so that the microservice calling terminal can realize the invocation of the target microservice based on the microservice instance list.
- microservice instance chain includes multiple microservice nodes, because each Each microservice node stores a list of microservice instances. Even if there is a faulty node, other normal nodes can feed back the instance list and execute the called microservice, so the reliability of microservice invocation can be further improved.
- microservice providing terminal as the execution subject can be any microservice node in the microservice instance chain, or a microservice node to be registered.
- step S102 in response to the invocation request of the target microservice sent by the microservice caller, before obtaining the list of microservice instances matching the invocation request, it also includes:
- Step S202 constructing at least one microservice node as a microservice instance chain based on an IP segment scanning operation.
- the address segment of the node needs to be configured without specifying a specific IP address.
- the IP address can be configured flexibly, and the IP segment scanning of other nodes that can belong to the same microservice instance chain can be performed, which can improve the scanning efficiency.
- Step S204 based on the transfer operation of the microservice information of the microservice nodes along the microservice instance chain, a list of microservice instances is generated.
- the micro-service instance chain is obtained, and further based on the micro-service instance
- the chain can perform information transfer and list update to ensure that microservices are effectively invoked.
- step S202 based on the IP segment scanning operation, constructs at least one microservice node as a specific implementation of a microservice instance chain, including:
- Step S302 when the registration information of the node to be registered is received, the IP segment information of the node to be registered is extracted from the registration information, and the node to be registered is a microservice node to be registered.
- the registration information of the node to be registered may be the same as the microservice information of the node.
- Step S304 when the microservice instance chain is empty, sort the nodes to be registered based on the IP segment information to construct a microservice instance chain.
- Step S306 when the microservice instance chain is a non-empty chain, perform an IP segment scan on the microservice instance chain of the non-empty chain to determine the original front node and the original back node of the node to be registered, and insert the node to be registered into the original front node Between the node and the original node, it is recorded as an insertion node.
- the first IP segment information of the original former node is the largest IP segment smaller than the IP segment information in the microservice instance chain
- the second IP segment information of the original post node is the smallest IP segment larger than the IP segment information in the microservice instance chain part.
- Step S308 returning registration success information to the node to be registered.
- the microservice instance chain is constructed by sorting the nodes based on the size of the IP segment, so that microservice information can be transmitted between nodes with similar IP addresses.
- the microservice instance chain is a circular instance chain.
- each microservice instance represents a microservice node.
- Microservice instance 1 to microservice instance 8 form a circular instance chain, and the instance information of the microservice node is transmitted in the ring in a chained manner.
- each instance simultaneously updates the state of all components currently saved in the local machine during the transfer process.
- a complete list of instances can be generated after passing around one by one, and further passed in sequence, so that each microservice node can save the list of microservice instances, no matter which microservice node receives the call request , the instance list can be sent to the calling terminal, so that the calling terminal can execute the calling operation smoothly.
- a specific implementation manner of generating a list of microservice instances includes :
- Step S502 when the microservice instance chain is empty, keep the microservice information of the node to be registered in the microservice instance list.
- Step S504 when the microservice instance chain is non-empty, transfer the microservice information of the inserted node to the original post node, so that the original post node updates the microservice instance list, and sends the updated microservice instance list along the ring instance The chain is passed until it is passed to the insertion node.
- the microservice information includes at least one of node IP segment information, node port, microservice name, instance name and instance detection interface.
- the node to be registered when the microservice instance chain is an empty chain, the node to be registered can be understood as the original node, that is, the node that constructs the microservice instance list; when the microservice instance chain is a non-empty chain, the node to be registered can understand To insert a node, that is, update the microservice instance list based on the microservice information of the inserted node, and then realize the construction and update of the microservice instance list.
- step S602 the node to be registered performs an IP segment scanning operation.
- Step S604 check whether other microservice nodes in the instance chain are scanned, if the detection result is "Yes”, go to Step S608, and if the detection result is "No", go to Step S606.
- Step S606 generating a microservice instance list based on its own microservice information.
- step S610 the latter microservice node registers the node to be registered based on the registration information, and returns registration success information to the node to be registered, and the node to be registered is changed to a registered node.
- step S612 the latter microservice node transmits the registration information in a circular manner.
- Step S614 the registration node receives the microservice instance list, and selects the previous microservice node from the microservice instance list.
- Step S616 the registration node updates the microservice instance list based on the selected previous microservice node to form a new circular instance chain.
- a node when a node starts up, it scans backwards according to the specified IP segment, which is called ring scan.
- ring scan When scanning to a post-node whose IP segment is larger than its own, stop scanning and save its own microservice instance information, including but not limited to the following information: current machine IP, port, current microservice name, instance name, instance detection interface Wait for the specific information to be sent to the target machine, that is, the post node. After receiving the successful registration information, pull the entire microservice list information of the target machine to the local and save it.
- the component runs healthy and receives the registration information of the new node, check the registered node information. If the node information is greater than the current node IP value, write the node information to the microservice list, and then return success to the newly registered node information.
- the registration information of the new node is sent to the original front node and the back node.
- the original front node pulls a complete list of microservices and adjusts its own back node.
- the post node in the original chain After the post node in the original chain receives the new registration information, it transmits its registration information to its own post node until the registration information is updated to all microservice nodes in the ring and then stops.
- the method further includes: detecting the status of nodes in the microservice instance chain based on a preset detection frequency.
- the availability and reachability of microservices are ensured through a mutual detection mechanism, and its component status is more accurate than heartbeat updates.
- the detection of the node status in the microservice instance chain based on the preset detection frequency specifically includes:
- Step S702 when detecting an abnormal heartbeat of the previous microservice node, setting the previous microservice node to an unavailable state in the microservice instance list, and updating the microservice instance list.
- Step S704 when it is detected that the number of abnormal heartbeats of the previous microservice node reaches the abnormal threshold, delete the previous microservice node from the microservice instance list, update the microservice instance list, and reconstruct the microservice instance chain.
- detecting the state of the nodes in the microservice instance chain based on the preset detection frequency specifically includes:
- Step S802 any current node detects the heartbeat information of the previous node.
- Step S804 based on the heartbeat information, detect whether the heartbeat of the previous node is normal, if the detection result is "Yes”, proceed to Step S806, and if the detection result is "No", proceed to Step S808.
- Step S806 recording the detection time.
- Step S808 detect whether the number of abnormal heartbeats reaches the abnormal threshold, if the detection result is "Yes”, proceed to Step S810, and if the detection result is "No", proceed to Step S812.
- Step S810 delete the former node from the microservice instance list.
- Step S812 setting the state of the previous node as unreachable, and updating the instance list.
- step S814 the state information is transmitted to the subsequent node.
- Step S816 after detecting whether the node is reachable, if the detection result is "yes”, go to step S820, and if the detection result is "no", go to step S818.
- Step S820 circularly transmit the updated instance list.
- Step S822 until the updated instance list is delivered to the current node.
- the timing detection task when the microservice component is successfully registered on the chain, the timing detection task will be started.
- the timing detection task occurs, the current node needs to detect the state of the previous node. The state is not abnormal, the current node only records its health detection history, but there is no need to synchronize data to the backward node.
- the previous node fails, that is, when the heartbeat is abnormal, if the configured heartbeat abnormal threshold is not reached, only the status of the previous node in the microservice list is set as unavailable, and it is passed to the subsequent node. If the later node is unavailable at this time, then further take the next node in the ring as a temporary later node to send an information synchronization signal until all new information is synchronized to the entire ring and then ends.
- the previous node When the number of abnormal heartbeats of the previous node is detected to be greater than or equal to the abnormal threshold, the previous node is removed from the microservice list and passed to the backward node until the new information is synchronized to the entire ring, and at the same time one is taken from the microservice list Nodes that happen to be smaller than themselves to form new rings.
- the post-node information in the new ring from the new registration list information is used as the post-node to form a new ring.
- the local microservice list information is used, and the registration process is re-executed.
- an implementation of the microservice invocation terminal to execute the microservice invocation method includes the following steps:
- Step S902 sending an invocation request of the target microservice to the microservice node.
- Step S904 receiving the microservice instance list fed back by the microservice node based on the call request, the microservice list is used to record instance information of at least one microservice node, and at least one microservice node forms a chain structure.
- Step S906 selecting a target microservice node from the list of microservice instances based on the load balancing policy.
- Step S908 calling the target microservice based on the access information of the target microservice node.
- microservice invocation terminal executes the microservice invocation method includes the following steps:
- Step S1002 the microservice calling terminal initiates a remote calling request.
- step S1004 a list of matching microservice instances is obtained based on the name of the microservice.
- Step S1006 check whether there is the required target microservice in the microservice instance list, if the detection result is "No”, go to step S1008, and if the detection result is "Yes", go to step S1010.
- Step S1008 returning an error message to the microservice providing terminal.
- Step S1010 obtain an access address of a running instance from the list of detected microservice instances based on the load balancing strategy.
- Step S1012 perform a remote call operation based on the instance access address.
- Step S1014 check whether the calling operation is successful, if the detection result is "No", go to Step S1016, and if the detection result is "Yes", go to Step S1018.
- Step S1016 detect whether there is another available instance address in the microservice instance list, if the detection result is "No”, go to Step S1020, and if the detection result is "Yes", return to Step S1012.
- the entire microservice list information is stored at each microservice point, and it can be quickly synchronized to the ring no matter when a node is unhealthy or new. Therefore, when calling, directly obtain the list of microservice instances whose microservice status is available according to the name of the microservice that needs to be called, and then select the actual microservice instance to call according to the configuration low to high availability strategy.
- a construction module 1106, configured to construct at least one microservice node as a microservice instance chain based on an IP segment scanning operation;
- the microservice information transfer operation of the microservice node generates a list of microservice instances.
- it further includes: a return module 1110, configured to return registration success information to the node to be registered.
- the microservice instance chain is a circular instance chain.
- the microservice calling device 1200 is expressed in the form of a hardware module.
- Components of the microservice invocation apparatus 1200 may include but not limited to: a second sending module 1202, configured to send the invocation request of the target microservice to the microservice node; a receiving module 1204, configured to receive the microservice fed back by the microservice node based on the invocation request.
- the instance list, the microservice list is used to record the instance information of at least one microservice node, and at least one microservice node forms a chain structure;
- the selection module 1206 is used to select the target microservice node from the microservice instance list based on the load balancing strategy;
- a calling module 1208, configured to call the target microservice based on the access information of the target microservice node.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Hardware Redundancy (AREA)
Abstract
The present application relates to the technical field of computers, and provides a micro-service calling method and apparatus, an electronic device, and a computer readable storage medium. The micro-service calling method comprises: in response to a calling request of a target micro-service sent by a micro-service calling end, obtaining a micro-service instance list matching the calling request, the micro-service list being used for recording micro-service information of all nodes on a micro-service instance chain, and the micro-service instance chain comprising at least one micro-service node; and sending the micro-service instance list to the micro-service calling end, so that the calling end calls the target micro-service on the basis of the micro-service instance list. By means of the technical solution of the present application, strong dependence on a registration center is eliminated, and thus, a call fault cannot be caused by a fault of the registration center, thereby improving the reliability of micro-service calling.
Description
本申请要求在2021年6月29日提交中国专利局、申请号为202110726509.4、发明名称为“微服务调用方法、装置、电子设备和可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the China Patent Office on June 29, 2021, with the application number 202110726509.4, and the title of the invention is "microservice calling method, device, electronic device, and readable storage medium", the entire content of which Incorporated in this application by reference.
本申请涉及计算机技术领域,尤其涉及一种微服务调用方法、装置、电子设备和计算机可读存储介质。The present application relates to the field of computer technology, and in particular to a microservice calling method, device, electronic equipment, and computer-readable storage medium.
微服务架构是通过引入注册中心以提供微服务的发现功能。在微服务的注册和调用过程中,注册中心作为整体服务器端,提供微服务的注册和客户端的发现,而微服务调用者和微服务提供者都由客户端来实现。The microservice architecture provides the discovery function of microservices by introducing a registration center. In the process of microservice registration and invocation, the registration center, as the overall server, provides microservice registration and client discovery, while microservice callers and microservice providers are implemented by the client.
在应用程序启动时,微服务提供者会向注册中心注册自身提供的微服务,并周期性地发送心跳来更新实例状态。When the application starts, the microservice provider will register the microservices provided by itself with the registry, and periodically send heartbeats to update the instance status.
微服务调用者向微服务注册中心取得所需的微服务列表,并将其缓存到本地并周期性地向注册中心请求以更新本地缓存的状态,并在获取到微服务列表后,根据微服务名称获取具体的微服务实例以及该实例的访问信息,以进一步根据负载均衡策略来确定选取的实例实施进行调用。The microservice caller obtains the required microservice list from the microservice registration center, caches it locally and periodically requests the registration center to update the state of the local cache, and after obtaining the microservice list, according to the microservice The name obtains the specific microservice instance and the access information of the instance, so as to further determine the selected instance to implement the call according to the load balancing strategy.
由上可知,目前的微服务架构使用的注册与发现机制均强依赖注册中心,如果注册中心出现故障,则所有的微服务可能都不能调用。It can be seen from the above that the registration and discovery mechanism used by the current microservice architecture strongly relies on the registration center. If the registration center fails, all microservices may not be called.
需要说明的是,在上述背景技术部分公开的信息仅用于加强对本申请的背景的理解,因此可以包括不构成对本领域普通技术人员已知的现有技术的信息。It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the application, and therefore may include information that does not constitute prior art known to those of ordinary skill in the art.
发明内容Contents of the invention
本申请的目的在于提供一种微服务调用方法、装置、电子设备和计算机可读存储介质,至少在一定程度上克服由于相关技术中对注册中心具有较强的依赖性的问题。The purpose of the present application is to provide a microservice invocation method, device, electronic device and computer-readable storage medium, at least to a certain extent, to overcome the problem of strong dependence on the registration center in the related art.
本申请的其他特性和优点将通过下面的详细描述变得显然,或部分地通过本申请的实践而习得。Other features and advantages of the present application will become apparent from the following detailed description, or in part, be learned by practice of the present application.
根据本申请的一个方面,提供一种微服务调用方法,包括:响应于微服务调用端发送的目标微服务的调用请求,获取与所述调用请求匹配的微服务实例列表,所述微服务列表用于记录微服务实例链上所有节点的微服务信息,所述微服务实例链包括至少一个所述微服务节点;将所述微服务实例列表发送至所述微服务调用端,即由所述调用端基于所述微服务实例列表调用所述目标微服务。According to one aspect of the present application, a method for invoking a microservice is provided, including: in response to the invocation request of the target microservice sent by the microservice invocation end, obtaining a list of microservice instances matching the invocation request, the microservice list It is used to record the microservice information of all nodes on the microservice instance chain, and the microservice instance chain includes at least one of the microservice nodes; the microservice instance list is sent to the microservice calling end, that is, the The calling end calls the target microservice based on the microservice instance list.
在本申请的一个实施例中,所述在响应于微服务调用端发送的目标微服务的调用请求,获取与所述调用请求匹配的微服务实例列表之前,还包括:基于IP段扫描操作将至少一个所述微服务节点构造为所述微服务实例链;以及基于沿所述微服务实例链进行的所述微服务节点的微服务信息的传递操作,生成所述微服务实例列表。In one embodiment of the present application, before obtaining the list of microservice instances matching the invocation request in response to the invocation request of the target microservice sent by the microservice invocation end, it further includes: based on the IP segment scanning operation, At least one of the microservice nodes is configured as the microservice instance chain; and the microservice instance list is generated based on the transfer operation of the microservice information of the microservice nodes along the microservice instance chain.
在本申请的一个实施例中,所述基于IP段扫描操作将至少一个所述微服务节点构造为所述微服务实例链,具体包括:在接收到待注册节点的注册信息时,从所述注册信息中提取所述待注 册节点的IP段信息,所述待注册节点为待注册的所述微服务节点;在所述微服务实例链为空链时,基于所述IP段信息对所述待注册节点进行排序,以构造出所述微服务实例链;在所述微服务实例链为非空链时,对非空链的所述微服务实例链执行所述IP段扫描,以确定所述待注册节点的原前节点和原后节点,将所述待注册节点插入所述原前节点和所述原后节点之间,记为插入节点,其中,所述原前节点的第一IP段信息为所述微服务实例链中小于所述IP段信息中的最大IP段,所述原后节点的第二IP段信息为所述微服务实例链中大于所述IP段信息中的最小IP段。In one embodiment of the present application, the IP segment-based scanning operation constructs at least one of the microservice nodes as the microservice instance chain, which specifically includes: when receiving the registration information of the node to be registered, from the The IP segment information of the node to be registered is extracted from the registration information, and the node to be registered is the microservice node to be registered; when the microservice instance chain is an empty chain, based on the IP segment information, the The nodes to be registered are sorted to construct the microservice instance chain; when the microservice instance chain is a non-empty chain, the IP segment scan is performed on the microservice instance chain of the non-empty chain to determine the Describe the original front node and the original back node of the node to be registered, insert the said to-be-registered node between the original front node and the original back node, and record it as an insertion node, wherein the first IP of the original front node The segment information is the largest IP segment in the microservice instance chain that is smaller than the IP segment information, and the second IP segment information of the original node is the smallest IP segment in the microservice instance chain that is larger than the IP segment information. IP segment.
在本申请的一个实施例中,还包括:向所述待注册节点返回注册成功信息。In an embodiment of the present application, the method further includes: returning registration success information to the node to be registered.
在本申请的一个实施例中,所述微服务实例链为环形实例链。In one embodiment of the present application, the microservice instance chain is a circular instance chain.
在本申请的一个实施例中,所述基于沿所述微服务实例链进行的所述微服务节点的微服务信息的传递操作,生成所述微服务实例列表,具体包括:在所述微服务实例链为空链时,将所述待注册节点的微服务信息保持在所述微服务实例列表中;在所述微服务实例链为非空链时,将所述插入节点的微服务信息传递至所述原后节点,以使所述原后节点更新所述微服务实例列表,并将更新后的所述微服务实例列表沿所述环形实例链传递,直至传递至所述插入节点,其中,所述微服务信息包括节点IP段信息、节点端口、微服务名称、实例名称和实例检测接口中的至少一种。In one embodiment of the present application, generating the microservice instance list based on the transfer operation of the microservice information of the microservice node along the microservice instance chain specifically includes: When the instance chain is an empty chain, keep the microservice information of the node to be registered in the microservice instance list; when the microservice instance chain is a non-empty chain, transfer the microservice information of the inserted node to the original rear node, so that the original rear node updates the microservice instance list, and passes the updated microservice instance list along the ring instance chain until it is passed to the insertion node, wherein , the microservice information includes at least one of node IP segment information, node port, microservice name, instance name, and instance detection interface.
在本申请的一个实施例中,还包括:基于预设的检测频率检测所述微服务实例链中的节点状态。In an embodiment of the present application, the method further includes: detecting the status of nodes in the microservice instance chain based on a preset detection frequency.
在本申请的一个实施例中,所述基于预设的检测频率检测所述微服务实例链中的节点状态,具体包括:在检测到前一所述微服务节点的心跳异常时,将前一所述微服务节点在所述微服务实例列表设置为不可用状态,并更新所述微服务实例列表;在检测到前一所述微服务节点的心跳异常次数达到异常阈值时,将前一所述微服务节点从所述微服务实例列表中删除,并更新所述微服务实例列表,以及重构所述微服务实例链。In one embodiment of the present application, the detecting the state of the nodes in the microservice instance chain based on the preset detection frequency specifically includes: when detecting the abnormal heartbeat of the previous microservice node, sending the previous The microservice node is set to an unavailable state in the microservice instance list, and updates the microservice instance list; when it is detected that the number of abnormal heartbeats of the previous microservice node reaches the abnormal threshold, the The microservice node is deleted from the microservice instance list, and the microservice instance list is updated, and the microservice instance chain is reconstructed.
根据本申请的另一个方面,提供一种微服务调用方法,包括:向微服务节点发送目标微服务的调用请求;接收所述微服务节点基于所述调用请求反馈的微服务实例列表,所述微服务列表用于记录至少一个微服务节点的实例信息,所述至少一个微服务节点构成链式结构;基于负载均衡策略从所述微服务实例列表中选择目标微服务节点;基于所述目标微服务节点的访问信息调用所述目标微服务。According to another aspect of the present application, a microservice invocation method is provided, including: sending a microservice invocation request to a microservice node; receiving a microservice instance list fed back by the microservice node based on the invocation request, the The microservice list is used to record the instance information of at least one microservice node, and the at least one microservice node forms a chain structure; select the target microservice node from the microservice instance list based on the load balancing strategy; The access information of the service node invokes the target microservice.
根据本申请的再一个方面,提供一种微服务调用装置,包括:获取模块,用于响应于微服务调用端发送的目标微服务的调用请求,获取与所述调用请求匹配的微服务实例列表,所述微服务列表用于记录微服务实例链上所有节点的微服务信息,所述微服务实例链包括至少一个所述微服务节点;第一发送模块,用于将所述微服务实例列表发送至所述微服务调用端,即由所述调用端基于所述微服务实例列表调用所述目标微服务。According to another aspect of the present application, a microservice invocation device is provided, including: an acquisition module, configured to acquire a list of microservice instances matching the invocation request in response to the invocation request of the target microservice sent by the microservice invocation end , the microservice list is used to record the microservice information of all nodes on the microservice instance chain, and the microservice instance chain includes at least one microservice node; the first sending module is used to list the microservice instance sent to the microservice caller, that is, the caller invokes the target microservice based on the microservice instance list.
根据本申请的又一个方面,提供一种微服务调用装置,包括:第二发送模块,用于向微服务节点发送目标微服务的调用请求;接收模块,用于接收所述微服务节点基于所述调用请求反馈的微服务实例列表,所述微服务列表用于记录至少一个微服务节点的实例信息,所述至少一个微服务节点构成链式结构;选择模块,用于基于负载均衡策略从所述微服务实例列表中选择目标微服务节点;调用模块,用于基于所述目标微服务节点的访问信息调用所述目标微服务。According to another aspect of the present application, a microservice invocation device is provided, including: a second sending module, configured to send a target microservice invocation request to a microservice node; a receiving module, configured to receive the microservice node based on the The microservice instance list of the call request feedback, the microservice list is used to record the instance information of at least one microservice node, and the at least one microservice node forms a chain structure; the selection module is used to select from all the microservice nodes based on the load balancing strategy Selecting a target microservice node from the list of microservice instances; a calling module, configured to call the target microservice based on the access information of the target microservice node.
根据本申请的又一个方面,提供一种电子设备,包括:处理器;以及存储器,用于存储处理器的可执行指令;其中,处理器配置为经由执行可执行指令来执行上述第一方面任意一项所述的微服务调用方法。According to another aspect of the present application, there is provided an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute any of the above-mentioned first aspects by executing the executable instructions. One of the described microservice call methods.
根据本申请的又一个方面,提供一种电子设备,包括:处理器;以及存储器,用于存储处理器的可执行指令;其中,处理器配置为经由执行可执行指令来执行上述第二方面任意一项所述的微服务调用方法。According to another aspect of the present application, there is provided an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein, the processor is configured to execute any of the above-mentioned second aspects by executing the executable instructions. One of the described microservice call methods.
根据本申请的又一个方面,提供一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述任意一项的微服务调用方法。According to yet another aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, any one of the microservice calling methods above is implemented.
本申请的实施例所提供的微服务调用方案,通过将至少一个微服务提供终端作为微服务节点,以配置出微服务实例链,使属于微服务实例链上的所有节点的微服务信息进行链式传递,进而能够使每 个微服务节点均能够以保存微服务信息的方式保存所有微服务节点的最新组件状态。进一步地,基于随机发送或轮询发送的方式,使作为微服务节点的微服务提供终端直接接收微服务调用终端发送的目标微服务的调用请求,以使微服务提供终端直接向微服务调用终端反馈能够实现目标微服务的微服务实例列表,从而使微服务调用终端基于微服务实例列表实现目标微服务的调用。The microservice invocation scheme provided by the embodiment of the present application configures a microservice instance chain by using at least one microservice provider terminal as a microservice node, so that the microservice information belonging to all nodes on the microservice instance chain can be chained In this way, each microservice node can save the latest component status of all microservice nodes in the way of saving microservice information. Further, based on random transmission or polling transmission, the microservice provider terminal as a microservice node directly receives the target microservice invocation request sent by the microservice invocation terminal, so that the microservice provider terminal directly sends the microservice invocation terminal The microservice instance list that can realize the target microservice is fed back, so that the microservice calling terminal realizes the invocation of the target microservice based on the microservice instance list.
上述微服务调用方案,一方面,上述请求与调用过程不需要注册中心的参与,也就是说摆脱了对注册中心的强依赖性,因此不会因为注册中心的故障造成调用故障,从而能够提高微服务调用的可靠性,另一方面,在微服务实例链包括多个微服务节点时,由于每个微服务节点均存储有微服务实例列表,即使其中出现故障节点,也能够通过其它正常节点反馈实例列表和执行微服务的被调用,因此能够进一步提升微服务调用的可靠性。The above microservice call scheme, on the one hand, the above request and call process does not require the participation of the registration center, that is to say, it gets rid of the strong dependence on the registration center, so the call failure will not be caused by the failure of the registration center, thereby improving the micro service. Reliability of service calls. On the other hand, when the microservice instance chain includes multiple microservice nodes, since each microservice node stores a list of microservice instances, even if there is a faulty node, it can be fed back by other normal nodes. The list of instances and the calls to execute microservices can further improve the reliability of microservice calls.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description serve to explain the principles of the application. Apparently, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative efforts.
图1示出本申请实施例中一种微服务调用方法的流程图;FIG. 1 shows a flow chart of a method for invoking a microservice in an embodiment of the present application;
图2示出本申请实施例中另一种微服务调用方法的流程图;FIG. 2 shows a flow chart of another microservice calling method in the embodiment of the present application;
图3示出本申请实施例中再一种微服务调用方法的流程图;FIG. 3 shows a flowchart of another microservice calling method in the embodiment of the present application;
图4示出本申请实施例中一种微服务实例链的结构示意图;FIG. 4 shows a schematic structural diagram of a microservice instance chain in an embodiment of the present application;
图5示出本申请实施例中又一种微服务调用方法的流程图;FIG. 5 shows a flow chart of another microservice calling method in the embodiment of the present application;
图6示出本申请实施例中又一种微服务调用方法的流程图;FIG. 6 shows a flow chart of another microservice calling method in the embodiment of the present application;
图7示出本申请实施例中另一种微服务调用方法的流程图;FIG. 7 shows a flow chart of another microservice calling method in the embodiment of the present application;
图8示出本申请实施例中又一种微服务调用方法的流程图;FIG. 8 shows a flowchart of another microservice calling method in the embodiment of the present application;
图9示出本申请实施例中再一种微服务调用方法的流程图;FIG. 9 shows a flow chart of another microservice calling method in the embodiment of the present application;
图10示出本申请实施例中一种微服务调用系统的示意图;FIG. 10 shows a schematic diagram of a microservice calling system in the embodiment of the present application;
图11示出本申请实施例中一种微服务调用装置的示意图;FIG. 11 shows a schematic diagram of a microservice invocation device in the embodiment of the present application;
图12示出本申请实施例中另一种微服务调用装置的示意图;FIG. 12 shows a schematic diagram of another microservice invocation device in the embodiment of the present application;
图13示出本申请实施例中一种电子设备的示意图;和FIG. 13 shows a schematic diagram of an electronic device in an embodiment of the present application; and
图14示出本申请实施例中一种计算机可读存储介质的示意图。Fig. 14 shows a schematic diagram of a computer-readable storage medium in an embodiment of the present application.
现在将参考附图更全面地描述示例实施方式。然而,示例实施方式能够以多种形式实施,且不应被理解为限于在此阐述的范例;相反,提供这些实施方式使得本申请将更加全面和完整,并将示例实施方式的构思全面地传达给本领域的技术人员。所描述的征、结构或性可以以任何合适的方式结合在一个或更多实施方式中。在下面的描述中,提供许多具体细节从而给出对本申请的实施方式的充分理解。然而,本领域技术人员将意识到,可以实践本申请的技术方案而省略所述定细节中的一个或更多,或者可以采用其它的、组元、装置、步骤等。在其它情况下,不详细示出或描述公知技术方案以避免喧宾夺主而使得本申请的各方面变得模糊。Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the concepts of example embodiments to those skilled in the art. The described features, structures or properties may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided in order to give a thorough understanding of embodiments of the present application. However, those skilled in the art will appreciate that the technical solutions of the present application can be practiced without one or more of the specified details, or other components, devices, steps, etc. can be adopted. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the application.
此外,附图仅为本申请的示意性图解,图中相同的附图标记表示相同或类似的分,因而将省略对它们的重复描述。附图中所示的一些方框图是功能实体,不一定必须与物理或逻辑上独立的实体相对应。可以采用软件形式来实现这些功能实体,或在一个或多个硬件模块或集成电路中实现这些功能实体,或在不同网络和/或处理器装置和/或微控制器装置中实现这些功能实体。In addition, the drawings are only schematic illustrations of the present application, and the same reference numerals in the drawings represent the same or similar components, and thus their repeated descriptions will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different network and/or processor means and/or microcontroller means.
下面结合附图对本申请示例实施方式进行详细说明。The exemplary implementation manners of the present application will be described in detail below in conjunction with the accompanying drawings.
如图1所示,微服务提供终端执行微服务调用方法,包括以下步骤:As shown in Figure 1, the microservice provides the terminal to execute the microservice calling method, including the following steps:
步骤S102,响应于微服务调用端发送的目标微服务的调用请求,获取与调用请求匹配的微服务实例列表,微服务列表用于记录微服务实例链上所有节点的微服务信息,微服务实例链包括至少一个微服务节点。Step S102, in response to the invocation request of the target microservice sent by the microservice caller, obtain a list of microservice instances matching the invocation request. The microservice list is used to record the microservice information of all nodes on the microservice instance chain. The microservice instance A chain includes at least one microservice node.
其中,微服务调用终端直接接收微服务调用端,即微服务调用终端发送的目标微服务的调用请求,微服务调用终端发送调用请求,可以基于随机发送或轮询发送的方式,确定具有目标微服务实例的微服务提供终端,即微服务节点。Among them, the microservice invocation terminal directly receives the invocation request of the target microservice sent by the microservice invocation terminal, that is, the invocation request of the target microservice sent by the microservice invocation terminal. The microservice provider terminal of the service instance is the microservice node.
微服务实例链为将多个微服务节点根据指定排序方式进行排序,以使微服务节点之间进行信息交互,从而实现每个微服务节点上均可以存储有包括微服务实例链上所有的微服务节点的微服务信息的微服务实例列表。The microservice instance chain is to sort multiple microservice nodes according to the specified sorting method, so that information can be exchanged between the microservice nodes, so that each microservice node can store all the microservice instances on the microservice instance chain. The microservice instance list of the microservice information of the service node.
本领域的技术人员还能够理解的是,微服务实例链不排除只有一个微服务节点的情况。Those skilled in the art can also understand that the microservice instance chain does not exclude the situation that there is only one microservice node.
另外,微服务实例链可以为开放的链式结构,也可以为闭合的链式结构。In addition, the microservice instance chain can be an open chain structure or a closed chain structure.
步骤S104,将微服务实例列表发送至微服务调用端,即由调用端基于微服务实例列表调用目标微服务。Step S104, sending the microservice instance list to the microservice calling end, that is, the calling end invokes the target microservice based on the microservice instance list.
在该实施例中,通过将至少一个微服务提供终端作为微服务节点,以配置出微服务实例链,使属于微服务实例链上的所有节点的微服务信息进行链式传递,进而能够使每个微服务节点均能够以保存微服务信息的方式保存所有微服务节点的最新组件状态。进一步地,基于随机发送或轮询发送的方式,使作为微服务节点的微服务提供终端直接接收微服务调用终端发送的目标微服务的调用请求,以使微服务提供终端直接向微服务调用终端反馈能够实现目标微服务的微服务实例列表,从而使微服务调用终端基于微服务实例列表实现目标微服务的调用,一方面,上述请求与调用过程不需要注册中心的参与,也就是说摆脱了对注册中心的强依赖性,因此不会因为注册中心的故障造成调用故障,从而能够提高微服务调用的可靠性,另一方面,在微服务实例链包括多个微服务节点时,由于每个微服务节点均存储有微服务实例列表,即使其中出现故障节点,也能够通过其它正常节点反馈实例列表和执行微服务的被调用,因此能够进一步提升微服务调用的可靠性。In this embodiment, at least one microservice provider terminal is used as a microservice node to configure a microservice instance chain, so that the microservice information belonging to all nodes on the microservice instance chain can be transmitted in a chain, so that each Each microservice node can save the latest component status of all microservice nodes in the way of saving microservice information. Further, based on random transmission or polling transmission, the microservice provider terminal as a microservice node directly receives the target microservice invocation request sent by the microservice invocation terminal, so that the microservice provider terminal directly sends the microservice invocation terminal Feedback can realize the microservice instance list of the target microservice, so that the microservice calling terminal can realize the invocation of the target microservice based on the microservice instance list. Strong dependence on the registry, so the failure of the registry will not cause call failures, which can improve the reliability of microservice calls. On the other hand, when the microservice instance chain includes multiple microservice nodes, because each Each microservice node stores a list of microservice instances. Even if there is a faulty node, other normal nodes can feed back the instance list and execute the called microservice, so the reliability of microservice invocation can be further improved.
另外,本领域的技术人员还能够理解的是,作为执行主体的微服务提供终端可以为微服务实例链中的任意一个微服务节点,也可以为待注册的微服务节点。In addition, those skilled in the art can also understand that the microservice providing terminal as the execution subject can be any microservice node in the microservice instance chain, or a microservice node to be registered.
如图2所示,在本申请的一个实施例中,在步骤S102,响应于微服务调用端发送的目标微服务的调用请求,获取与调用请求匹配的微服务实例列表之前,还包括:As shown in Figure 2, in one embodiment of the present application, in step S102, in response to the invocation request of the target microservice sent by the microservice caller, before obtaining the list of microservice instances matching the invocation request, it also includes:
步骤S202,基于IP段扫描操作将至少一个微服务节点构造为微服务实例链。Step S202, constructing at least one microservice node as a microservice instance chain based on an IP segment scanning operation.
其中,在节点启动时,仅需配置节点的地址段而无需指定具体地IP地址,能够灵活配置IP地址,对可以属于同一微服务实例链的其它节点进行IP段扫描,能提升扫描效率。Among them, when the node is started, only the address segment of the node needs to be configured without specifying a specific IP address. The IP address can be configured flexibly, and the IP segment scanning of other nodes that can belong to the same microservice instance chain can be performed, which can improve the scanning efficiency.
步骤S204,基于沿微服务实例链进行的微服务节点的微服务信息的传递操作,生成微服务实例列表。Step S204, based on the transfer operation of the microservice information of the microservice nodes along the microservice instance chain, a list of microservice instances is generated.
在该实施例中,通过给启动的节点配置IP地址段,并基于IP地址段进行节点地址扫描,进而基于扫描结构对多个微服务节点进行排序,得到微服务实例链,进一步基于微服务实例链能够进行信息传递与列表更新,保证微服务被有效地调用。In this embodiment, by configuring the IP address segment for the started node, and scanning the node address based on the IP address segment, and then sorting the multiple micro-service nodes based on the scanning structure, the micro-service instance chain is obtained, and further based on the micro-service instance The chain can perform information transfer and list update to ensure that microservices are effectively invoked.
如图3所示,在本申请的一个实施例中,步骤S202,基于IP段扫描操作将至少一个微服务节点构造为微服务实例链的一种具体实施方式,包括:As shown in Figure 3, in one embodiment of the present application, step S202, based on the IP segment scanning operation, constructs at least one microservice node as a specific implementation of a microservice instance chain, including:
步骤S302,在接收到待注册节点的注册信息时,从注册信息中提取待注册节点的IP段信息,待注册节点为待注册的微服务节点。Step S302, when the registration information of the node to be registered is received, the IP segment information of the node to be registered is extracted from the registration information, and the node to be registered is a microservice node to be registered.
其中,待注册节点的注册信息可以与该节点的微服务信息相同。Wherein, the registration information of the node to be registered may be the same as the microservice information of the node.
步骤S304,在微服务实例链为空链时,基于IP段信息对待注册节点进行排序,以构造出微服务实例链。Step S304, when the microservice instance chain is empty, sort the nodes to be registered based on the IP segment information to construct a microservice instance chain.
步骤S306,在微服务实例链为非空链时,对非空链的微服务实例链执行IP段扫描,以确定待注册节点的原前节点和原后节点,将待注册节点插入原前节点和原后节点之间,记为插入节点。Step S306, when the microservice instance chain is a non-empty chain, perform an IP segment scan on the microservice instance chain of the non-empty chain to determine the original front node and the original back node of the node to be registered, and insert the node to be registered into the original front node Between the node and the original node, it is recorded as an insertion node.
其中,原前节点的第一IP段信息为微服务实例链中小于IP段信息中的最大IP段,原后节点的第二IP段信息为微服务实例链中大于IP段信息中的最小IP段。Among them, the first IP segment information of the original former node is the largest IP segment smaller than the IP segment information in the microservice instance chain, and the second IP segment information of the original post node is the smallest IP segment larger than the IP segment information in the microservice instance chain part.
如图3所示,在本申请的一个实施例中,还包括:As shown in Figure 3, in an embodiment of the present application, it also includes:
步骤S308,向待注册节点返回注册成功信息。Step S308, returning registration success information to the node to be registered.
在该实施例中,通过基于IP段的大小进行节点排序,以构造微服务实例链,从而能够使微服务信息能够在IP地址相近的节点之间传递。In this embodiment, the microservice instance chain is constructed by sorting the nodes based on the size of the IP segment, so that microservice information can be transmitted between nodes with similar IP addresses.
在本申请的一个实施例中,微服务实例链为环形实例链。In one embodiment of the present application, the microservice instance chain is a circular instance chain.
如图4所示,每个微服务实例代表一个微服务节点,微服务实例1至微服务实例8组成环形实例链,而微服务节点的实例信息则通过链式的方式在环内进行传递,同时,每个实例在传递过程中均同时更新当前保存在本机的所有组件的状态。通过构造环形实例链,在依次传递一圈后,即可生成完整的实例列表,进一步地依次传递,使每个微服务节点均保存有该微服务实例列表,无论哪个微服务节点接收到调用请求,均可将实例列表发送至调用终端,以使调用终端顺利执行调用操作。As shown in Figure 4, each microservice instance represents a microservice node. Microservice instance 1 to microservice instance 8 form a circular instance chain, and the instance information of the microservice node is transmitted in the ring in a chained manner. At the same time, each instance simultaneously updates the state of all components currently saved in the local machine during the transfer process. By constructing a ring-shaped instance chain, a complete list of instances can be generated after passing around one by one, and further passed in sequence, so that each microservice node can save the list of microservice instances, no matter which microservice node receives the call request , the instance list can be sent to the calling terminal, so that the calling terminal can execute the calling operation smoothly.
如图5所示,在本申请的一个实施例中,步骤S204,基于沿微服务实例链进行的微服务节点的微服务信息的传递操作,生成微服务实例列表的一种具体实施方式,包括:As shown in Figure 5, in one embodiment of the present application, in step S204, based on the transfer operation of the microservice information of the microservice nodes along the microservice instance chain, a specific implementation manner of generating a list of microservice instances includes :
步骤S502,在微服务实例链为空链时,将待注册节点的微服务信息保持在微服务实例列表中。Step S502, when the microservice instance chain is empty, keep the microservice information of the node to be registered in the microservice instance list.
步骤S504,在微服务实例链为非空链时,将插入节点的微服务信息传递至原后节点,以使原后节点更新微服务实例列表,并将更新后的微服务实例列表沿环形实例链传递,直至传递至插入节点。Step S504, when the microservice instance chain is non-empty, transfer the microservice information of the inserted node to the original post node, so that the original post node updates the microservice instance list, and sends the updated microservice instance list along the ring instance The chain is passed until it is passed to the insertion node.
其中,微服务信息包括节点IP段信息、节点端口、微服务名称、实例名称和实例检测接口中的至少一种。Wherein, the microservice information includes at least one of node IP segment information, node port, microservice name, instance name and instance detection interface.
在该实施例中,在微服务实例链为空链时,待注册节点可以理解为原始节点,即构造微服务实例列表的节点,在微服务实例链为非空链时,待注册节点可以理解为插入节点,即基于插入节点的微服务信息更新微服务实例列表,进而实现了微服务实例列表的构造与更新。In this embodiment, when the microservice instance chain is an empty chain, the node to be registered can be understood as the original node, that is, the node that constructs the microservice instance list; when the microservice instance chain is a non-empty chain, the node to be registered can understand To insert a node, that is, update the microservice instance list based on the microservice information of the inserted node, and then realize the construction and update of the microservice instance list.
如图6所示,根据本申请的微服务调用方案中微服务节点的注册过程,包括:As shown in Figure 6, according to the registration process of the microservice node in the microservice invocation scheme of the present application, it includes:
步骤S602,待注册节点执行IP段扫描操作。In step S602, the node to be registered performs an IP segment scanning operation.
步骤S604,检测是否扫描到实例链中的其它微服务节点,在检测结果为“是”时,进入步骤S608,在检测结果为“否”时,进入步骤S606。Step S604, check whether other microservice nodes in the instance chain are scanned, if the detection result is "Yes", go to Step S608, and if the detection result is "No", go to Step S606.
步骤S606,基于自身的微服务信息生成微服务实例列表。Step S606, generating a microservice instance list based on its own microservice information.
步骤S608,将自身的微服务信息发送至相邻的后一微服务节点,以执行注册操作。Step S608, sending its own microservice information to the next adjacent microservice node to perform a registration operation.
步骤S610,后一微服务节点基于注册信息对待注册节点进行登记,并向待注册节点返回注册成功信息,待注册节点变更为注册节点。In step S610, the latter microservice node registers the node to be registered based on the registration information, and returns registration success information to the node to be registered, and the node to be registered is changed to a registered node.
步骤S612,后一微服务节点将注册信息进行环式传递。In step S612, the latter microservice node transmits the registration information in a circular manner.
步骤S614,注册节点接收到微服务实例列表,并从微服务实例列表中选择前一微服务节点。Step S614, the registration node receives the microservice instance list, and selects the previous microservice node from the microservice instance list.
步骤S616,注册节点基于选择的前一微服务节点更新微服务实例列表,以形成新的环形实例链。Step S616, the registration node updates the microservice instance list based on the selected previous microservice node to form a new circular instance chain.
具体的,当一个节点启动时,则按照指定的IP段向后扫描,称为环状扫描。在扫描到IP段比自己的大的后节点时,停止扫描,并将自身的微服务实例信息,包含并不限于以下信息:当前机器IP、端口、当前微服务名称,实例名称,实例检测接口等具体信息发送给目标机器,即后节点,收到注册成功信息之后,将目标机器的整个微服务列表信息拉去到本地并且保存。Specifically, when a node starts up, it scans backwards according to the specified IP segment, which is called ring scan. When scanning to a post-node whose IP segment is larger than its own, stop scanning and save its own microservice instance information, including but not limited to the following information: current machine IP, port, current microservice name, instance name, instance detection interface Wait for the specific information to be sent to the target machine, that is, the post node. After receiving the successful registration information, pull the entire microservice list information of the target machine to the local and save it.
在注册列表中取得比自己小的最大IP作为自己的前节点,将节点插入到前节点和后节点之间,形成环形实例链。Obtain the largest IP that is smaller than itself in the registration list as its own front node, and insert the node between the front node and the back node to form a circular instance chain.
当注册时循环到自己部署的IP时均找不到其他可用的服务时,则将自己的组件信息作为唯一的实例保存到微服务列表中,并且终止扫描。When no other available service can be found even when it loops to the IP deployed by itself during registration, it saves its own component information as the only instance in the microservice list, and terminates the scan.
当组件健康运行,收到新节点的注册信息时,检测注册的节点信息,如果节点信息比当前的 节点IP值大时,将节点信息写入到微服务列表,之后向新注册的节点返回成功信息。When the component runs healthy and receives the registration information of the new node, check the registered node information. If the node information is greater than the current node IP value, write the node information to the microservice list, and then return success to the newly registered node information.
进一步地,将新节点的注册信息发送给原前节点和后节点,原前节点收到信息之后拉去一次完整微服务列表,并且调整好自己的后节点。Further, the registration information of the new node is sent to the original front node and the back node. After receiving the information, the original front node pulls a complete list of microservices and adjusts its own back node.
而原链中的后节点收到新的注册信息之后则往自己的后节点传递其注册信息,直至该注册信息更新到环中的所有微服务节点中后停止。After the post node in the original chain receives the new registration information, it transmits its registration information to its own post node until the registration information is updated to all microservice nodes in the ring and then stops.
在本申请的一个实施例中,还包括:基于预设的检测频率检测微服务实例链中的节点状态。In an embodiment of the present application, the method further includes: detecting the status of nodes in the microservice instance chain based on a preset detection frequency.
在该实施例中,通过相互检测机制来确保微服务的可用性以及可到达性,其组件状态比心跳更新更为准确。In this embodiment, the availability and reachability of microservices are ensured through a mutual detection mechanism, and its component status is more accurate than heartbeat updates.
如图7所示,在本申请的一个实施例中,基于预设的检测频率检测微服务实例链中的节点状态,具体包括:As shown in Figure 7, in one embodiment of the present application, the detection of the node status in the microservice instance chain based on the preset detection frequency specifically includes:
步骤S702,在检测到前一微服务节点的心跳异常时,将前一微服务节点在微服务实例列表设置为不可用状态,并更新微服务实例列表。Step S702, when detecting an abnormal heartbeat of the previous microservice node, setting the previous microservice node to an unavailable state in the microservice instance list, and updating the microservice instance list.
步骤S704,在检测到前一微服务节点的心跳异常次数达到异常阈值时,将前一微服务节点从微服务实例列表中删除,并更新微服务实例列表,以及重构微服务实例链。Step S704, when it is detected that the number of abnormal heartbeats of the previous microservice node reaches the abnormal threshold, delete the previous microservice node from the microservice instance list, update the microservice instance list, and reconstruct the microservice instance chain.
在该实施例中,通过由链中的后一节点来对临近的前一节点进行心跳检测,代替相关技术中的向注册中心汇报自身的心跳信息的方式,能够提升节点异常时,进行异常处理的实时性和可靠性。In this embodiment, by using the subsequent node in the chain to detect the heartbeat of the adjacent previous node, instead of reporting its own heartbeat information to the registration center in the related art, it is possible to improve the exception handling when the node is abnormal. real-time and reliability.
如图8所示,在本申请的一个实施例中,基于预设的检测频率检测微服务实例链中的节点状态,具体还包括:As shown in Figure 8, in one embodiment of the present application, detecting the state of the nodes in the microservice instance chain based on the preset detection frequency specifically includes:
步骤S802,任一当前节点检测前节点的心跳信息。Step S802, any current node detects the heartbeat information of the previous node.
步骤S804,基于心跳信息检测前节点心跳是否正常,在检测结果为“是”时,进入步骤S806,在检测结果为“否”时,进入步骤S808。Step S804, based on the heartbeat information, detect whether the heartbeat of the previous node is normal, if the detection result is "Yes", proceed to Step S806, and if the detection result is "No", proceed to Step S808.
步骤S806,记录检测时间。Step S806, recording the detection time.
步骤S808,检测心跳异常次数是否达到异常阈值,在检测结果为“是”时,进入步骤S810,在检测结果为“否”时,进入步骤S812。Step S808, detect whether the number of abnormal heartbeats reaches the abnormal threshold, if the detection result is "Yes", proceed to Step S810, and if the detection result is "No", proceed to Step S812.
步骤S810,从微服务实例列表中删除前节点。Step S810, delete the former node from the microservice instance list.
步骤S812,将前节点的状态设置为不可达,并更新实例列表。Step S812, setting the state of the previous node as unreachable, and updating the instance list.
步骤S814,将状态信息向后节点传递。In step S814, the state information is transmitted to the subsequent node.
步骤S816,检测后节点是否可达,在检测结果为“是”时,进入步骤S820,在检测结果为“否”时,进入步骤S818。Step S816, after detecting whether the node is reachable, if the detection result is "yes", go to step S820, and if the detection result is "no", go to step S818.
步骤S818,选择后节点后面的节点作为临时后节点。Step S818, selecting a node following the post node as a temporary post node.
步骤S820,将更新后的实例列表进行环式传递。Step S820, circularly transmit the updated instance list.
步骤S822,直至更新后的实例列表传递至当前节点。Step S822, until the updated instance list is delivered to the current node.
具体的,在组件,即节点状态检测过程中,当微服务组件在链上注册成功之后,会启动定时检测任务,在定时检测任务发生时,需要当前节点检测前节点的状态,如果前节点的状态没有异常,当前节点仅记录其健康检测历史,但无需向后节点同步数据。Specifically, in the component, that is, the node state detection process, when the microservice component is successfully registered on the chain, the timing detection task will be started. When the timing detection task occurs, the current node needs to detect the state of the previous node. The state is not abnormal, the current node only records its health detection history, but there is no need to synchronize data to the backward node.
在前节点发生故障,即心跳异常时,如果未到配置好的心跳异常阈值时,则只将前节点在微服务列表中的状态置为不可用,同时往后节点传递。如果此时后节点不可用时,则进一步取环中下一个节点作为临时后节点发送信息同步信号,直至所有的新信息同步到整个环中后结束。When the previous node fails, that is, when the heartbeat is abnormal, if the configured heartbeat abnormal threshold is not reached, only the status of the previous node in the microservice list is set as unavailable, and it is passed to the subsequent node. If the later node is unavailable at this time, then further take the next node in the ring as a temporary later node to send an information synchronization signal until all new information is synchronized to the entire ring and then ends.
当检测前节点的心跳异常次数大于或等于异常阈值后,将该前节点从微服务列表移除,并且向后节点传递直至新信息同步到整个环中后结束,同时从微服务列表中取一个恰好比自己小的节点,以形成新的环。When the number of abnormal heartbeats of the previous node is detected to be greater than or equal to the abnormal threshold, the previous node is removed from the microservice list and passed to the backward node until the new information is synchronized to the entire ring, and at the same time one is taken from the microservice list Nodes that happen to be smaller than themselves to form new rings.
当一个节点收到同步信息,发现当前的后节点信息已经不在注册列表之后,则从新的注册列表信息中新环中的后一个信息作为后节点,以形成新的环。When a node receives the synchronization information and finds that the current post-node information is no longer behind the registration list, the post-node information in the new ring from the new registration list information is used as the post-node to form a new ring.
如果一个节点已经形成了新的环,但是依然收到之前的前节点发来的同步信号时,则返回刷新失败。If a node has formed a new ring, but still receives the synchronization signal from the previous node, it will return refresh failure.
当一个节点向后同步信息时收到失败信息,情况本机的微服务列表信息,重新执行注册过程。When a node receives a failure message when synchronizing information backwards, the local microservice list information is used, and the registration process is re-executed.
如图9所示,微服务调用终端执行微服务调用方法的一种实施方式,包括以下步骤:As shown in Figure 9, an implementation of the microservice invocation terminal to execute the microservice invocation method includes the following steps:
步骤S902,向微服务节点发送目标微服务的调用请求。Step S902, sending an invocation request of the target microservice to the microservice node.
步骤S904,接收微服务节点基于调用请求反馈的微服务实例列表,微服务列表用于记录至少一个微服务节点的实例信息,至少一个微服务节点构成链式结构。Step S904, receiving the microservice instance list fed back by the microservice node based on the call request, the microservice list is used to record instance information of at least one microservice node, and at least one microservice node forms a chain structure.
步骤S906,基于负载均衡策略从微服务实例列表中选择目标微服务节点。Step S906, selecting a target microservice node from the list of microservice instances based on the load balancing policy.
步骤S908,基于目标微服务节点的访问信息调用目标微服务。Step S908, calling the target microservice based on the access information of the target microservice node.
如图10所示,微服务调用终端执行微服务调用方法的另一种实施方式,包括以下步骤:As shown in FIG. 10 , another implementation manner in which the microservice invocation terminal executes the microservice invocation method includes the following steps:
步骤S1002,微服务调用终端发起远程调用请求。Step S1002, the microservice calling terminal initiates a remote calling request.
步骤S1004,基于微服务的名称获取到匹配的微服务实例列表。In step S1004, a list of matching microservice instances is obtained based on the name of the microservice.
步骤S1006,检测微服务实例列表中是否具有所需的目标微服务,在检测结果为“否”时,进入步骤S1008,在检测结果为“是”时,进入步骤S1010。Step S1006, check whether there is the required target microservice in the microservice instance list, if the detection result is "No", go to step S1008, and if the detection result is "Yes", go to step S1010.
步骤S1008,向微服务提供终端返回错误信息。Step S1008, returning an error message to the microservice providing terminal.
步骤S1010,基于负载均衡策略从检测微服务实例列表中获取一个正在运行的实例访问地址。Step S1010, obtain an access address of a running instance from the list of detected microservice instances based on the load balancing strategy.
步骤S1012,基于实例访问地址执行远程调用操作。Step S1012, perform a remote call operation based on the instance access address.
步骤S1014,检测调用操作是否成功,在检测结果为“否”时,进入步骤S1016,在检测结果为“是”时,进入步骤S1018。Step S1014, check whether the calling operation is successful, if the detection result is "No", go to Step S1016, and if the detection result is "Yes", go to Step S1018.
步骤S1016,检测微服务实例列表中是否具有另一可用的实例地址,在检测结果为“否”时,进入步骤S1020,在检测结果为“是”时,返回步骤S1012。Step S1016, detect whether there is another available instance address in the microservice instance list, if the detection result is "No", go to Step S1020, and if the detection result is "Yes", return to Step S1012.
步骤S1018,返回调用结果。Step S1018, return the call result.
步骤S1020,向微服务提供终端返回错误信息。Step S1020, returning an error message to the microservice providing terminal.
具体的,基于环形传递机制,在每个微服务点均存有整个微服务列表信息,无论时有节点不健康或者新增时均能快速地同步到环中。因此,调用时直接根据需要调用微服务地名称取得其微服务状态为可用地微服务实例列表,然后根据配置低到高可用策略来选择实际的微服务实例进行调用。Specifically, based on the ring transfer mechanism, the entire microservice list information is stored at each microservice point, and it can be quickly synchronized to the ring no matter when a node is unhealthy or new. Therefore, when calling, directly obtain the list of microservice instances whose microservice status is available according to the name of the microservice that needs to be called, and then select the actual microservice instance to call according to the configuration low to high availability strategy.
需要注意的是,上述附图仅是根据本公开示例性实施例的方法所包括的处理的示意性说明,而不是限制目的。易于理解,上述附图所示的处理并不表明或限制这些处理的时间顺序。另外,也易于理解,这些处理可以是例如在多个模块中同步或异步执行的。It should be noted that the above-mentioned figures are only schematic illustrations of processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not imply or limit the chronological order of these processes. In addition, it is also easy to understand that these processes may be executed synchronously or asynchronously in multiple modules, for example.
所属技术领域的技术人员能够理解,本申请的各个方面可以实现为系统、方法或程序产品。因此,本申请的各个方面可以具体实现为以下形式,即:完全的硬件实施方式、完全的软件实施方式(包括固件、微代码等),或硬件和软件方面结合的实施方式,这里可以统称为“电路”、“模块”或“系统”。Those skilled in the art can understand that various aspects of the present application can be implemented as a system, method or program product. Therefore, various aspects of the present application can be specifically implemented in the following forms, that is: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which can be collectively referred to herein as "circuit", "module" or "system".
下面参照图11来描述根据本申请的这种实施方式的微服务调用装置1100。图11所示的微服务调用装置1100仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。The microservice calling apparatus 1100 according to this embodiment of the present application will be described below with reference to FIG. 11 . The microservice invoking apparatus 1100 shown in FIG. 11 is only an example, and should not impose any limitation on the functions and application scope of this embodiment of the present application.
微服务调用装置1100以硬件模块的形式表现。微服务调用装置1100的组件可以包括但不限于:获取模块1102,用于响应于微服务调用端发送的目标微服务的调用请求,获取与调用请求匹配的微服务实例列表,微服务列表用于记录微服务实例链上所有节点的微服务信息,微服务实例链包括至少一个微服务节点;第一发送模块1104,用于将微服务实例列表发送至微服务调用端,即由调用端基于微服务实例列表调用目标微服务。The microservice calling device 1100 is expressed in the form of a hardware module. The components of the microservice invocation apparatus 1100 may include but not limited to: an acquisition module 1102, configured to respond to the invocation request of the target microservice sent by the microservice invocation end, and obtain a list of microservice instances matching the invocation request, and the microservice list is used for Record the microservice information of all nodes on the microservice instance chain, the microservice instance chain includes at least one microservice node; the first sending module 1104 is used to send the microservice instance list to the microservice calling end, that is, the calling end is based on the microservice A list of service instances to call the target microservice.
在本申请的一个实施例中,还包括:构造模块1106,用于基于IP段扫描操作将至少一个微服务节点构造为微服务实例链;传递模块1108,用于基于沿微服务实例链进行的微服务节点的微服务信息的传递操作,生成微服务实例列表。In one embodiment of the present application, it also includes: a construction module 1106, configured to construct at least one microservice node as a microservice instance chain based on an IP segment scanning operation; The microservice information transfer operation of the microservice node generates a list of microservice instances.
在本申请的一个实施例中,构造模块1106还用于:在接收到待注册节点的注册信息时,从注册信息中提取待注册节点的IP段信息,待注册节点为待注册的微服务节点;在微服务实例链为空链时,基于IP段信息对待注册节点进行排序,以构造出微服务实例链;在微服务实例链为非空链时,对非空链的微服务实例链执行IP段扫描,以确定待注册节点的原前节点和原后节点, 将待注册节点插入原前节点和原后节点之间,记为插入节点,其中,原前节点的第一IP段信息为微服务实例链中小于IP段信息中的最大IP段,原后节点的第二IP段信息为微服务实例链中大于IP段信息中的最小IP段。In one embodiment of the present application, the construction module 1106 is also used to: when receiving the registration information of the node to be registered, extract the IP segment information of the node to be registered from the registration information, and the node to be registered is a microservice node to be registered ; When the microservice instance chain is an empty chain, sort the nodes to be registered based on the IP segment information to construct a microservice instance chain; when the microservice instance chain is a non-empty chain, execute Scan the IP segment to determine the original front node and the original back node of the node to be registered, insert the node to be registered between the original front node and the original back node, and record it as an inserted node, where the first IP segment information of the original front node is The microservice instance chain is smaller than the largest IP segment in the IP segment information, and the second IP segment information of the original node is the smallest IP segment in the microservice instance chain that is larger than the IP segment information.
在本申请的一个实施例中,还包括:返回模块1110,用于向待注册节点返回注册成功信息。In one embodiment of the present application, it further includes: a return module 1110, configured to return registration success information to the node to be registered.
在本申请的一个实施例中,微服务实例链为环形实例链。In one embodiment of the present application, the microservice instance chain is a circular instance chain.
在本申请的一个实施例中,传递模块1108还用于:在微服务实例链为空链时,将待注册节点的微服务信息保持在微服务实例列表中;在微服务实例链为非空链时,将插入节点的微服务信息传递至原后节点,以使原后节点更新微服务实例列表,并将更新后的微服务实例列表沿环形实例链传递,直至传递至插入节点,其中,微服务信息包括节点IP段信息、节点端口、微服务名称、实例名称和实例检测接口中的至少一种。In one embodiment of the present application, the delivery module 1108 is also used to: when the microservice instance chain is an empty chain, keep the microservice information of the node to be registered in the microservice instance list; when the microservice instance chain is non-empty When chaining, the microservice information of the inserted node is transmitted to the original post node, so that the original post node updates the microservice instance list, and the updated microservice instance list is passed along the ring instance chain until it is passed to the inserted node, wherein, The microservice information includes at least one of node IP segment information, node port, microservice name, instance name and instance detection interface.
在本申请的一个实施例中,还包括:检测模块1112,用于基于预设的检测频率检测微服务实例链中的节点状态。In one embodiment of the present application, it further includes: a detection module 1112, configured to detect the status of nodes in the microservice instance chain based on a preset detection frequency.
在本申请的一个实施例中,检测模块1112还用于:在检测到前一微服务节点的心跳异常时,将前一微服务节点在微服务实例列表设置为不可用状态,并更新微服务实例列表;在检测到前一微服务节点的心跳异常次数达到异常阈值时,将前一微服务节点从微服务实例列表中删除,并更新微服务实例列表,以及重构微服务实例链。In one embodiment of the present application, the detection module 1112 is also used to: when detecting an abnormal heartbeat of the previous microservice node, set the previous microservice node to an unavailable state in the microservice instance list, and update the microservice Instance list; when detecting that the number of abnormal heartbeats of the previous microservice node reaches the abnormal threshold, delete the previous microservice node from the list of microservice instances, update the list of microservice instances, and reconstruct the chain of microservice instances.
下面参照图12来描述根据本申请的这种实施方式的微服务调用装置1200。图12所示的微服务调用装置1200仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。The microservice calling apparatus 1200 according to this embodiment of the present application will be described below with reference to FIG. 12 . The microservice invoking apparatus 1200 shown in FIG. 12 is only an example, and should not limit the functions and scope of use of this embodiment of the present application.
微服务调用装置1200以硬件模块的形式表现。微服务调用装置1200的组件可以包括但不限于:第二发送模块1202,用于向微服务节点发送目标微服务的调用请求;接收模块1204,用于接收微服务节点基于调用请求反馈的微服务实例列表,微服务列表用于记录至少一个微服务节点的实例信息,至少一个微服务节点构成链式结构;选择模块1206,用于基于负载均衡策略从微服务实例列表中选择目标微服务节点;调用模块1208,用于基于目标微服务节点的访问信息调用目标微服务。The microservice calling device 1200 is expressed in the form of a hardware module. Components of the microservice invocation apparatus 1200 may include but not limited to: a second sending module 1202, configured to send the invocation request of the target microservice to the microservice node; a receiving module 1204, configured to receive the microservice fed back by the microservice node based on the invocation request The instance list, the microservice list is used to record the instance information of at least one microservice node, and at least one microservice node forms a chain structure; the selection module 1206 is used to select the target microservice node from the microservice instance list based on the load balancing strategy; A calling module 1208, configured to call the target microservice based on the access information of the target microservice node.
下面参照图13来描述根据本申请的这种实施方式的电子设备1300。图13显示的电子设备1300仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。An electronic device 1300 according to this embodiment of the present application is described below with reference to FIG. 13 . The electronic device 1300 shown in FIG. 13 is only an example, and should not limit the functions and scope of use of this embodiment of the present application.
如图13所示,电子设备1300以通用计算设备的形式表现。电子设备1300的组件可以包括但不限于:上述至少一个处理单元1310、上述至少一个存储单元1320、连接不同系统组件(包括存储单元1320和处理单元1310)的总线1330。As shown in FIG. 13, electronic device 1300 takes the form of a general-purpose computing device. Components of the electronic device 1300 may include but not limited to: at least one processing unit 1310 , at least one storage unit 1320 , and a bus 1330 connecting different system components (including the storage unit 1320 and the processing unit 1310 ).
其中,存储单元存储有程序代码,程序代码可以被处理单元1310执行,使得处理单元1310执行本说明书上述“示例性方法”部分中描述的根据本申请各种示例性实施方式的步骤。例如,处理单元1310可以执行如图1中所示的步骤S202、S204、S206和S208,以及本申请的微服务调用方法中限定的其他步骤。Wherein, the storage unit stores program codes, and the program codes can be executed by the processing unit 1310, so that the processing unit 1310 executes the steps according to various exemplary embodiments of the present application described in the “Exemplary Method” section of this specification. For example, the processing unit 1310 may execute steps S202, S204, S206, and S208 as shown in FIG. 1, and other steps defined in the microservice calling method of the present application.
存储单元1320可以包括易失性存储单元形式的可读介质,例如随机存取存储单元(RAM)13201和/或高速缓存存储单元13202,还可以进一步包括只读存储单元(ROM)13203。The storage unit 1320 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 13201 and/or a cache storage unit 13202 , and may further include a read-only storage unit (ROM) 13203 .
存储单元1320还可以包括具有一组(至少一个)程序模块13205的程序/实用工具13204,这样的程序模块13205包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。The storage unit 1320 may also include a program/utility 13204 having a set (at least one) of program modules 13205, such program modules 13205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, Implementations of networked environments may be included in each or some combination of these examples.
总线1330可以为表示几类总线结构中的一种或多种,包括存储单元总线或者存储单元控制器、外围总线、图形加速端口、处理单元或者使用多种总线结构中的任意总线结构的局域总线。 Bus 1330 may represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local area using any of a variety of bus structures. bus.
电子设备1300也可以与一个或多个外部设备1370(例如键盘、指向设备、蓝牙设备等)通信,还可与一个或者多个使得用户能与该电子设备交互的设备通信,和/或与使得该电子设备1300能与一个或多个其它计算设备进行通信的任何设备(例如路由器、调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口1350进行。并且,电子设备1300还可以通过网络适配器1360与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器1360通过总线1330与电子设备1300的其它模块通信。应当明白, 尽管图中未示出,可以结合电子设备使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。 Electronic device 1300 may also communicate with one or more external devices 1370 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), and may also communicate with one or more devices that enable a user to interact with the electronic device, and/or communicate with one or more devices that enable The electronic device 1300 is capable of communicating with any device (eg, router, modem, etc.) that communicates with one or more other computing devices. Such communication may occur through input/output (I/O) interface 1350 . Moreover, the electronic device 1300 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN) and/or a public network such as the Internet) through the network adapter 1360 . As shown, the network adapter 1360 communicates with other modules of the electronic device 1300 through the bus 1330 . It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and Data backup storage system, etc.
通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本申请实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中或网络上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、终端装置、或者网络设备等)执行根据本申请实施方式的方法。Through the description of the above implementations, those skilled in the art can easily understand that the example implementations described here can be implemented by software, or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of software products, which can be stored in a non-volatile storage medium (which can be CD-ROM, U disk, mobile hard disk, etc.) or on the network , including several instructions to make a computing device (which may be a personal computer, server, terminal device, or network device, etc.) execute the method according to the embodiment of the present application.
在本申请的示例性实施例中,还提供了一种计算机可读存储介质,其上存储有能够实现本说明书上述方法的程序产品。在一些可能的实施方式中,本申请的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当程序产品在终端设备上运行时,程序代码用于使终端设备执行本说明书上述“示例性方法”部分中描述的根据本申请各种示例性实施方式的步骤。In an exemplary embodiment of the present application, a computer-readable storage medium is also provided, on which a program product capable of implementing the above-mentioned method in this specification is stored. In some possible implementations, various aspects of the present application can also be implemented in the form of a program product, which includes program code. When the program product runs on the terminal device, the program code is used to make the terminal device execute the above-mentioned Steps according to various exemplary embodiments of the present application described in the "Exemplary Methods" section.
参考图14所示,描述了根据本申请的实施方式的用于实现上述方法的程序产品1400,其可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在终端设备,例如个人电脑上运行。然而,本申请的程序产品不限于此,在本文件中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。As shown in FIG. 14 , a program product 1400 for implementing the above method according to an embodiment of the present application is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program codes, and can be used in terminal equipment, For example running on a personal computer. However, the program product of the present application is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program, and the program may be used by or in combination with an instruction execution system, device, or device.
计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer readable signal medium may include a data signal carrying readable program code in baseband or as part of a carrier wave. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、有线、光缆、RF等等,或者上述的任意合适的组合。Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言的任意组合来编写用于执行本申请操作的程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、C++等,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户计算设备上部分在远程计算设备上执行、或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算设备,或者,可以连接到外部计算设备(例如利用因特网服务提供商来通过因特网连接)。Program codes for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages—such as Java, C++, etc., as well as conventional procedural programming languages. Programming language - such as "C" or a similar programming language. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server to execute. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider). business to connect via the Internet).
应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本申请的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. Actually, according to the embodiment of the present application, the features and functions of two or more modules or units described above may be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided to be embodied by a plurality of modules or units.
此外,尽管在附图中以特定顺序描述了本申请中方法的各个步骤,但是,这并非要求或者暗示必须按照该特定顺序来执行这些步骤,或是必须执行全部所示的步骤才能实现期望的结果。附加的或备选的,可以省略某些步骤,将多个步骤合并为一个步骤执行,以及/或者将一个步骤分解为多个步骤执行等。In addition, although the steps of the methods of the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in that specific order, or that all illustrated steps must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step for execution, and/or one step may be decomposed into multiple steps for execution, etc.
通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本申请实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中或网络上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、移动终端、或者网络设备等)执行根据本申请实施方式的方法。Through the description of the above implementations, those skilled in the art can easily understand that the example implementations described here can be implemented by software, or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of software products, which can be stored in a non-volatile storage medium (which can be CD-ROM, U disk, mobile hard disk, etc.) or on the network , including several instructions to make a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) execute the method according to the embodiment of the present application.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由所附的权利要求指出。Other embodiments of the present application will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the application, these modifications, uses or adaptations follow the general principles of the application and include common knowledge or conventional technical means in the technical field not disclosed in the application . The specification and examples are to be considered exemplary only, with a true scope and spirit of the application indicated by the appended claims.
Claims (14)
- 一种微服务调用方法,应用于微服务节点,其特征在于,包括:A method for invoking microservices, applied to microservice nodes, characterized in that it includes:响应于微服务调用端发送的目标微服务的调用请求,获取与所述调用请求匹配的微服务实例列表,所述微服务列表用于记录微服务实例链上所有节点的微服务信息,所述微服务实例链包括至少一个所述微服务节点;In response to the invocation request of the target microservice sent by the microservice calling end, obtain a list of microservice instances matching the invocation request, the microservice list is used to record the microservice information of all nodes on the microservice instance chain, the The microservice instance chain includes at least one microservice node;将所述微服务实例列表发送至所述微服务调用端,即由所述调用端基于所述微服务实例列表调用所述目标微服务。The microservice instance list is sent to the microservice calling end, that is, the calling end invokes the target microservice based on the microservice instance list.
- 根据权利要求1所述的微服务调用方法,其特征在于,所述在响应于微服务调用端发送的目标微服务的调用请求,获取与所述调用请求匹配的微服务实例列表之前,还包括:The method for invoking microservices according to claim 1, wherein, before obtaining a list of microservice instances matching the invocation request in response to the invocation request of the target microservice sent by the microservice invocation end, further comprising: :基于IP段扫描操作将至少一个所述微服务节点构造为所述微服务实例链;以及Constructing at least one of said microservice nodes as said microservice instance chain based on an IP segment scanning operation; and基于沿所述微服务实例链进行的所述微服务节点的微服务信息的传递操作,生成所述微服务实例列表。The microservice instance list is generated based on the transfer operation of the microservice information of the microservice node along the microservice instance chain.
- 根据权利要求2所述的微服务调用方法,其特征在于,所述基于IP段扫描操作将至少一个所述微服务节点构造为所述微服务实例链,具体包括:The method for invoking microservices according to claim 2, wherein the scanning operation based on the IP segment constructs at least one microservice node as the microservice instance chain, specifically comprising:在接收到待注册节点的注册信息时,从所述注册信息中提取所述待注册节点的IP段信息,所述待注册节点为待注册的所述微服务节点;When receiving the registration information of the node to be registered, extracting the IP segment information of the node to be registered from the registration information, the node to be registered is the microservice node to be registered;在所述微服务实例链为空链时,基于所述IP段信息对所述待注册节点进行排序,以构造出所述微服务实例链;When the microservice instance chain is an empty chain, sort the nodes to be registered based on the IP segment information to construct the microservice instance chain;在所述微服务实例链为非空链时,对非空链的所述微服务实例链执行所述IP段扫描,以确定所述待注册节点的原前节点和原后节点,将所述待注册节点插入所述原前节点和所述原后节点之间,记为插入节点,When the microservice instance chain is a non-empty chain, the IP segment scan is performed on the microservice instance chain of the non-empty chain to determine the original front node and the original post node of the node to be registered, and the The node to be registered is inserted between the original front node and the original rear node, which is recorded as an inserted node,其中,所述原前节点的第一IP段信息为所述微服务实例链中小于所述IP段信息中的最大IP段,所述原后节点的第二IP段信息为所述微服务实例链中大于所述IP段信息中的最小IP段。Wherein, the first IP segment information of the original former node is the largest IP segment in the microservice instance chain smaller than the IP segment information, and the second IP segment information of the original post node is the microservice instance The smallest IP segment in the chain that is larger than the IP segment information.
- 根据权利要求3所述的微服务调用方法,其特征在于,还包括:The microservice calling method according to claim 3, further comprising:向所述待注册节点返回注册成功信息。Return registration success information to the node to be registered.
- 根据权利要求3所述的微服务调用方法,其特征在于,所述微服务实例链为环形实例链。The microservice calling method according to claim 3, wherein the microservice instance chain is a ring instance chain.
- 根据权利要求5所述的微服务调用方法,其特征在于,所述基于沿所述微服务实例链进行的所述微服务节点的微服务信息的传递操作,生成所述微服务实例列表,具体包括:The microservice invocation method according to claim 5, wherein the microservice instance list is generated based on the transfer operation of the microservice information of the microservice node along the microservice instance chain, specifically include:在所述微服务实例链为空链时,将所述待注册节点的微服务信息保持在所述微服务实例列表中;When the microservice instance chain is an empty chain, keep the microservice information of the node to be registered in the microservice instance list;在所述微服务实例链为非空链时,将所述插入节点的微服务信息传递至所述原后节点,以使所述原后节点更新所述微服务实例列表,并将更新后的所述微服务实例列表沿所述环形实例链传递,直至传递至所述插入节点,When the microservice instance chain is a non-empty chain, the microservice information of the inserted node is transferred to the original post node, so that the original post node updates the microservice instance list, and the updated The microservice instance list is passed along the ring instance chain until it is passed to the insertion node,其中,所述微服务信息包括节点IP段信息、节点端口、微服务名称、实例名称和实例检测接口中的至少一种。Wherein, the microservice information includes at least one of node IP segment information, node port, microservice name, instance name and instance detection interface.
- 根据权利要求3至6中任一项所述的微服务调用方法,其特征在于,还包括:The microservice invocation method according to any one of claims 3 to 6, further comprising:基于预设的检测频率检测所述微服务实例链中的节点状态。The state of the nodes in the microservice instance chain is detected based on a preset detection frequency.
- 根据权利要求7所述的微服务调用方法,其特征在于,所述基于预设的检测频率检测所述微服务实例链中的节点状态,具体包括:The method for invoking microservices according to claim 7, wherein the detection of the node status in the microservice instance chain based on the preset detection frequency specifically includes:在检测到前一所述微服务节点的心跳异常时,将前一所述微服务节点在所述微服务实例列表设置为不可用状态,并更新所述微服务实例列表;When an abnormal heartbeat of the previous microservice node is detected, the previous microservice node is set to an unavailable state in the microservice instance list, and the microservice instance list is updated;在检测到前一所述微服务节点的心跳异常次数达到异常阈值时,将前一所述微服务节点从所述微服务实例列表中删除,并更新所述微服务实例列表,以及重构所述微服务实例链。When it is detected that the number of abnormal heartbeats of the previous microservice node reaches the abnormal threshold, the previous microservice node is deleted from the microservice instance list, and the microservice instance list is updated, and all the microservice instances are reconstructed. The microservice instance chain described above.
- 一种微服务调用方法,应用于微服务调用端,其特征在于,包括:A microservice invocation method applied to a microservice invocation end, characterized in that it includes:向微服务节点发送目标微服务的调用请求;Send the invocation request of the target microservice to the microservice node;接收所述微服务节点基于所述调用请求反馈的微服务实例列表,所述微服务列表用于记录至少一个微服务节点的实例信息,所述至少一个微服务节点构成链式结构;receiving the microservice instance list fed back by the microservice node based on the call request, the microservice list is used to record instance information of at least one microservice node, and the at least one microservice node forms a chain structure;基于负载均衡策略从所述微服务实例列表中选择目标微服务节点;Selecting a target microservice node from the list of microservice instances based on a load balancing strategy;基于所述目标微服务节点的访问信息调用所述目标微服务。Invoking the target microservice based on the access information of the target microservice node.
- 一种微服务调用装置,应用于微服务节点,其特征在于,包括:A microservice invocation device applied to a microservice node, characterized in that it includes:获取模块,用于响应于微服务调用端发送的目标微服务的调用请求,获取与所述调用请求匹配的微服务实例列表,所述微服务列表用于记录微服务实例链上所有节点的微服务信息,所述微服务实例链包括至少一个所述微服务节点;The obtaining module is used to respond to the invocation request of the target microservice sent by the microservice caller, and obtain a list of microservice instances matching the invocation request, and the microservice list is used to record the microservices of all nodes on the microservice instance chain. Service information, the microservice instance chain includes at least one microservice node;第一发送模块,用于将所述微服务实例列表发送至所述微服务调用端,即由所述调用端基于所述微服务实例列表调用所述目标微服务。The first sending module is configured to send the microservice instance list to the microservice caller, that is, the caller calls the target microservice based on the microservice instance list.
- 一种微服务调用装置,应用于微服务调用端,其特征在于,包括:A microservice invocation device applied to a microservice invocation end, characterized in that it includes:第二发送模块,用于向微服务节点发送目标微服务的调用请求;The second sending module is used to send the invocation request of the target microservice to the microservice node;接收模块,用于接收所述微服务节点基于所述调用请求反馈的微服务实例列表,所述微服务列表用于记录至少一个微服务节点的实例信息,所述至少一个微服务节点构成链式结构;A receiving module, configured to receive a microservice instance list fed back by the microservice node based on the call request, the microservice list is used to record instance information of at least one microservice node, and the at least one microservice node forms a chain structure;选择模块,用于基于负载均衡策略从所述微服务实例列表中选择目标微服务节点;A selection module, configured to select a target microservice node from the list of microservice instances based on a load balancing strategy;调用模块,用于基于所述目标微服务节点的访问信息调用所述目标微服务。A calling module, configured to call the target microservice based on the access information of the target microservice node.
- 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:处理器;以及processor; and存储器,用于存储所述处理器的可执行指令;a memory for storing executable instructions of the processor;其中,所述处理器配置为经由执行所述可执行指令来执行权利要求1至8中任意一项所述的微服务调用方法。Wherein, the processor is configured to execute the microservice invocation method described in any one of claims 1 to 8 by executing the executable instructions.
- 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:处理器;以及processor; and存储器,用于存储所述处理器的可执行指令;a memory for storing executable instructions of the processor;其中,所述处理器配置为经由执行所述可执行指令来执行权利要求9所述的微服务调用方法。Wherein, the processor is configured to execute the microservice calling method of claim 9 by executing the executable instructions.
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至9中任意一项所述的微服务调用方法。A computer-readable storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor, the method for invoking a microservice according to any one of claims 1 to 9 is implemented.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110726509.4 | 2021-06-29 | ||
CN202110726509.4A CN113364885B (en) | 2021-06-29 | 2021-06-29 | Micro-service calling method and device, electronic equipment and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023273240A1 true WO2023273240A1 (en) | 2023-01-05 |
Family
ID=77537051
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/140935 WO2023273240A1 (en) | 2021-06-29 | 2021-12-23 | Micro-service calling method and apparatus, electronic device, and readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113364885B (en) |
WO (1) | WO2023273240A1 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113364885B (en) * | 2021-06-29 | 2022-11-22 | 天翼云科技有限公司 | Micro-service calling method and device, electronic equipment and readable storage medium |
CN117834739A (en) * | 2022-09-27 | 2024-04-05 | 华为云计算技术有限公司 | Service calling method and device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105515759A (en) * | 2015-11-27 | 2016-04-20 | 国网信息通信产业集团有限公司 | Micro service registration method and micro service registration system |
US20190294636A1 (en) * | 2018-03-20 | 2019-09-26 | Siemens Healthcare Gmbh | Providing microservice information |
CN111615066A (en) * | 2020-02-07 | 2020-09-01 | 中国海洋大学 | Distributed micro-service registration and calling method based on broadcast |
CN112905364A (en) * | 2021-03-31 | 2021-06-04 | 重庆度小满优扬科技有限公司 | Calling method of micro service and electronic equipment |
CN113364885A (en) * | 2021-06-29 | 2021-09-07 | 中国电信股份有限公司 | Micro-service calling method and device, electronic equipment and readable storage medium |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020015838A1 (en) * | 2018-07-20 | 2020-01-23 | Nokia Solutions And Networks Oy | Zero trust perimeterization for microservices |
CN109496420B (en) * | 2018-08-22 | 2021-02-23 | 袁振南 | Ring server cluster management method, device and computer storage medium |
CN112738339B (en) * | 2020-12-29 | 2022-09-23 | 杭州东信北邮信息技术有限公司 | Service instance lossless capacity expansion and reduction method under telecommunication domain micro-service architecture |
CN112968945B (en) * | 2021-02-01 | 2023-01-24 | 北京字跳网络技术有限公司 | Current limiting method and device, electronic equipment and storage medium |
-
2021
- 2021-06-29 CN CN202110726509.4A patent/CN113364885B/en active Active
- 2021-12-23 WO PCT/CN2021/140935 patent/WO2023273240A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105515759A (en) * | 2015-11-27 | 2016-04-20 | 国网信息通信产业集团有限公司 | Micro service registration method and micro service registration system |
US20190294636A1 (en) * | 2018-03-20 | 2019-09-26 | Siemens Healthcare Gmbh | Providing microservice information |
CN111615066A (en) * | 2020-02-07 | 2020-09-01 | 中国海洋大学 | Distributed micro-service registration and calling method based on broadcast |
CN112905364A (en) * | 2021-03-31 | 2021-06-04 | 重庆度小满优扬科技有限公司 | Calling method of micro service and electronic equipment |
CN113364885A (en) * | 2021-06-29 | 2021-09-07 | 中国电信股份有限公司 | Micro-service calling method and device, electronic equipment and readable storage medium |
Non-Patent Citations (1)
Title |
---|
ZHAO CHUNYANG, XIAO BING; GUO JINWEI; QIAN WEINING: "Application of the Consistency Protocol in Distributed Database Systems", HUADONG SHIFAN DAXUE XUEBAO (ZIRAN KEXUE BAN), HUADONG SHIFAN DAXUE, CH, no. 5, 25 September 2018 (2018-09-25), CH , pages 91 - 106, XP093018802, ISSN: 1000-5641, DOI: 10.3969/j.issn.1000-5641.2018.05.008 * |
Also Published As
Publication number | Publication date |
---|---|
CN113364885A (en) | 2021-09-07 |
CN113364885B (en) | 2022-11-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2023273240A1 (en) | Micro-service calling method and apparatus, electronic device, and readable storage medium | |
US9722862B2 (en) | Computer system to support failover in an event stream processing system | |
US9049241B2 (en) | Peer discovery and secure communication in failover schemes | |
US20070041327A1 (en) | Multicast heartbeat signaling | |
CN111414208B (en) | Application program starting method, device and equipment | |
US20060153064A1 (en) | System and method for storing and restoring communication dialog | |
US20090177743A1 (en) | Device, Method and Computer Program Product for Cluster Based Conferencing | |
CN107995247B (en) | File transmission method, server and system | |
CN102571947A (en) | Processing method proxy method, device and system | |
US10027563B2 (en) | Using status inquiry and status response messages to exchange management information | |
WO2022083379A1 (en) | Connection processing method and apparatus, electronic device, and computer-readable storage medium | |
US20130111002A1 (en) | Systems and methods for establishing a virtual local area network | |
CN117615057B (en) | Fault detection method, device, system, computer equipment and storage medium | |
US20190044887A1 (en) | Method and apparatus for conditional broadcasting of network configuration data | |
CN112131014B (en) | Decision engine system and business processing method thereof | |
US20230144294A1 (en) | Method for data transmission of audio and video in end-to-end system | |
CN115412597B (en) | Real-time data communication method | |
CN114615355B (en) | Message processing method and message analysis module | |
WO2023229531A2 (en) | Data transmission method and apparatus, terminal, and storage medium | |
CN116647476A (en) | Network management method, apparatus, computer device, storage medium, and program product | |
CN116192927A (en) | Data transmission method and device based on SaaS service, computer equipment and medium | |
CN112711466B (en) | Hanging affair inspection method and device, electronic equipment and storage medium | |
CN110716827A (en) | Hot backup method suitable for distributed system and distributed system | |
CN114095759B (en) | Stream media redirection method and related device | |
CN113660339B (en) | Method and apparatus for decentralizing clusters |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21948165 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21948165 Country of ref document: EP Kind code of ref document: A1 |