Service request allocation method and system, electronic equipment and computer program product

By dynamically screening effective service units in a multi-site cluster and quickly upgrading the database from a slave node to a master node, the service interruption problem caused by cross-site node failure is solved, and high availability and fast response service continuity are achieved.

CN120768947APending Publication Date: 2025-10-10INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510946117.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

Multi-site clusters may experience service interruptions due to node failures in cross-site service units. Existing technologies cannot meet the stringent high availability requirements of financial services.

Method used

By receiving service requests in the target routing unit, filtering out service units containing valid application nodes, and quickly upgrading the database slave node to the master node when the database master node fails, ensuring that the application node accesses the database master node, and combining load balancing and fault detection mechanisms to dynamically allocate service requests.

Benefits of technology

It improves service continuity and reduces fault response time, ensuring high availability and stability of financial services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120768947A_ABST
    Figure CN120768947A_ABST
Patent Text Reader

Abstract

The invention discloses a service request allocation method and system, electronic equipment and a computer program product. Relates to the field of distribution, and the method comprises the steps: receiving a target service request which is used for requesting a service unit in a first site to provide a service; l target service units are screened out from S service units in the first site, the target service request is allocated to the L target service units, the target service units are service units containing effective application nodes, S and L are positive integers, and L is smaller than or equal to S; and receiving service results returned by the L target service units, and sending the service results to the initiating node of the target service request. Through application of the method and the device, the problem of service interruption of the service request of the multi-site cluster caused by node faults in the cross-site service unit in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of distributed systems, and in particular to a method, system, electronic device, and computer program product for allocating service requests. Background Art

[0002] With the increasing complexity of financial services and user demands, traditional single-machine high-performance architectures can no longer meet high availability requirements, especially the need for rapid recovery in the face of failures, prompting the financial industry to turn to distributed cloud computing architectures.

[0003] Financial business information systems, deployed in multi-site distributed scenarios, have extremely high demands for service continuity and load balancing to ensure stable and efficient business processing services for users at all times and to avoid service interruptions or delays caused by single points of failure. Although distributed architectures improve processing capabilities through resource expansion, current technologies suffer from long response times when handling node failures within service units, impacting service quality and user experience, and failing to meet the stringent high availability requirements of financial services.

[0004] Currently, no effective solution has been proposed to the problem in related technologies that service interruption occurs in multi-site clusters due to node failure in cross-site service units. Summary of the Invention

[0005] The main purpose of the present application is to provide a service request allocation method, system, electronic device and computer program product to solve the problem in the related art that a multi-site cluster may be interrupted in service due to node failure in a cross-site service unit.

