Service request scheduling method, device, equipment, medium and program product
By storing business requests in a complete binary tree structure and processing them asynchronously using multiple threads, and combining semantic recognition and a rule engine to determine scheduling parameters, the problem of hardware resource pressure and inefficiency under massive concurrent requests is solved, achieving efficient and fast business request scheduling.
Patent Information
- Application Number
- CN202511708541.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2026-02-24
AI Technical Summary
Existing technologies, when handling massive concurrent business requests, lead to increased pressure on hardware resources, low scheduling efficiency for the highest priority business requests, and slow system response speed.
The system uses a complete binary tree structure to store business requests and scheduling parameters. It determines scheduling parameters through semantic recognition and a rule engine, uses a multi-threaded asynchronous processing mechanism to schedule business requests according to priority, and introduces lifecycle management and asynchronous polling query mechanisms to handle risky and suspicious transactions.
It improved the scheduling efficiency and response speed of business requests, optimized the utilization of hardware resources, reduced manual intervention, adapted to diverse requests, avoided resource idleness and bottlenecks, and ensured the timely processing of critical requests.
Smart Images

Figure CN121560481A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of big data technology, specifically to the field of data storage technology, and more specifically to a business request scheduling method, apparatus, device, medium, and program product. Background Technology
[0002] With the rapid development of information technology, various business systems, especially those in financial transactions, IoT data processing, and cloud computing task scheduling, face massive concurrent business requests. These requests often have different levels of importance, urgency, and resource requirements. Therefore, prioritizing these requests to ensure timely response and efficient processing of critical business operations is of paramount importance.
[0003] However, when dealing with massive concurrent business requests, existing technologies, whether maintaining multiple queues, performing full scans of lists, or inserting into linked lists, may lead to unnecessary hardware processor computation or memory overhead. This is especially true when the number of requests is large, which significantly increases the pressure on hardware resources. At the same time, existing technologies are inefficient in scheduling and processing the highest priority business requests, resulting in a slow overall system response speed. Summary of the Invention
[0004] In view of the above problems, this application provides a service request scheduling method, apparatus, device, medium and program product.
[0005] According to a first aspect of this application, a business request scheduling method is provided, comprising: responding to a user-initiated business request, determining scheduling parameters corresponding to the business request based on the business type of the business request, wherein the scheduling parameters represent the priority of the business request being scheduled; encapsulating the business request and the scheduling parameters into node objects and storing them in a preset storage structure, wherein the preset storage structure is a complete binary tree, the complete binary tree being configured to adjust the position of the node objects according to the size of the scheduling parameters, such that the priority represented by the scheduling parameters of the parent node is higher than that of the child node; and scheduling the business requests corresponding to each node object according to the priority order represented by the scheduling parameters, starting from the root node of the complete binary tree.
[0006] According to an embodiment of this application, determining the scheduling parameters corresponding to a business request based on the business type of the business request includes: performing semantic recognition on the business request and extracting keywords that can characterize the urgency of the business; determining the business type corresponding to the business request based on the keywords; and determining the scheduling parameters corresponding to the business request based on the business type using a preset rule engine.
[0007] According to an embodiment of this application, determining the scheduling parameters corresponding to a service request based on the service type of the service request further includes: determining the initiation time corresponding to the service request based on the timestamp of the service request; and jointly determining the scheduling parameters corresponding to the service request based on the initiation time and the service type.
[0008] According to an embodiment of this application, the service request and scheduling parameters are encapsulated as node objects and stored in a preset storage structure, including: inserting the node object into the last position of the complete binary tree and comparing the size of the scheduling parameters corresponding to the node object and the node object's parent node; in response to the node object's priority being greater than the parent node's priority, swapping the positions of the node object and the parent node; re-comparing the size of the scheduling parameters corresponding to the node object and the new parent node after the swap, until the node object reaches the root node, or the node object's priority is less than or equal to the parent node's priority.
[0009] According to an embodiment of this application, starting from the root node of a complete binary tree, business requests corresponding to each node object are scheduled according to the priority order represented by the scheduling parameters, including: starting from the root node of the complete binary tree, using a multi-threaded asynchronous processing mechanism, business requests corresponding to each node object are synchronously scheduled according to the priority order represented by the scheduling parameters.
[0010] According to an embodiment of this application, the method further includes: updating the status of the service request based on the scheduling result of the service request; and performing corresponding handling measures based on the status of the service request.
[0011] According to an embodiment of this application, based on the status of the business request, corresponding handling measures are performed, including: in response to the business request being a risk-sharing transaction, the risk-sharing transaction is re-inserted into the complete binary tree for storage.
[0012] According to an embodiment of this application, the corresponding handling measures are executed based on the status of the business request, and the method further includes: in response to the business request being a suspicious transaction, using an asynchronous polling query mechanism to poll and query the suspicious transaction to confirm the true status of the suspicious transaction.
[0013] A second aspect of this application provides a service request scheduling device, comprising: a determining module, configured to, in response to a user-initiated service request, determine scheduling parameters corresponding to the service request based on the service type of the service request, wherein the scheduling parameters represent the priority of the service request being scheduled; a storage module, configured to encapsulate the service request and the scheduling parameters into node objects and store them in a preset storage structure, wherein the preset storage structure is a complete binary tree, and the complete binary tree is configured to adjust the position of the node objects according to the size of the scheduling parameters, such that the priority represented by the scheduling parameters of the parent node is higher than that of the child node; and a scheduling module, configured to, starting from the root node of the complete binary tree, schedule the service requests corresponding to each node object in order of priority represented by the scheduling parameters.
[0014] A third aspect of this application provides an electronic device comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.
[0015] A fourth aspect of this application also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.
[0016] The fifth aspect of this application also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method. Attached Figure Description
[0017] The above-mentioned contents, other objects, features and advantages of this application will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0018] Figure 1 This diagram illustrates an application scenario of the service request scheduling method according to an embodiment of this application.
[0019] Figure 2 A flowchart illustrating a service request scheduling method according to an embodiment of this application is shown schematically.
[0020] Figure 3 This schematic diagram illustrates the principle of inserting node objects into a min-heap according to an embodiment of this application;
[0021] Figure 4 The schematic diagram illustrates the principle of a service request scheduling method according to an embodiment of this application;
[0022] Figure 5 This schematically illustrates a structural block diagram of a service request scheduling apparatus according to an embodiment of this application; and
[0023] Figure 6 A block diagram of an electronic device suitable for implementing a service request scheduling method according to an embodiment of this application is illustrated schematically. Detailed Implementation
[0024] The embodiments of this application will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this application. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this application for ease of explanation. However, it will be apparent that one or more embodiments may be implemented without these specific details. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.
[0025] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0026] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0027] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0028] It should be noted that the business request scheduling method and apparatus of this application can be used in the field of financial technology for business request scheduling, and can also be used in any field other than financial technology for business request scheduling. The application field of the business request scheduling method and apparatus of this application is not limited.
[0029] In the technical solution of this application, the user information (including but not limited to user personal information, user image information, user device information, such as location information) and data (including but not limited to data used for analysis, stored data, and displayed data) involved are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of related data all comply with relevant laws, regulations, and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse.
[0030] In scenarios involving automated decision-making using personal information, the methods, devices, and systems provided in this application all offer users corresponding entry points for choosing to agree to or reject the automated decision-making results. If the user chooses to reject, the process proceeds to the expert decision-making stage. Here, "automated decision-making" refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests, or economic, health, and credit status through computer programs, and then making a decision. Here, "expert decision-making" refers to the activity of making decisions by personnel who specialize in a particular field, possess specialized experience, knowledge, and skills, and have reached a certain level of professional expertise.
[0031] Embodiments of this application provide a service request scheduling method, comprising: responding to a user-initiated service request, determining scheduling parameters corresponding to the service request based on the service type of the service request, wherein the scheduling parameters represent the priority of the service request being scheduled; encapsulating the service request and the scheduling parameters into node objects and storing them in a preset storage structure, wherein the preset storage structure is a complete binary tree, the complete binary tree is configured to adjust the position of the node objects according to the size of the scheduling parameters, such that the priority represented by the scheduling parameters of the parent node is higher than that of the child node; starting from the root node of the complete binary tree, scheduling the service requests corresponding to each node object according to the priority order represented by the scheduling parameters.
[0032] Figure 1 The diagram illustrates an application scenario of the service request scheduling method according to an embodiment of this application.
[0033] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, and a third terminal device 103. Network 104 serves as a medium for providing communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0034] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0035] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0036] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0037] It should be noted that the service request scheduling method provided in this application embodiment can generally be executed by server 105. Correspondingly, the service request scheduling device provided in this application embodiment can generally be located in server 105. The service request scheduling method provided in this application embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the service request scheduling device provided in this application embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.
[0038] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0039] The following will be based on Figure 1 The described scene, through Figures 2-4 The service request scheduling method according to the embodiments of this application will be described in detail.
[0040] Figure 2 A flowchart illustrating a service request scheduling method according to an embodiment of this application is shown.
[0041] like Figure 2 As shown, the service request scheduling method of this embodiment includes operations S210 to S230, and the service request scheduling method can be executed by the server.
[0042] In operation S210, in response to a user-initiated service request, the scheduling parameters corresponding to the service request are determined based on the service type of the service request. The scheduling parameters represent the priority at which the service request is scheduled.
[0043] In operation S220, business requests and scheduling parameters are encapsulated into node objects and stored in a preset storage structure. The preset storage structure is a complete binary tree, which is configured to adjust the position of the node objects according to the size of the scheduling parameters, so that the priority represented by the scheduling parameters of the parent node is higher than that of the child node.
[0044] In operation S230, starting from the root node of the complete binary tree, the business requests corresponding to each node object are scheduled according to the priority order represented by the scheduling parameters.
[0045] A min-heap is a special type of complete binary tree data structure that satisfies the following two main properties:
[0046] (1) Structure: Except for the last layer, all other layers are completely filled, and all nodes in the last layer are arranged as far to the left as possible.
[0047] (2) Heap order: The value of each node object in the tree is less than or equal to the value of its child nodes, which means that the root node of the tree always stores the minimum value among all elements in the heap.
[0048] Simply put, a min-heap is like a "container" that automatically puts the smallest element at the top. When the system needs to frequently retrieve the smallest element, a min-heap is very efficient.
[0049] In the embodiments of this application, when a user initiates a service request, the system receives all relevant information about that service request.
[0050] For example, this business request could specifically be a transaction request. When a user initiates a transaction (such as a transfer, payment, or query) through a front-end interface, application programming interface (API), or other means, the system first receives this request.
[0051] Next, the system extracts all the core data required to process the transaction from the request, including but not limited to: transaction type (such as emergency transfer, normal transfer, batch deduction), transaction amount, payee and payee information, request timestamp, user ID, etc. Then, based on the transaction type, it determines the scheduling parameters corresponding to the business request. These scheduling parameters reflect the priority of the business request; the smaller the scheduling parameter, the higher the priority, and the larger the scheduling parameter, the lower the priority.
[0052] To implement priority handling, this business request will not directly enter a simple queue. Instead, it will be "wrapped" together with the scheduling parameters into a node object with a priority identifier, i.e., a heap element, and then inserted into a min-heap.
[0053] Because a min-heap has the characteristic that the root node always maintains the minimum value, during the insertion process, the min-heap will automatically adjust the position of the current node object according to the size of the scheduling parameters, so that the priority represented by the scheduling parameters corresponding to the parent node is higher than that of the child node (that is, the value of the parent node is less than or equal to the value of its child node). In this way, it can be guaranteed that the root node of the min-heap is always the highest priority business among all pending business requests.
[0054] Finally, starting from the root node of the min-heap, the business requests corresponding to each node object are scheduled according to the priority order represented by the scheduling parameters to complete the business processing.
[0055] According to the embodiments of this application, a complete binary tree (min-heap) is introduced as the preset storage structure to realize priority processing of business requests. Since the min-heap has the characteristic that the root node always keeps the minimum value, this application uses the scheduling parameters that can represent the priority of business requests to fill the min-heap, that is, the scheduling parameters are used as the sorting basis of the min-heap, ensuring that the root node of the min-heap is always the highest priority business among all the business requests to be processed. In this way, the system can efficiently retrieve the highest priority business request from the root node for scheduling and processing, which greatly improves the scheduling efficiency and response speed of business requests.
[0056] In this embodiment of the application, operation S210 determines the scheduling parameters corresponding to the service request based on the service type of the service request, which may include, for example:
[0057] Semantic recognition is performed on business requests to extract keywords that can represent the urgency of the business; based on the keywords, the business type corresponding to the business request is determined; based on the business type, the scheduling parameters corresponding to the business request are determined using a preset rule engine.
[0058] In this embodiment, semantic recognition and a rule engine are introduced to achieve automated and intelligent determination of business request scheduling parameters.
[0059] For example, when a user initiates a business request, the system's built-in Natural Language Processing (NLP) module can perform semantic recognition on the user's input request description (such as "Please transfer 10,000 yuan to Zhang immediately").
[0060] The natural language processing module extracts keywords such as "immediately" and "urgent" to determine the urgency of the request. It also identifies "transfer" as the business type.
[0061] Based on this information, the scheduling parameters can be determined using a pre-defined rules engine.
[0062] In this embodiment of the application, the rule engine can be, for example:
[0063] If the scheduling parameter for "Emergency Transfer" is 1, "Normal Transfer" is 5, and "Account Inquiry" is 10, then the scheduling parameter for the current "Emergency Transfer" request is 1.
[0064] According to embodiments of this application, the introduction of semantic recognition and a rule engine enables more precise identification of the true urgency and type of business requests, making priority allocation more aligned with actual business needs. It also reduces reliance on manual intervention and a large number of pre-set fixed rules, allowing the system to more intelligently adapt to diverse requests.
[0065] In this embodiment of the application, operation S210 determines the scheduling parameters corresponding to the service request based on the service type of the service request, and may further include, for example:
[0066] Based on the timestamp of the business request, determine the initiation time of the business request; based on the initiation time and the business type, jointly determine the scheduling parameters corresponding to the business request.
[0067] In this embodiment of the application, in addition to determining the primary priority based on the business type, the request initiation time is introduced as the basis for determining the secondary (or composite) priority.
[0068] This means that when two transactions have the same primary priority of "transaction type", the request time can be used as a secondary sorting criterion. Generally, the earlier the request time, the higher the priority.
[0069] For example, after user A initiates a business request, user B then initiates an "emergency transfer" request.
[0070] The system records the initiation time of user A's request (e.g., T1) and the initiation time of user B's request (e.g., T2, where T2 is slightly later than T1).
[0071] Assuming both requests have the same business type and urgency, the base value of the scheduling parameter is 1. However, the system will fine-tune the scheduling parameter or use it as a secondary sorting criterion based on the initiation time. For example, the final scheduling parameter might be defined as the primary priority parameter plus (initiation time in milliseconds / constant). Alternatively, when comparing requests, if the primary priority parameters are the same, the initiation time will be compared, thus giving priority to requests initiated at time T1 over requests initiated at time T2.
[0072] According to embodiments of this application, the request initiation time is introduced as a basis for determining secondary (or composite) priorities. This solves the blind spot where relying solely on business type may lead to an inability to distinguish priorities among similar requests, thus avoiding the "starvation" phenomenon of requests with the same priority. For requests of equal importance, requests initiated earlier by users can be processed first, which aligns with users' intuitive expectations.
[0073] In this embodiment, operation S220 encapsulates the service request and scheduling parameters into node objects and stores them using a preset storage structure, which may include, for example:
[0074] Insert the node object into the last position of the complete binary tree and compare the scheduling parameters of the node object with those of its parent node; in response to the node object's priority being greater than that of its parent node, swap the positions of the node object and its parent node; re-compare the scheduling parameters of the swapped node object with those of its new parent node, until the node object reaches the root node, or the node object's priority is less than or equal to that of its parent node.
[0075] In this embodiment, the "float" insertion operation of the min-heap is clearly defined, which ensures that the structure and heap order (parent node priority is higher than child node) of the complete binary tree are maintained after inserting a new element. See details below. Figure 3 As shown.
[0076] Figure 3 The schematic diagram illustrates the principle of inserting a node object into a min-heap according to an embodiment of this application.
[0077] like Figure 3 As shown, the node object is first placed at the last position in the heap represented by the array.
[0078] Then, the system begins the Heapify Up operation:
[0079] Compare the node object (e.g., with a scheduling parameter of 1) with its parent node (assuming its parent node is a "normal transfer" with a scheduling parameter of 5).
[0080] Since 1 < 5 (higher priority), the two are swapped.
[0081] The node object is now in a new position, and the system continues to compare it with the new parent node (let's say it's a "large payment" with a scheduling parameter of 3).
[0082] Since 1 < 3, the two are swapped again.
[0083] This process continues until the node object reaches the root node (because it has the highest priority) or encounters a parent node with a higher priority (smaller scheduling parameters), at which point it stops floating up.
[0084] According to embodiments of this application, the "floating" insertion operation ensures that the root node of the heap is always the highest priority element, laying the foundation for efficient scheduling. Furthermore, the time complexity of the insertion operation is far superior to linear scanning or linked list traversal, guaranteeing that new requests can be quickly enqueued in high-concurrency scenarios.
[0085] In this embodiment of the application, operation S230 starts from the root node of the complete binary tree and schedules the business requests corresponding to each node object according to the priority order represented by the scheduling parameters. For example, it may include:
[0086] Starting from the root node of the complete binary tree, the business requests corresponding to each node object are synchronously scheduled according to the priority order represented by the scheduling parameters using a multi-threaded asynchronous processing mechanism.
[0087] In this embodiment, a multi-threaded asynchronous processing mechanism is introduced to perform scheduling.
[0088] For example, the system can start a thread pool containing multiple worker threads that asynchronously retrieve node objects from the root node of a complete binary tree.
[0089] When a thread acquires the root node object, the object is removed from the heap, and the heap automatically performs a HeapifyDown operation, moving the next highest priority request to the root node.
[0090] Multiple worker threads process the business requests they receive in parallel. For example, one thread processes user A's "urgent transfer", another thread processes user B's "urgent transfer", and a third thread may process a "credit card repayment" request with a second higher priority.
[0091] According to embodiments of this application, the multi-threaded asynchronous processing mechanism allows multiple business requests to be processed in parallel, making full use of multi-core hardware processor resources and greatly improving the system's processing capabilities in high-concurrency scenarios. Parallel processing shortens the overall request processing time, improves the system's response efficiency to user requests, and effectively avoids resource idleness and bottlenecks that may result from single-threaded processing.
[0092] In this embodiment of the application, the service request scheduling method may further include, for example:
[0093] Update the status of the business request based on the scheduling result; and execute the corresponding handling measures based on the status of the business request.
[0094] In this application embodiment, a lifecycle management of business requests is introduced, which is a general framework for updating the status and taking subsequent measures based on the processing results.
[0095] For example, after a worker thread finishes processing a business request, it updates the status of the business request based on the processing result. If the business request is a risky transaction, a risk flag is added to its status; if the business request is a suspicious transaction, a suspicious flag is added to its status. Then, the corresponding handling measures are executed according to its specific status.
[0096] According to embodiments of this application, the lifecycle management of business requests provides a unified response mechanism for various situations (such as success, failure, exception, and suspicion) in the processing flow. Through status updates, the current progress and final result of each request can be clearly understood.
[0097] In this embodiment of the application, corresponding handling measures are executed according to the status of the business request, which may include, for example:
[0098] In response to a business request for a risk-sharing transaction, the risk-sharing transaction is re-inserted into a complete binary tree for storage.
[0099] In this application embodiment, a mechanism for automatic retry and rescheduling by re-inserting into the min-heap is proposed for "risky transactions".
[0100] For example, suppose user A's "emergency transfer" fails during processing due to a momentary malfunction in the external banking system (such as network timeout, database lockout, etc.). The system identifies this as a "risky transaction" (or "abnormal transaction").
[0101] At this point, the system updates the status of the "risky transaction" to "pending retry" or "abnormal" and re-inserts it into the complete binary tree (min-heap). Upon re-insertion, the transaction is given a slightly lower priority (e.g., the scheduling parameter changes from 1 to 1.1 to avoid infinite immediate retries), or its priority is reactivated after a period of time. Through a floating operation, it finds its new position in the heap, waiting to be scheduled for retry next.
[0102] According to embodiments of this application, for transient failures (such as network jitter, temporary resource shortages, etc.), the system can automatically retry without manual intervention, reducing the service failure rate. Furthermore, the priority mechanism ensures that even risky transactions requiring retries are prioritized and processed according to their importance.
[0103] In this embodiment of the application, corresponding handling measures are executed according to the status of the business request, which may include, for example:
[0104] In response to a business request that identifies a transaction as suspicious, an asynchronous polling mechanism is used to poll and query the suspicious transaction to confirm its true status.
[0105] In this embodiment of the application, an asynchronous polling query mechanism is introduced for "suspicious transactions" with unclear processing results.
[0106] For example, suppose user C initiates a "large payment". The system has sent a deduction request to the third-party payment platform, but has not received a clear success or failure response for a long time, or the response received is incomplete. The system marks it as a "suspicious transaction".
[0107] At this point, the system will not reinsert the "suspicious transaction" into the main scheduling heap. Instead, it will update the transaction's status to "pending confirmation" and hand it over to a separate "asynchronous polling query module." This module will start one or more asynchronous polling threads to periodically (e.g., every 5 minutes) query the third-party payment platform for the true status of the "suspicious transaction" until a clear result (success, failure, or final confirmation) is obtained.
[0108] The query operation is performed in a separate asynchronous thread, which does not occupy the core business processing thread, thus ensuring the normal processing of other high-priority requests in the system.
[0109] According to the embodiments of this application, the asynchronous polling query mechanism solves the problem of response delay or unclear status that may occur when interacting with external systems, and avoids the blocking of the main processing flow.
[0110] In addition, in this embodiment of the application, for business requests that require reconciliation processing, the core transaction data such as the transaction payment and receipt account, transaction amount, and transaction time can be compared based on the serial number provided by the current application to the downstream application to achieve reconciliation processing.
[0111] Figure 4 The schematic diagram illustrates the principle of a service request scheduling method according to an embodiment of this application.
[0112] like Figure 4 As shown, the principle of the service request scheduling method in this embodiment is as follows:
[0113] The user initiates a business request: this is the starting point of the entire scheduling process.
[0114] Determine scheduling parameters: When a user initiates a business request, the system will determine the priority of the request based on information such as the business type and the timestamp of the request.
[0115] Priority Heap Insertion: Encapsulates the business request and its priority parameter into a node and inserts it into a min-heap of a complete binary tree structure. This structure can automatically adjust to ensure that the highest priority business request is always located at the root node of the tree (the top of the heap).
[0116] Scheduling and execution: The scheduler continuously retrieves the highest priority requests from the top of the heap and processes them through a multi-threaded asynchronous mechanism.
[0117] Update request status: After the request is processed, the system will update its status based on the scheduling result (such as success, failure, risk, etc.).
[0118] Implementation of corrective measures: Based on the updated status, the system will perform corresponding follow-up operations, such as:
[0119] Risky transactions: If a request is determined to be a risky transaction, it will be reinserted into the priority heap and await the next scheduling process.
[0120] Suspicious transactions: If a transaction is identified as suspicious, an independent asynchronous polling mechanism will be initiated to further confirm its true status.
[0121] Normal / Completed: The lifecycle of the request ends if the request processing is normal or has been completed.
[0122] Based on the above-described service request scheduling method, this application also provides a service request scheduling apparatus. The following will be combined with... Figure 5 The device is described in detail.
[0123] Figure 5 The diagram illustrates the structure of a service request scheduling apparatus according to an embodiment of this application.
[0124] like Figure 5 As shown, the service request scheduling device 500 of this embodiment includes: a determination module 510, a storage module 520 and a scheduling module 530.
[0125] The determining module 510 is used to respond to a user-initiated service request by determining the scheduling parameters corresponding to the service request based on the service type of the service request. The scheduling parameters represent the priority at which the service request is scheduled. In one embodiment, the determining module 510 can be used to perform the operation S210 described above, which will not be repeated here.
[0126] The storage module 520 encapsulates business requests and scheduling parameters into node objects and stores them in a preset storage structure, which is a complete binary tree. The complete binary tree is configured to adjust the position of the node objects according to the size of the scheduling parameters, so that the priority represented by the scheduling parameters of the parent node is higher than that of the child node. In one embodiment, the storage module 520 can be used to perform the operation S220 described above, which will not be repeated here.
[0127] The scheduling module 530 is used to schedule the business requests corresponding to each node object, starting from the root node of the complete binary tree, according to the priority order represented by the scheduling parameters. In one embodiment, the scheduling module 530 can be used to execute the operation S230 described above, which will not be repeated here.
[0128] According to an embodiment of this application, the determining module 510 includes: a semantic recognition module, a business type determining module, and a rule engine module.
[0129] The semantic recognition module is used to perform semantic recognition on business requests and extract keywords that can represent the urgency of the business.
[0130] The business type determination module is used to determine the business type corresponding to a business request based on keywords.
[0131] The rules engine module is used to determine the scheduling parameters corresponding to business requests based on the business type and using a preset rules engine.
[0132] According to an embodiment of this application, the determining module 510 further includes: an initiation time determining module and a composite scheduling parameter determining module.
[0133] The initiation time determination module is used to determine the initiation time of a business request based on the timestamp of the business request.
[0134] The composite scheduling parameter determination module is used to jointly determine the scheduling parameters corresponding to the service request based on the initiation time and service type.
[0135] According to an embodiment of this application, the storage module 520 includes: an insertion module, a position exchange module, and an iterative comparison module.
[0136] The insertion module is used to insert a node object into the last position of a complete binary tree and compare the size of the scheduling parameters corresponding to the node object and its parent node.
[0137] The position swapping module is used to swap the positions of a node object and its parent node in response to a node object having a higher priority than its parent node.
[0138] The iterative comparison module is used to re-compare the scheduling parameters of the node object after the position swap with the new parent node of the node object, until the node object reaches the root node, or the priority of the node object is less than or equal to the priority of the parent node.
[0139] According to an embodiment of this application, the scheduling module 530 includes a multi-threaded asynchronous processing module.
[0140] The multi-threaded asynchronous processing module is used to synchronously schedule the business requests corresponding to each node object, starting from the root node of the complete binary tree, according to the priority order represented by the scheduling parameters, using a multi-threaded asynchronous processing mechanism.
[0141] According to an embodiment of this application, the service request scheduling device 500 further includes an update module and an execution module.
[0142] The update module is used to update the status of business requests based on the scheduling results of the business requests.
[0143] The execution module is used to perform corresponding handling measures based on the status of the business request.
[0144] According to an embodiment of this application, the execution module includes a re-insertion module.
[0145] The re-insertion module is used to respond to business requests for risk-sharing transactions by re-inserting the risk-sharing transactions into a complete binary tree for storage.
[0146] According to an embodiment of this application, the execution module further includes an asynchronous polling query module.
[0147] The asynchronous polling query module is used to respond to business requests for suspicious transactions by using an asynchronous polling query mechanism to process the suspicious transactions and confirm their true status.
[0148] According to embodiments of this application, any plurality of modules among the determination module 510, storage module 520, and scheduling module 530 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least a portion of the functionality of one or more of these modules can be combined with at least a portion of the functionality of other modules and implemented in one module. According to embodiments of this application, at least one of the determination module 510, storage module 520, and scheduling module 530 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the determination module 510, storage module 520, and scheduling module 530 can be at least partially implemented as a computer program module, which, when run, can perform corresponding functions.
[0149] Figure 6 A block diagram of an electronic device suitable for implementing a service request scheduling method according to an embodiment of this application is illustrated schematically.
[0150] like Figure 6 As shown, an electronic device 600 according to an embodiment of this application includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this application.
[0151] RAM 603 stores various programs and data required for the operation of electronic device 600. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 executes various operations of the method flow according to embodiments of this application by executing programs in ROM 602 and / or RAM 603. It should be noted that the programs may also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 may also execute various operations of the method flow according to embodiments of this application by executing programs stored in said one or more memories.
[0152] According to embodiments of this application, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to a bus 604. The electronic device 600 may also include one or more of the following components connected to the input / output (I / O) interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 610 as needed so that computer programs read from it can be installed into the storage section 608 as needed.
[0153] This application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.
[0154] According to embodiments of this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this application, the computer-readable storage medium may include ROM 602 and / or RAM 603 and / or one or more memories other than ROM 602 and RAM 603 described above.
[0155] Embodiments of this application also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of this application.
[0156] When the computer program is executed by the processor 601, it performs the functions defined in the system / apparatus of this application embodiment. According to the embodiments of this application, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0157] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0158] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, it performs the functions defined in the system of this application embodiment. According to the embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0159] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0160] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0161] Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, the features described in the various embodiments of this application can be combined and / or combined in various ways without departing from the spirit and teachings of this application. All such combinations and / or combinations fall within the scope of this application.
Claims
1. A service request scheduling method, characterized in that, The method includes: In response to a user initiating a service request, the scheduling parameters corresponding to the service request are determined based on the service type of the service request, wherein the scheduling parameters represent the priority at which the service request is scheduled; The business request and the scheduling parameters are encapsulated into node objects and stored in a preset storage structure, wherein the preset storage structure is a complete binary tree. The complete binary tree is configured to adjust the position of the node objects according to the size of the scheduling parameters, so that the priority represented by the scheduling parameters corresponding to the parent node is higher than that of the child node. Starting from the root node of the complete binary tree, the service requests corresponding to each node object are scheduled according to the priority order represented by the scheduling parameters.
2. The method according to claim 1, characterized in that, The step of determining the scheduling parameters corresponding to the service request based on the service type of the service request includes: The business requests are semantically recognized to extract keywords that can characterize the urgency of the business. Based on the keywords, determine the business type corresponding to the business request; Based on the business type, the scheduling parameters corresponding to the business request are determined using a preset rule engine.
3. The method according to claim 2, characterized in that, The step of determining the scheduling parameters corresponding to the service request based on the service type of the service request further includes: The initiation time of the business request is determined based on the timestamp of the business request. Based on the initiation time and the service type, the scheduling parameters corresponding to the service request are jointly determined.
4. The method according to claim 1, characterized in that, The step of encapsulating the service request and the scheduling parameters into node objects and storing them in a preset storage structure includes: Insert the node object into the last position of the complete binary tree, and compare the size of the scheduling parameter corresponding to the node object and the parent node of the node object; In response to the node object having a higher priority than the parent node, the positions of the node object and the parent node are swapped; The scheduling parameters of the node object after the position swap are re-compared with those of the new parent node of the node object until the node object reaches the root node, or the priority of the node object is less than or equal to the priority of the parent node.
5. The method according to claim 1, characterized in that, Starting from the root node of the complete binary tree, scheduling the business requests corresponding to each node object according to the priority order represented by the scheduling parameters includes: Starting from the root node of the complete binary tree, the business requests corresponding to each node object are synchronously scheduled according to the priority order represented by the scheduling parameters using a multi-threaded asynchronous processing mechanism.
6. The method according to claim 1, characterized in that, The method further includes: Update the status of the service request based on the scheduling result of the service request; Based on the status of the business request, execute the corresponding handling measures.
7. The method according to claim 6, characterized in that, The step of executing corresponding handling measures based on the status of the service request includes: In response to the business request being a risk-sharing transaction, the risk-sharing transaction is reinserted into the complete binary tree for storage.
8. The method according to claim 7, characterized in that, The step of executing corresponding handling measures based on the status of the service request further includes: In response to the business request being a suspicious transaction, an asynchronous polling query mechanism is used to poll and query the suspicious transaction to confirm its true status.
9. A service request scheduling device, characterized in that, The device includes: The determination module is used to respond to a user-initiated service request and determine the scheduling parameters corresponding to the service request based on the service type of the service request, wherein the scheduling parameters represent the priority of scheduling the service request; The storage module is used to encapsulate the business request and the scheduling parameters into node objects and store them in a preset storage structure, wherein the preset storage structure is a complete binary tree, and the complete binary tree is configured to adjust the position of the node objects according to the size of the scheduling parameters, so that the priority represented by the scheduling parameters corresponding to the parent node is higher than that of the child node. The scheduling module is used to schedule the business requests corresponding to each node object, starting from the root node of the complete binary tree, according to the priority order represented by the scheduling parameters.
10. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 8.