Resource fuse method, device, computer equipment and storage medium
By real-time monitoring of health between the first resource and the management node and statistics of global health, the problem of low resource circuit breaking efficiency and accuracy in the prior art is solved, and a faster and more accurate resource circuit breaking processing is achieved.
Patent Information
- Application Number
- CN202110874708.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-30
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-07-30
AI Technical Summary
In the prior art, the efficiency and accuracy of resource circuit breakers are low, especially in services with small traffic. It takes a long time to reach the minimum call threshold, resulting in missing the actual circuit breaker requirement.
By real-time monitoring of health and statistics of global health between the first resource and the management node, the management node issues call status to each resource node based on the global health, ensuring that the main caller can accurately judge the call of the second resource. and fuse if necessary.
It greatly shortens the circuit breaker time, improves the accuracy of judging whether to circuit breaker, ensures that even if a single business traffic is small, it can respond quickly based on global health, and improves the accuracy and processing efficiency of resource circuit breakers.
Smart Images

Figure CN115701084B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to technical fields such as network technology, cloud technology, and cloud computing. The present application relates to a resource fuse method, device, computer equipment, and storage medium. Background Art
[0002] As the scale of various businesses in applications expands, the complexity of the businesses increases. Many businesses require multiple resources to call each other to implement; therefore, the call between resources has become a key issue in the business architecture of applications. However, calls between resources often fail. In this field, when a call fails, resource fuses can be used to ensure overall availability. For example, service A calls an interface of service B. When service B fails, service A cuts off the call to service B.
[0003] In the related art, the resource fuse process may include: taking service A calling service B as an example, the service fuse may be triggered by the call situation of service A to service B within a period of time. For example, first determine whether the total number of call requests within one minute reaches the minimum call threshold of 600. When the total number of call requests reaches 600, then determine whether the call error rate exceeds the minimum error threshold of 50%. When the number of call failures exceeds 300 times, that is, the call error rate exceeds 50%, the resource fuse is triggered, and service A stops calling service B.
[0004] The above resource circuit breaking requires data observation within a certain period of time to trigger the circuit breaking, and the processing process is lengthy. Especially for businesses with small traffic, it takes a long time for the number of service calls to reach the minimum call threshold before determining whether to circuit break. During the waiting period, it is very likely that the actual circuit breaking demand will be missed; therefore, the efficiency and accuracy of service circuit breaking are low. Summary of the invention
[0005] The present application provides a resource fusing method, device, computer equipment and storage medium, which can solve the problem of low efficiency and accuracy of service fusing in related technologies. The technical solution is as follows:
[0006] In one aspect, a resource fusing method is provided, the method being executed by a first node where a first resource is located, the method comprising:
[0007] Based on the result of the first resource calling the second resource, obtaining the health of the second resource when being called by the first resource;
[0008] Sending the health status to a management node;
[0009] receiving a global health of the second resource sent by the management node, where the global health is used to indicate an ability of the second resource to provide business functions to at least two resources;
[0010] In response to the call state corresponding to the global health being a fuse state, performing fuse processing on the second resource;
[0011] Among them, the health status is used to indicate the ability of the second resource to provide business functions to the first resource, the first resource is any one of at least two resources that call the second resource, and the second resource refers to any resource in the service, interface, instance or instance group that provides business functions.
[0012] In one possible implementation, the method further includes:
[0013] In response to the call state corresponding to the global health being a hold state, performing a hold process on the second resource;
[0014] In response to the call status corresponding to the global health being a healthy state, continue to call the second resource.
[0015] In a possible implementation manner, the maintaining processing of the second resource includes:
[0016] When the resources indicated by the routing rule of the first resource include any resource with a higher calling priority than the second resource, interrupt the calling of the second resource and switch to calling a fourth resource whose corresponding calling status is a healthy status;
[0017] When the calling priority of the second resource is higher than any resource indicated by the routing rule, continue to call the second resource.
[0018] In one possible implementation, the call result includes: whether the call is wrong, the call delay, or at least one of the error types of the call error; the health indicator includes: the number of call errors, the number of call timeouts, the total duration of the call delay, the number of successful calls, or at least one of the target errors of the target type.
[0019] On the other hand, a resource fusing method is provided, the method being executed by a management node, the method comprising:
[0020] Obtaining the health of the second resource when it is called by each of the at least two resources;
[0021] Based on the health of the second resource when being called by each of the at least two resources, calculating a global health of the second resource, where the global health is used to indicate an ability of the second resource to provide business functions to the at least two resources;
[0022] Sending the global health of the second resource to each node where the at least two resources are located, respectively, so that the node where each resource is located determines whether to perform fuse processing on the second resource based on the call state corresponding to the global health;
[0023] The health status is used to indicate the ability of the second resource to provide business functions to any one of the at least two resources, the at least two resources include the first resource, and the second resource refers to any one of the services, interfaces, instances or instance groups that provide business functions.
[0024] In a possible implementation, the health includes a resource identifier of each of the at least two resources, a resource identifier of the second resource, and a health indicator of the second resource when called by each resource within a target period; the health indicator includes at least one of the number of call errors, the number of call timeouts, the total duration of call delays, the number of successful calls, or the number of target errors belonging to a target type;
[0025] The counting of the global health of the second resource based on the health of the second resource when being called by each of the at least two resources includes at least one of the following:
[0026] Based on the number of call errors, the number of call successes, the resource identifiers of the at least two resources, and the resource identifier of the second resource, counting a call error rate of the second resource being called by the at least two resources within a target period;
[0027] Based on the number of call timeouts, the number of call errors, the number of successful calls, the resource identifiers of the at least two resources, and the resource identifier of the second resource, counting a call delay rate of the second resource being called by the at least two resources within a target period;
[0028] Based on the number of call errors, the resource identifiers of the at least two resources, and the resource identifier of the second resource, counting a total number of call errors of the second resource being called by the at least two resources within a target period;
[0029] Based on the number of call errors, the number of successful calls, the target error number, the resource identifiers of the at least two resources and the resource identifier of the second resource, the target error rate of call errors of the target type when the second resource is called by the at least two resources within the target period is counted.
[0030] In a possible implementation, obtaining the health of the second resource when it is called by each of the at least two resources includes at least one of the following:
[0031] Receiving the health of a second resource sent by a node where each resource of the at least two resources is located;
[0032] Receive the health status of each resource when called by the second node, which is sent by the second node where the second resource is located.
[0033] On the other hand, a resource fuse device is provided, the device is executed by a first node where a first resource is located, and the device includes:
[0034] An acquisition module, configured to acquire the health of the second resource when it is called by the first resource based on the result of the first resource calling the second resource;
[0035] A sending module, used for sending the health status to the management node;
[0036] A receiving module, configured to receive the global health of the second resource sent by the management node, where the global health is used to indicate the ability of the second resource to provide business functions to at least two resources;
[0037] A fusing module, configured to perform fusing processing on the second resource in response to a call state corresponding to the global health being a fusing state;
[0038] Among them, the health status is used to indicate the ability of the second resource to provide business functions to the first resource, the first resource is any one of at least two resources that call the second resource, and the second resource refers to any resource in the service, interface, instance or instance group that provides business functions.
[0039] On the other hand, a resource fuse device is provided, the device is executed by a management node, and the device includes:
[0040] An acquisition module, used to acquire the health of the second resource when it is called by each of the at least two resources;
[0041] a statistics module, configured to count the global health of the second resource based on the health of the second resource when it is called by each of the at least two resources, wherein the global health is used to indicate the ability of the second resource to provide business functions to the at least two resources;
[0042] A sending module, used for sending the global health of the second resource to each node where the at least two resources are located, so that the node where each resource is located determines whether to perform fuse processing on the second resource based on the call state corresponding to the global health;
[0043] The health status is used to indicate the ability of the second resource to provide business functions to any one of the at least two resources, the at least two resources include the first resource, and the second resource refers to any one of the services, interfaces, instances or instance groups that provide business functions.
[0044] In another aspect, a computer device is provided, the computer device comprising:
[0045] one or more processors;
[0046] Memory;
[0047] One or more computer programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute the above-mentioned resource fuse method.
[0048] On the other hand, a computer-readable storage medium is provided, wherein the computer storage medium is used to store computer instructions. When the computer instructions are executed on a computer, the computer can execute the above-mentioned resource fuse method.
[0049] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned resource fuse method.
[0050] The beneficial effects of the technical solution provided by this application are:
[0051] The resource fusing method provided by the present application, for any resource of at least two resources that call the second resource, in accordance with the resource fusing process of the first resource, specifically reports the health of the second resource when it is called by the first resource to the management node, so that the management node can calculate the global health based on the health of the second resource when it is called by each resource and send it to each main caller in time, so that the main caller can accurately know the situation of the second resource being called globally based on the global health, so that the calling state of the second resource can be accurately grasped from an overall perspective; compared with the technology of fusing a single resource based on its own calling situation, the present application performs fusing by accurately grasping the global situation, which not only greatly shortens the fusing time, but also improves the accuracy of judging whether to fuse. Moreover, different global healths correspond to different calling states, and only when the calling state corresponding to the global health is a fusing state, the fusing process is performed, further improving the accuracy of resource fusing; even if the single business traffic is small, it can respond quickly based on the global health, improving the accuracy and processing efficiency of resource fusing. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0053] Figure 1 A schematic diagram of an implementation environment of a resource fuse method provided in this application;
[0054] Figure 2 A schematic diagram of signaling interaction for resource fusing provided in an embodiment of the present application;
[0055] Figure 3 A schematic diagram of a system architecture provided for an embodiment of the present application;
[0056] Figure 4 A schematic diagram of a system architecture provided for an embodiment of the present application;
[0057] Figure 5 A schematic diagram of a process of statistically analyzing global health status at a management end provided in an embodiment of the present application;
[0058] Figure 6 A schematic diagram of a code for a routing rule provided in an embodiment of the present application;
[0059] Figure 7 A schematic diagram of a code of a fuse rule provided in an embodiment of the present application;
[0060] Figure 8 A schematic diagram of a node internal module execution flow provided in an embodiment of the present application;
[0061] Fig. 9 A schematic diagram of an architecture of a calling scenario example provided in an embodiment of the present application;
[0062] Fig.10 A schematic diagram of test data of a related technology provided by an embodiment of the present application;
[0063] Fig.11 A schematic diagram of test data of the present application provided in an embodiment of the present application;
[0064] Fig.12 A schematic diagram of test data of a related technology provided by an embodiment of the present application;
[0065] Fig.13 A schematic diagram of test data of the present application provided in an embodiment of the present application;
[0066] Fig.14 A schematic diagram of the structure of a resource fuse device provided in an embodiment of the present application;
[0067] Fig.15 A schematic diagram of the structure of a resource fuse device provided in an embodiment of the present application;
[0068] Fig.16 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present invention.
[0070] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0071] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0072] Cloud computing refers to the delivery and use model of IT infrastructure, which means obtaining required resources through the network in an on-demand and easily scalable manner; in a broad sense, cloud computing refers to the delivery and use model of services, which means obtaining required services through the network in an on-demand and easily scalable manner. This service can be IT and software, Internet-related, or other services. Cloud computing is the product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.
[0073] With the development of the Internet, real-time data streams, and the diversification of connected devices, as well as the demand for search services, social networks, mobile commerce, and open collaboration, cloud computing has developed rapidly. Different from the previous parallel distributed computing, the emergence of cloud computing will promote revolutionary changes in the entire Internet model and enterprise management model from a conceptual perspective.
[0074] In short, a database can be seen as an electronic filing cabinet - a place where electronic files are stored, and users can add, query, update, delete, and other operations on the data in the files. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application.
[0075] Big data refers to a collection of data that cannot be captured, managed, and processed by conventional software tools within a certain time frame. It is a massive, high-growth, and diverse information asset that requires new processing models to have stronger decision-making power, insight discovery, and process optimization capabilities. With the advent of the cloud era, big data has also attracted more and more attention. Big data requires special technologies to effectively process large amounts of data within a tolerable time frame. Technologies applicable to big data include large-scale parallel processing databases, data mining, distributed file systems, distributed databases, cloud computing platforms, the Internet, and scalable storage systems.
[0076] The so-called artificial intelligence cloud service is generally also called AIaaS (AIas a Service, Chinese for "AI as a Service"). This is the current mainstream service mode of artificial intelligence platforms. Specifically, the AIaaS platform will split several common AI services and provide independent or packaged services in the cloud. This service model is similar to opening an AI theme mall: all developers can access and use one or more artificial intelligence services provided by the platform through API interfaces. Some senior developers can also use the AI framework and AI infrastructure provided by the platform to deploy and operate their own cloud artificial intelligence services.
[0077] Medical cloud refers to the use of cloud computing to create a cloud platform for medical and health services based on new technologies such as cloud computing, mobile technology, multimedia, 4G communications, big data, and the Internet of Things, combined with medical technology, to achieve the sharing of medical resources and the expansion of medical scope. Because of the application of cloud computing technology, medical cloud improves the efficiency of medical institutions and facilitates residents' medical treatment. For example, hospital appointment registration, electronic medical records, and medical insurance are all products of the combination of cloud computing and the medical field. Medical cloud also has the advantages of data security, information sharing, dynamic expansion, and overall layout.
[0078] The resource fuse method provided in the present application counts the global health of the called resources in real time based on the health data of each dispersed calling resource, so that each resource can accurately and efficiently judge whether the resource is blown based on the global health. Exemplarily, the present application can use the distributed computing in the above-mentioned cloud computing technology to count the global health of the resources called by the massive calling resources in real time; it can also use database technology to add, query, update, delete and other operations on massive health data, global health data and other data in real time. Especially for high-concurrency business, big data technology can be used to realize fast data flow, large-scale real-time computing, etc. for the massive data during high-concurrency resource calls.
[0079] Exemplarily, the resource fuse method of the present application is applicable to any scenario that requires calling resources to implement business functions, and can be applied in multiple fields such as artificial intelligence cloud services and medical clouds. For example, in the field of artificial intelligence cloud services, one or more independent or packaged artificial intelligence services can usually be provided on the cloud for developers to access and use by calling API interfaces; and when calling the API interface, the resource fuse method of the present application can be used to count and monitor the global health of the called API interface in real time, so that the call can be interrupted in time and quickly when the API interface is in a fuse state to ensure the smooth progress of subsequent business. For example, for functions such as appointment registration and online payment in the field of medical cloud, the resource fuse method of the present application can also be used to count and monitor the global health of the called interfaces such as the UnionPay interface called when paying or the medical data provider interface called when registering, and quickly fuse resources in the event of a failure to improve the success rate of the overall business.
[0080] Figure 1 A schematic diagram of the implementation environment of a resource fuse method provided in this application. Figure 1 As shown, the implementation environment includes: a first node 101 where the first resource is located, a second node 102 where the second resource is located, and a management node 103. The first resource and the second resource are resources that can provide business functions; the first resource is the active caller, and the second resource is the called party. The call of the first resource to the second resource is realized through data interaction between the first node 101 and the second node 102. The management node 103 is configured with a management service, which is used to manage the call process of the first resource to the second resource; for example, based on the monitoring and statistics of health data when the resources are called, the call process between the first resource and the second resource can be intervened.
[0081] The management service can be in any form of a component, an independent application, a program plug-in, or an interface or service that integrates management functions for resource calls. The first node 101, the second node 102, and the management node 103 refer to nodes of any form that have an operating environment for running the first resource, the second resource, and the management service, respectively. For example, each node in the first node 101, the second node 102, and the management node 103 can be a system environment built based on virtualization technology, or a node composed of physical machines, or a space environment built based on containerization technology; for example, each node can be a Docker (application container engine) container environment built based on containerization technology. These three nodes can be deployed in one or more physical devices or device clusters, or in one or more virtual machines. The embodiment of the present application does not specifically limit the form and deployment method of each node.
[0082] Exemplarily, the management node 103 obtains the health of the second resource when it is called by each resource including the first resource based on the management service to count the global health of the second resource. The management node 103 can send the global health to the nodes where each resource is located, so as to monitor the global call status of the second resource in real time and achieve accurate and rapid judgment on resource fuse. In one possible scenario, the management node 103 interacts with the first node 101, and the first node 101 reports the health of the second resource when it is called by the first resource. In another possible scenario, the management node 103 interacts with the second node 102, and the second node 102 reports the health of the second resource when it is called by a single resource.
[0083] Each node in this application is built and deployed based on a server in a network environment. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server or server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The above-mentioned network may include but is not limited to: wired network, wireless network, wherein the wired network includes: local area network, metropolitan area network and wide area network, and the wireless network includes: Bluetooth, Wi-Fi and other networks that realize wireless communication. The specific requirements can also be determined based on the actual application scenario, and are not limited here.
[0084] The following is an introduction and explanation of several terms involved in this application:
[0085] Resource: refers to any form of resource such as service, interface, instance, instance group, etc. that provides business functions. The first resource and the second resource involved in this application are all defined in this definition. Among them, the first resource is the calling end, and the second resource is the called end. The first resource calls the second resource, for example, service A calls the business function of interface B.
[0086] Fuse: Isolate resources to interrupt the call when the resource is called. In this application, when the first resource calls the second resource, if the second resource is in a fuse state, the second resource can be fused, that is, the call to the second resource is interrupted and switched to calling other available resources. For example, in a possible scenario example, due to uneven load, network partition, version bug, etc., in a distributed system, functional failures of one or more resources are prone to occur, resulting in a decrease in the success rate of business calls. At this time, the faulty resources can be isolated, that is, the resources are fused.
[0087] Service: refers to a logical group that provides business functions to the outside world. For example, it can be code logic that executes instructions and provides multiple related business functions. For example, a service can be a "song statistics service."
[0088] Interface: the logical entry point for a single business function. That is, the interface can be a functional logic in the service. For example, the interface can be "statistics of song downloads" or "statistics of song playbacks"; it is a single statistical logic under the "song statistics service".
[0089] Instance: A process or node that provides business functions to the outside world. In other words, an instance can be a process with an accessible network address (IP:Port) that provides services. IP (Internet Protocol) refers to the IP address, and Port refers to the port. For example, the "song statistics service" is deployed on the 10.12.11.13 node and listens to port 8888; then 10.12.11.13:8888 is the instance of the "song statistics service".
[0090] Instance grouping: A grouping of instances with the same attributes according to a logical dimension. For example, all instances in the data center of city A are provided to users in city A for the "song statistics service"; then all instances in the data center of city A belong to an instance group.
[0091] Health: The ability of one resource to provide business functions to another resource. In this application, it can be the ability of the second resource to provide business functions to the first resource.
[0092] Global health: in this application, it refers to the ability of the second resource to provide business functions to at least two resources.
[0093] The resource fusing method is described in detail below based on the description of each step in the embodiment.
[0094] Figure 2 A signaling interaction diagram of a resource fuse method provided in an embodiment of the present application. The method can be implemented by the first node where the first resource is located and the management node interacting. Figure 2 As shown, the method includes the following steps.
[0095] Step 201: The first node obtains the health of the second resource when it is called by the first resource based on the result of the first resource calling the second resource.
[0096] The first resource is any one of at least two resources that call the second resource, and the second resource refers to any one of services, interfaces, instances, or instance groups that provide business functions. The health level is used to indicate the ability of the second resource to provide business functions to the first resource. In this step, the first node can send a call request to the second node, and obtain the health level in real time based on the call result returned by the second node.
[0097] In a possible implementation, the first node may periodically perform the step of obtaining health based on the call result according to the target cycle, and step 201 may include: for each target cycle, the first node receives at least one call result returned by the second node based on at least one call request sent to the second node where the second resource is located within the target cycle; the first node counts the health index of the second resource when it is called by the first resource within the target cycle based on the at least one call result; the first node generates the health of the second resource when it is called by the first resource within the target cycle according to the resource identifier of the first resource, the resource identifier of the second resource and the counted health index of the second resource. The first node may repeat the above steps to obtain the corresponding health within multiple target cycles. Exemplarily, the resource identifier may be any identifier such as a service name identifier, an interface number identifier, an instance name identifier or an instance group name identifier. The error type may include but is not limited to: system error, business logic error, etc. The resource identifier and the error type may be based on the need for equipment, and the embodiment of the present application does not specifically limit this. Exemplarily, the target period can be configured based on needs, and the embodiments of the present application do not specifically limit this; for example, the target period can be 10ms, 1s, etc., that is, the first node obtains the corresponding health status within the 10ms once every 10ms.
[0098] In one possible implementation, the call result includes: whether the call is erroneous, the call delay, or at least one of the error types of the call error; the health indicator includes: at least one of the number of call errors, the number of call timeouts, the total duration of the call delay, the number of successful calls, or the number of target errors of the target type. Exemplarily, taking the number of call errors as an example, the first node may accumulate the number of call results with call errors in multiple call results to obtain the number of call errors. The first node may determine that the call corresponding to the call result is a timed-out call based on the duration of the call delay in the call result and the target duration when the duration of the call delay exceeds the target duration, and the first node may accumulate the number of corresponding calls as timed-out calls in multiple call results to obtain the number of call timeouts.
[0099] Exemplarily, the health includes the resource identifier of the first resource, the resource identifier of the second resource, and the health indicator of the second resource counted. Of course, the health may also include the call timestamp, the error name of the call error, etc.; for example, when calling between services, the health may include not only the service name identifier, but also the call interface information, service cluster information, etc. In one possible example, the first node may encapsulate the data included in the health in a specified data format, for example, encapsulate the various data included in the health in corresponding fields, and report the encapsulated data to the management node. For example, taking the call between services as an example, the following Table 1 provides encapsulated data of the health reported by the calling service. As shown in the following Table 1, in the encapsulated data of the health, the Service Key field can be encapsulated with a service name identifier, that is, a resource identifier, which can include a resource identifier of a first resource and a resource identifier of a second resource; the Labels field can be encapsulated with call interface information; the Metadata field can be encapsulated with service cluster information; the Ret Code field can be encapsulated with a return result status code, that is, an error code for a call error, which can indicate an error type or an error name; the Ret Status field can be encapsulated with the number of successful calls / failed calls, the Delay field can be encapsulated with a call delay, which can indicate the total duration of the delay; the Time Stamp field can be encapsulated with a timestamp, indicating the time point when the service call occurs. Among them, the first four data items in Table 1 are statistical dimensions, which means that the subsequent management nodes can count the health indicators from each resource according to the statistical dimensions; the fifth and sixth items are health indicators, and the first node can count the number of successful calls, the number of failed calls, the total duration of call delays and other health indicators.
[0100] Table 1
[0101] Fields type describe Service Key Dimensions Service name identifier Labels Dimensions Calling interface information Metadata Dimensions Service cluster information Ret Code Dimensions Return result status code Ret Status index Number of successful calls / number of failed calls Delay index Call Delay Time Stamp Timestamp The time when the service call occurs
[0102] By using the result of the first resource calling the second resource, the health is obtained, thereby obtaining the actual status data of the calling process of the second resource, and then using the data for global statistics, which improves the authenticity and accuracy of the statistics. In addition, based on the target cycle, the health can be generated periodically based on the resource identifier and the health indicator, so as to monitor the calling situation in the recent time in real time, which improves the timeliness and accuracy of health monitoring.
[0103] Step 202: The first node sends the health status to the management node.
[0104] The first node may periodically send to the management node the health of the second resource when it is called by the first resource according to the target period. It should be noted that, among the at least two resources that call the second resource, the nodes where the other resources except the first resource are located also send to the management node the health of the second resource when it is called by the other resources.
[0105] Step 203: The management node receives the health status sent by the first node.
[0106] When the first node periodically sends, the management node receives the health of the second resource sent by the first node according to the target period when the second resource is called by the first resource. In a possible implementation, the management node also obtains the health of other resources other than the first resource when calling the second resource. The process of the management node obtaining the health may include: the management node obtains the health of the second resource when it is called by each of the at least two resources. The health of the second resource when it is called by each resource is used to indicate the ability of the second resource to provide business functions to each resource. In a possible scenario, the health is reported to the management node by the active caller, that is, the node where each of the at least two resources is located sends the health of the second resource when it is called by each resource to the management node, and the management node receives the health of the second resource sent by the node where each of the at least two resources is located; for example, for the first resource of the at least two resources, the health of the second resource can be sent to the management node according to the above steps 201-203, and the management node receives it. In another possible scenario, the called direction reports the health status to the management node; that is, the second node sends the health status when called by each of the at least two resources; the management node receives the health status sent by the second node when called by each resource. The second node records the calling situation in real time when called, and obtains the health status when called by each resource based on the calling result of each call. The process of the second node obtaining the health status based on the calling result can be the same as the above step 201, which will not be repeated here.
[0107] It should be noted that in this application, the health of the second resource when it is called by a single resource can be reported by the calling party or the called party. In the embodiment of this application, the above steps 201-203 are only introduced by taking the way of the first node reporting the health to the management node as an example; of course, the way of the second node reporting can also be adopted to synchronize the health to the management node in real time. The embodiment of this application does not specifically limit who reports the health.
[0108] Step 204: The management node collects statistics on the global health of the second resource based on the health of the second resource when it is called by each of the at least two resources.
[0109] The global health is used to indicate the ability of the second resource to provide business functions to the at least two resources; the management node counts each health indicator in the health according to the health of each resource when calling the second resource within the target period to obtain the global health.
[0110] In one possible implementation, the health includes the resource identifier of each of the at least two resources, the resource identifier of the second resource, and the health index of the second resource when it is called by each resource within the target period; the health index includes: at least one of the number of call errors, the number of call timeouts, the total duration of call delays, the number of successful calls, or the number of target errors of the target type; correspondingly, the global health may include: at least one of the call error rate, the call timeout rate, the total number of call errors, or the target error rate of call errors of the target type when the second resource is called by the at least two resources. The implementation of this step may include at least one of the following four methods.
[0111] In the first way, the management node counts the call error rate of the second resource called by the at least two resources within the target period based on the number of call errors, the number of call successes, the resource identifiers of the at least two resources and the resource identifier of the second resource.
[0112] The management node counts the total number of call errors and the total number of successful calls when the at least two resources call the second resource within the target period according to the resource identifiers of the at least two resources and the resource identifier of the second resource, and uses the ratio between the total number of call errors and the total number of calls as the call error rate corresponding to the second resource within the target period. The total number of calls may be the sum of the total number of call errors and the total number of successful calls. The total number of call errors may be the cumulative sum of the number of call errors corresponding to multiple resources, and the total number of successful calls may be the cumulative sum of the number of successful calls corresponding to multiple resources.
[0113] In a possible example, the management node may use a sliding window algorithm for fast statistics. Taking the use of the sliding window algorithm to count the total number of call errors as an example, the implementation method of using the sliding window algorithm for statistics may include: taking the data that needs to be counted for 1 minute as an example, the number of sliding windows may be 10, and the time slice of each sliding window may be 6 seconds. For example, for the data from 19:59:00 to 20:00:00 reported at 20:00:00, the sliding window content is as follows:
[0114] 19:59:00-19:59:06 Sliding window: 1 error;
[0115] 19:59:06-19:59:12 Sliding window: 1 error;
[0116] 19:59:12-19:59:18 Sliding window: 1 error;
[0117] …
[0118] 19:59:54-20:00:00 sliding window: 1 error; then we can count that the total number of call errors in the one minute from 19:59:00 to 20:00:00 is 10.
[0119] After the data is reported at 20:00:06, it is the data from 19:59:06 to 20:00:06. The sliding window content of the data is as follows:
[0120] 19:59:06-19:59:12 Sliding window: 1 error;
[0121] 19:59:12-19:59:18 Sliding window: 1 error;
[0122] …
[0123] 20:00:00-20:00:06 sliding window: 1 error; then the total number of call errors can be counted as 10. Of course, the cumulative number of this 1 minute is the statistic from 19:59:06 to 20:00:06, which is 10. In the process of two sets of data statistics, in the next set of data statistics, the statistical item "19:59:00-19:59:06: 1 error" will be dropped.
[0124] In the second method, the management node counts the call delay rate of the second resource called by the at least two resources within the target period based on the number of call timeouts, the number of call errors, the number of call successes, the resource identifiers of the at least two resources, and the resource identifier of the second resource.
[0125] The management node counts the total number of call timeouts when the at least two resources call the second resource within the target period according to the resource identifiers of the at least two resources, the resource identifiers of the second resource, and the number of call timeouts, and counts the total number of calls when the at least two resources call the second resource within the target period according to the number of call errors and the number of successful calls, and uses the ratio between the total number of call timeouts and the total number of calls as the call error rate. The total number of call timeouts can be the cumulative sum of the number of call timeouts corresponding to multiple resources. The total number of calls can be the sum obtained by accumulating the number of call errors and the number of successful calls corresponding to multiple resources. For example, service A and service B both call service C, and when service A uses service C, the number of successes is 10 and the number of errors is 2; when service B calls service C, the number of successes is 15 and the number of errors is 1; then the total number of calls is the cumulative sum of the two success numbers and the two error numbers, which is 28. Of course, in a possible example, the total number of calls can also be directly counted by the first node and reported to the management node. This application does not make specific restrictions on this. In another possible example, the management node may also count the average duration of the call delay when the at least two resources call the second resource within the target period, and subsequently send the average duration to the nodes where each resource is located. For example, the first node makes a fuse judgment based on the average duration of the call delay.
[0126] In a third manner, the management node counts the total number of call errors of the second resource being called by the at least two resources within a target period based on the number of call errors, the resource identifiers of the at least two resources, and the resource identifier of the second resource.
[0127] The management node counts the total number of call errors when the at least two resources call the second resource within the target period according to the resource identifiers of the at least two resources, the resource identifier of the second resource, and the number of call errors. The total number of call errors may be the cumulative sum of the number of call errors corresponding to multiple resources.
[0128] The fourth method is that the management node counts the target error rate of call errors of the target type when the second resource is called by the at least two resources within the target period based on the number of call errors, the number of call successes, the target error number, the resource identifiers of the at least two resources, and the resource identifier of the second resource.
[0129] The management node counts the total number of target errors belonging to the target type when the at least two resources call the second resource within the target period according to the resource identifiers of the at least two resources, the resource identifier of the second resource, and the target error number, and uses the ratio between the total number of target errors and the total number of calls as the target error rate of call errors belonging to the target type. The target total number of call errors may be a cumulative sum of target error numbers corresponding to multiple resources. The total number of calls may be a sum obtained by accumulating the number of call errors and the number of successful calls corresponding to multiple resources.
[0130] It should be noted that this step only shows the possible situation that the global call result includes at least one of the above four data. Of course, the global call result may also include other data. For example, the global call result may also include: the total number of successful calls of global calls, the total number of call errors of global calls, the average duration of call delays of global calls, and other data. It may also be sent to the nodes where the resources of each main caller are located. For the data statistics involved in any of the above four methods, the sliding window algorithm can be used for statistics; for example, the sliding window algorithm is used to count the total number of calls, the total number of successful calls, the total number of target errors, etc. The implementation principle is the same as that of counting the total number of call errors, and will not be repeated here.
[0131] By counting the global health of the second resource when it is called by at least two resources based on the health of the second resource when it is called by each resource, it is possible to accurately grasp the calling situation of the second resource when it is called globally, and ensure the accuracy of the subsequent fuse judgment. Moreover, the fuse judgment is made from an overall perspective based on the global call result, which is different from the judgment based on the local call result for a single resource in the related technology. This application greatly shortens the time required for judgment and improves the efficiency of fuse judgment. In addition, it is also possible to periodically count the global health according to the target cycle, so that the global call situation of the second resource can be monitored in real time, ensuring the timeliness of the subsequent fuse judgment and achieving rapid fuse.
[0132] Step 205: The management node sends the global health of the second resource to the first node.
[0133] It should be noted that the management node sends the global health of the second resource to the node where each resource of the at least two resources is located. The at least two resources include the first resource. The global health is sent by the management node so that the node where each resource is located determines whether to perform fuse processing on the second resource based on the call status corresponding to the global health. The management node can periodically send the global health so that each resource can monitor in real time the situation where the second resource is globally called. Taking the first node as an example, the definition node can make a judgment based on the following steps 206-208, and perform fuse processing on the second resource based on step 209.
[0134] Step 206: The first node receives the global health of the second resource sent by the management node.
[0135] It should be noted that, among the at least two resources that call the second resource, the nodes where the other resources except the first resource are located also receive the global health of the second resource sent by the management node.
[0136] In a possible implementation, the global health includes a global call result when the second resource is called by the at least two resources; the first node can perform fuse processing on the second resource based on the global call result through the following steps 207-208.
[0137] like Figure 3 As shown, the management node is located at the management end, the main calling end includes services C1, C2, and C3 as the main calling party, and the called end includes services S1, S2, and S3 as the called party. Figure 3 As shown, the calling service of the calling end can report the health of the called service to the management end, and the management end counts the global health of each called service and pushes the global health to each calling service. For example, when service S3 is in the fuse state, the calling services C2 and C3 that call the service S3 can execute the fuse decision on service S3, that is, perform fuse processing on service S3.
[0138] like Figure 4 As shown, of course, the service in the called end can also report the health of each called service to the management end, and the management end can count the global health of each called service and push the global health to each calling service.
[0139] like Figure 5 As shown, Figure 5 The figure shows the health of each called service reported by services C1, C2, and C3 to the management end, and the process of the management node sending the global health statistics. Figure 5 As shown, the data reported by service C1 includes: "S1: success: 20, Delay: 30ms" and "S2: success: 5, Delay: 40ms", that is, when S1 is called by C1, the number of successful calls is 20, and the total delay time of the call is 30ms; when S2 is called by C1, the number of successful calls is 5, and the total delay time of the call is 40ms.
[0140] The data reported by service C2 include: "S1: success: 25, Delay: 35ms", "S2: success: 10, Delay: 40ms" and "S3: success: 5, fail: 10, Delay: 800ms", that is, when S1 is called by C2, the number of successful calls is 25, and the total call delay is 35ms; when S2 is called by C2, the number of successful calls is 10, and the total call delay is 40ms; when S3 is called by C2, the number of successful calls is 5, the number of call errors is 10, and the total call delay is 800ms.
[0141] The data reported by service C3 includes: "S3: success: 1, fail: 20, Delay, 1000ms", that is, when S3 is called by C3, the number of successful calls is 1, the number of call errors is 20, and the total call delay is 1000ms.
[0142] The management end collects statistics on the data reported by services C1, C2, and C3 to obtain the global health of each called service and sends it to services C1, C2, and C3. The global health obtained by the management end includes: "S1: success: 45, Delay: 33ms", "S2: success: 15, Delay: 40ms", and "S3: success: 6, fail: 30, Delay: 900ms". That is, in the global call results of S1: the number of successful calls is 45, and the average call delay is 33ms; in the global call results of S2: the number of successful calls is 15, and the average call delay is 40ms; in the global call results of S3: the number of successful calls is 6, the total number of call errors is 30, and the average call delay is 900ms. The total number of call errors, call error rate, and average delay duration of service S3 all indicate that S3 has a low ability to provide business functions and needs to have its resources blown. That is, services C1, C2, and C3 blow service S3, thereby interrupting the call to service S3.
[0143] Step 207: When the global call result indicated by the first node in response to the global health meets the target condition, the call state corresponding to the global health is determined to be a blown state.
[0144] The call state is used to indicate the ability of the second resource to provide business functions for the calling party resource when it is currently called. When it is in the fuse state, it means that the ability of the second resource to provide business functions is low and it is no longer suitable to continue to be called, and the call to it needs to be interrupted. The target condition is used to indicate the condition when the fuse state is reached. The first node can judge whether the global call result meets the target condition based on the global call result indicated by the global health; when the global call result meets the target condition, the first node determines that the second resource is in the fuse state; when the global call result does not meet the target condition, it is determined that the second resource has not reached the fuse state. The fuse state refers to the state that needs to be interrupted. In one possible example, the target condition can be: the global call result reaches the fault result threshold of the first resource calling the second resource. That is, when the global call result is the fault result threshold of the fault call, the call state corresponding to the global health is determined to be the fuse state.
[0145] In one possible implementation, the global call result includes at least one of a call error rate, a call timeout rate, a total number of call errors, or a target error rate; accordingly, the implementation of this step may include any one of the following methods 1 to 4.
[0146] Method 1: In response to the call error rate exceeding the first threshold, the first node determines that the call state corresponding to the global health is a blown state.
[0147] When the call error rate exceeds the first threshold, it indicates that the call error probability is high and it is no longer suitable to continue to provide business functions for the first resource. The first node determines that the call state is a fuse state. In addition, when the call error rate does not exceed the first threshold, the first node determines that the call state has not reached the fuse state and is a state that can be called by the first resource.
[0148] Method 2: When the call timeout rate exceeds the second threshold, the first node determines that the call state corresponding to the global health is a blown state.
[0149] When the call timeout rate exceeds the second threshold, it indicates that the probability of call timeout is high, and it is no longer suitable to continue to provide business functions for the first resource, and the first node determines that the call state is a fuse state. In addition, when the call timeout rate does not exceed the second threshold, the first node determines that the call state has not reached the fuse state and is a state that can be called by the first resource.
[0150] Method three: When the total number of call errors exceeds a third threshold, the first node determines that the call state corresponding to the global health is a blown state.
[0151] When the total number of call errors exceeds the third threshold, it means that the call has had many call errors, the error amount is relatively large, and it is no longer suitable to continue to provide business functions for the first resource. The first node determines that the call state is a fuse state. In addition, when the total number of call errors does not exceed the third threshold, the first node determines that the call state has not reached the fuse state and is a state that can be called by the first resource.
[0152] Mode 4: When the target error rate of the call error belonging to the target type exceeds the fourth threshold, the first node determines that the call state corresponding to the global health is a blown state.
[0153] When the target error rate exceeds the fourth threshold, it indicates that the probability of the target type of call error is high, and it is no longer suitable to continue to provide business functions for the first resource, and the first node determines that the call state is a fuse state. In addition, when the target error rate does not exceed the fourth threshold, the first node determines that the call state has not reached the fuse state and is a state that can be called by the first resource.
[0154] In one possible implementation, the first node can use any of the above four methods to judge the call status of the second resource, thereby quickly discovering the fuse status of the second resource based on the global call situation, thereby improving the accuracy and processing efficiency of resource fusing.
[0155] In another possible implementation, the first node may also make a judgment in combination with any two, three or four of the above four methods. For example, the first node may make a judgment in combination with the above methods one and three, and the process of determining that the call state corresponding to the global health is a blown state may include: the first node responds to the call error rate exceeding the first threshold and the total number of call errors exceeding the third threshold, and determines that the call state corresponding to the global health is a blown state. Here, only the combination of method one and method three is taken as an example. Of course, other combinations can also be used for judgment. Based on the implementation methods that are similar to the combination of method one and method three, they are not listed here one by one. The embodiment of the present application does not specifically limit the judgment method of multiple combinations of the above four methods, and any combination of the above four methods is within the protection scope of the present application.
[0156] In a possible implementation, the management node can also determine the weight of each called party resource based on the global health of each called party resource, and send the weight of each called party resource to each calling party resource. The process may include: the management node determines the weight of each resource in the second resource and at least one adjacent resource according to the global health of the second resource and the global health of at least one adjacent resource that overlaps with the business function of the second resource, the management node sends the weight of each resource in the second resource and at least one adjacent resource to the first node, the first node receives the weight of each resource sent by the management node, and updates the routing rules according to the weight of each resource in the second resource and at least one adjacent resource. Among them, the higher the ability to provide business functions indicated by the global health of each resource, the higher the weight of the resource. For example, according to the weight, the calling priority of the second resource and at least one adjacent resource is adjusted accordingly; for example, the higher the weight, the higher the calling priority.
[0157] By judging the call status of the second resource based on the global call result, the fuse status of the second resource can be accurately and timely judged from the global call situation; and, using the target condition as the basis for judgment, the second resource is determined to be in the fuse state only when the global call result meets the target condition, thereby clearly defining the judgment conditions for whether the fuse is blown, and improving the accuracy of the judgment of the fuse status. In addition, it is also possible to further refine the judgment based on multiple angles such as the call error rate, call delay rate, total number of call errors or target error rate based on one or more data included in the global call result, thereby expanding the scope of application of the resource fuse method in this application, or judging based on a combination of multiple methods in the above four methods, thereby further improving the accuracy of the fuse status judgment when the resource is blown, and improving the reliability and applicability of the resource fuse method.
[0158] Step 208: The first node performs a fuse process on the second resource.
[0159] The first node interrupts the call to the second resource and switches to call a third resource whose corresponding call status is a healthy state. The first node interrupts the calling process of the first resource to the second resource, that is, stops sending a call request to the second resource, and selects a healthy third resource from multiple called resources to call the third resource. Exemplarily, the called resource refers to a resource that can be called by the first resource to provide a business function. The called resource can be any resource in a service, interface, instance, or instance group for providing a business function.
[0160] In one possible implementation, suitable resources can be screened based on the routing rules of the first resource. Accordingly, the process of the first node fusing the second resource may include: the first node interrupts the call to the second resource; when the first node responds to the successful interruption of the call to the second resource, according to the routing rules of the first resource, a third resource with a corresponding call status of a healthy state is selected from the adjacent resources located within the target area of the second resource, and the first node calls the third resource. The routing rule is used to indicate at least one adjacent resource that overlaps with the business function provided by the second resource. Exemplarily, the routing rule may include multiple adjacent resources that can be called and the call priority of each adjacent resource. When the call to the second resource is interrupted, the first node can select the third resource with the highest call priority from multiple adjacent resources in a healthy state according to the call status and call priority of each adjacent resource. Among them, when the calling path between the third resource and the first resource is long, a long connection method can be used for calling. The process of the first node calling the third resource may include: when the third resource and the first resource are located in different cities, a long connection is established between the first node and the node where the third resource is located, and based on the long connection, the first resource calls the third resource.
[0161] It should be noted that when the first node fails to find a resource in a healthy state, the first node does not interrupt the first resource's call to the second resource. That is, when the first node fails to find other resources in a healthy state, it fails to successfully switch to the third resource in a healthy state. At this time, the first resource continues to call the second resource.
[0162] like Figure 6 As shown, the routing rule can be Figure 6 As shown, the priority route is to service SET01, and its corresponding call priority is 0; the backup route is to SET51, and its corresponding call priority is 1. The system is configured so that 0 takes precedence over 1, that is, SET01 has a higher call priority than SET51. Among them, SET51 is an adjacent resource that serves as a backup for SET01.
[0163] By interrupting the call to the second resource, the resource in the fuse state is effectively isolated to avoid the impact of the second resource on the overall operation of the first resource; and by switching to call the third resource in a healthy state, it is ensured that there are still suitable resources for the first resource to call, which ensures the smooth execution of the first resource's business and improves the success rate of the first resource's business. Furthermore, through routing rules, adjacent resources can be selected for calling, which can reduce the time spent on the call path as much as possible, ensure a rapid response to the first resource's business, further reduce the time consumed in the fuse processing process, and improve the processing efficiency of resource fuse.
[0164] It should be noted that the above steps 207-208 are a possible implementation of the step "when the call state corresponding to the global health is in the blown state, the second resource is blown". The above steps 207-208 first determine whether the global call result meets the target condition, and only when the global call result meets the target condition, determine that the second resource is in the blown state, and then perform the blown process. In another possible implementation, it is also possible to make a comprehensive judgment by counting the health of each resource when calling the second resource. For example, when the call state corresponding to the global health is in the blown state, the step of blowing the second resource may also include: the first node determines whether each health meets the blown condition, and counts the number of healths that meet the blown condition among multiple healths; when the ratio between the number of healths that meet the blown condition and the total number of multiple healths exceeds the target ratio, it is determined that the call state corresponding to the global health is in the blown state, and the second resource is blown. Among them, one implementation method for judging whether the health degree meets the fuse condition can be: judging the ratio of the number of call errors of the first resource calling the second resource within the target period to the total number of period calls within the target period, and when the ratio exceeds the target ratio, it is determined that the health degree meets the fuse condition. Of course, the judgment can also be based on the number of call timeouts, the number of call errors, or the target number of errors. Here, only the ratio of the number of call errors is used as an example, but the specific judgment method is not limited.
[0165] In a possible implementation, the call state of the second resource may include: a fuse state, a hold state, and a health state. When executing the above step 207, when the global call result meets the hold condition, the first node determines that the call state corresponding to the global health is the hold state; when the global call result meets the health condition, the first node determines that the health state corresponding to the global health is the hold state. Accordingly, steps 207-208 can also be replaced by the following step A or the following step B.
[0166] Step A: When the call state corresponding to the global health is a hold state, the first node performs a hold process on the second resource.
[0167] The hold state may be an intermediate state between the healthy state and the blown state. When in the hold state, the ability of the second resource to provide business functions is not lower than the ability of the blown state, but is also not higher than the ability of the healthy state. At this time, the second resource can continue to provide business functions for a part of the resources and is no longer suitable for disaster recovery calls, that is, it is called as a backup for other resources. For example, the hold process may be a process of continuing to hold the direct call to the second resource and interrupting the call to the second resource that is a backup call type. Among them, the backup call refers to the situation where the first resource switches from the target resource to call the second resource, and the second resource is called by the first resource as a backup of the target resource. The direct call is a call other than the backup call. Exemplarily, the first resource directly calls the second resource as follows: the first resource directly selects the second resource with the highest call priority based on the routing rules for calling. Correspondingly, the maintenance processing of step A may include: when the resources indicated by the routing rule of the first resource include any resource with a higher calling priority than the second resource, the first node interrupts the call to the second resource and switches to calling the fourth resource whose corresponding calling status is a healthy status; when the calling priority of the second resource is higher than any resource indicated by the routing rule, the first node continues to call the second resource. Among them, when there is any resource whose calling priority is higher than the calling priority of the second resource among the resources indicated by the routing rule, it means that the second resource is called by the first resource as a backup of the target resource, and the call of the first resource to the second resource is a backup call, and the call can be interrupted. When the calling priority of the second resource is higher than any resource indicated by the routing rule, it means that the first resource directly calls the second resource and the call can continue to be maintained.
[0168] In a possible implementation, similar to the four methods of determining the fuse state in step 207, it is also possible to determine whether the hold state is reached based on one or more data included in the global call result. That is, when executing method 1 of step 207, it is also possible to execute: when the call error rate exceeds the fifth threshold but does not exceed the first threshold, determine that the call state corresponding to the global health is the hold state; wherein the fifth threshold is less than the first threshold.
[0169] When executing the second method of the above step 207, you can also execute: when the call timeout rate exceeds the sixth threshold but does not exceed the second threshold, determine that the call state corresponding to the global health is a hold state; wherein the sixth threshold is less than the second threshold.
[0170] When executing method three of step 207 above, the following may also be performed: when the total number of call errors exceeds the seventh threshold but does not exceed the third threshold, determining that the call state corresponding to the global health is a hold state; wherein the seventh threshold is less than the third threshold.
[0171] When executing method 4 of step 207 above, the following may also be performed: when the target error rate of the call error belonging to the target type exceeds the eighth threshold but does not exceed the fourth threshold, determining that the call state corresponding to the global health is a hold state; wherein the eighth threshold is less than the fourth threshold.
[0172] Of course, a comprehensive judgment can also be made by combining the various data included in all the call results. The process of combining two or more methods for judgment is the same as the above step 207 and will not be repeated here.
[0173] like Figure 7 As shown, Figure 7 A circuit breaker configuration is shown, Figure 7 From the Chinese annotations, it can be seen that the judgment can be based on the global error number, that is, the total number of call errors of the global call, rather than the error number of a single caller node; in addition, the first threshold value can be 20%, and the fifth threshold value can be 10%, that is, the call error rate exceeds 10% and it is a hold state, and the call error rate exceeds 20% and it is a blown state; the second threshold value can be 30%, and the sixth threshold value can be 10%, that is, the call timeout rate exceeds 10% and it is a hold state, and the call timeout rate exceeds 30% and it is a blown state.
[0174] Step B: When the calling state corresponding to the global health is a healthy state, the first node continues to call the second resource.
[0175] When the call status of the second resource is in a healthy state, the second resource can continue to be called. Similar to the four methods of judging the fuse status in step 207, it is also possible to judge whether a healthy state is reached based on one or more data included in the global call result. Exemplarily, the judgment conditions include but are not limited to: the call error rate does not exceed the fifth threshold, the call timeout rate does not exceed the sixth threshold, the total number of call errors does not exceed the seventh threshold, and the target error rate of call errors belonging to the target type does not exceed the eighth threshold.
[0176] By judging whether the call status is a hold status or a healthy status based on the global health, corresponding operations are performed based on the hold status or the healthy status, thereby further improving the accuracy of resource calls. Even if the call status does not belong to the blown status, the current call status can be accurately judged, so that relevant operations can be accurately performed on the call process based on the status, thereby improving the reliability of resource blown.
[0177] It should be noted that the embodiment of the present application does not specifically limit the execution order between the above steps 207-208 and the above steps A and B, and they can be executed simultaneously or in a specified order. For example, when executing step 207, it can be determined whether the call state is in the fuse state, the hold state or the healthy state, and based on the determined state, the process of executing step 208, step A or step B is performed accordingly. For another example, step 207 can be executed first. If it is determined based on step 207 that the call state is the fuse state, step 208 is executed directly; if it is determined based on step 207 that the call state is not the fuse state, it can continue to determine whether it belongs to the hold state based on step A. If it is the hold state, the hold processing step in step A is directly executed; if it is not the hold state, the operation corresponding to the healthy state in step B is directly executed.
[0178] Another point that needs to be explained is that when multiple resources call each other, the node where the resources of the caller are located and the management node can periodically execute the above steps 201-208, so that the resources of the caller can monitor in real time the situation of the global calls of the resources of the called party, so as to accurately and quickly judge the circuit breaker requirements and then perform circuit breaker processing on the resources of the called party.
[0179] like Figure 8 As shown, the main calling end service process of the first node can be configured with a decoding module, a routing module and a fuse module, and each module executes the above steps accordingly. For example, when a client request (Client Request) is received, the decoding module can decode the client request to obtain the bank card number segment information in the request, and the routing module routes different requests to different called end services based on the bank card number segment information, and the fuse module obtains and reports the health data of the called end service in real time. After receiving the reported data, the management end summarizes and counts the data, and pushes the statistical global health data to the fuse module. The fuse module executes the fuse decision based on the global health, and can also feedback the fuse result to the routing module after the fuse is blown, and the routing module executes the fuse switch to switch to call the healthy state of the resource.
[0180] like Fig. 9 As shown, Fig. 9A possible scenario architecture of resource fusing is shown. For ticket purchase services when taking public transportation, the global server load balance (GSLB) can push the service request from the client to each gateway, and then push it to each gateway interface CGI (Common Gateway Interface) through the gateway. The service request includes the user data submitted by the user when purchasing the ticket, such as bank card number segment information, geographical area, etc. Each gateway interface CGI can call the query interface that provides user data in the SET service based on the routing rules, and use the query interface to perform related query operations based on the user data, for example, query the SET service matching the user based on the user's bank card number segment information; then, after the SET service, the corresponding front-end is called based on the routing rules, and the corresponding front-end is forwarded to the deduction interface, such as the deduction interface of UnionPay, and the deduction interface is used to deduct the fee, thereby ensuring that the user purchases the ticket successfully. Among them, the management service provided by the management node of the present application can call different SET interfaces based on the routing rules in CGI according to the business requests of different bank card numbers. For example, the first three digits of the bank card numbers in different cities are different. The CGI routes the business requests of different bank card numbers to the SET of the city corresponding to the bank card number based on the routing rules. For example, the business request of the bank card number in City A is routed to the SET service in City A to reduce the calling path and improve the calling efficiency. Among them, the management service of the management end can automatically remove and switch when calling, for example, using resource fuse, automatically remove unavailable services and switch to call services in healthy status; CGI is configured with routing rules, and routing can be performed based on the routing rules. In addition, when calling the front-end again through SET, the global health data of the management end can be used to monitor the calling status of each front-end to remove the faulty machine, and support the resources of the called party through fuse processing, maintenance processing, etc., that is, to protect the front-end; of course, the weight of each called party's resources can also be divided based on the global health to ensure the load balancing of the system and improve the business success rate and processing efficiency.
[0181] Two comparative examples are provided below to compare the execution results of the resource fuse method of the present application with the execution results of the related technology to reflect the effect achieved by the resource fuse method of the present application.
[0182] Example 1: For a business with low single-machine traffic, in the related technology, the failure lasts for 5 minutes before the circuit breaker is performed. After the resource circuit breaker method in this application is used for technical optimization, the circuit breaker can be performed immediately.
[0183] Scenario: The called service has 2 instances, one of which has an exception. The calling service has 3 instances; the calling service sends call requests to the called service 16 times a minute. Fig.10The figure shows the statistical result of the number of failed requests when the resource is fused in the related art. When the solution of the present application is not adopted, the number of failed requests lasts for 5 minutes. Fig.11 This is the test statistics after using the resource fuse method in this application, which is the statistical result of the number of failed requests when the resource fuse is used, such as Fig.11 As shown, after using the resource fusing method in the present application, the fusing is performed at the time when the failure first occurs, and there is no need to wait for a short time before the fusing is performed, thereby greatly shortening the fusing time.
[0184] Example 2: For the call of the calling party's service that stores the call status of the called party's service, when the entire called service is close to overload and some instances are overloaded, the overall error rate in the related technology rises from 18% to 30%. After optimization using the resource fuse method of this application, the error rate is maintained at 15% to 16% and will not rise.
[0185] Scenario: The called service has 2 instances, one of which is abnormal and the other is overloaded, and the calling service has 3 instances. Fig.12 In the related technology shown, the failure rate statistics when the resource is blown, 18% of the requests will fail. The frequency of the main service sending call requests to the called service is 16 / minute; Fig.13 The test statistics after using the resource fuse method in this application are the statistics of the failure rate when the resource fuse is used, such as Fig.13 As shown, after optimization using the resource fuse method in this application, the failure rate is stabilized at around 15% in the same scenario.
[0186] The resource fusing method provided by the present application, for any resource of at least two resources that call the second resource, in accordance with the resource fusing process of the first resource, specifically reports the health of the second resource when it is called by the first resource to the management node, so that the management node can calculate the global health based on the health of the second resource when it is called by each resource and send it to each main caller in time, so that the main caller can accurately know the situation of the second resource being called globally based on the global health, so that the calling state of the second resource can be accurately grasped from an overall perspective; compared with the technology of fusing a single resource based on its own calling situation, the present application performs fusing by accurately grasping the global situation, which not only greatly shortens the fusing time, but also improves the accuracy of judging whether to fuse. Moreover, different global healths correspond to different calling states, and only when the calling state corresponding to the global health is a fusing state, the fusing process is performed, further improving the accuracy of resource fusing; even if the single business traffic is small, it can respond quickly based on the global health, improving the accuracy and processing efficiency of resource fusing.
[0187] In addition, the call status is judged based on the global call result, and based on one or more data included in the global call result, the judgment is refined based on multiple angles such as call error rate, call delay rate, total number of call errors or target error rate, thereby further improving the accuracy of the judgment of the circuit breaking status when the resource is blown, and improving the reliability and applicability of the resource circuit breaking method.
[0188] Moreover, by interrupting the call to the second resource and switching to calling a healthy third resource, the success rate of the first resource's business is guaranteed. Adjacent adjacent resources can also be selected for calling. Even if the call to the second resource is interrupted, the adjacent resources can respond quickly to the first resource's business, further reducing the time consumed by the fuse processing process, improving the processing efficiency of resource fuses, and improving the success rate of business.
[0189] Fig.14 A schematic diagram of the structure of a resource fuse device provided in an embodiment of the present application. The device is executed by a first node where a first resource is located; Fig.14 As shown, the device comprises:
[0190] The acquisition module 1401 is used to acquire the health of the second resource when it is called by the first resource based on the result of the first resource calling the second resource;
[0191] A sending module 1402 is used to send the health status to the management node;
[0192] A receiving module 1403 is used to receive the global health of the second resource sent by the management node, where the global health is used to indicate the ability of the second resource to provide business functions to at least two resources;
[0193] A fusing module 1404, configured to perform fusing processing on the second resource in response to a call state corresponding to the global health being a fusing state;
[0194] The health status is used to indicate the ability of the second resource to provide business functions to the first resource, the first resource is any one of at least two resources that call the second resource, and the second resource refers to any one of the services, interfaces, instances or instance groups that provide business functions.
[0195] In a possible implementation, the global health includes a global call result when the second resource is called by the at least two resources;
[0196] The fuse module 1404 includes:
[0197] A determination unit, configured to determine, in response to a global call result indicated by the global health degree meeting a target condition, that a call state corresponding to the global health degree is a fuse state;
[0198] The fuse unit is used to interrupt the call of the second resource and switch to calling the third resource whose corresponding call status is a healthy state.
[0199] In a possible implementation, the global call result includes: at least one of a call error rate, a call timeout rate, a total number of call errors, or a target error rate of call errors belonging to a target type when the second resource is called by the at least two resources;
[0200] The determination unit is used for any of the following:
[0201] In response to the call error rate exceeding a first threshold, determining that the call state corresponding to the global health is a fuse state;
[0202] In response to the call timeout rate exceeding the second threshold, determining that the call state corresponding to the global health is a fuse state;
[0203] In response to the total number of call errors exceeding a third threshold, determining that the call state corresponding to the global health is a blown state;
[0204] In response to a target error rate of call errors belonging to the target type exceeding a fourth threshold, determining that the call state corresponding to the global health is a blown state.
[0205] In one possible implementation, the fuse unit is used to interrupt the call to the second resource; in response to a successful interruption of the call to the second resource, according to the routing rule of the first resource, a third resource whose corresponding call status is a healthy state is selected from the adjacent resources located within the target area of the second resource, and the third resource is called, and the routing rule is used to indicate at least one adjacent resource that overlaps with the business function provided by the second resource.
[0206] In a possible implementation, the device further includes:
[0207] A maintaining module, configured to perform a maintaining process on the second resource in response to a call state corresponding to the global health being a maintaining state;
[0208] The healthy calling module is used to continue calling the second resource in response to the calling state corresponding to the global health being a healthy state.
[0209] In one possible implementation, the maintenance module is used to interrupt the call to the second resource and switch to calling a fourth resource whose corresponding call status is a healthy state when the resources indicated by the routing rule of the first resource include any resource whose calling priority is higher than that of the second resource; and continue to call the second resource when the calling priority of the second resource is higher than that of any resource indicated by the routing rule.
[0210] In one possible implementation, the acquisition module 1401 is used to receive at least one call result returned by the second node where the second resource is located for each target cycle based on at least one call request sent to the second node where the second resource is located within the target cycle; based on the at least one call result, count the health index of the second resource when it is called by the first resource within the target cycle; and generate the health of the second resource when it is called by the first resource within the target cycle based on the resource identifier of the first resource, the resource identifier of the second resource and the counted health index of the second resource.
[0211] In one possible implementation, the call result includes: whether the call is erroneous, the call delay, or at least one of the error types of the call error; the health indicator includes: the number of call errors, the number of call timeouts, the total duration of the call delay, the number of successful calls, or at least one of the target errors of the target type.
[0212] The resource fusing method provided by the present application, for any resource of at least two resources that call the second resource, in accordance with the resource fusing process of the first resource, specifically reports the health of the second resource when it is called by the first resource to the management node, so that the management node can calculate the global health based on the health of the second resource when it is called by each resource and send it to each main caller in time, so that the main caller can accurately know the situation of the second resource being called globally based on the global health, so that the calling state of the second resource can be accurately grasped from an overall perspective; compared with the technology of fusing a single resource based on its own calling situation, the present application performs fusing by accurately grasping the global situation, which not only greatly shortens the fusing time, but also improves the accuracy of judging whether to fuse. Moreover, different global healths correspond to different calling states, and only when the calling state corresponding to the global health is a fusing state, the fusing process is performed, further improving the accuracy of resource fusing; even if the single business traffic is small, it can respond quickly based on the global health, improving the accuracy and processing efficiency of resource fusing.
[0213] In addition, the call status is judged based on the global call result, and based on one or more data included in the global call result, the judgment is refined based on multiple angles such as call error rate, call delay rate, total number of call errors or target error rate, thereby further improving the accuracy of the judgment of the circuit breaking status when the resource is blown, and improving the reliability and applicability of the resource circuit breaking method.
[0214] Moreover, by interrupting the call to the second resource and switching to calling a healthy third resource, the success rate of the first resource's business is guaranteed. Adjacent adjacent resources can also be selected for calling. Even if the call to the second resource is interrupted, the adjacent resources can respond quickly to the first resource's business, further reducing the time consumed by the fuse processing process, improving the processing efficiency of resource fuses, and improving the success rate of business.
[0215] Fig.15 A schematic diagram of the structure of a resource fuse device provided in an embodiment of the present application. The device is executed by a management node; Fig.15 As shown, the device comprises:
[0216] An acquisition module 1501 is used to acquire the health of the second resource when it is called by each of the at least two resources;
[0217] A statistics module 1502, configured to count the global health of the second resource based on the health of the second resource when it is called by each of the at least two resources, where the global health is used to indicate the ability of the second resource to provide business functions to the at least two resources;
[0218] The sending module 1503 is used to send the global health of the second resource to the node where each resource of the at least two resources is located, so that the node where each resource is located determines whether to perform fuse processing on the second resource based on the call state corresponding to the global health;
[0219] The health status is used to indicate the ability of the second resource to provide business functions to any one of the at least two resources, where the at least two resources include the first resource, and the second resource refers to any one of the services, interfaces, instances or instance groups that provide business functions.
[0220] In a possible implementation, the health includes a resource identifier of each of the at least two resources, a resource identifier of the second resource, and a health indicator of the second resource when called by each resource within a target period; the health indicator includes at least one of the number of call errors, the number of call timeouts, the total duration of call delays, the number of successful calls, or the number of target errors belonging to a target type;
[0221] The statistics module 1502 is used for at least one of the following:
[0222] Based on the number of call errors, the number of call successes, the resource identifiers of the at least two resources, and the resource identifier of the second resource, counting a call error rate of the second resource called by the at least two resources within a target period;
[0223] Based on the number of call timeouts, the number of call errors, the number of call successes, the resource identifiers of the at least two resources, and the resource identifier of the second resource, counting a call delay rate of the second resource called by the at least two resources within a target period;
[0224] Based on the number of call errors, the resource identifiers of the at least two resources, and the resource identifier of the second resource, counting a total number of call errors of the second resource being called by the at least two resources within a target period;
[0225] Based on the number of call errors, the number of call successes, the target number of errors, the resource identifiers of the at least two resources and the resource identifier of the second resource, a target error rate of call errors of the target type when the second resource is called by the at least two resources within a target period is counted.
[0226] In a possible implementation, the acquisition module 1501 is used for at least one of the following:
[0227] Receiving the health of a second resource sent by a node where each resource of the at least two resources is located;
[0228] Receive the health status of each resource when called, which is sent by the second node where the second resource is located.
[0229] The resource fuse method provided by the present application is that the management node calculates the global health status based on the health status of the second resource reported by each resource when it is called, and sends it to each main caller in a timely manner, so that the main caller can accurately know the situation of the second resource being called globally based on the global health status, and thus can accurately grasp the calling status of the second resource from an overall perspective; compared with the technology of fusing a single resource based on its own calling situation, the present application performs fuse based on the accurate grasp of the global situation, which not only greatly shortens the fuse time, but also improves the accuracy of judging whether to fuse; even if the single business traffic is small, it can respond quickly based on the global health status, thereby improving the accuracy and processing efficiency of resource fuses.
[0230] The resource fuse device of this embodiment can execute the resource fuse method shown in the above embodiments of the present application. The implementation principle is similar and will not be repeated here.
[0231] Fig.16 1 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.16As shown, the computer device includes: a memory and a processor; at least one program, stored in the memory, for being executed by the processor, compared with the prior art, it can be realized: for any resource of at least two resources that call the second resource, according to the resource fuse process of the first resource, specifically by reporting the health of the second resource when it is called by the first resource to the management node, so that the management node can be based on the health of the second resource when it is called by each resource, the global health is counted and sent to each main caller in time, so that the main caller can accurately know the situation of the second resource being called globally based on the global health, so that the calling state of the second resource can be accurately grasped from an overall perspective; compared with the technology of single resource fuse based on each call situation, the present application fuses by accurately grasping the global situation, which not only greatly shortens the fuse time, but also improves the accuracy of judging whether to fuse. In addition, different global healths correspond to different call states, and only when the call state corresponding to the global health is a fuse state, the fuse processing is performed, further improving the accuracy of resource fuse; even if the single business traffic is small, it can respond quickly based on the global health, improving the accuracy and processing efficiency of resource fuse.
[0232] In an alternative embodiment, a computer device is provided, such as Fig.16 As shown, Fig.16 The computer device 1600 shown includes: a processor 1601 and a memory 1603. The processor 1601 and the memory 1603 are connected, such as through a bus 1602. Optionally, the computer device 1600 may also include a transceiver 1604, which may be used for data interaction between the computer device and other computer devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 1604 is not limited to one, and the structure of the computer device 1600 does not constitute a limitation on the embodiments of the present application.
[0233] Processor 1601 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 1601 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0234] The bus 1602 may include a path to transmit information between the above components. The bus 1602 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 1602 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0235] The memory 1603 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0236] The memory 1603 is used to store the application code (computer program) for executing the solution of the present application, and the execution is controlled by the processor 1601. The processor 1601 is used to execute the application code stored in the memory 1603 to implement the contents shown in the above method embodiment.
[0237] Among them, computer equipment includes but is not limited to: servers, service clusters, virtual machines built using virtual machine technology, container spaces built using containerization technology, etc.
[0238] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content of the resource fuse method in the aforementioned method embodiment.
[0239] The embodiment of the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above-mentioned resource fuse method.
[0240] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0241] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A resource fusing method, characterized in that: The method is performed by a first node where a first resource is located, and the method includes: For each target period, based on at least one call request sent to the second node where the second resource is located within the target period, receiving at least one call result returned by the second node; Based on the at least one calling result, counting a health indicator of the second resource when it is called by the first resource within the target period; Generate, according to the resource identifier of the first resource, the resource identifier of the second resource and the counted health indicator of the second resource, the health of the second resource when it is called by the first resource within the target period; Sending the health status to a management node; receiving a global health of the second resource sent by the management node, where the global health is used to indicate an ability of the second resource to provide business functions to at least two resources; In response to the call state corresponding to the global health being a fuse state, performing fuse processing on the second resource; The health level is used to indicate the ability of the second resource to provide a business function to the first resource, the first resource is any one of at least two resources that call the second resource, and the second resource is any one of the following resources: Resources that provide services for business functions; Resources that provide interfaces for business functions; Resources that provide instances of business functions; A resource that provides a grouping of instances of a business function.
2. The resource fuse method according to claim 1, characterized in that: The global health includes a global call result when the second resource is called by the at least two resources; When the call state corresponding to the global health is in a fuse state, performing fuse processing on the second resource includes: In response to the global call result indicated by the global health degree meeting the target condition, determining that the call state corresponding to the global health degree is a fuse state; The call to the second resource is interrupted, and the call is switched to a third resource whose corresponding call status is a healthy status.
3. The resource fuse method according to claim 2, characterized in that: The global call result includes at least one of the following: a calling error rate when the second resource is called by the at least two resources; a call timeout rate when the second resource is called by the at least two resources; a total number of calling errors when the second resource is called by the at least two resources; a target error rate of calling errors when the second resource is called by a resource of the target type among the at least two resources; When the global call result in response to the global health indication meets the target condition, determining that the call state corresponding to the global health is a fuse state includes any of the following: In response to the call error rate exceeding a first threshold, determining that the call state corresponding to the global health is a fuse state; In response to the call timeout rate exceeding a second threshold, determining that the call state corresponding to the global health is a fuse state; In response to the total number of call errors exceeding a third threshold, determining that the call state corresponding to the global health is a blown state; In response to the target error rate exceeding a fourth threshold, determining that the call state corresponding to the global health is a blown state.
4. The resource fuse method according to claim 2, characterized in that: The interruption of calling the second resource and switching to calling the third resource whose corresponding calling state is a healthy state includes: Interrupt calling the second resource; In response to a successful interruption of the call to the second resource, according to the routing rule of the first resource, a third resource whose corresponding call status is a healthy state is selected from the adjacent resources located within the target area of the second resource, and the third resource is called. The routing rule is used to indicate at least one adjacent resource that overlaps with the business function provided by the second resource.
5. A resource fusing method, characterized in that: The method is performed by a management node, and includes: Obtaining the health of the second resource when it is called by each of the at least two resources; Based on the health of the second resource when being called by each of the at least two resources, calculating a global health of the second resource, where the global health is used to indicate an ability of the second resource to provide business functions to the at least two resources; Sending the global health of the second resource to each node where the at least two resources are located, respectively, so that the node where each resource is located determines whether to perform fuse processing on the second resource based on the call state corresponding to the global health; The health level is used to indicate the ability of the second resource to provide a business function to any one of the at least two resources, the at least two resources include the first resource, and the second resource refers to any one of the following resources: Resources that provide services for business functions; Resources that provide interfaces for business functions; Resources that provide instances of business functions; Resources that provide instance groupings of business functions; Among them, the health status includes the resource identifier of each of the at least two resources, the resource identifier of the second resource, and the health status index of the second resource when called by each resource within the target period; the health status index is obtained by counting at least one calling result of each resource calling the second resource within the target period.
6. A resource fuse device, characterized in that: The device is deployed in a first node where a first resource is located, and the device includes: An acquisition module is used to receive, for each target period, at least one call result returned by the second node based on at least one call request sent to the second node where the second resource is located within the target period; based on the at least one call result, count the health index of the second resource when it is called by the first resource within the target period; generate the health of the second resource when it is called by the first resource within the target period according to the resource identifier of the first resource, the resource identifier of the second resource and the counted health index of the second resource; A sending module, used for sending the health status to the management node; A receiving module, configured to receive the global health of the second resource sent by the management node, where the global health is used to indicate the ability of the second resource to provide business functions to at least two resources; A fusing module, configured to perform fusing processing on the second resource in response to a call state corresponding to the global health being a fusing state; The health level is used to indicate the ability of the second resource to provide a business function to the first resource, the first resource is any one of at least two resources that call the second resource, and the second resource is any one of the following resources: Resources that provide services for business functions; Resources that provide interfaces for business functions; Resources that provide instances of business functions; A resource that provides a grouping of instances of a business function.
7. The resource fuse device according to claim 6, characterized in that: The global health includes a global call result when the second resource is called by the at least two resources; The fuse module is used for: In response to the global call result indicated by the global health degree meeting the target condition, determining that the call state corresponding to the global health degree is a fuse state; The call to the second resource is interrupted, and the call is switched to a third resource whose corresponding call status is a healthy status.
8. The resource fuse device according to claim 7, characterized in that: The global call result includes at least one of the following: a calling error rate when the second resource is called by the at least two resources; a call timeout rate when the second resource is called by the at least two resources; a total number of calling errors when the second resource is called by the at least two resources; a target error rate of calling errors when the second resource is called by a resource of the target type among the at least two resources; When the global call result in response to the global health indication meets the target condition, determining that the call state corresponding to the global health is a fuse state includes any of the following: In response to the call error rate exceeding a first threshold, determining that the call state corresponding to the global health is a fuse state; In response to the call timeout rate exceeding a second threshold, determining that the call state corresponding to the global health is a fuse state; In response to the total number of call errors exceeding a third threshold, determining that the call state corresponding to the global health is a blown state; In response to the target error rate exceeding a fourth threshold, determining that the call state corresponding to the global health is a blown state.
9. The resource fuse device according to claim 7, characterized in that: The fuse module is used for: Interrupt calling the second resource; In response to a successful interruption of the call to the second resource, according to the routing rule of the first resource, a third resource whose corresponding call status is a healthy state is selected from the adjacent resources located within the target area of the second resource, and the third resource is called. The routing rule is used to indicate at least one adjacent resource that overlaps with the business function provided by the second resource.
10. A resource fuse device, characterized in that: The device is deployed in a management node, and includes: An acquisition module, used to acquire the health of the second resource when it is called by each of the at least two resources; a statistics module, configured to count the global health of the second resource based on the health of the second resource when it is called by each of the at least two resources, wherein the global health is used to indicate the ability of the second resource to provide business functions to the at least two resources; A sending module, used for sending the global health of the second resource to each node where the at least two resources are located, so that the node where each resource is located determines whether to perform fuse processing on the second resource based on the call state corresponding to the global health; The health level is used to indicate the ability of the second resource to provide a business function to any one of the at least two resources, and the at least two resources are any one of the following resources: Resources that provide services for business functions; Resources that provide interfaces for business functions; Resources that provide instances of business functions; Resources that provide instance groupings of business functions; Among them, the health status includes the resource identifier of each of the at least two resources, the resource identifier of the second resource, and the health status index of the second resource when called by each resource within the target period; the health status index is obtained by counting at least one calling result of each resource calling the second resource within the target period.
11. A computer device, characterized in that: The computer device comprises: one or more processors; Memory; One or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and the one or more computer programs are configured to: execute the resource fuse method according to any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer instructions. When the computer instructions are executed on a computer, the computer can execute the resource fuse method described in any one of claims 1 to 5.
Citation Information
Patent Citations
Micro-service architecture, micro-service node and fusing recovery method and device thereof
CN109976935A
System micro-servitization transformation method, device and equipment and storage medium
CN111953735A