[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a service request allocation method is provided. Applied to a target routing unit in a first site, the first site is a site in a multi-site cluster, the method comprising: receiving a target service request, wherein the target service request is used to request a service unit in the first site to provide a service; screening out L target service units from the S service units in the first site, and allocating the target service request to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S; receiving the service results returned by the L target service units, and sending the service results to the initiating node of the target service request, wherein, when the current database master node of a target service unit fails, a database slave node is upgraded to the updated database master node according to the selection strategy, and all application nodes in each target service unit access the database master node in the target service unit when providing services.

[0007] Optionally, each target service unit processes the target service request by: processing the target service request by the application node to obtain a data request, and sending the data request to the database master node; responding to the data request by the database master node to obtain return data, and sending the return data to the application node; processing the return data by the application node to obtain a service result, and returning the service result to the target routing unit.

[0008] Optionally, the method further comprises: tracking the load of each target service unit, wherein the number of service requests being processed by each target service unit is positively correlated with the size of the load of the target service unit; and when the load of any first target service unit among the L target service units is greater than a preset load, allocating part of the service requests being processed by the first target service unit to a second target service unit, wherein the second target service unit is a target service unit whose load is less than the preset load.

[0009] Optionally, selecting the L target service units from the S service units in the first site comprises: detecting whether first failure information sent by a service unit in the S service units is received, wherein the first failure information indicates that the application node in the service unit fails, and the first failure information is sent by the application node or by a monitoring system configured to monitor the operation of the S service units; and excluding the service unit sending the first failure information from the S service units to obtain the L target service units.

[0010] Optionally, each target service unit updates the database master node by: detecting whether second failure information is received, wherein the second failure information indicates that the current database master node fails, and the second failure information is sent by the current database master node or by a monitoring system configured to monitor the operation of the S service units; if the second failure information is received and there is a database slave node in the target service unit located in the first site, promoting one database slave node located in the first site to an updated database master node; and if the second failure information is received and there is no database slave node in the target service unit located in the first site, selecting a database slave node in another site connected by the target service unit, and promoting the selected database slave node to the updated database master node.

[0011] Optionally, the multi-site cluster has M groups of service units distributed across multiple sites, and each group of service units includes S service units, wherein the number of application nodes deployed in each service unit is not less than the number of sites connected by the service unit, the number of database nodes deployed in each service unit is not less than the number of sites connected by the service unit, one database node in each service unit is set as a database master node, and other database nodes except the database master node are set as database slave nodes.

[0012] Optionally, when the database slave node and database master node of a service unit are in the same site, the synchronous replication mode is used to synchronize the operation log data, where the operation log is the log generated when the service unit processes the service request; when the database slave node and database master node of a service unit are not in the same site, the asynchronous replication mode is used to synchronize the operation log data.

[0013] To achieve the above-mentioned purpose, according to another aspect of the present application, a service request dispatching system is provided. The system includes: a multi-site cluster, comprising N sites, where N is a positive integer; N routing units, each located in a site, each routing unit being used to detect the load of each service unit and the failure status of the application node at the site where the routing unit is located, and dispatching service requests for the service units at the site where the routing unit is located; M groups of service units, deployed across multiple sites in the multi-site cluster, where M is a positive integer, a group of service units is deployed across two sites, application nodes and database nodes are deployed in each service unit, the database nodes include a master database node and a slave database node, when the current database master node fails, a database slave node is upgraded to the updated database master node according to the selection strategy, and all application nodes access the database master node in the service unit when providing services.

[0014] According to another aspect of the present application, an electronic device is provided, comprising: a memory storing an executable program; and a processor for running the program, wherein when the program runs, the service request allocation method of any one of the embodiments of the present application is executed.

[0015] According to another aspect of the present application, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the steps of any one of the service request allocation methods in the embodiments of the present application.

[0016] In the embodiment of the present application, a target service request is received, wherein the target service request is used to request a service unit in a first station to provide a service; L target service units are selected from S service units in the first station, and the target service request is dispatched to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S; a service result returned by the L target service units is received, and the service result is sent to an initiating node of the target service request, wherein when a current database master node of a target service unit is invalid, a database slave node is promoted to an updated database master node according to a selection strategy, and all application nodes in each target service unit access the database master node in the target service unit when providing a service. The problem that a service is interrupted due to node invalidation in a service unit across stations in a multi-station cluster in the related art is solved, the service request is intelligently dispatched by dynamically selecting a service unit containing a valid application node, and the mechanism that a database slave node is quickly promoted when a database master node is invalid is combined, so that the service continuity is improved and the fault response time is reduced. BRIEF DESCRIPTION OF DRAWINGS

[0017] The accompanying drawings, which form a part of the present application, are intended to provide further understanding of the present application, and are used to interpret the application and its specification, and do not constitute improper limitations to the present application. In the drawings:

[0018] Figure 1 It is a hardware structure block diagram of a computer terminal for implementing a service request dispatching method;

[0019] Figure 2 It is a working schematic of a service request dispatching system provided by the embodiment of the present application Figure 1 ;

[0020] Figure 3 It is a flowchart of a service request dispatching method provided by the embodiment of the present application;

[0021] Figure 4 It is a working schematic of a service unit provided by the embodiment of the present application;

[0022] Figure 5 It is a working schematic when an application node in a service unit is invalid according to the embodiment of the present application;

[0023] Figure 6 It is a working schematic when a database master node in a service unit is invalid according to the embodiment of the present application;

[0024] Figure 7 It is a schematic diagram of a service request dispatching device provided by the embodiment of the present application;

[0025] Figure 8 This is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] It should be noted that the collected information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse. For example, an interface is set up between this system and relevant users or institutions to provide users with corresponding operation entrances for users to choose to agree or refuse the automated decision-making results; if the user chooses to refuse, the expert decision-making process will be entered. If the user chooses to agree, the user can view the purpose of data use in real time through the authorization interface, and has the right to withdraw authorization or delete data at any time. After withdrawing authorization, the system will terminate the relevant data processing within 24 hours.

[0029] Example 1

