Service invocation methods, nodes, networks, devices, media, and products
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2024-12-17
- Publication Date
- 2026-07-21
AI Technical Summary
In distributed systems, it is difficult to flexibly specify the service node located downstream of the call chain, resulting in low development and testing efficiency and difficulty in controlling the distribution ratio of traffic among service nodes.
Custom routing is implemented through the configuration center. Based on the service information, the attribute information of the service node is obtained from the service registry. The target service node is determined from multiple service nodes by using the attribute information filtering rules and monitoring indicator filtering rules, and traffic is distributed through the load balancing strategy.
It simplifies the development and testing environment deployment of distributed systems, improves development and testing efficiency, enables dynamic and flexible allocation of traffic among service nodes, and reduces the workload of operation and maintenance.
Smart Images

Figure CN119966988B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the fields of distributed technology and fintech, and specifically to a service invocation method, a node, a distributed node network, a device, a medium, and a program product. Background Technology
[0002] In a distributed system, a service typically has multiple service nodes to provide the service. Each time a service is invoked, the distributed system automatically selects a service node to provide the service. If the service is located at the beginning of the call chain, developers or testers can directly specify the service node to provide the service.
[0003] However, in the process of realizing the inventive concept disclosed herein, the inventors discovered that when the service is located at a service node downstream of the starting point of the call chain, it is difficult to determine a suitable service node. Summary of the Invention
[0004] In view of the above problems, this disclosure provides a service invocation method, node, distributed node network, device, medium and program product.
[0005] According to a first aspect of this disclosure, a service invocation method is provided, comprising: in response to receiving an invocation instruction carrying service information, obtaining attribute information of N service nodes from a service registry, where N is an integer greater than 1; determining a target routing rule from M pre-stored routing rules based on the service information, where M is an integer greater than 1; determining a first target service node from the N service nodes based on the target routing rule and the attribute information of the N service nodes; and invoking the first target service node to process the service information.
[0006] According to embodiments of this disclosure, the target routing rule includes attribute information filtering rules and monitoring indicator filtering rules; determining a first target service node from the N service nodes based on the target routing rule and the attribute information of N service nodes includes: determining J candidate service nodes from the N service nodes based on the attribute information filtering rules and the attribute information of the N service nodes, where J is an integer greater than 1 and less than or equal to N; obtaining monitoring indicator information of the J candidate service nodes from the monitoring center based on the attribute information of the J candidate service nodes; and determining the first target service node from the J candidate service nodes based on the monitoring indicator filtering rules and the monitoring indicator information of the J candidate service nodes.
[0007] According to embodiments of this disclosure, there are K attribute information filtering rules, where K is an integer greater than 1. Based on the attribute information filtering rules and the attribute information of N service nodes, J candidate service nodes are determined from the N service nodes, including: for the nth service node, in response to detecting that the (k-1)th attribute verification result indicates that the verification is passed, the attribute information of the nth service node is verified using the kth attribute information filtering rule to obtain the kth attribute verification result, where n is a positive integer less than or equal to N, and k is an integer greater than 1 and less than or equal to K; if the kth attribute verification result indicates that the verification is not passed, the nth service node is determined as the second target service node; and if all K attribute verification results indicate that the verification is passed, the nth service node is determined as a candidate service node.
[0008] According to embodiments of this disclosure, the monitoring indicator screening rule includes Q screening condition fields, which are separated by logical operators. The type information of the logical operators corresponds to the type information of the parsing processing program of the first service node, and Q is an integer greater than 1. Based on the monitoring indicator screening rule and the monitoring indicator information of J candidate service nodes, the first target service node is determined from the J candidate service nodes, including: verifying the monitoring indicator information of the j-th candidate service node based on the logical operation method of the logical operators and the Q screening condition fields to obtain the verification result of the j-th indicator, where j is a positive integer less than or equal to J; and if the verification result of the j-th indicator indicates that the verification is passed, the j-th candidate service node is determined as the first target service node.
[0009] According to embodiments of this disclosure, the above service invocation method further includes: in response to receiving a startup command, running a communication thread to communicate with a configuration center via the communication thread; receiving modified routing rules from the configuration center via the communication thread; and updating the routing rules in the storage space based on the modified routing rules.
[0010] According to embodiments of this disclosure, determining a target routing rule from M pre-stored routing rules based on service information includes: reading M routing rules from storage space, wherein each routing rule is associated with pre-stored service information; determining matching service information from the pre-stored service information associated with the M routing rules by matching the service information with the pre-stored service information associated with the M routing rules; and determining the routing rule associated with the matching service information as the target routing rule.
[0011] According to embodiments of this disclosure, the above service invocation method further includes: in response to a start command, sending attribute information to a service registry, causing the service registry to register the service node based on the received attribute information; and in response to a close command, sending an unregistration request to the service registry, causing the service registry to unregister the service node corresponding to the unregistration request.
[0012] According to an embodiment of this disclosure, there are E first target service nodes, where E is an integer greater than 1; calling the first target service nodes to process service information includes: using a load balancing strategy to determine e first target service nodes from the E first target service nodes, where e is a positive integer less than E; and calling the e first target service nodes to process service information.
[0013] A second aspect of this disclosure provides a service node, comprising: an acquisition module, configured to, in response to receiving a call instruction carrying service information, acquire attribute information of N service nodes from a service registry, where N is an integer greater than 1; a first determination module, configured to, based on the service information, determine a target routing rule from M pre-stored routing rules, where M is an integer greater than 1; a second determination module, configured to, based on the target routing rule and the attribute information of the N service nodes, determine a first target service node from the N service nodes; and a call module, configured to call the first target service node to process the service information.
[0014] A third aspect of this disclosure provides a distributed node network comprising B of the aforementioned service nodes, where B is an integer greater than N.
[0015] A fourth aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.
[0016] The fifth aspect of this disclosure also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.
[0017] A sixth aspect of this disclosure also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.
[0018] According to embodiments of this disclosure, upon receiving a call instruction carrying service information, attribute information of N service nodes is obtained from a service registry. Based on this service information, a target routing rule is determined from M pre-stored routing rules. Thus, based on the target routing rule and the attribute information of the second service node, a first target service node satisfying the target routing rule is selected from the N service nodes. This achieves the designation of the first target service node downstream of the call chain's starting point, thereby utilizing this first target service node to process the service. Therefore, during development and testing, a debugging environment can be deployed only on the first target service node, simplifying the deployment of the distributed system development environment and improving development efficiency. Furthermore, it provides the distributed system with the ability to dynamically, flexibly, and efficiently designate downstream service providers, improving the testing efficiency of test service nodes.
[0019] Furthermore, in a real-world production environment, since service nodes can be specified for providing services, the distribution ratio of traffic among these service nodes can be controlled. Therefore, this disclosure provides distributed systems with the ability to control the distribution ratio of traffic among service nodes, reducing operational workload. Attached Figure Description
[0020] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0021] Figure 1 This illustration schematically depicts an application scenario of a service invocation method, node, distributed node network, device, medium, and program product according to embodiments of the present disclosure.
[0022] Figure 2 A flowchart illustrating a service invocation method according to a first embodiment of this disclosure is shown schematically.
[0023] Figure 3 A schematic diagram illustrating the invocation of a service node according to an embodiment of this disclosure is shown.
[0024] Figure 4 A schematic diagram illustrating a service invocation method according to a second embodiment of the present disclosure is shown.
[0025] Figure 5 A schematic diagram illustrating the structure of a service node according to an embodiment of this disclosure is shown; and
[0026] Figure 6 A block diagram schematically illustrates an electronic device suitable for implementing a service invocation method according to an embodiment of the present disclosure. Detailed Implementation
[0027] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.
[0028] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0029] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0030] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0031] In the technical solution disclosed herein, the user information (including but not limited to user personal information, user image information, user device information, such as location information) and data (including but not limited to data used for analysis, stored data, and displayed data) involved are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse.
[0032] In scenarios involving automated decision-making using personal information, the methods, devices, and systems provided in this disclosure all offer users corresponding entry points for choosing to agree to or reject the automated decision-making results. If the user chooses to reject, the process proceeds to the expert decision-making stage. Here, "automated decision-making" refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests, or economic, health, and credit status through computer programs, and then making a decision. Here, "expert decision-making" refers to the activity of making decisions by personnel who specialize in a particular field, possess specialized experience, knowledge, and skills, and have reached a certain level of professional expertise.
[0033] According to embodiments of this disclosure, during development and testing, if a service node located downstream of the call chain origin can be specified to provide services, development and testing efficiency will be greatly improved. For example, during code debugging, if a service node can be specified to provide services, only one debugging environment needs to be deployed on this service node, greatly reducing the workload of debugging; during stress testing, if a service node can be specified to provide services, all traffic can be directed to this service node, thereby quickly exposing performance problems and performance bottlenecks.
[0034] In a real production environment, if a service node located downstream of the call chain can be specified to provide services, the distribution ratio of traffic among the service nodes used to provide services can be controlled, thereby enabling capabilities such as version gray-scale upgrades and feature gray-scale deployments.
[0035] However, the routing capabilities of current distributed systems are coarse-grained and inflexible, making it difficult to specify service nodes located downstream of the call chain's starting point.
[0036] In view of this, the present invention provides a method for implementing custom routing based on a configuration center. It only requires setting custom routing rules for services in the configuration center. When a service is called, the custom routing rules will be used to filter out service nodes that meet the conditions for providing services, thereby realizing custom routing.
[0037] Specifically, embodiments of this disclosure provide a service invocation method, including: in response to receiving an invocation instruction carrying service information, obtaining attribute information of N service nodes from a service registry based on the service information, where N is an integer greater than 1; determining a target routing rule from M pre-stored routing rules based on the service information, where M is an integer greater than 1; determining a first target service node from the N service nodes based on the target routing rule and the attribute information of the N service nodes; and invoking the first target service node to process the service information.
[0038] Furthermore, this disclosure also provides a service node for executing service invocation methods. Additionally, this disclosure provides a distributed node network including B of the aforementioned service nodes, where B is an integer greater than N.
[0039] Figure 1 The illustration schematically depicts an application scenario of a service invocation method, node, distributed node network, device, medium, and program product according to embodiments of the present disclosure.
[0040] like Figure 1 As shown, application scenario 100 according to this embodiment may include a configuration center 110, a distributed node network 120, a service registration center 130, and a monitoring center 140. The distributed node network 120 includes B service nodes 121_1…121_B. The network serves as a medium for providing communication links between the configuration center 110, the node network 120, the service registration center 130, and the monitoring center 140, and may also serve as a medium for providing communication links between the B service nodes 121_1…121_B. The network may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0041] Configuration center 110 can be a platform for configuring information about each service node in the distributed node network 120. Each of the B service nodes 121_1...121_B can be used to provide services or initiate service calls. In this embodiment, the service node that initiates a service call is called a consumer node; the node that provides the service is called a provider node. Consumer and provider are relative terms; a consumer node for one service may be a provider node for another service. Specifically, any one of the B service nodes 121_1...121_B can act as a consumer node and initiate calls to other service nodes.
[0042] The service registration center 130 can be used to register and store the information of each of the above B service nodes 121_1...121_B.
[0043] The monitoring center 140 can be used to monitor and store the indicator information of each of the above B service nodes 121_1……121_B.
[0044] Service nodes can be servers that provide various services, such as a backend management server that supports websites browsed by users using their terminal devices (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device. Similarly, the configuration center 110, service registration center 130, and monitoring center 140 can also be built based on servers, which will not be elaborated here.
[0045] Users can use terminal devices to interact with the configuration center 110, service nodes, service registration center 130, or monitoring center 140 via the network to receive or send messages, etc. Various communication client applications can be installed on the terminal devices, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only). Terminal devices can be various electronic devices with a display screen that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0046] It should be noted that the service invocation method provided in this embodiment can generally be executed by at least one service node in the distributed node network 120.
[0047] It should be understood that Figure 1 The number of configuration centers 110, service nodes, service registration centers 130, and monitoring centers 140 shown in the diagram is merely illustrative. Depending on implementation needs, there can be any number of configuration centers 110, service nodes, service registration centers 130, and monitoring centers 140.
[0048] The following will be based on Figure 1 The described scene, through Figures 2-4 The service invocation method of the disclosed embodiments will be described in detail.
[0049] Figure 2 A flowchart illustrating a service invocation method according to a first embodiment of this disclosure is shown schematically.
[0050] like Figure 2 As shown, the service invocation method of this embodiment includes operations S210 to S240.
[0051] In operation S210, in response to receiving a call instruction carrying service information, the system retrieves the attribute information of N service nodes from the service registry, where N is an integer greater than 1.
[0052] In operation S220, based on service information, the target routing rule is determined from M pre-stored routing rules, where M is an integer greater than 1.
[0053] In operation S230, based on the target routing rules and the attribute information of N service nodes, the first target service node is determined from the N service nodes.
[0054] In operation S240, the first target service node is invoked to process service information.
[0055] According to embodiments of this disclosure, service information can be attribute information of a service to be invoked by a consumer node. Service information may include, but is not limited to, service identifiers and service type information. The service identifier can be a unique identifier jointly determined by the service's interface identifier, version identifier, and method identifier. The service registry can store attribute information of each service node in the node network. The attribute information of a service node may include, but is not limited to, the service node's address identifier and port information. Therefore, the service registry can be used to send attribute information of other service nodes to consumer nodes based on the attribute information of the service nodes, thereby enabling consumer nodes to invoke other service nodes to process services.
[0056] Routing rules can be custom rules used to select service nodes that provide services. For example, a routing rule can include a service identifier. The service identifier in a routing rule is used to identify the service corresponding to that routing rule. That is, when a service is called, the routing rule corresponding to that service can be determined based on the service identifier. Routing rules can be customized based on requirements and can be stored in a configuration center. The configuration center can be a platform used to configure routing rules. Routing rules can be added, modified, or deleted in the configuration center.
[0057] According to embodiments of this disclosure, when a service node receives a call instruction carrying service information, the service node can act as a consumer node and send the service information to the service registry, so that the service registry can provide the service node with the attribute information of the service node for the service based on the service identifier in the service information, that is, the attribute information of the aforementioned N service nodes.
[0058] Consumer nodes can read and parse pre-stored routing rules in their local storage. They can match the service identifiers in the routing rules with those in the service information to determine if the service to be invoked has a corresponding custom routing rule. If a routing rule among the M rules matches the service identifier in the service information, that matching rule is designated as the target routing rule. If no matching rule among the M rules matches the service identifier in the service information, a load balancing strategy can be used to directly select a unique service node from the N service nodes to provide the service. Load balancing strategies can include, but are not limited to, random, round-robin, weighted round-robin, least connections, and hashing.
[0059] Consumer nodes can analyze the attribute information of N service nodes based on target routing rules to select a first target service node that satisfies the target routing rules, and then invoke the first target service node. In one embodiment of this disclosure, if no first target service node is found after filtering N service nodes based on routing rules, an exception message can be generated, and an error can be reported based on the exception message. In another embodiment of this disclosure, if only one first target service node is found after filtering N service nodes based on routing rules, that single first target service node can be directly invoked to provide services.
[0060] According to embodiments of this disclosure, upon receiving a call instruction carrying service information, attribute information of N service nodes is obtained from a service registry. Based on this service information, a target routing rule is determined from M pre-stored routing rules. Thus, based on the target routing rule and the attribute information of the second service node, a first target service node satisfying the target routing rule is selected from the N service nodes. This achieves the designation of the first target service node downstream of the call chain's starting point, thereby utilizing this first target service node to process the service. Therefore, during development and testing, a debugging environment can be deployed only on the first target service node, simplifying the deployment of the distributed system development environment and improving development efficiency. Furthermore, it provides the distributed system with the ability to dynamically, flexibly, and efficiently designate downstream service providers, improving the testing efficiency of test service nodes.
[0061] Furthermore, in a real-world production environment, since service nodes can be specified for providing services, the distribution ratio of traffic among these service nodes can be controlled. Therefore, this disclosure provides distributed systems with the ability to control the distribution ratio of traffic among service nodes, reducing operational workload.
[0062] According to embodiments of this disclosure, determining a target routing rule from M pre-stored routing rules based on service information includes: reading M routing rules from storage space, wherein each routing rule is associated with pre-stored service information; determining matching service information from the pre-stored service information associated with the M routing rules by matching the service information with the pre-stored service information associated with the M routing rules; and determining the routing rule associated with the matching service information as the target routing rule.
[0063] In one embodiment of this disclosure, the pre-stored service information associated with the routing rules may include the identifier of the service in the routing rules. However, this disclosure is not limited thereto. In another embodiment, the routing rules may be stored in storage space in association with the pre-stored service information. The pre-stored service information may include the pre-stored identifier of the service.
[0064] According to embodiments of this disclosure, the identifier of the pre-stored service can be matched with the identifier of the service in the received service information to determine the matching service information that matches the received service information from the pre-stored service information associated with M routing rules, thereby determining the routing rule associated with the matching service information as the target routing rule.
[0065] According to embodiments of this disclosure, by matching service information with pre-stored service information, matching service information is determined from the pre-stored service information in the storage space, thereby determining the routing rule associated with the matching service information as the target routing rule, which improves the accuracy of determining the target routing rule.
[0066] According to embodiments of this disclosure, the target routing rule includes attribute information filtering rules and monitoring indicator filtering rules; determining a first target service node from the N service nodes based on the target routing rule and the attribute information of N service nodes includes: determining J candidate service nodes from the N service nodes based on the attribute information filtering rules and the attribute information of the N service nodes, where J is an integer greater than 1 and less than or equal to N; obtaining monitoring indicator information of the J candidate service nodes from the monitoring center based on the attribute information of the J candidate service nodes; and determining the first target service node from the J candidate service nodes based on the monitoring indicator filtering rules and the monitoring indicator information of the J candidate service nodes.
[0067] According to embodiments of this disclosure, attribute information filtering rules can be used to filter N service nodes based on their attribute information, thereby obtaining candidate service nodes whose attribute information satisfies the target routing rules. For example, attribute information filtering rules may include one or more filtering conditions. The filtering conditions in attribute information filtering rules can be static conditions, such as IP (Internet Protocol) address identifiers, tags, system environment variables, etc.
[0068] According to embodiments of this disclosure, the monitoring center can monitor the data metrics of service nodes in a distributed node network in real time, thereby obtaining and storing the monitoring metric information of the storage nodes. The monitoring metric information may include, but is not limited to, CPU (Central Processing Unit) usage, memory usage, disk I / O (Input / Output) counts, network uplink and downlink traffic, number of network connections, number of processes, number of threads, virtual machine GC (Garbage Collection) counts, etc.
[0069] Monitoring metric filtering rules can be used to filter N service nodes based on their monitoring metric information, thereby obtaining candidate service nodes whose monitoring metric information meets the target routing rules. For example, a monitoring metric filtering rule can include one or more filtering conditions. The filtering conditions in the monitoring metric filtering rule can be dynamic conditions, such as CPU usage, number of threads, number of GC cycles in the virtual machine, etc.
[0070] In this embodiment of the disclosure, in addition to the attribute information filtering rules and monitoring indicator filtering rules described above, the target routing rules may also include request message filtering rules. For example, the filtering conditions of the request message filtering rules may include, but are not limited to, whether a certain field exists in the request message received from the service node and whether a certain field in the message has a specific value, etc.
[0071] Therefore, the routing rules in this disclosure are quite comprehensive. Thus, both custom static routes can be implemented based on static information such as host environment variables, tags, and system variables, and custom dynamic routes can be implemented based on dynamic information such as performance metrics.
[0072] According to embodiments of this disclosure, candidate service nodes are selected from N service nodes by using static attribute information filtering rules and service node attribute information. Then, a first target service node is selected from the candidate service nodes by using dynamic monitoring indicator filtering rules. Therefore, by using both static and dynamic routing rules to perform multi-dimensional and multi-level filtering of service nodes, the accuracy of determining the first target service node is improved.
[0073] According to embodiments of this disclosure, there are K attribute information filtering rules, where K is an integer greater than 1. Based on the attribute information filtering rules and the attribute information of N service nodes, J candidate service nodes are determined from the N service nodes, including: for the nth service node, in response to detecting that the (k-1)th attribute verification result indicates that the verification is passed, the attribute information of the nth service node is verified using the kth attribute information filtering rule to obtain the kth attribute verification result, where n is a positive integer less than or equal to N, and k is an integer greater than 1 and less than or equal to K; if the kth attribute verification result indicates that the verification is not passed, the nth service node is determined as the second target service node; and if all K attribute verification results indicate that the verification is passed, the nth service node is determined as a candidate service node.
[0074] According to embodiments of this disclosure, the routing rules exhibit short-circuit behavior, meaning that if the attribute information or monitoring indicator information of a service node does not satisfy at least one rule, the service node is determined to be the second target service node. The second target service node is a service node that is not used to provide services based on the aforementioned service information.
[0075] For example, if the verification result of the k-th attribute fails, the n-th service node can be determined as the second target service node without needing to determine whether the attribute information of the n-th service node satisfies the Kk attribute information filtering rules following the k-th attribute information filtering rule. Correspondingly, when there are multiple monitoring indicator filtering rules, the verification logic of multiple monitoring indicator filtering rules is the same as the verification logic of attribute information filtering rules, and can be referred to, so it will not be elaborated here.
[0076] According to the embodiments of this disclosure, by using K attribute information filtering rules to sequentially verify the attribute information of the nth service node, the nth service node can be determined as a candidate service node if all K attribute verification results indicate that the verification has passed, thereby improving the accuracy of determining candidate service nodes.
[0077] According to embodiments of this disclosure, the monitoring indicator screening rule includes Q screening condition fields, which are separated by logical operators, where Q is an integer greater than 1. Based on the monitoring indicator screening rule and the monitoring indicator information of J candidate service nodes, the first target service node is determined from the J candidate service nodes, including: verifying the monitoring indicator information of the j-th candidate service node based on the logical operation method of the logical operators and the Q screening condition fields to obtain the verification result of the j-th indicator, where j is a positive integer less than or equal to J; and if the verification result of the j-th indicator indicates that the verification is passed, the j-th candidate service node is determined as the first target service node.
[0078] According to embodiments of this disclosure, multiple filtering conditions in a rule are connected by logical operators. Keywords such as OR and NOT can be used as logical operators, as can symbols such as || and !. Regardless of the logical operator used, it is acceptable as long as the logical operator is consistent with the parsing and processing procedure of the consumer node; that is, the type information of the logical operator corresponds to the type information of the parsing and processing procedure of the consumer node. The format of the routing rule includes, but is not limited to, json, xml, yaml, or pkl, etc. An example of a routing rule may include: age==20 || age==22. Here, age represents age, || represents a logical operator, and age==20 and age==22 represent filtering condition fields.
[0079] In this embodiment, the attribute information filtering rules are constructed in a similar manner to the monitoring indicator filtering rules, including filtering condition fields and logical operators. Based on this, the validation method for each filtering condition field in a single attribute information filtering rule is the same as the validation method for the single monitoring indicator filtering rule described above; it can be referred to the validation method for the single monitoring indicator filtering rule described above, and will not be elaborated upon here.
[0080] According to embodiments of this disclosure, by combining logical operators with filtering condition fields to form routing rules, the scalability of routing rules is improved, making the content of routing rules more flexible and richer, and enabling more accurate filtering of service nodes. Furthermore, using logical operators combined with filtering condition fields to verify the monitoring indicator information of service nodes improves the accuracy and flexibility in determining the first target service node.
[0081] According to embodiments of this disclosure, the above service invocation method further includes: in response to receiving a start command, running a communication thread to communicate with a configuration center via the communication thread; receiving modified routing rules from the configuration center via the communication thread; and updating the routing rules in the storage space based on the modified routing rules.
[0082] According to embodiments of this disclosure, a configuration center centrally manages all routing rules. Development, testing, and operations personnel can create, modify, and delete routing rules in the routing configuration center. The configuration center can obtain attribute information of all consumer nodes of a service from the service registry, and based on this obtained attribute information, synchronize the service's routing rules to all consumer nodes of the service in real time.
[0083] After startup, each service node runs a communication thread in the background to communicate with the configuration center in real time, always ready to receive push notifications from the routing configuration center. This communication thread can be a daemon thread. Once the service node receives a routing rule pushed by the configuration center, it immediately caches the routing rule.
[0084] In this embodiment of the disclosure, when the routing rules for a service change, the configuration center immediately retrieves the consumer list for that service from the service registry and then pushes the changed routing rules to all consumer nodes of that service. Upon receiving the changed routing rules, the consumer nodes can retrieve the original routing rules corresponding to the changed routing rules from the storage space based on the service identifier in the changed routing rules, and then replace the original routing rules, thereby completing the routing rule update.
[0085] According to embodiments of this disclosure, by maintaining communication with the configuration center through a communication thread after startup, routing rules synchronized in real time by the configuration center can be received in a timely manner. This allows for timely updates to the routing rules stored in the local storage space, improving the timeliness of the routing rules and enabling them to take effect in real time. This achieves flexible and efficient custom routing functionality, eliminates development and testing pain points, and improves production and maintenance efficiency.
[0086] According to embodiments of this disclosure, the above service invocation method further includes: in response to a start command, sending attribute information to a service registry, causing the service registry to register the service node based on the received attribute information; and in response to a close command, sending an unregistration request to the service registry, causing the service registry to unregister the service node corresponding to the unregistration request.
[0087] According to embodiments of this disclosure, a service registry is used to maintain a consumer list and a provider list for each recorded service. Upon startup, a service node immediately registers itself with the service registry. For example, a service node may append a record containing its own IP address identifier, port identifier, and other information to both the service's consumer list and provider list. Before shutting down, a service node deregisters from the service registry. For example, a service node may delete the records it added upon startup from both the service's consumer list and provider list.
[0088] Based on this, consumer nodes can obtain all service nodes that can be used to provide a certain service from the service registry, and configuration centers can obtain all consumer nodes for a certain service from the service registry.
[0089] According to embodiments of this disclosure, registration and deregistration are performed in the service registry center when the service node is started and when it is shut down, respectively. This allows for timely receipt of attribute information of the service node from the service registry center and routing rules from the configuration center, thereby improving the timeliness of information reception.
[0090] According to an embodiment of this disclosure, there are E first target service nodes, where E is an integer greater than 1; calling the first target service nodes to process service information includes: using a load balancing strategy to determine e first target service nodes from the E first target service nodes, where e is a positive integer less than E; and calling the e first target service nodes to process service information.
[0091] According to embodiments of this disclosure, when there are E first target service nodes, it is necessary to filter these E first target service nodes. A load balancing strategy can be used to select e first target service nodes from the E to provide services. When e is 1, only one first target service node can be used to provide services based on service information.
[0092] According to embodiments of this disclosure, by using a load balancing strategy to select e first target service nodes from E first target service nodes, the distribution of traffic among the service nodes used to provide services can be controlled, thereby reducing the workload of operation and maintenance.
[0093] According to embodiments of this disclosure, information that needs to be transmitted throughout the entire service call request message can be stored in the thread context. For example, each time a request arrives, the aforementioned information is immediately stored in the thread context, so that when requesting to remotely call other services, the information in the thread context can be appended to the message. Thus, the thread context stores the aforementioned information for each call request, allowing for the tracing of the call chain based on this information.
[0094] Figure 3 A schematic diagram illustrating the invocation of a service node according to an embodiment of this disclosure is shown.
[0095] like Figure 3 As shown, after development, testing, or operations personnel change the routing rules for service A stored in configuration center 110, configuration center 110 can obtain the consumer list for providing service A from service registry 130. Prior to this, after service node 121_b starts up, it can send attribute information to service registry 130 to register its own information in service registry 130's consumer list, where b is a positive integer less than or equal to B. Therefore, the consumer list will include service node 121_b's information.
[0096] Based on this, after obtaining the consumer list, configuration center 110 can push the routing rules of service A to the consumers of service A in the list. The consumer of service A is service node 121_b.
[0097] After receiving the routing rules, service node 121_b can obtain the list of providers of service A from the service registry 130. Since the monitoring center 140 stores the monitoring information collected from each service node, service node 121_b can obtain the monitoring information of each service node in the provider list from the monitoring center 140.
[0098] Service node 121_b can use routing rules to determine service node 121_b+1 as the first target service node based on the obtained monitoring information and the attribute information of service nodes in the provider list, and thus call service node 121_b+1 to process services.
[0099] Figure 4 A schematic diagram of a service invocation method according to a second embodiment of the present disclosure is shown.
[0100] like Figure 4 As shown, the service invocation method in this embodiment includes operations S410~S470.
[0101] When operating the S410, the changed routing rules are received from the configuration center via the communication thread.
[0102] When operating S420, update the routing rules in the storage space based on the changed routing rules.
[0103] When operating S430, in response to receiving a call command carrying service information, it retrieves the attribute information of N service nodes from the service registry.
[0104] In operation S440, based on service information, the target routing rule is determined from the M pre-stored routing rules.
[0105] When operating S450, the first target service node is determined from the N service nodes based on the target routing rules and the attribute information of the N service nodes.
[0106] When operating S460, a load balancing strategy is used to determine e first target service nodes from E first target service nodes.
[0107] During operation S470, e first target service nodes are invoked to process service information.
[0108] Based on the above service invocation method, this disclosure also provides a service node. The following will combine... Figure 5 Provide a detailed description of this service node.
[0109] Figure 5 A schematic block diagram of a service node according to an embodiment of the present disclosure is shown.
[0110] like Figure 5 As shown, the service invocation device 500 of this embodiment includes an acquisition module 510, a first determination module 520, a second determination module 530, and an invocation module 540.
[0111] The acquisition module 510 is used to obtain attribute information of N service nodes from the service registry in response to receiving a call instruction carrying service information, where N is an integer greater than 1. In one embodiment, the acquisition module 510 can be used to perform the operation S210 described above, which will not be repeated here.
[0112] The first determining module 520 is used to determine a target routing rule from M pre-stored routing rules based on service information, where M is an integer greater than 1. In one embodiment, the first determining module 520 can be used to perform the operation S220 described above, which will not be repeated here.
[0113] The second determining module 530 is used to determine the first target service node from the N service nodes based on the target routing rules and the attribute information of the N service nodes. In one embodiment, the second determining module 530 can be used to perform the operation S230 described above, which will not be repeated here.
[0114] The calling module 540 is used to call the first target service node to process service information. In one embodiment, the calling module 540 can be used to execute the operation S240 described above, which will not be repeated here.
[0115] According to embodiments of this disclosure, the second determining module 530 includes a first determining submodule, an acquiring submodule, and a second determining submodule. The first determining submodule is used to determine J candidate service nodes from the N service nodes based on attribute information filtering rules and attribute information of the N service nodes, where J is an integer greater than 1 and less than or equal to N. The acquiring submodule is used to acquire monitoring indicator information of the J candidate service nodes from the monitoring center based on the attribute information of the J candidate service nodes. The second determining submodule is used to determine a first target service node from the J candidate service nodes based on monitoring indicator filtering rules and monitoring indicator information of the J candidate service nodes.
[0116] According to embodiments of this disclosure, the first determining submodule includes a first verification unit, a first determining unit, and a second determining unit. The first verification unit is configured to, for the nth service node, in response to detecting that the (k-1)th attribute verification result indicates that the verification has passed, verify the attribute information of the nth service node using the kth attribute information filtering rules to obtain the kth attribute verification result, where n is a positive integer less than or equal to N, and k is an integer greater than 1 and less than or equal to K. The first determining unit is configured to, if the kth attribute verification result indicates that the verification has failed, determine the nth service node as a second target service node. The second determining unit is configured to, if all K attribute verification results indicate that the verification has passed, determine the nth service node as a candidate service node.
[0117] According to embodiments of this disclosure, the second determining submodule includes a second verification unit and a third determining unit. The second verification unit verifies the monitoring indicator information of the j-th candidate service node based on logical operations of logical operators and Q filtering condition fields, obtaining a verification result for the j-th indicator, where j is a positive integer less than or equal to J. The third determining unit, if the verification result for the j-th indicator indicates that the verification is successful, determines the j-th candidate service node as the first target service node.
[0118] According to embodiments of this disclosure, the service node further includes a running module, a receiving module, and an updating module. The running module is configured to run a communication thread in response to receiving a startup command, so as to communicate with the configuration center via the communication thread; the receiving module is configured to receive modified routing rules from the configuration center through the communication thread; and the updating module is configured to update the routing rules in the storage space based on the modified routing rules.
[0119] According to embodiments of this disclosure, the first determining module 520 includes a reading submodule, a matching submodule, and a third determining submodule. The reading submodule is used to read M routing rules from storage space, wherein each routing rule is associated with pre-stored service information; the matching submodule is used to determine matching service information from the pre-stored service information associated with the M routing rules by matching the service information with the pre-stored service information associated with the M routing rules; the third determining submodule is used to determine the routing rule associated with the matching service information as the target routing rule.
[0120] According to embodiments of this disclosure, the service node further includes a first sending module and a second sending module. The first sending module is configured to, in response to a start command, send attribute information to a service registry, causing the service registry to register the service node based on the received attribute information. The second sending module is configured to, in response to a close command, send an unregistration request to the service registry, causing the service registry to unregister the service node corresponding to the unregistration request.
[0121] According to embodiments of this disclosure, the invocation module 540 includes a fourth determining submodule and an invocation submodule. The fourth determining submodule is used to determine e first target service nodes from E first target service nodes using a load balancing strategy, where e is a positive integer less than E; the invocation submodule is used to invoke the e first target service nodes to process service information.
[0122] According to embodiments of this disclosure, any plurality of modules among the acquisition module 510, the first determination module 520, the second determination module 530, and the calling module 540 may be combined into one module, or any one of these modules may be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the acquisition module 510, the first determination module 520, the second determination module 530, and the calling module 540 may be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in any one of software, hardware, and firmware methods, or in a suitable combination of any of these methods. Alternatively, at least one of the acquisition module 510, the first determination module 520, the second determination module 530, and the calling module 540 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0123] Figure 6 A block diagram schematically illustrates an electronic device suitable for implementing a service invocation method according to an embodiment of the present disclosure.
[0124] like Figure 6As shown, an electronic device 600 according to an embodiment of this disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.
[0125] RAM 603 stores various programs and data required for the operation of electronic device 600. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 602 and / or RAM 603. It should be noted that the programs may also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.
[0126] According to embodiments of this disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to a bus 604. The electronic device 600 may also include one or more of the following components connected to the input / output (I / O) interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 610 as needed so that computer programs read from it can be installed into the storage section 608 as needed.
[0127] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.
[0128] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 602 and / or RAM 603 and / or one or more memories other than ROM 602 and RAM 603 described above.
[0129] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to enable the computer system to implement the service invocation methods provided in the embodiments of this disclosure.
[0130] When the computer program is executed by the processor 601, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0131] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0132] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0133] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0134] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0135] Those skilled in the art will understand that the features described in the various embodiments of this disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments of this disclosure can be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.
[0136] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.
Claims
1. A service invocation method, characterized in that, The method includes: In response to receiving a call instruction carrying service information, the system retrieves attribute information of N service nodes from the service registry, where N is an integer greater than 1; the service information refers to the attribute information of the service to be called by the consumer node. Based on the service information, the target routing rule is determined from the M pre-stored routing rules, where M is an integer greater than 1; Based on the target routing rules and the attribute information of the N service nodes, a first target service node is determined from the N service nodes; and The first target service node is invoked to process the service information. The target routing rules include attribute information filtering rules and monitoring indicator filtering rules. The step of determining a first target service node from the N service nodes based on the target routing rules and the attribute information of the N service nodes includes: determining J candidate service nodes from the N service nodes based on the attribute information filtering rules and the attribute information of the N service nodes, where J is an integer greater than 1 and less than or equal to N; obtaining monitoring indicator information of the J candidate service nodes from the monitoring center based on the attribute information of the J candidate service nodes; and determining the first target service node from the J candidate service nodes based on the monitoring indicator filtering rules and the monitoring indicator information of the J candidate service nodes. The monitoring indicator screening rules include Q screening condition fields, which are separated by logical operators, where Q is an integer greater than 1. The step of determining the first target service node from the J candidate service nodes based on the monitoring indicator screening rules and the monitoring indicator information of the J candidate service nodes includes: verifying the monitoring indicator information of the j-th candidate service node based on the logical operation of the logical operators and the Q screening condition fields to obtain a verification result for the j-th indicator, where j is a positive integer less than or equal to J; and if the verification result for the j-th indicator indicates that the verification is successful, determining the j-th candidate service node as the first target service node. The type information of the logical operator corresponds to the type information of the parsing processing program of the consumer node; The attribute information filtering rules are K, where K is an integer greater than 1; the step of determining J candidate service nodes from the N service nodes based on the attribute information filtering rules and the attribute information of the N service nodes includes: for the nth service node, in response to detecting that the (k-1)th attribute verification result indicates that the verification is passed, verifying the attribute information of the nth service node using the kth attribute information filtering rule to obtain the kth attribute verification result, where n is a positive integer less than or equal to N, and k is an integer greater than 1 and less than or equal to K; if the kth attribute verification result indicates that the verification is failed, determining the nth service node as the second target service node; and if all K attribute verification results indicate that the verification is passed, determining the nth service node as the candidate service node; The method further includes: in response to receiving a startup command, running a communication thread to communicate with a configuration center via the communication thread; receiving modified routing rules from the configuration center through the communication thread, wherein the modified routing rules are pushed by the configuration center based on a consumer list obtained from a service registry when the routing rules of any service change; and updating the routing rules in the storage space based on the modified routing rules to complete real-time synchronization of the routing rules. The step of determining a target routing rule from M pre-stored routing rules based on the service information includes: reading the M routing rules from storage space, wherein each routing rule is associated with pre-stored service information; determining matching service information from the pre-stored service information associated with the M routing rules by matching the service information with the pre-stored service information associated with the M routing rules; and determining the routing rule associated with the matching service information as the target routing rule.
2. The method according to claim 1, characterized in that, The method further includes: In response to the start command, attribute information is sent to the service registry, causing the service registry to register the service node based on the received attribute information; and In response to the shutdown command, a deregistration request is sent to the service registry, causing the service registry to deregister the service node corresponding to the deregistration request.
3. The method according to claim 1, characterized in that, The number of the first target service nodes is E, where E is an integer greater than 1; The step of invoking the first target service node to process the service information includes: Using a load balancing strategy, e first target service nodes are determined from E first target service nodes, where e is a positive integer less than E; as well as The service information is processed by calling the e first target service nodes.
4. A service node, characterized in that, The service nodes include: The acquisition module is used to, in response to receiving a call instruction carrying service information, obtain attribute information of N service nodes from the service registry, where N is an integer greater than 1; the service information is the attribute information of the service to be called by the consumer node; The first determining module is used to determine the target routing rule from M pre-stored routing rules based on the service information, where M is an integer greater than 1; The second determining module is used to determine a first target service node from the N service nodes based on the target routing rules and the attribute information of the N service nodes; and The calling module is used to call the first target service node to process the service information; The target routing rules include attribute information filtering rules and monitoring indicator filtering rules. The step of determining a first target service node from the N service nodes based on the target routing rules and the attribute information of the N service nodes includes: determining J candidate service nodes from the N service nodes based on the attribute information filtering rules and the attribute information of the N service nodes, where J is an integer greater than 1 and less than or equal to N; obtaining monitoring indicator information of the J candidate service nodes from the monitoring center based on the attribute information of the J candidate service nodes; and determining the first target service node from the J candidate service nodes based on the monitoring indicator filtering rules and the monitoring indicator information of the J candidate service nodes. The monitoring indicator screening rules include Q screening condition fields, which are separated by logical operators, where Q is an integer greater than 1. The step of determining the first target service node from the J candidate service nodes based on the monitoring indicator screening rules and the monitoring indicator information of the J candidate service nodes includes: verifying the monitoring indicator information of the j-th candidate service node based on the logical operation of the logical operators and the Q screening condition fields to obtain a verification result for the j-th indicator, where j is a positive integer less than or equal to J; and if the verification result for the j-th indicator indicates that the verification is successful, determining the j-th candidate service node as the first target service node. The type information of the logical operators corresponds to the type information of the parsing processing program of the consumer node. The attribute information filtering rules are K, where K is an integer greater than 1; the step of determining J candidate service nodes from the N service nodes based on the attribute information filtering rules and the attribute information of the N service nodes includes: for the nth service node, in response to detecting that the (k-1)th attribute verification result indicates that the verification is passed, verifying the attribute information of the nth service node using the kth attribute information filtering rule to obtain the kth attribute verification result, where n is a positive integer less than or equal to N, and k is an integer greater than 1 and less than or equal to K; if the kth attribute verification result indicates that the verification is failed, determining the nth service node as the second target service node; and if all K attribute verification results indicate that the verification is passed, determining the nth service node as the candidate service node; The service node is also configured to: in response to receiving a startup command, run a communication thread to communicate with the configuration center via the communication thread; receive modified routing rules from the configuration center through the communication thread, the modified routing rules being pushed by the configuration center based on a consumer list obtained from the service registry when the routing rules of any service change; and update the routing rules in the storage space based on the modified routing rules to complete real-time synchronization of the routing rules. The step of determining a target routing rule from M pre-stored routing rules based on the service information includes: reading the M routing rules from storage space, wherein each routing rule is associated with pre-stored service information; determining matching service information from the pre-stored service information associated with the M routing rules by matching the service information with the pre-stored service information associated with the M routing rules; and determining the routing rule associated with the matching service information as the target routing rule.
5. A distributed system, characterized in that, The distributed system includes B service nodes as described in claim 4, where B is an integer greater than N.
6. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 3.
7. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 3.
8. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 3.