Service calling method and device for multi-available-area deployment
By obtaining registration data and determining the number of target services, healthy availability zone service instances are prioritized, which solves the problem of cross-availability zone call delay and stability, and achieves efficient stability and fault tolerance capabilities of the system.
Patent Information
- Application Number
- CN202410820431.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-17
AI Technical Summary
In a system deployed in multiple availability zones, cross-availability zone service calls have a large delay, which affects system performance. In addition, single-availability zone providers may suffer from overload and failure problems, making it difficult to effectively reduce network congestion and improve stability.
By obtaining registration data, including availability zone information, service IP information, and service port information, it is determined whether the number of target services meets the preset number, and based on this, it is decided which service instance in the availability zone to call, and healthy provider instances are prioritized to reduce cross-border cross-border service instances. Availability zone calls enable nearby routing and fault self-healing.
While effectively reducing cross-availability zone calls, it ensures that service calls are directed to healthy provider instances, reduces network congestion, improves system stability and performance, and has cross-availability zone fault tolerance and fault self-healing capabilities.
Smart Images

Figure CN118656232A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of microservice technology, and in particular, relates to a service calling method and device for multi-availability zone deployment. Background Art
[0002] In the relevant technology, in the production environment, in order to ensure the high availability and robustness of the system, services are usually deployed across availability zones (for example, for the same application, two nodes are deployed in availability zone 1 and two nodes are deployed in availability zone 2). The advantage of such deployment is that when a problem occurs in a single availability zone, the entire system can still operate normally without affecting the actual business. Therefore, how to better implement service calls in a multi-availability zone deployment state has become an urgent problem to be solved. Summary of the invention
[0003] In view of the above deficiencies in the prior art, the purpose of the invention is to provide a service calling method and device for multi-availability zone deployment, which effectively reduces cross-availability zone calls while ensuring that service calls are made to healthy provider instances, thereby reducing network congestion and improving system stability.
[0004] According to a first aspect of the present invention, a method for calling a service deployed in multiple availability zones is proposed, comprising: S1, obtaining registration data, the registration data comprising availability zone information, service IP information, and service port information; S2, when calling a first service in a first availability zone, determining an availability zone identical to the first availability zone based on the availability zone information, and using the identical availability zones as the first availability zones; S3, determining a target number of services in the first availability zone, and determining whether the target number of services meets a preset number, and determining a calling service for the first service in the first availability zone based on the determination result.
[0005] Further, determining the target service quantity of the first availability zone and judging whether the target service quantity meets the preset quantity include: determining the service quantity of the second service of the first availability zone, the service quantity being the healthy service quantity; judging whether the service quantity of the second service meets the preset quantity.
[0006] Further, determining the calling service of the first service in the first availability zone based on the judgment result includes: when determining that the service quantity of the second service meets the preset quantity, using the second service in the first availability zone as the calling service of the first service in the first availability zone.
[0007] Furthermore, determining a calling service of the first service in the first availability zone based on the judgment result includes: determining whether a fault occurs in the second service in the first availability zone when it is determined that the service quantity of the second service does not meet the preset quantity; determining an availability zone closest to the first availability zone based on the availability zone information when it is determined that a fault occurs in the second service in the first availability zone, and using the availability zone closest to the first availability zone as the second availability zone; and using the service of the second availability zone as the calling service of the first service in the first availability zone.
[0008] Furthermore, using the service of the second availability zone as a calling service of the first service of the first availability zone includes: re-initiating a calling request to the first service of the first availability zone; and using the second service of the second availability zone as a calling service of the first service of the first availability zone.
[0009] Furthermore, obtaining registration data includes: registering the service to a registration center, wherein the registration of the service carries the available zone information, the service IP information, and the service port information corresponding to the service; and obtaining the registration data based on the registration center.
[0010] Furthermore, the method also includes: when calling the first service of the second availability zone, determining the availability zone that is the same as the second availability zone based on the availability zone information, and using the same availability zone as the second availability zone; determining the target number of services in the second availability zone, and judging whether the target number of services meets a preset number, and determining the calling service of the first service in the second availability zone based on the judgment result.
[0011] According to a second aspect of the present invention, a service calling device for multi-availability zone deployment is proposed, including: an acquisition module for acquiring registration data, the registration data including availability zone information, service IP information, and service port information; a first determination module for determining, when calling a first service in a first availability zone, an availability zone that is the same as the first availability zone based on the availability zone information, and using the same availability zones as the first availability zones; a second determination module for determining a target number of services in the first availability zone, and determining whether the target number of services meets a preset number, and determining a calling service for the first service in the first availability zone based on the determination result.
[0012] According to a third aspect of the present invention, an electronic device is proposed, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the methods described in the first aspect of the present invention.
[0013] According to a fourth aspect of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods according to the first aspect of the present invention.
[0014] The beneficial effects of the present invention are as follows:
[0015] The service calling method and device for multi-availability zone deployment described in the present invention obtains registration data, which includes availability zone information, service IP information, and service port information; when calling the first service in the first availability zone, the availability zone that is the same as the first availability zone is determined based on the availability zone information, and the same availability zone is used as the first availability zone; the target service quantity of the first availability zone is determined, and it is judged whether the target service quantity meets the preset quantity, and the calling service of the first service in the first availability zone is determined based on the judgment result. This method realizes that while effectively reducing cross-availability zone calls, it ensures that the service calls are to healthy provider instances, reduces network congestion, and improves system stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0017] Figure 1 is a flowchart of a service calling method for multi-availability zone deployment according to an embodiment of the present invention;
[0018] Figure 2 is a flowchart of a service calling method for multi-availability zone deployment according to a specific embodiment of the present invention;
[0019] Figure 3 is a structural block diagram of a service invocation device deployed in multiple availability zones according to an embodiment of the present invention;
[0020] Figure 4 It is a structural block diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.
[0022] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.
[0023] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0024] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.
[0025] Microservice architecture is a system architecture design style. Different from the traditional monolithic architecture, microservice architecture advocates splitting a single application into multiple small services, which run in their own independent processes and use lightweight communication mechanisms to communicate with each other.
[0026] An availability zone (AZ) is a physical area in the same region with independent power and network. An AZ is a collection of one or more physical data centers with independent wind, fire, water, and electricity. The distance between different availability zones is within 100 km. Multiple AZs in a region are connected by high-speed optical fibers to meet the needs of users to build high-availability systems across AZs.
[0027] In order to ensure the availability of the system, more and more systems are deployed across availability zones, which greatly improves the disaster recovery capability of the system. When a single availability zone encounters unexpected network instability, power outages, and restarts, etc., it can still ensure that the client can resume message production and consumption after a short wait for reconnection. However, since systems deployed across availability zones are not in the same computer room, there will be network delays when making cross-region calls.
[0028] In a production environment, in order to ensure the high availability and robustness of the system, services are usually deployed across availability zones (for example, for the same application, two nodes are deployed in availability zone 1 and two nodes are deployed in availability zone 2). The advantage of such deployment is that when a problem occurs in a single availability zone, the entire system can still operate normally without affecting the actual business. However, since applications are deployed in different availability zones, when making remote calls to microservices, service calls across availability zones will have a greater delay than service calls in the same availability zone, affecting the performance of the overall system. To solve the above problems, common distributed high-availability solutions use custom routing rules to achieve nearby routing, but during the routing process, there will be problems such as overload of single availability zone providers and failures in the same availability zone.
[0029] To this end, the present invention proposes a service calling method, apparatus and related equipment for multi-availability zone deployment. Specifically, the service calling method, apparatus and related equipment for multi-availability zone deployment of an embodiment of the present invention are described below with reference to the accompanying drawings.
[0030] Figure 1 It is a flow chart of a service calling method for multi-availability zone deployment according to an embodiment of the present invention. It should be noted that the service calling method for multi-availability zone deployment in the embodiment of the present invention can be applied to the service calling device for multi-availability zone deployment in the embodiment of the present invention. The service calling device for multi-availability zone deployment can be configured on an electronic device or in a server. This embodiment of the present application is not limited to this.
[0031] like Figure 1 As shown in the figure, the service calling method for multi-zone deployment includes:
[0032] S110, obtaining registration data; the registration data includes available zone information, service IP information, and service port information.
[0033] In an embodiment of the present invention, the service is registered to a registration center, and the service registration carries the available zone information, service IP information, and service port information corresponding to the service; and the registration data is obtained based on the registration center.
[0034] S120: When a first service in a first availability zone is called, availability zones identical to the first availability zone are determined based on the availability zone information, and the identical availability zones are used as first availability zones.
[0035] That is to say, when receiving a call request for the first service of the first availability zone, the availability zone that is the same as the first availability zone is determined based on the information of the availability zone. For example, the availability zone that is the same as the first availability zone can be determined based on the IP of the availability zone, the resource pool corresponding to the availability zone, and other information, and the identical availability zones determined are all used as the first availability zone.
[0036] S130, determining a target service quantity of the first available zone, and determining whether the target service quantity meets a preset quantity, and determining a calling service of a first service in the first available zone based on the determination result.
[0037] In an embodiment of the present invention, the service quantity of the second service in the first available zone is determined, and the service quantity is the healthy service quantity; it is determined whether the service quantity of the second service meets the preset quantity, and then the calling service of the first service in the first available zone is determined based on the Pan reading result. The specific implementation method can refer to the subsequent embodiments.
[0038] According to the service calling method for multi-availability zone deployment of an embodiment of the present invention, registration data is obtained, and the registration data includes availability zone information, service IP information, and service port information; when calling the first service in the first availability zone, the availability zone that is the same as the first availability zone is determined based on the availability zone information, and the same availability zone is used as the first availability zone; the target service quantity of the first availability zone is determined, and it is determined whether the target service quantity meets the preset quantity, and the calling service of the first service in the first availability zone is determined based on the judgment result. This method realizes that while effectively reducing cross-availability zone calls, it ensures that the service calls are to healthy provider instances, reduces network congestion, and improves system stability.
[0039] In order to make it easier for those skilled in the art to understand the present invention, Figure 2 is a service calling method for multi-availability zone deployment according to a specific embodiment of the present invention, such as Figure 2 As shown, the service calling method for the multi-zone deployment includes:
[0040] S210, obtaining registration data, the registration data including available zone information, service IP information, and service port information.
[0041] In an embodiment of the present invention, the service is registered to a registration center, and the service registration carries the available zone information, service IP information, and service port information corresponding to the service; and the registration data is obtained based on the registration center.
[0042] When the provider registers the service, the agent listens to the service registration method, and then enhances the service registration method through the asm tool, adds the available zone code of the current service to the provider metadata, and registers it with the registration center, and then obtains the registration data based on the registration center.
[0043] It should be noted that monitoring the service registration method through the agent can be understood as the algorithm for selecting the provider. Monitoring the service registration method is mainly to modify the load balancing algorithm logic, which can control consumers to give priority to calling providers in the same availability zone; enhancing the service registration method through the asm tool is mainly to modify the algorithm logic and control consumers to give priority to calling providers in the same availability zone. asm is a bytecode modification tool, which mainly modifies the bytecode of the class where the service registration method is located and adds code logic to achieve the purpose of control.
[0044] S220: When a first service in a first availability zone is called, an availability zone identical to the first availability zone is determined based on the availability zone information, and the identical availability zones are used as first availability zones.
[0045] In the embodiment of the present invention, the implementation of step S220 may refer to the implementation of step S120 described above, and the present invention will not elaborate on this any more.
[0046] S230: Determine the service quantity of the second service in the first availability zone, where the service quantity is a healthy service quantity.
[0047] S240: Determine whether the service quantity of the second service meets a preset quantity.
[0048] That is, it is determined whether the number of healthy services of the second service meets the preset number.
[0049] S250: When it is determined that the service quantity of the second service meets a preset quantity, determine a calling service of the first service in the first available zone.
[0050] In one embodiment of the present invention, when it is determined that the service quantity of the second service meets a preset quantity, the second service in the first availability zone is used as a calling service of the first service in the first availability zone.
[0051] S260: When it is determined that the service quantity of the second service does not meet the preset quantity, determine a calling service of the first service in the first available zone.
[0052] In an embodiment of the present invention, when it is determined that the service quantity of the second service does not meet the preset quantity, it is determined whether the second service of the first availability zone fails; when it is determined that the second service of the first availability zone fails, the availability zone closest to the first availability zone is determined based on the availability zone information, and the availability zone closest to the first availability zone is used as the second availability zone; the service of the second availability zone is used as the calling service of the first service of the first availability zone.
[0053] Wherein, when the second availability zone is determined, a call request to the first service in the first availability zone may be re-initiated; and the second service in the second availability zone may be used as the calling service of the first service in the first availability zone.
[0054] It should be noted that the second service in the first availability zone and the second service in the second availability zone belong to the same service, but they are deployed in different availability zones, and the second service is the called service.
[0055] It should be noted that the relationship between the first service in the first availability zone and the second service in the first availability zone is: the first service calls the second service.
[0056] In another embodiment of the present invention, when calling the first service of the second availability zone, the availability zone that is the same as the second availability zone is determined based on the availability zone information, and the same availability zone is used as the second availability zone; the target service quantity of the second availability zone is determined, and it is judged whether the target service quantity meets the preset quantity, and the calling service of the first service of the second availability zone is determined based on the judgment result.
[0057] Among them, determining the target service quantity of the second availability zone and judging whether the target service quantity meets the preset quantity include: determining the service quantity of the second service in the second availability zone, where the service quantity is the healthy service quantity; judging whether the service quantity of the second service meets the preset quantity.
[0058] When it is determined that the service quantity of the second service meets the preset quantity, the second service in the second availability zone is used as the calling service of the first service in the second availability zone.
[0059] Among them, when it is determined that the service quantity of the second service does not meet the preset quantity, it is judged whether the second service of the second availability zone fails; when it is determined that the second service of the second availability zone fails, the availability zone closest to the second availability zone is determined based on the availability zone information, and the availability zone closest to the second availability zone is used as the first availability zone; the service of the first availability zone is used as the calling service of the first service of the second availability zone.
[0060] Wherein, when the first availability zone is determined, a call request to the first service in the second availability zone may be re-initiated; and the second service in the first availability zone is used as the calling service of the first service in the second availability zone.
[0061] It should be noted that the relationship between the first service in the second availability zone and the second service in the second availability zone is: the first service calls the second service.
[0062] It can be seen that the multi-availability service calling method of the embodiment of the present invention can give priority to calling the provider instance in the same availability zone, reducing the calling delay, and also has the characteristics of cross-availability zone fault disaster recovery and fault self-healing. Among them, cross-availability zone disaster recovery: when the number of healthy instances in the same availability zone is less than the minimum number of instances required for the current traffic, or when the instances in the same availability zone are in an unhealthy state, the load balancer will automatically route, isolate the faulty availability zone, and find the nearest availability zone that meets the required minimum number of instances, thereby realizing cross-availability zone disaster recovery; fault self-healing: after isolating the instance in the faulty availability zone, the recovery status of the faulty instance will also be asynchronously detected. When the faulty instance recovers, the load balancer will put the faulty instance into the routable list, and then call the newly recovered faulty instance through the same availability zone priority calling algorithm, thereby realizing self-healing of the faulty instance without manual intervention.
[0063] In a specific embodiment of the present invention, the environment is prepared: availability zone 1, availability zone 2, service 1, service 2, and registration center; it should be noted that when the service 1 interface is called, service 1 will automatically call the service 2 interface. Among them, one service 1 node and two service 2 nodes are deployed in availability zone 1, and both service 1 and service 2 are registered with the registration center respectively; one service 1 node and two service 2 nodes are deployed in availability zone 2, and both service 1 and service 2 are registered with the registration center respectively. After the deployment is completed, the availability zone information, ip, port and other information of service 2 will be automatically registered with the registration center, and service 1 will automatically subscribe to the availability zone information, ip, port and other information of service 1 from the registration center. Among them, a call is initiated to service 1 in availability zone 1, and the log is checked. Service 1 will automatically call the two nodes of service 2 in availability zone 1. The purpose of calling the nearest availability zone is achieved; a call is initiated to service 1 in availability zone 2, and the log is checked. Service 1 will automatically call the two nodes of service 2 in availability zone 2. The purpose of calling the nearest availability zone is achieved; a fault is injected into service 2 in availability zone 1, so that service 2 is in an unhealthy state. Re-initiate a call to service 1 in zone 1 and check the logs. Service 1 will automatically call the two nodes of service 2 in zone 2. This will achieve the purpose of automatically switching unhealthy instances. After completion, cancel the fault of service 2 in zone 1; inject a fault into service 2 in zone 2 to put service 2 in an unhealthy state. Re-initiate a call to service 1 in zone 2 and check the logs. Service 1 will automatically call the two nodes of service 2 in zone 1. This will achieve the purpose of automatically switching unhealthy instances. After completion, cancel the fault of service 2 in zone 2.
[0064] According to the service calling method for multi-availability zone deployment according to an embodiment of the present invention, by introducing a service availability zone registration and marking mechanism, when the system is deployed in two or more availability zones, the service consumer calls the service provider, giving priority to calling services in the same availability zone. At the same time, the health status of the provider is detected asynchronously. When the number of healthy services in the same availability zone is less than the minimum number provided (the minimum number of instances required for the current traffic), the availability zone service closest to the current availability zone is called, and searches are performed in sequence until a healthy instance of the nearest availability zone is found. This can effectively reduce service calls across availability zones, reduce the time consumption of service calls, avoid network congestion, and at the same time have the capabilities of cross-availability zone disaster recovery and fault self-healing, thereby improving the performance of the overall system.
[0065] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0066] According to one aspect of an embodiment of the present invention, a service invocation device deployed in multiple availability zones is also proposed. Figure 3 is a structural block diagram of a service invocation device deployed in multiple availability zones according to an embodiment of the present invention; Figure 3 As shown, including:
[0067] The acquisition module 310 is used to acquire registration data, where the registration data includes available zone information, service IP information, and service port information;
[0068] A first determining module 320 is configured to determine, when a first service in a first availability zone is called, an availability zone identical to the first availability zone based on the availability zone information, and use the identical availability zones as the first availability zone;
[0069] The second determination module 330 is used to determine the target service quantity of the first availability zone, and determine whether the target service quantity meets a preset quantity, and determine the calling service of the first service of the first availability zone based on the determination result.
[0070] According to the service calling device deployed in multiple availability zones of the embodiment of the present invention, registration data is obtained, and the registration data includes availability zone information, service IP information, and service port information; when calling the first service in the first availability zone, the availability zone that is the same as the first availability zone is determined based on the availability zone information, and the same availability zone is used as the first availability zone; the target service quantity of the first availability zone is determined, and it is judged whether the target service quantity meets the preset quantity, and the calling service of the first service in the first availability zone is determined based on the judgment result. In this way, while effectively reducing cross-availability zone calls, it is achieved to ensure that the service calls are to healthy provider instances, reduce network congestion, and improve system stability.
[0071] Optionally, the second determination module 330 is specifically configured to determine the service quantity of the second service in the first availability zone, where the service quantity is the healthy service quantity; and determine whether the service quantity of the second service meets the preset quantity.
[0072] Optionally, the second determining module 330 is specifically configured to use the second service in the first availability zone as a calling service of the first service in the first availability zone when determining that the service quantity of the second service meets the preset quantity.
[0073] Optionally, the second determination module 330 is specifically used to determine whether the second service in the first availability zone fails when the service quantity of the second service does not meet the preset quantity; when it is determined that the second service in the first availability zone fails, determine the availability zone closest to the first availability zone based on the availability zone information, and use the availability zone closest to the first availability zone as the second availability zone; and use the service of the second availability zone as the calling service of the first service in the first availability zone.
[0074] Optionally, the second determination module 330 is specifically configured to re-initiate a call request to the first service in the first availability zone; and use the second service in the second availability zone as the calling service of the first service in the first availability zone.
[0075] Optionally, the acquisition module 310 is specifically used to register the service to a registration center, the registration of the service carries the available zone information, the service IP information, and the service port information corresponding to the service; and the registration data is acquired based on the registration center.
[0076] Optionally, the device also includes a third determination module and a fourth determination module. The third determination module is used to determine the same availability zone as the second availability zone based on the availability zone information when calling the first service of the second availability zone, and use the same availability zone as the second availability zone; the fourth determination module is used to determine the target number of services in the second availability zone, and judge whether the target number of services meets a preset number, and determine the calling service of the first service in the second availability zone based on the judgment result.
[0077] According to one aspect of an embodiment of the present invention, an electronic device is provided.
[0078] Figure 4 Schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Figure 4 As shown, the electronic device may include one or more ( Figure 4Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a microprocessor (Microprocessor Unit, referred to as MPU) or a programmable logic device (Programmable logic device, referred to as PLD)) and a memory 104 for storing data. In an exemplary embodiment, the electronic device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 4 The structure shown is for illustration only and does not limit the structure of the above terminal device. Figure 4 More or fewer components as shown, or with Figure 4 Equivalent functions or comparisons shown Figure 4 A different configuration with more features is shown.
[0079] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the level determination method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal device via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0080] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the switching device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0081] The present invention proposes a computer-readable storage medium having a computer program stored thereon, which can be loaded and executed by a processor to implement the service calling method deployed in multiple availability zones as described in the first aspect.
[0082] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.
[0083] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0084] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.
Claims
1. A service calling method for multi-availability zone deployment, characterized in that: include: S1, obtaining registration data, where the registration data includes available zone information, service IP information, and service port information; S2, when a first service in a first availability zone is called, determining an availability zone that is the same as the first availability zone based on the availability zone information, and using the same availability zones as the first availability zones; S3, determining a target service quantity of the first availability zone, and judging whether the target service quantity meets a preset quantity, and determining a calling service of the first service of the first availability zone based on the judgment result.
2. The service calling method for multi-availability zone deployment according to claim 1, characterized in that: Determining a target service quantity of the first available zone, and judging whether the target service quantity meets a preset quantity, includes: Determine a service quantity of a second service in the first availability zone, where the service quantity is a healthy service quantity; Determine whether the service quantity of the second service meets the preset quantity.
3. The service calling method for multi-availability zone deployment according to claim 2, characterized in that: Determining a calling service of the first service in the first available zone based on the determination result includes: When it is determined that the service quantity of the second service meets the preset quantity, the second service of the first availability zone is used as the calling service of the first service of the first availability zone.
4. The service calling method for multi-availability zone deployment according to claim 2, characterized in that: Determining a calling service of the first service in the first available zone based on the determination result includes: If it is determined that the service quantity of the second service does not meet the preset quantity, determining whether a failure occurs in the second service of the first availability zone; In the case where it is determined that a second service in the first availability zone fails, determining an availability zone closest to the first availability zone based on the availability zone information, and using the availability zone closest to the first availability zone as the second availability zone; The service of the second availability zone is used as a calling service of the first service of the first availability zone.
5. The service calling method for multi-availability zone deployment according to claim 4, characterized in that: Using the service of the second availability zone as a calling service of the first service of the first availability zone includes: Re-initiating a call request for the first service in the first availability zone; The second service in the second availability zone is used as a calling service of the first service in the first availability zone.
6. The service calling method for multi-availability zone deployment according to claim 1, characterized in that: Get registration data, including: Register the service to the registration center, where the service registration carries the available zone information, the service IP information, and the service port information corresponding to the service; The registration data is obtained based on the registration center.
7. The service calling method for multi-availability zone deployment according to claim 1, characterized in that: The method further comprises: When the first service in the second availability zone is called, the availability zone identical to the second availability zone is determined based on the availability zone information, and the identical availability zones are used as the second availability zone; Determine a target service quantity of the second availability zone, determine whether the target service quantity meets a preset quantity, and determine a calling service of the first service of the second availability zone based on the determination result.
8. A service calling device deployed in multiple availability zones, characterized in that: include: An acquisition module is used to acquire registration data, wherein the registration data includes available zone information, service IP information, and service port information; A first determining module is configured to determine, when a first service in a first availability zone is called, an availability zone that is the same as the first availability zone based on the availability zone information, and use the same availability zones as the first availability zone; The second determination module is used to determine the target service quantity of the first availability zone, and determine whether the target service quantity meets a preset quantity, and determine the calling service of the first service of the first availability zone based on the determination result.
9. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.