[0030] According to an embodiment of the present application, an embodiment of a service request dispatching method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0031] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 This is a hardware structure diagram of a computer terminal for implementing a service request dispatching method. Figure 1 As shown, the computer terminal 10 may include one or more ( Figure 1 The computer system includes a processor 102 (shown as 102a, 102b, ..., 102n) (the processor 102 may include but is not limited to a processing device such as a microprocessor (MCU) or a programmable logic device (FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, the computer system may also include: a display, an input / output interface (I / O interface, Input / Output interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0032] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuitry may be a single independent processing module, or may be incorporated in whole or in part into any of the other components of the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0033] The memory 104 can be used to store software programs of application software and modules, such as program instructions / data storage means corresponding to the service request allocation method in the embodiments of the present application. The processor 102 executes various functional applications and data processing, i.e., implements the service request allocation method described above, by running the software programs and modules stored in the memory 104. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include memories remotely arranged with respect to the processor 102, which can be connected to the computer terminal 10 through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0034] The transmission device 106 is used to receive or send data via a network. Specific examples of the network can include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to be able to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet in a wireless manner.

[0035] The display can be, for example, a touch screen type liquid crystal display (Liquid Crystal Display, LCD), which can enable a user to interact with the user interface of the computer terminal 10 (or a mobile device).

[0036] The embodiments of the present application also provide a service request allocation system, Figure 2 According to the service request allocation system provided by the embodiments of the present application Figure 1 As shown in Figure 2 The system includes:

[0037] A multi-site cluster containing N sites, where N is a positive integer. For example, as shown in Figure 2 The N sites in the multi-site cluster can include site 1 and site 2.

[0038] N routing units, each of which is located in a site, and each routing unit is used to detect the load of each service unit in the site where the routing unit is located and the failure state of the application node, and allocate service requests for the service units in the site.

[0039] The routing unit can allocate target service requests, for example, as shown in Figure 2As shown, site 1 and site 2 in a multi-site cluster can be connected through service units (service unit 1 and service unit 2). The target service request initiated from outside site 1 first reaches the routing unit of site 1, and is then intelligently assigned to the target service unit (which can be at least one of service unit 1 and service unit 2) for processing. After the processing is completed, the service result is obtained, and the service result is then fed back to the requester through the routing unit, forming a closed-loop data flow.

[0040] M groups of service units are deployed across multiple sites in a multi-site cluster, where M is a positive integer. A group of service units is deployed across two sites. Application nodes and database nodes are deployed in each service unit. The database nodes include master database nodes and slave database nodes. When the current database master node fails, a database slave node is upgraded to the updated database master node according to the selection strategy. All application nodes access the database master node in their service unit when providing services.

[0041] Among them, each two sites can be connected through a set of service units, such as Figure 2 As shown in the figure, the set of service units connected between Site 1 and Site 2 includes Service Unit 1 and Service Unit 2. A service unit is a basic service provision unit composed of several application nodes and database nodes. These nodes collaborate to complete specific business functions and produce service results. Application nodes within a service unit are responsible for processing business logic and responding to target service requests. They are deployed at the site to which the service unit is connected. Database nodes within a service unit are divided into master and slave nodes. The master node is responsible for reading, writing, and managing data, while the slave node receives and stores data sent by the master node.

[0042] It should be noted that the routing unit not only intelligently allocates service requests based on real-time load but also manages service unit failures. For example, if an application node fails, services can continue to be provided through application nodes at other sites connected to the routing unit. For example, if a database master node fails, the routing unit can use the slave node upgrade mechanism to upgrade a slave node to the master node, taking over the work of the failed master node, ensuring data service continuity and consistency, and avoiding service interruptions caused by single points of failure.

[0043] The service request dispatching system of the embodiment of the present application comprises a multi-site cluster comprising N sites, where N is a positive integer; N routing units, each located in one site, each routing unit being used to detect the load of each service unit and the failure status of the application node at the site where the routing unit is located, and dispatching service requests for the service units at the site where the routing unit is located; M groups of service units, deployed across multiple sites in the multi-site cluster, where M is a positive integer, a group of service units being deployed across two sites, application nodes and database nodes being deployed within each service unit, the database nodes comprising a master database node and a slave database node, and when the current database master node fails, a database slave node is upgraded to the updated database master node according to a selection strategy, and all application nodes access the database master node in the service unit where they are located when providing services. The system solves the problem of service interruption caused by node failure in cross-site service units in the related art, and by leveraging the advantages of multiple sites, adopting a flexible deployment method for service units, a method for converting service units when application nodes fail, and a method for upgrading slave nodes when database master nodes fail, the system can quickly resume services when application nodes and database nodes of a service unit fail, thereby improving service continuity and reducing fault response time.

[0044] Under the above operating environment, this application provides Figure 3 The service request provisioning method shown. Figure 3 is a flow chart of a service request deployment method provided in accordance with an embodiment of the present application, such as Figure 3 As shown, the method is applied to a target routing unit in a first site, where the first site is a site in a multi-site cluster, and includes:

[0045] Step S301: receiving a target service request, wherein the target service request is used to request a service unit in a first site to provide a service.

[0046] Specifically, a target service request is a request initiated by an external site to implement a specific business function service, such as account inquiry, transfer, or loan approval. The primary site is any site in a multi-site cluster, and the external sites are sites other than the primary site in the multi-site cluster. Each site has a routing unit deployed to dispatch target service requests.

[0047] A service unit is a basic service provisioning unit consisting of several application nodes and database nodes. These nodes collaborate to complete specific business functions. Each site can be connected via a set of service units. Multiple service units can be deployed within each site, and a single service unit can connect to multiple sites.

[0048] Step S302 , select L target service units from the S service units in the first site, and allocate the target service request to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S.

[0049] Specifically, S is the total number of service units deployed in the first site, L is a positive integer between 1 and S, and the selection of the L value depends on at least one of the following factors: the current load of each service unit, and the availability of application nodes and database nodes in each service unit.

[0050] The application node is part of the service unit, responsible for processing business logic and responding to target service requests, and is deployed on the site connected to the service unit (such as Figure 2 As shown, deployed at site 1 connected by two service units. The application node determines whether the service unit can successfully complete the business processing. In order to complete the service request, it is necessary to filter out the target service unit containing a valid application node from the service units in the first site and allocate the target service request to the target service unit.

[0051] Step S303: Receive the service results returned by L target service units, and send the service results to the initiating node of the target service request. When the current database master node of a target service unit fails, a database slave node is upgraded to the updated database master node according to the selection strategy. All application nodes in each target service unit access the database master node in the target service unit when providing services.

[0052] Specifically, after the L target service units complete processing the target service request, they obtain the service result and send it to the routing unit. The routing unit then sends the service result to the initiating node of the target service request, forming a complete request-to-response cycle.

[0053] It should be noted that during the operation of the target service unit, the database master node is responsible for reading, writing and managing data. All application nodes in each target service unit need to access the database master node in the target service unit when providing services. When the current database master node fails, in order to avoid service interruption, this embodiment selects a new database master node to take over the work of the failed database master node (upgrading a database slave node to the updated database master node according to the selection strategy), ensuring the continuity of data processing within the target service unit. Even if the database master node fails, the normal operation of the target service unit can be maintained by taking over by the database slave node.

[0054] In an embodiment of the present application, a target service request is received, wherein the target service request is used to request a service unit in the first site to provide a service; L target service units are screened out from the S service units in the first site, and the target service request is allocated to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S; the service results returned by the L target service units are received, and the service results are sent to the initiating node of the target service request, wherein, when the current database master node of a target service unit fails, a database slave node is upgraded to the updated database master node according to the selection strategy, and all application nodes in each target service unit access the database master node in the target service unit when providing services. The problem of service interruption caused by node failure in cross-site service units in the related art is solved. By dynamically screening service units containing valid application nodes and intelligently allocating service requests, combined with a mechanism for quickly upgrading database slave nodes when the database master node fails, the effect of improving service continuity and reducing fault response time is achieved.

[0055] In order to process the deployed target service request, optionally, in the service request deployment method provided in the embodiment of the present application, each target service unit processes the target service request in the following manner: processes the target service request through the application node, obtains the data request, and sends the data request to the database master node; responds to the data request through the database master node, obtains the return data, and sends the return data to the application node; processes the return data through the application node, obtains the service result, and returns the service result to the target routing unit.

[0056] Figure 4 is a schematic diagram of the working of the service unit provided in accordance with an embodiment of the present application, such as Figure 4 As shown in the figure, the processing flow of the target service request includes:

[0057] Specifically, the application node may include multiple, for example, application node 1 and application node 2, which are components of the target service unit and are responsible for receiving and parsing the service request sent from the target routing unit, and then generating the corresponding data request according to the business logic. The data request contains the target or instructions required to process the business request.

[0058] Within the target service unit, the database master node is responsible for processing all data requests and can connect with database slave nodes to perform data calls and synchronization. After completing the data request, the database master node receives the returned data and sends it to the application node. The application node processes the returned data and obtains the service result. The service result contains the final status of the target service request, such as whether the operation was successful and the business processing results. The application node then returns the service result to the target routing unit.

[0059] It should be noted that when the target service unit fails, the target routing unit will send failure information to other sites connected to the target routing unit to achieve data synchronization and avoid sending target service requests to the failed target service unit.

[0060] The embodiment of the present application converts the target service request into a specific data request through the collaboration between the application node of the target service unit and the database master node, and then executes the data request to finally obtain the service result, thereby ensuring the accurate execution of the target service request and forming a complete closed loop of target service request and response.

[0061] In order to maintain stable operation and efficient response of the target service unit under the multi-site architecture, it is necessary to control the load of the target service unit. Optionally, the service request allocation method provided in the embodiment of the present application also includes: tracking the load of each target service unit, wherein the number of service requests being processed by each target service unit is positively correlated with the size of the load of the target service unit; when the load of any first target service unit among the L target service units is greater than the preset load, allocating part of the service requests being processed by the first target service unit to the second target service unit, wherein the second target service unit is a target service unit whose load is less than the preset load.

[0062] It's important to note that load refers to the number of target service requests currently being processed by a target service unit, reflecting the workload of the target service unit. A higher load means a higher workload for the target service unit. When the load exceeds the preset limit, the target service unit is overloaded, reducing the processing efficiency of the multi-site cluster.

[0063] When the load of the first target service unit is greater than the preset load, the routing unit relieves the pressure of the first target service unit by allocating some of the service requests being processed by the first target service unit to the second target service unit with higher processing margin.

[0064] The embodiment of the present application realizes automatic load balancing by reallocating part of the service requests of the first service unit with high load to the second service unit with lower load, thereby avoiding response delay or service rejection caused by overload of the first target service unit, thereby improving the overall processing capacity and resource utilization while ensuring high availability.

[0065] The validity of the service unit can be determined by the routing unit, thereby ensuring that the target service request is allocated to a valid service unit. Optionally, in the service request allocation method provided in the embodiment of the present application, screening out L target service units from the S service units in the first site includes: detecting whether a first failure message sent by a service unit in the S service units is received, wherein the first failure message indicates that an application node in the service unit has failed, and the first failure message is sent by the application node or by a monitoring system, and the monitoring system is used to monitor the operation of the S service units; removing the service unit that sends the first failure message from the S service units to obtain L target service units.

[0066] Specifically, the first failure message indicates that the application node in the corresponding service unit has failed. This message can be proactively sent by the application node upon detecting its own failure, or by a monitoring system responsible for monitoring the operational status of the S service units. Upon receiving the first failure message, the routing unit removes the service unit that sent this message from the list of available service units among the S service units, ensuring that the target service request is not assigned to the service unit with the failed application node, thereby avoiding service interruption or response delay. After removing the failed service unit, the remaining L service units in the list of available service units are used as target service units to process subsequent target service requests.

[0067] Figure 5 Schematic diagram of the operation when an application node fails in a service unit according to an embodiment of the present application. Figure 5 As shown, site 1 can be used as the first site, and service unit 1 and service unit 2 are connected between site 1 and site 2. After receiving the first failure information sent by application node 1 of service unit 1, service unit 1 is removed from the list of available service units of the first site, that is, the target service request is no longer allocated to service unit 1, and service unit 2 is retained as the target service unit of the first site.

[0068] The embodiment of the present application excludes failed service units according to the first failure information, screens out L target service units, enhances the stability of target service request processing, and avoids service interruption caused by failed service units.

[0069] In order to ensure the continuity of database operations and data consistency, optionally, in the service request dispatching method provided in the embodiment of the present application, each target service unit updates the database master node in the following manner: detecting whether a second failure information is received, wherein the second failure information indicates that the current database master node has failed, and the second failure information is issued by the current database master node, or issued by a monitoring system, and the monitoring system is used to monitor the operation of S service units; if the second failure information is received, and there is a database slave node in the target service unit in the first site, a database slave node in the first site is upgraded to an updated database master node; if the second failure information is received, and there is no database slave node in the target service unit in the first site, a database slave node in other sites connected to the target service unit is selected, and the selected database slave node is upgraded to an updated database master node.

[0070] Specifically, in addition to the first failure message, the routing unit also needs to continuously monitor whether it has received a second failure message (i.e., information indicating that the current database master node of the service unit has failed). The second failure message can be sent by the current database master node or by the monitoring system. After receiving the second failure message, the routing unit takes appropriate fault recovery measures based on the database slave node within the target service unit.

[0071] Exemplarily, when there are database slave nodes in the target service unit located in the first site, one of the slave nodes is selected and upgraded to an updated database master node to replace the failed master node and continue to provide services; Figure 6 Schematic diagram of the operation when the database master node fails in the service unit according to the embodiment of the present application. Figure 6 As shown, when the database master node fails, the database slave node at the same site is upgraded to the updated database master node.

[0072] For example, if the target service unit does not have a database slave node in the first site, a database slave node in the target service unit is selected across sites and promoted to the updated database master node to ensure the continuity of target service request processing. After the database slave node is promoted to the database master node, it will begin processing all data requests from the target service unit.

[0073] It should be noted that there is a data synchronization mechanism between the database master node and the database slave nodes in the target service unit. After the database master node completes its work, it synchronizes its data status to the remaining database slave nodes to maintain data consistency within the target service unit.

[0074] The embodiment of the present application identifies whether the current database master node has failed by detecting the second failure information, and when it is confirmed that the current database master node has failed, a database slave node in the target service unit is upgraded to an updated database master node according to the selection strategy, thereby ensuring data consistency and continuous processing of service requests, and maintaining high service availability even in the event of a failure of the database master node.

[0075] In order to optimize the resource distribution of a multi-site cluster, it is necessary to configure the resources within the service unit. Optionally, in the service request allocation method provided in an embodiment of the present application, M groups of service units are distributed across multiple sites in the multi-site cluster, where a group of service units includes S service units, wherein the number of application nodes deployed in each service unit is not less than the number of sites connected to the service unit, and the number of deployed database nodes is not less than the number of sites connected to the service unit. One database node in each service unit is set as a database master node, and other database nodes other than the database master node are set as database slave nodes.

[0076] Specifically, the number of deployed application nodes is no less than the number of sites connected to the service unit, ensuring that in the event of a failure of an application node at one site, services can continue to be provided to the site through other application nodes of the service unit, reducing the risk of service interruption due to site failure.

[0077] Each service unit must have at least one database master node and a database slave node. These slave nodes connect to the database master node, allowing them to quickly take over if the master node fails and also receive data synchronized by the master node. The total number of these two types of database nodes must be no less than the number of sites connected to the service unit. This ensures that if a database node at one site fails, service can continue to be provided to that site through the service unit's other database nodes.

[0078] The embodiment of the present application ensures that each service unit has sufficient application nodes and database nodes, and sets up a succession mechanism for the database master node and the database slave node, which can ensure the high availability of business services in the multi-site cluster when encountering local failures.

[0079] In order to ensure data consistency between database nodes within the service unit, optionally, in the service request dispatching method provided in the embodiment of the present application, when the database slave node and the database master node of a service unit are in the same site, the synchronous replication mode is used to synchronize the operation log data, wherein the operation log is the log generated when the service unit processes the service request; when the database slave node and the database master node of a service unit are not in the same site, the asynchronous replication mode is used to synchronize the operation log data.

[0080] Specifically, when the database master node and the database slave node are in the same site, the synchronous replication of the operation log is triggered immediately after each data operation is completed. Since data transmission occurs in the same site, the network latency is relatively low, and data synchronization can be completed quickly without significantly increasing system latency.

[0081] When the database master node and the database slave node are deployed on different sites, the asynchronous replication mode is used to synchronize the operation logs. The triggering of data synchronization is not synchronized with the data operation, but is performed according to a predetermined time interval or data volume threshold. Since data transmission spans different sites, the asynchronous replication mode can reduce the delay caused by remote data transmission to a certain extent.

[0082] In addition, the operation log is stored in each database node. Specifically, the database master node stores the operation log and then sends it to the database slave node. The database slave node can receive the operation log but cannot actively send it, ensuring the authenticity and security of the operation log.

[0083] The embodiment of the present application intelligently selects the data synchronization method between database nodes and selects synchronous or asynchronous replication mode for data coherence according to their physical locations, which not only ensures data consistency but also fully considers the impact of network performance and improves the efficiency of data synchronization.

[0084] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0085] Example 2

[0086] The embodiment of the present application further provides a service request allocation device. It should be noted that the service request allocation device of the embodiment of the present application can be used to execute the service request allocation method provided in the embodiment of the present application. The service request allocation device provided in the embodiment of the present application is introduced below.

[0087] According to an embodiment of the present application, a device for implementing the above service request allocation method is also provided. Figure 7 is a schematic diagram of a service request allocation device provided according to an embodiment of the present application, such as Figure 7 As shown, the device includes:

[0088] The service request receiving unit 701 is configured to receive a target service request, wherein the target service request is used to request a service unit in the first site to provide a service.

[0089] The service request allocation unit 702 is used to filter out L target service units from the S service units in the first site and allocate the target service request to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S.

[0090] The service result sending unit 703 is used to receive the service results returned by the L target service units and send the service results to the initiating node of the target service request. When the current database master node of a target service unit fails, a database slave node is upgraded to the updated database master node according to the selection strategy. All application nodes in each target service unit access the database master node in the target service unit when providing services.

[0091] In an embodiment of the present application, a service request receiving unit 701 receives a target service request, wherein the target service request is used to request a service unit in a first site to provide a service; a service request allocating unit 702 selects L target service units from S service units in the first site and allocates the target service request to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S; a service result sending unit 703 receives the service results returned by the L target service units and sends the service results to the initiating node of the target service request, wherein when the current database master node of a target service unit fails, a database slave node is upgraded to the updated database master node according to the selection strategy, and all application nodes in each target service unit access the database master node in the target service unit when providing services. This solves the problem of service interruption caused by node failure in cross-site service units in multi-site clusters in the related art, and achieves the effect of improving service continuity and reducing fault response time by dynamically screening service units containing valid application nodes and intelligently allocating service requests, combined with a mechanism for quickly upgrading database slave nodes when the database master node fails.

[0092] Optionally, the service request allocation device provided in the embodiment of the present application also includes: a data request sending module, which is used to process the target service request through the application node, obtain the data request, and send the data request to the database master node; a return data sending module, which is used to respond to the data request through the database master node, obtain the return data, and send the return data to the application node; a service result return module, which is used to process the return data through the application node, obtain the service result, and return the service result to the target routing unit.

[0093] Optionally, the service request allocation device provided in the embodiment of the present application further includes: a load tracking module for tracking the load of each target service unit, wherein the number of service requests being processed by each target service unit is positively correlated with the size of the load of the target service unit; a service request allocation module for allocating part of the service requests being processed by the first target service unit to a second target service unit when the load of any first target service unit among the L target service units is greater than a preset load, wherein the second target service unit is a target service unit whose load is less than the preset load.

[0094] Optionally, in the service request allocation device provided in the embodiment of the present application, the service request allocation unit 702 includes: a first failure information checking module, used to detect whether a first failure information sent by a service unit among the S service units is received, wherein the first failure information indicates that an application node in the service unit has failed, and the first failure information is sent by the application node or by a monitoring system, and the monitoring system is used to monitor the operation status of the S service units; a service unit elimination module, used to eliminate the service unit that sends the first failure information from the S service units to obtain L target service units.

[0095] Optionally, in the service request allocation device provided in the embodiment of the present application, the service result sending unit 703 includes: a second failure information detection module, used to detect whether the second failure information is received, wherein the second failure information indicates that the current database master node has failed, and the second failure information is issued by the current database master node, or issued by the monitoring system, and the monitoring system is used to monitor the operation status of S service units; a first database upgrade module, used to upgrade a database slave node in the first site to an updated database master node if the second failure information is received and there is a database slave node in the target service unit in the first site; a second database upgrade module, used to select a database slave node in other sites connected to the target service unit if the second failure information is received and there is no database slave node in the target service unit in the first site, and upgrade the selected database slave node to an updated database master node.

[0096] Optionally, in the service request dispatching device provided in an embodiment of the present application, M groups of service units are distributed across multiple sites in a multi-site cluster, wherein a group of service units includes S service units, wherein the number of application nodes deployed in each service unit is not less than the number of sites connected to the service unit, and the number of deployed database nodes is not less than the number of sites connected to the service unit, and one database node in each service unit is set as a database master node, and other database nodes other than the database master node are set as database slave nodes.

[0097] Optionally, the service request dispatching device provided in the embodiment of the present application further includes: a first data synchronization module, which is used to synchronize the operation log data using a synchronous replication mode when the database slave node and the database master node of a service unit are in the same site, wherein the operation log is a log generated when the service unit processes a service request; and a second data synchronization module, which is used to synchronize the operation log data using an asynchronous replication mode when the database slave node and the database master node of a service unit are not in the same site.

[0098] It should be noted that the above-mentioned units and modules correspond to steps S301 to S303 in Example 1, and the examples and application scenarios implemented by each unit and module are the same as those of the corresponding steps, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above-mentioned modules can also be part of a device and can be run in the computer terminal 10 provided in Example 1.

[0099] Example 3

[0100] An embodiment of the present application may provide an electronic device, Figure 8 This is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 8 As shown, the electronic device may include: one or more ( Figure 8 Only one is shown) processor 802, memory 804, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0101] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the above-mentioned method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0102] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: receive a target service request, wherein the target service request is used to request the service unit in the first site to provide a service; screen out L target service units from the S service units in the first site, and allocate the target service request to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S; receive the service results returned by the L target service units, and send the service results to the initiating node of the target service request, wherein, when the current database master node of a target service unit fails, a database slave node is upgraded to an updated database master node according to the selection strategy, and all application nodes in each target service unit access the database master node in the target service unit when providing services.

