Transaction processing request scheduling method and device
By filtering and executing multiple machine screening strategies based on the attribute information of transaction processing requests, the problems of poor request processing flexibility and low success rate in the prior art are solved, and more efficient and flexible request scheduling is achieved.
Patent Information
- Application Number
- CN202411725141.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-21
AI Technical Summary
The prior art has poor flexibility when processing user requests, which is difficult to ensure the success rate of request processing, and lacks correlation with actual user requests.
By receiving transaction processing requests, based on the requested attribute information, multiple matching machine filtering policies and their priorities are obtained from the policy set, these policies are executed in turn to filter out the target machine from the cluster, and the request is scheduled to be processed by the target machine.
It improves the scheduling flexibility and processing efficiency of transaction processing requests, enhances the success rate of request processing, and enables the request to be properly scheduled according to actual conditions.
Smart Images

Figure CN119668800A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for scheduling transaction processing requests. Background Art
[0002] With the development of Internet technology, the number of user requests that servers need to handle has gradually increased. Currently, multiple machines are generally combined into a cluster to provide external services, and the cluster has only one access interface. Under related technologies, a load balancing strategy is adopted to call the access interface to distribute the client's user requests to the specified machines in the cluster. In specific implementation, the current number of requests for each server in the cluster is obtained through polling, and then the user request is forwarded to the server with the least number of requests.
[0003] However, this method always forwards user requests to the server with the least number of current requests, has poor flexibility, lacks relevance to actual user requests, and is difficult to guarantee the success rate of user request processing. Summary of the invention
[0004] The embodiments of the present application provide a method and device for scheduling transaction processing requests, which are used to improve the flexibility of scheduling transaction processing requests, as well as the processing efficiency and success rate of transaction processing requests.
[0005] On the one hand, an embodiment of the present application provides a method for scheduling a transaction processing request, the method comprising:
[0006] receiving a transaction processing request;
[0007] Based on the attribute information of the transaction processing request, obtain N machine screening strategies matching the transaction processing request and priorities of the N machine screening strategies from a strategy set, wherein each machine screening strategy matches at least one machine in the cluster, and N is a positive integer greater than 1;
[0008] Based on the respective priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to screen out target machines from the cluster;
[0009] The transaction processing request is dispatched to the target machine for processing to obtain a transaction processing result.
[0010] Optionally, the executing the N machine screening strategies in sequence based on respective priorities of the N machine screening strategies to screen out target machines from the cluster includes:
[0011] Based on the respective priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to obtain a set of machines screened from the cluster by the N machine screening strategies;
[0012] The machine set corresponding to the machine screening strategy with the highest priority is taken as the reference set. According to the respective priorities of the other N-1 machine screening strategies, the machine sets of the other N-1 machine screening strategies are iterated to intersect with the reference set until the intersection result is one machine, and the one machine is taken as the target machine.
[0013] Optionally, the iteratively intersecting the machine sets of the other N-1 machine screening strategies with the reference set comprises:
[0014] For each of the other N-1 machine screening strategies, perform the following operations:
[0015] Intersecting a machine set of a machine screening strategy with the reference set to obtain an intersection result;
[0016] The reference set is updated to the intersection result.
[0017] Optionally, the executing the N machine screening strategies in sequence based on respective priorities of the N machine screening strategies to screen out target machines from the cluster includes:
[0018] Execute a machine screening strategy with the highest priority, obtain a first machine set screened from the cluster, and use the first machine set as a reference set;
[0019] According to the respective priorities of the other N-1 machine screening strategies, the other N-1 machine screening strategies are executed in sequence; each time a machine screening strategy is executed to screen out a second machine set from the cluster, the second machine set is intersected with the reference set and the reference set is updated, and the process stops when the intersection result is one machine, and the one machine is used as the target machine.
[0020] Optionally, each time a machine screening strategy is executed to screen out a second machine set from the cluster, the intersection of the second machine set and the reference set is calculated and the reference set is updated, including:
[0021] Each time a machine screening strategy is executed to screen out a second machine set from the cluster, the second machine set is intersected with the reference set to obtain an intersection result; and the reference set is updated to the intersection result.
[0022] Optionally, it also includes:
[0023] If the N machine screening policies include a general policy, the general policy is the machine screening policy with the highest priority among the N machine screening policies.
[0024] Optionally, the method further includes: loading the policy set into memory when the service is started.
[0025] Optionally, it also includes:
[0026] If an abnormal machine appears in the cluster, the association between the abnormal machine and the corresponding machine screening policy is released through a script or command, and the abnormal machine is deleted from the to-be-forwarded directory.
[0027] Optionally, it also includes:
[0028] When a new machine appears in the cluster, add the new machine to the to-be-forwarded directory through a script or command;
[0029] If the policy set includes a machine screening policy satisfied by the newly added machine, an association relationship between the newly added machine and the satisfied machine screening policy is established through a script or command;
[0030] If the policy set does not include a machine screening policy satisfied by the newly added machine, a new machine screening policy is configured for the newly added machine through a script or command, and the new machine screening policy is added to the policy set.
[0031] On the one hand, an embodiment of the present application provides a scheduling device for a transaction processing request, the device comprising:
[0032] A receiving module, used for receiving a transaction processing request;
[0033] a processing module, configured to obtain, from a policy set, N machine screening policies that match the transaction processing request and priorities of the N machine screening policies based on the attribute information of the transaction processing request, wherein each machine screening policy matches at least one machine in the cluster, and N is a positive integer greater than 1;
[0034] Based on the respective priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to screen out target machines from the cluster;
[0035] The scheduling module is used to schedule the transaction processing request to the target machine for processing and obtain the transaction processing result.
[0036] Optionally, the processing module is specifically used for:
[0037] Based on the respective priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to obtain a set of machines screened from the cluster by the N machine screening strategies;
[0038] The machine set corresponding to the machine screening strategy with the highest priority is taken as the reference set. According to the respective priorities of the other N-1 machine screening strategies, the machine sets of the other N-1 machine screening strategies are iterated to intersect with the reference set until the intersection result is one machine, and the one machine is taken as the target machine.
[0039] Optionally, the processing module is specifically used for:
[0040] For each of the other N-1 machine screening strategies, perform the following operations:
[0041] Intersecting a machine set of a machine screening strategy with the reference set to obtain an intersection result;
[0042] The reference set is updated to the intersection result.
[0043] Optionally, the processing module is specifically used for:
[0044] Execute a machine screening strategy with the highest priority, obtain a first machine set screened from the cluster, and use the first machine set as a reference set;
[0045] According to the respective priorities of the other N-1 machine screening strategies, the other N-1 machine screening strategies are executed in sequence; each time a machine screening strategy is executed to screen out a second machine set from the cluster, the second machine set is intersected with the reference set and the reference set is updated, and the process stops when the intersection result is one machine, and the one machine is used as the target machine.
[0046] Optionally, the processing module is specifically used for:
[0047] Each time a machine screening strategy is executed to screen out a second machine set from the cluster, the second machine set is intersected with the reference set to obtain an intersection result; and the reference set is updated to the intersection result.
[0048] Optionally, the processing module is further used for:
[0049] If the N machine screening policies include a general policy, the general policy is the machine screening policy with the highest priority among the N machine screening policies.
[0050] Optionally, the processing module is further used for:
[0051] Load the policy set into memory when the service starts
[0052] Optionally, the processing module is further used for:
[0053] If an abnormal machine appears in the cluster, the association between the abnormal machine and the corresponding machine screening policy is released through a script or command, and the abnormal machine is deleted from the to-be-forwarded directory.
[0054] Optionally, the processing module is further used for:
[0055] When a new machine appears in the cluster, add the new machine to the to-be-forwarded directory through a script or command;
[0056] If the policy set includes a machine screening policy satisfied by the newly added machine, an association relationship between the newly added machine and the satisfied machine screening policy is established through a script or command;
[0057] If the policy set does not include a machine screening policy satisfied by the newly added machine, a new machine screening policy is configured for the newly added machine through a script or command, and the new machine screening policy is added to the policy set.
[0058] In one aspect, an embodiment of the present application provides a computer device, including:
[0059] A memory for storing program instructions;
[0060] The processor is used to call the program instructions stored in the memory and execute the steps of the scheduling method for the transaction processing request according to the obtained program.
[0061] On the one hand, an embodiment of the present application provides a computer-readable storage medium storing a computer program executable by a computer device, which, when executed on the computer device, enables the computer to execute the steps of the above-mentioned method for scheduling transaction processing requests.
[0062] On the one hand, an embodiment of the present application provides a computer program product, including a computer program stored on a computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by a computer device, the computer device executes the steps of the scheduling method for the above-mentioned transaction processing request.
[0063] In an embodiment of the present application, multiple matching machine screening strategies are screened based on the attribute information of the transaction processing request, and the priorities of the multiple machine screening strategies are determined. The multiple machine screening strategies are executed in sequence to screen out target machines from the cluster, so as to realize reasonable scheduling of the transaction processing request according to the actual situation of the transaction processing request, so as to schedule the transaction processing request to a suitable target machine for processing, thereby further improving the processing success rate of the transaction processing request while ensuring the processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0065] Figure 1 A system architecture diagram provided for an embodiment of the present invention;
[0066] Figure 2 A flowchart of a method for scheduling a transaction processing request provided in an embodiment of the present application;
[0067] Figure 3 A schematic diagram of the structure of a method for scheduling transaction processing requests provided in an embodiment of the present application;
[0068] Figure 4 A schematic diagram of the structure of a method for scheduling transaction processing requests provided in an embodiment of the present application;
[0069] Figure 5 A schematic diagram of the structure of a scheduling device for transaction processing requests provided in an embodiment of the present application;
[0070] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0071] In order to make the purpose, technical scheme and beneficial effects of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0072] The following is a brief introduction to the system architecture diagram applicable to the technical solution of the embodiment of the present application. It should be noted that the process introduced below is only used to illustrate the embodiment of the present application and is not a limitation.
[0073] refer to Figure 1, which is a system architecture diagram applicable to the embodiment of the present application, the system architecture includes at least a client 101 and a server 102, the number of clients 101 can be one or more, the server 102 includes a load balancer, a policy executor and a server cluster, wherein the load balancer and the policy executor can be located in a server cluster or can be independent of the server cluster. The number of server clusters can be one or more. For example, the server 102 includes cluster A and cluster B, cluster A includes: machine A1, machine A2, ..., machine An, cluster B includes: machine B1, machine B2, ..., machine Bn, wherein n is a positive integer greater than 1, and n in cluster A and n in cluster B may be different.
[0074] This application does not specifically limit the number of server clusters in the client 101 and the server 102.
[0075] The policy executor can save policy configuration information to implement persistent policies; when the server starts, it starts loading policy configuration information; the policy executor can also modify the configuration policy through scripts or commands based on actual conditions.
[0076] The client 101 is pre-installed with an application with transaction functions, which may be a client application, a web application, a mini-program application, etc. The client 101 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart home appliance, a smart voice interaction device, a smart car device, etc., but is not limited thereto.
[0077] The server 102 is the background service of the application. The server 102 is a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms, but is not limited to these.
[0078] It should be noted that the method in the embodiment of the present application can be executed by the server 102 alone, or can be executed by the client 101 and the server 102 together.
[0079] In the embodiment of the present application, the client 101 and the server 102 can be directly or indirectly connected to each other through one or more networks. The network can be a wired network or a wireless network, for example, the wireless network can be a mobile cellular network, or a wireless fidelity (Wireless-Fidelity, WIFI) network, and of course, it can also be other possible networks, which are not limited in the embodiment of the present application.
[0080] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0081] It should be noted that the acquisition, transmission, storage, and use of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations.
[0082] The following is based on Figure 1 The system architecture diagram shown in FIG. 1 shows a flow chart of a scheduling method for a transaction processing request provided in an embodiment of the present application. The flow chart of the scheduling method can be as follows: Figure 1 The server 102 shown executes, Figure 2 As shown, the following steps are included:
[0083] Step 201, receiving a transaction processing request.
[0084] Step 202, based on the attribute information of the transaction processing request, obtain N machine screening policies that match the transaction processing request from the policy set, and the priorities of the N machine screening policies, wherein each machine screening policy matches at least one machine in the cluster, and N is a positive integer greater than 1.
[0085] Specifically, the attribute information of the transaction processing request includes: transaction customer, transaction type, transaction amount, transaction note information, etc., wherein the transaction note information is a special request made by the transaction customer.
[0086] The machine screening strategies in the strategy set are divided into multiple subsets, each of which represents a category in the attribute information, such as a subset containing machine screening strategies related to transaction amounts, each of which contains several machine screening strategies. Priorities are pre-set for multiple subsets, and priorities are also pre-set for several machine screening strategies in the same subset. For the same subset, one machine screening strategy can be obtained, or multiple machine screening strategies can be obtained.
[0087] Specifically, according to various attribute information in the transaction processing request, matching machine screening strategies are respectively obtained from corresponding subsets of the strategy set, and each machine screening strategy matches at least one machine in the cluster.
[0088] In some embodiments, if the N machine screening policies include a common policy, the common policy is the machine screening policy with the highest priority among the N machine screening policies.
[0089] Specifically, the general policy is obtained based on the transaction note information in the transaction processing request, and a machine screening policy that meets the customer's special requirements in the transaction note information is obtained from the policy set. When the general policy is included in multiple machine screening policies that match the transaction processing request, the default general policy is the machine screening policy with the highest priority.
[0090] For example, refer to Figure 3 , the client sends a transaction processing request for transaction X to the server, and the load balancer in the server forwards the transaction processing request for transaction X to the policy executor. After the policy executor receives the transaction processing request for transaction X forwarded by the load balancer, it obtains multiple matching machine screening strategies and their respective priorities from the strategy set in the memory according to the attribute information of the transaction processing request for transaction X. The multiple machine screening strategies matching transaction X are in descending order of priority: general strategy, strategy X1, strategy X2, ..., strategy Xn. The general strategy is a machine screening strategy obtained from the strategy set according to the remark information in transaction X, and has the highest priority.
[0091] The client sends a transaction processing request for transaction Y to the server, and the load balancer in the server forwards the transaction processing request for transaction Y to the policy executor. After receiving the transaction processing request for transaction Y forwarded by the load balancer, the policy executor obtains the matching n machine screening policies and their respective priorities from the policy set in the memory according to the attribute information of the transaction processing request for transaction Y. The n machine screening policies matching transaction Y are in descending order of priority: policy Y1, policy Y2, ..., policy Yn.
[0092] The strategy executor receives two trade requests, namely Figure 3 Transaction X and transaction Y in the transaction; according to the attribute information of transaction X, multiple machine screening strategies matching transaction X (i.e., transaction processing request X) are obtained from the strategy set in the memory, and multiple machine screening strategies matching transaction Y (i.e., transaction processing request Y) are obtained. Among them, the machine screening strategies matching transaction Y include: strategy Y1, strategy Y2, ..., strategy Yn. The digital number is used to represent the priority of the machine screening strategy. The smaller the number, the higher the priority, and the general strategy has the highest priority.
[0093] For example, in the transaction remark information of the transaction processing request, the user proposes that the transaction processing request should be completed within a limited time after receiving the transaction processing request. Then, according to the time limit requirement, a machine screening strategy for load balancing is selected from the strategy set. For example, the content of the machine screening strategy can be: machines with a current machine load rate below 50%. The smaller the load rate of the target machine, the higher the processing efficiency of the target machine, and the shorter the processing time.
[0094] In the embodiment of the present application, a general strategy such as machine load balancing is configured for transaction processing requests based on the special requirements of the user, so as to achieve a relative balance between the shortest processing time and the processing success rate, thereby improving the processing efficiency of transaction processing requests.
[0095] In some embodiments, the policy set is loaded into memory when the service starts.
[0096] Specifically, before the server receives the transaction processing request sent by the client, it preloads the policy set into the memory when starting the load balancing service. When receiving the transaction processing request, it can quickly obtain the machine screening policy that matches the transaction processing request without having to load the relevant machine screening policy according to the transaction processing request, thereby saving time cost.
[0097] In some embodiments, if an abnormal machine appears in the cluster, the association between the abnormal machine and the corresponding machine screening policy is removed through a script or command, and the abnormal machine is deleted from the to-be-forwarded directory.
[0098] Specifically, an abnormal machine can be a machine that has a fault, or a machine whose existing performance no longer meets the processing requirements of the current business, or a machine that has other problems that cannot be immediately located but affect the processing of transaction processing requests. When the machine has the above-mentioned abnormality, at least one machine screening policy associated with the abnormal machine is obtained, the association between the abnormal machine and at least one machine screening policy is removed, and the abnormal machine is deleted from the to-be-forwarded directory. The to-be-forwarded directory contains the identification information of all machines that are currently operating normally except the abnormal machine, and the identification information can uniquely specify a machine.
[0099] In some embodiments, when a new machine appears in the cluster, the new machine is added to the to-be-forwarded directory through a script or command; if the policy set contains a machine screening policy that the new machine satisfies, an association relationship between the new machine and the satisfied machine screening policy is established through the script or command.
[0100] If the policy set does not contain a machine filtering policy that is satisfied by the newly added machine, a new machine filtering policy is configured for the newly added machine through a script or command, and the new machine filtering policy is added to the policy set.
[0101] Specifically, when a new machine appears in an existing cluster, or a new cluster appears based on an existing cluster, identification information of the new machine or multiple machines in the new cluster is added to the to-be-forwarded directory through a script or command.
[0102] If the policy set contains a machine filtering policy for the newly added machine, an association with the newly added machine is established in the machine filtering policy through a script or command. If there is no machine filtering policy that the newly added machine satisfies in the policy set, a new machine filtering policy is configured for the newly added machine based on the performance of the newly added machine, and the new machine filtering policy is added to the policy set. Each time the server is started, the updated policy set is loaded into memory. The performance of the newly added machine includes: processing power, storage capacity, response time, throughput, number of concurrent connections, CPU usage, etc.
[0103] In addition, although the CPU, database, etc. of the newly added machine or the newly added cluster are different from those of the machines in the existing cluster, they follow the same network protocol.
[0104] For example, the server can also modify the pre-configured policy through scripts or commands, including: when an abnormal machine appears in the cluster, the association between the abnormal machine and the corresponding machine screening policy is removed through the script or command, and the abnormal machine is deleted from the directory to be forwarded.
[0105] When a new machine appears in an existing cluster (such as Figure 1 The machines in cluster A are An) or a new cluster appears (such as Figure 1 Cluster B in the new group), add the newly added machine or the machine in the newly added group to the to-be-forwarded directory; if the current policy set contains a machine filtering policy that satisfies the conditions for the newly added machine or the machine in the newly added cluster, create a new association relationship between the machine filtering policy and the newly added machine (or the machine in the newly added cluster); if the current policy set contains no machine filtering policy that satisfies the conditions for the newly added machine (or the machine in the newly added cluster), configure a new machine filtering policy for the newly added machine based on the performance of the newly added machine, and add the new machine filtering policy to the policy set, so that the updated policy set can be loaded into the memory when the server is started next time.
[0106] In addition, each updated policy set is stored in a specified file or database in the form of agreed structured data to achieve Figure 1 The operation of the persistence strategy in the machine screening strategy, where the structured data format of the machine screening strategy is the same as the structured data format of the server, is simple and easy to use.
[0107] In an embodiment of the present application, the association between the abnormal machine and the corresponding machine screening policy is released, and the abnormal machine is deleted from the to-be-forwarded directory, thereby ensuring the security of the transaction processing request; the machine screening policy is modified or added for the newly added machine or the machine in the newly added cluster, and the newly added machine is added to the to-be-forwarded directory, thereby realizing the quick plug-in and unplug-out of the machine and reducing the maintenance cost.
[0108] Step 203 : Based on the priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to screen out target machines from the cluster.
[0109] In some embodiments, based on the respective priorities of N machine screening strategies, the N machine screening strategies are executed in sequence to obtain machine sets screened from the cluster by each of the N machine screening strategies; the machine set corresponding to the machine screening strategy with the highest priority is used as a reference set, and according to the respective priorities of the other N-1 machine screening strategies, the machine sets of the other N-1 machine screening strategies are iteratively intersected with the reference set until the intersection result is one machine, and the one machine is used as the target machine.
[0110] In some embodiments, the process of iterating and intersecting the machine sets of the other N-1 machine screening strategies with the reference set is:
[0111] For each machine set of the other N-1 machine screening strategies, the following operations are performed respectively: the machine set of a machine screening strategy is intersected with the reference set to obtain an intersection result; and the reference set is updated to the intersection result.
[0112] For example, refer to Figure 3 For the transaction processing request of transaction X in, taking n as 2 as an example, multiple machine screening strategies are executed respectively according to the priorities of multiple machine screening strategies matching transaction X, and the machine set screened by the general strategy is [machine 1, machine 2, machine 3], the machine set screened by strategy X1 is [machine 2], and the machine set screened by strategy X2 is [machine 2, machine 3].
[0113] The machine set selected by the general strategy with the highest priority is used as the reference set, that is, the reference set is [machine 1, machine 2, machine 3]; the machine set [machine 2] selected by strategy X1 is intersected with the reference set [machine 1, machine 2, machine 3], and the intersection result is [machine 2]. Since the intersection result at this time is one machine, that is, machine 2, the operation of intersecting the machine set of the remaining machine screening strategy with the reference set is stopped, and machine 2 is used as the target machine.
[0114] In some embodiments, the machine screening strategy with the highest priority is executed to obtain a first set of machines screened from the cluster, and the first set of machines is used as a reference set; the other N-1 machine screening strategies are executed in sequence according to their respective priorities; each time a machine screening strategy is executed to screen a second set of machines from the cluster, the second set of machines is intersected with the reference set and the reference set is updated, and the process stops when the intersection result is one machine, and one machine is used as the target machine.
[0115] In some embodiments, each time a machine screening strategy is executed to screen out a second machine set from the cluster, the second machine set is intersected with the reference set to obtain an intersection result; and the reference set is updated to the intersection result.
[0116] For example, refer to Figure 3 Transaction Y in transaction processing request, if n is 5, there are 5 machine screening strategies matching transaction Y. The smaller the number of machine screening strategies, the higher the priority. Execute strategy Y1 to get the corresponding first machine set [machine 1, machine 2, machine 3, machine 4, machine 5], and use this machine set as the reference set. Execute strategy Y2 to get the corresponding second machine set [machine 1, machine 2, machine 3]. Intersect the second machine set with the reference set to get the intersection result [machine 1, machine 2, machine 3]. Update the reference set to the intersection result, that is, the reference set is [machine 1, machine 2, machine 3].
[0117] Execute strategy Y3 to obtain the corresponding third machine set [machine 3, machine 4, machine 5]. Intersect the third machine set with the updated reference set to obtain the intersection result of [machine 3]. At this time, stop executing the remaining machine screening strategies and use machine 3 as the target machine.
[0118] Step 204, dispatching the transaction processing request to the target machine for processing, and obtaining the transaction processing result.
[0119] Specifically, the policy executor returns the execution result (i.e., the identification information of the target machine) to the request load balancer. The load balancer dispatches the transaction processing request to the target machine for processing based on the identification information of the target machine. The target machine returns the processing result to the load balancer, and the load balancer returns the processing result of the transaction request processing to the client.
[0120] In an embodiment of the present application, multiple matching machine screening strategies are screened based on the attribute information of the transaction processing request, and the priorities of the multiple machine screening strategies are determined. The multiple machine screening strategies are executed in sequence to screen out the target machines from the cluster. The transaction processing request can be reasonably scheduled according to the specified elements in the transaction processing request, and the transaction processing request can be scheduled to a suitable machine for processing, thereby further improving the processing success rate of the transaction processing request while ensuring the processing efficiency.
[0121] In some embodiments, the present application takes into account that modifying the common components in the server will affect the load of other components. Therefore, based on the original server, an enterprise-level load balancer is added, and the original load balancer and policy executor are set in a server cluster. The server cluster executes the transaction processing request scheduling operation, including scheduling the transaction processing request to the machine in the newly added cluster.
[0122] For example, refer to Figure 4 The server includes an enterprise-level load balancer, cluster A, and cluster B. Cluster B is a newly added cluster and includes multiple machines, such as machine B1, machine B2, ..., machine Bn. Cluster A includes: a load balancer, a policy executor, and multiple machines, such as machine A1, machine A2, ..., machine An.
[0123] The client sends a transaction processing request to the enterprise-level load balancer on the server side. The enterprise-level load balancer forwards the transaction processing request to the load balancer in cluster A, which then forwards the transaction processing request to the policy executor. The policy executor obtains N machine screening policies and their respective priorities that match the transaction processing request from the policy set pre-loaded into the memory. The N machine screening policies are executed in sequence according to the priority, the target machine is screened out, and the result is returned to the load balancer in cluster A. The load balancer dispatches the transaction processing request to the target machine for processing based on the result. The target machine can be a machine in cluster A or a machine in the newly added cluster B.
[0124] Among them, when an abnormal machine appears in cluster A or cluster B, the association between the abnormal machine and the corresponding machine screening policy is released; when a new machine appears in cluster A or other new clusters appear, the new machine or the machines in the other new clusters are added to the to-be-forwarded directory; if there is a machine screening policy that satisfies the conditions for the new machine or the machines in the other new clusters in the current policy set, a new association relationship between the machine screening policy and the new machine (or the machines in the other new clusters) is created; if there is no machine screening policy that satisfies the conditions for the new machine (or the machines in the other new clusters) in the current policy set, a new machine screening policy is configured for the new machine according to the performance of the new machine, and the new machine screening policy is added to the policy set, so that the updated policy set can be loaded into the memory when the server is started next time.
[0125] The updated machine screening strategy is saved as agreed structured data to a specified file or database.
[0126] In an embodiment of the present application, multiple matching machine screening strategies are screened based on the attribute information of the transaction processing request, and the priorities of the multiple machine screening strategies are determined. The multiple machine screening strategies are executed in sequence to screen out target machines from the cluster, which can achieve reasonable scheduling of transaction processing requests and further improve the processing success rate of transaction processing requests while ensuring processing efficiency.
[0127] Secondly, in the process of executing the machine screening strategy and screening out the target machines, a reference set is set, and the machine sets of the other N-1 machine screening strategies are intersected with the reference set. The intersection operation is stopped until the intersection result is one machine, or the machine set obtained by executing each machine screening strategy is intersected with the reference set until the intersection result is one machine, and the remaining machine screening strategies are stopped, so as to dispatch the transaction processing request to the appropriate target machine for processing, while reducing the execution cost of the server and reducing resource waste.
[0128] Based on the same technical concept, the present application embodiment provides a structural diagram of a scheduling device for transaction processing requests, such as Figure 5 As shown, the transaction processing request scheduling device 500 includes:
[0129] Receiving module 501, used for receiving a transaction processing request;
[0130] A processing module 502 is configured to obtain, from a policy set, N machine screening policies that match the transaction processing request and priorities of the N machine screening policies based on the attribute information of the transaction processing request, wherein each machine screening policy matches at least one machine in the cluster, and N is a positive integer greater than 1;
[0131] Based on the respective priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to screen out target machines from the cluster;
[0132] The scheduling module 503 is used to schedule the transaction processing request to the target machine for processing to obtain the transaction processing result.
[0133] Optionally, the processing module 502 is specifically configured to:
[0134] Based on the respective priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to obtain a set of machines screened from the cluster by the N machine screening strategies;
[0135] The machine set corresponding to the machine screening strategy with the highest priority is taken as the reference set. According to the respective priorities of the other N-1 machine screening strategies, the machine sets of the other N-1 machine screening strategies are iterated to intersect with the reference set until the intersection result is one machine, and the one machine is taken as the target machine.
[0136] Optionally, the processing module 502 is specifically configured to:
[0137] For each of the other N-1 machine screening strategies, perform the following operations:
[0138] Intersecting a machine set of a machine screening strategy with the reference set to obtain an intersection result;
[0139] The reference set is updated to the intersection result.
[0140] Optionally, the processing module 502 is specifically configured to:
[0141] Execute a machine screening strategy with the highest priority, obtain a first machine set screened from the cluster, and use the first machine set as a reference set;
[0142] According to the respective priorities of the other N-1 machine screening strategies, the other N-1 machine screening strategies are executed in sequence; each time a machine screening strategy is executed to screen out a second machine set from the cluster, the second machine set is intersected with the reference set and the reference set is updated, and the process stops when the intersection result is one machine, and the one machine is used as the target machine.
[0143] Optionally, the processing module 502 is specifically configured to:
[0144] Each time a machine screening strategy is executed to screen out a second machine set from the cluster, the second machine set is intersected with the reference set to obtain an intersection result; and the reference set is updated to the intersection result.
[0145] Optionally, the processing module 502 is further configured to:
[0146] If the N machine screening policies include a general policy, the general policy is the machine screening policy with the highest priority among the N machine screening policies.
[0147] Optionally, the processing module 502 is further configured to:
[0148] Load the policy set into memory when the service starts
[0149] Optionally, the processing module 502 is further configured to:
[0150] If an abnormal machine appears in the cluster, the association between the abnormal machine and the corresponding machine screening policy is released through a script or command, and the abnormal machine is deleted from the to-be-forwarded directory.
[0151] Optionally, the processing module 502 is further configured to:
[0152] When a new machine appears in the cluster, add the new machine to the to-be-forwarded directory through a script or command;
[0153] If the policy set includes a machine screening policy satisfied by the newly added machine, an association relationship between the newly added machine and the satisfied machine screening policy is established through a script or command;
[0154] If the policy set does not include a machine screening policy satisfied by the newly added machine, a new machine screening policy is configured for the newly added machine through a script or command, and the new machine screening policy is added to the policy set.
[0155] In an embodiment of the present application, multiple matching machine screening strategies are screened based on the attribute information of the transaction processing request, and the priorities of the multiple machine screening strategies are determined. The multiple machine screening strategies are executed in sequence to screen out the target machines from the cluster. The transaction processing request can be reasonably scheduled according to the specified elements in the transaction processing request, and the transaction processing request can be scheduled to a suitable machine for processing, thereby further improving the processing success rate of the transaction processing request while ensuring the processing efficiency.
[0156] Based on the same technical concept, the embodiment of the present application provides a computer device, which can be Figure 1 The server shown, such as Figure 6As shown, it includes at least one processor 601 and a memory 602 connected to the at least one processor. The specific link medium between the processor 601 and the memory 602 is not limited in the embodiment of the present application. Figure 6 For example, the processor 601 and the memory 602 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0157] In the embodiment of the present application, the memory 602 stores instructions executed by at least one processor 601, and the at least one processor 601 can execute the steps of the scheduling method of the above-mentioned transaction processing request by executing the instructions stored in the memory 602.
[0158] The processor 601 is the control center of the computer device, and can use various interfaces and lines to connect various parts of the computer device, and realize the scheduling of transaction processing requests by running or executing instructions stored in the memory 602 and calling data stored in the memory 602. Optionally, the processor 601 may include one or more processing modules, and the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.
[0159] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.
[0160] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 602 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 602 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer device, but is not limited thereto. The memory 602 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0161] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program executable by a computer device. When the program runs on the computer device, the computer device executes the steps of the scheduling method for the above-mentioned transaction processing request.
[0162] Based on the same inventive concept, an embodiment of the present application provides a computer program product, including a computer program stored on a computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by a computer device, the computer device executes the steps of the scheduling method for the above-mentioned transaction processing request.
[0163] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0164] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0165] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0166] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0167] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for scheduling transaction processing requests, characterized in that: include: receiving transaction processing requests; Based on the attribute information of the transaction processing request, obtain N machine screening strategies matching the transaction processing request and priorities of the N machine screening strategies from a strategy set, wherein each machine screening strategy matches at least one machine in the cluster, and N is a positive integer greater than 1; Based on the respective priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to screen out target machines from the cluster; The transaction processing request is dispatched to the target machine for processing to obtain a transaction processing result.
2. The method according to claim 1, characterized in that The executing the N machine screening strategies in sequence based on respective priorities of the N machine screening strategies to screen out target machines from the cluster includes: Based on the respective priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to obtain a set of machines screened from the cluster by the N machine screening strategies; The machine set corresponding to the machine screening strategy with the highest priority is taken as the reference set. According to the respective priorities of the other N-1 machine screening strategies, the machine sets of the other N-1 machine screening strategies are iterated to intersect with the reference set until the intersection result is one machine, and the one machine is taken as the target machine.
3. The method according to claim 2, characterized in that The iteratively intersecting the machine sets of the other N-1 machine screening strategies with the reference set comprises: For each of the other N-1 machine screening strategies, perform the following operations: Intersecting a machine set of a machine screening strategy with the reference set to obtain an intersection result; The reference set is updated to the intersection result.
4. The method according to claim 1, characterized in that The executing the N machine screening strategies in sequence based on respective priorities of the N machine screening strategies to screen out target machines from the cluster includes: Execute a machine screening strategy with the highest priority, obtain a first machine set screened from the cluster, and use the first machine set as a reference set; According to the respective priorities of the other N-1 machine screening strategies, the other N-1 machine screening strategies are executed in sequence; each time a machine screening strategy is executed to screen out a second machine set from the cluster, the second machine set is intersected with the reference set and the reference set is updated, and the process stops when the intersection result is one machine, and the one machine is used as the target machine.
5. The method according to claim 4, characterized in that The step of performing each machine screening strategy to screen out a second machine set from the cluster, finding an intersection between the second machine set and the reference set, and updating the reference set includes: Each time a machine screening strategy is executed to screen out a second machine set from the cluster, the second machine set is intersected with the reference set to obtain an intersection result; and the reference set is updated to the intersection result.
6. The method according to claim 1, characterized in that Also includes: If the N machine screening policies include a general policy, the general policy is the machine screening policy with the highest priority among the N machine screening policies.
7. The method according to any one of claims 1 to 6, characterized in that: Also includes: The policy set is loaded into memory when the service starts.
8. The method according to claim 7, characterized in that Also includes: If an abnormal machine appears in the cluster, the association between the abnormal machine and the corresponding machine screening policy is released through a script or command, and the abnormal machine is deleted from the to-be-forwarded directory.
9. The method according to claim 7, characterized in that Also includes: When a new machine appears in the cluster, add the new machine to the to-be-forwarded directory through a script or command; If the policy set includes a machine screening policy satisfied by the newly added machine, an association relationship between the newly added machine and the satisfied machine screening policy is established through a script or command; If the policy set does not include a machine screening policy satisfied by the newly added machine, a new machine screening policy is configured for the newly added machine through a script or command, and the new machine screening policy is added to the policy set.
10. A scheduling device for transaction processing requests, characterized in that: include: A receiving module, used for receiving a transaction processing request; a processing module, configured to obtain, from a policy set, N machine screening policies that match the transaction processing request and priorities of the N machine screening policies based on the attribute information of the transaction processing request, wherein each machine screening policy matches at least one machine in the cluster, and N is a positive integer greater than 1; Based on the respective priorities of the N machine screening strategies, the N machine screening strategies are executed in sequence to screen out target machines from the cluster; The scheduling module is used to schedule the transaction processing request to the target machine for processing and obtain the transaction processing result.
11. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of any one of the methods of claims 1 to 9 are implemented.
12. A computer-readable storage medium, characterized in that: It stores a computer program executable by a computer device. When the program is run on the computer device, the computer device executes the steps of any method described in claims 1 to 9.
13. A computer program product, characterized in that The computer program product comprises a computer program stored on a computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a computer device, the computer device is caused to execute the steps of the method according to any one of claims 1 to 9.