[0103] In an embodiment of the present application, a target service request is received, wherein the target service request is used to request a service unit in the first site to provide a service; L target service units are screened out from the S service units in the first site, and the target service request is allocated to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S; the service results returned by the L target service units are received, and the service results are sent to the initiating node of the target service request, wherein, when the current database master node of a target service unit fails, a database slave node is upgraded to the updated database master node according to the selection strategy, and all application nodes in each target service unit access the database master node in the target service unit when providing services. The problem of service interruption caused by node failure in cross-site service units in the related art is solved. By dynamically screening service units containing valid application nodes and intelligently allocating service requests, combined with a mechanism for quickly upgrading database slave nodes when the database master node fails, the effect of improving service continuity and reducing fault response time is achieved.

[0104] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: each target service unit processes the target service request in the following manner: processes the target service request through the application node, obtains the data request, and sends the data request to the database master node; responds to the data request through the database master node, obtains the return data, and sends the return data to the application node; processes the return data through the application node, obtains the service result, and returns the service result to the target routing unit.

[0105] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: tracking the load of each target service unit, wherein the number of service requests being processed by each target service unit is positively correlated with the size of the load of the target service unit; when the load of any first target service unit among the L target service units is greater than the preset load, deploying part of the service requests being processed by the first target service unit to the second target service unit, wherein the second target service unit is a target service unit whose load is less than the preset load.

[0106] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: detect whether the first failure information sent by a service unit among the S service units is received, wherein the first failure information indicates that the application node in the service unit has failed, and the first failure information is sent by the application node or by the monitoring system, and the monitoring system is used to monitor the operation status of the S service units; remove the service unit that sends the first failure information from the S service units to obtain L target service units.

[0107] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: detect whether the second failure information is received, wherein the second failure information indicates that the current database master node has failed, and the second failure information is issued by the current database master node, or issued by the monitoring system, and the monitoring system is used to monitor the operation of S service units; if the second failure information is received, and there is a database slave node in the target service unit in the first site, a database slave node in the first site is upgraded to an updated database master node; if the second failure information is received, and there is no database slave node in the target service unit in the first site, a database slave node in other sites connected to the target service unit is selected, and the selected database slave node is upgraded to an updated database master node.

[0108] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: M groups of service units are distributed across multiple sites in the multi-site cluster, where a group of service units includes S service units, wherein the number of application nodes deployed in each service unit is not less than the number of sites connected to the service unit, and the number of deployed database nodes is not less than the number of sites connected to the service unit, and one database node in each service unit is set as a database master node, and other database nodes other than the database master node are set as database slave nodes.

[0109] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: when the database slave node and the database master node of a service unit are in the same site, the synchronous replication mode is used to synchronize the operation log data, wherein the operation log is the log generated when the service unit processes the service request; when the database slave node and the database master node of a service unit are not in the same site, the asynchronous replication mode is used to synchronize the operation log data.

[0110] It can be understood by those skilled in the art that Figure 8 The structure shown is for illustration only, and the electronic device may also be a terminal device such as a smart phone, a tablet computer, a PDA, a mobile Internet device (MID), or a PAD. Figure 8 It does not limit the structure of the above electronic device. For example, the electronic device may also include Figure 8 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 8 Different configurations shown.

[0111] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0112] Example 4

[0113] The embodiment of the present application also provides a storage medium. Optionally, in this embodiment, the above storage medium can be used to store the program code executed by the following service request allocation method: receiving a target service request, wherein the target service request is used to request the service unit in the first site to provide a service; screening out L target service units from the S service units in the first site, and allocating the target service request to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S; receiving the service results returned by the L target service units, and sending the service results to the initiating node of the target service request, wherein, when the current database master node of a target service unit fails, a database slave node is upgraded to the updated database master node according to the selection strategy, and all application nodes in each target service unit access the database master node in the target service unit when providing services.

[0114] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0115] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the following steps of a service request allocation method: receiving a target service request, wherein the target service request is used to request a service unit in a first site to provide a service; screening out L target service units from the S service units in the first site, and allocating the target service request to the L target service units, wherein the target service unit is a service unit containing a valid application node, S and L are positive integers, and L is less than or equal to S; receiving service results returned by the L target service units, and sending the service results to the initiating node of the target service request, wherein, when the current database master node of a target service unit fails, a database slave node is upgraded to an updated database master node according to a selection strategy, and all application nodes in each target service unit access the database master node in the target service unit when providing services.

[0116] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0117] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0118] In several embodiments provided in the present application, it should be understood that the disclosed technology can be implemented by other ways. Among them, the above-described device embodiments are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, units or modules, and can be electrical or other forms.

[0119] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0120] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0121] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part of the prior art that contributes to the technical solutions or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0122] The above is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.

Claims

1. A service request deployment method, characterized in that: Applied to a target routing unit in a first site, where the first site is a site in a multi-site cluster, the method comprising: receiving a target service request, wherein the target service request is used to request a service unit in the first site to provide a service; Selecting L target service units from the S service units in the first site, and allocating the target service request to the L target service units, wherein the target service units are service units that include valid application nodes, S and L are positive integers, and L is less than or equal to S; Receive the service results returned by the L target service units, and send the service results to the initiating node of the target service request, wherein, when the current database master node of a target service unit fails, a database slave node is upgraded to the updated database master node according to the selection strategy, and all application nodes in each target service unit access the database master node in the target service unit when providing services.

2. The service request allocation method according to claim 1, characterized in that: Each target service unit processes the target service request in the following manner: Processing the target service request through the application node to obtain a data request, and sending the data request to the database master node; The database master node responds to the data request, obtains the returned data, and sends the returned data to the application node; The application node processes the returned data to obtain the service result, and returns the service result to the target routing unit.

3. The service request allocation method according to claim 1, characterized in that: The method further comprises: Tracking the load of each target service unit, wherein the number of service requests being processed by each target service unit is positively correlated with the size of the load of the target service unit; When the load of any first target service unit among the L target service units is greater than the preset load, part of the service requests being processed by the first target service unit is deployed to the second target service unit, wherein the second target service unit is a target service unit whose load is less than the preset load.

4. The service request allocation method according to claim 1, wherein: Selecting L target service units from the S service units in the first site includes: detecting whether first failure information sent by a service unit among the S service units is received, wherein the first failure information indicates that an application node in the service unit has failed, and the first failure information is sent by the application node or by a monitoring system configured to monitor operation of the S service units; The service units that send the first failure information are removed from the S service units to obtain the L target service units.

5. The service request allocation method according to claim 1, characterized in that: Each target service unit updates the database master node in the following way: detecting whether second failure information is received, wherein the second failure information indicates that the current database master node has failed, and the second failure information is sent by the current database master node or by a monitoring system configured to monitor operation of the S service units; If the second failure information is received and there is a database slave node in the target service unit located in the first site, upgrading a database slave node in the first site to the updated database master node; If the second failure information is received and the target service unit has no database slave node in the first site, a database slave node in another site connected to the target service unit is selected, and the selected database slave node is upgraded to the updated database master node.

6. The service request allocation method according to claim 1, characterized in that: There are M groups of service units distributed across multiple sites in the multi-site cluster, where one group of service units includes the S service units, wherein the number of application nodes deployed in each service unit is not less than the number of sites connected to the service unit, and the number of deployed database nodes is not less than the number of sites connected to the service unit, and one of the database nodes in each service unit is set as a database master node, and other database nodes other than the database master node are set as database slave nodes.

7. The service request allocation method according to claim 6, characterized in that: When the database slave node and database master node of a service unit are in the same site, the synchronous replication mode is used to synchronize the operation log data, wherein the operation log is the log generated when the service unit processes the service request; when the database slave node and database master node of a service unit are not in the same site, the asynchronous replication mode is used to synchronize the operation log data.

8. A service request deployment system, characterized in that: include: A multi-site cluster consists of N sites, where N is a positive integer; N routing units, each located in a site, each routing unit configured to detect the load of each service unit and the failure status of an application node in the site where the routing unit is located, and to dispatch service requests to the service units in the site; M groups of service units are deployed across multiple sites in the multi-site cluster, where M is a positive integer. A group of service units is deployed across two sites. Application nodes and database nodes are deployed in each service unit. The database nodes include a master database node and a slave database node. When the current database master node fails, a slave database node is upgraded to an updated database master node according to a selection strategy. All application nodes access the database master node in their service unit when providing services.

9. An electronic device, characterized in that: include: a memory storing an executable program; A processor is configured to run the program, wherein the program, when running, executes the service request allocation method according to any one of claims 1 to 7.

10. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the service request allocation method according to any one of claims 1 to 7 are implemented.