Single-lane queue-based agent high-concurrency task scheduling system
By using a single-lane queue-based scheduling system and generating a random backoff strategy through consistent hashing and service-constrained index, the system solves the problems of request peaks and resource race conditions in multi-agent high-concurrency tasks, achieves orderly task execution and state consistency, and improves the stability and efficiency of the system.
Patent Information
- Application Number
- CN202611254722.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-18
- Publication Date
- 2026-11-20
AI Technical Summary
Existing distributed task scheduling systems are prone to request spikes, resource contention, and state overlap when multiple agents are handling high-concurrency tasks, making it difficult to guarantee orderly task execution and state consistency.
By using a single-lane queue-based scheduling system, consistent hashing is used to map tasks of the same account to independent memory single-lane queue partitions. A random non-blocking backoff strategy is generated by combining the service limitation index. Local mutex locks are used to control network interactions, and the mutex locks are released to wake up emergency tasks after the state snapshot is committed.
Effectively distribute concurrent requests, avoid resource races and state overlap, improve the stability and state consistency of high-concurrency task scheduling, reduce the probability of repeated rate limiting, and balance the normal throughput and extreme response requirements of high concurrency.
Smart Images

Figure CN123137818A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed computing technology, specifically to a high-concurrency task scheduling system for intelligent agents based on a single-lane queue. Background Technology
[0002] With the development of artificial intelligence technology, multi-agent systems are widely used in scenarios such as distributed computing, cross-system data synchronization, and external server interface calls. Such systems typically require orchestrating multiple agents to execute batch network interaction tasks in parallel. The task scheduling method directly affects the stability of network requests, processing efficiency, and consistency of state data.
[0003] Existing distributed task scheduling systems primarily aim to improve internal throughput and resource utilization. When multiple agents send requests to the same external server within a short period, it can easily create instantaneous request spikes, causing the external server to return abnormal responses such as rate limiting and service overload. Using fixed waiting times for retries may result in multiple tasks resuming execution at the same time, creating periodic synchronous request spikes and leading to repeated request restrictions. Meanwhile, the service constraints and required retry times of external servers are dynamic, making it difficult for existing scheduling methods to dynamically adjust request intervals based on multi-dimensional feedback from the server. Regarding internal state management, when multiple agents concurrently access the same business account or controlled resource, execution order disorder, resource races, and state data overwriting can easily occur. Using global mutex locks or cross-node distributed locks increases communication overhead and may cause mutual blocking between different business objects. Furthermore, when tasks with specific business affiliations arrive in a concentrated manner, it can also cause queue backlogs and local memory overload.
[0004] In summary, how to avoid request concentration and resource contention, and ensure orderly task execution and state consistency when multiple agents perform high-concurrency tasks in constrained networks, is a technical problem that urgently needs to be solved in this field.
[0005] To address this, a high-concurrency task scheduling system for intelligent agents based on a single-lane queue is proposed. Summary of the Invention
[0006] The purpose of this invention is to provide a high-concurrency task scheduling system for intelligent agents based on a single-lane queue. This invention extracts network interaction account identifiers as consistent hash source operands, converging concurrent tasks from the same account into a single-lane queue partition in independent memory. The system extracts the service-constrained response frequency and constraint duration from the external server to generate a service-constrained index, and uses a closed-loop joint adjustment of the position and scale parameters of the log-normal distribution model to generate random non-blocking backoff. Network interactions are controlled through local mutex locks, atomically writing state snapshots and scheduling records to be processed in database transactions, and waking up urgent tasks after transaction commit and mutex lock release. This invention can distribute centralized requests, avoid resource races and state overwriting, and improve the stability and state consistency of high-concurrency task scheduling.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A high-concurrency task scheduling system for intelligent agents based on a single-lane queue, comprising: The queue construction module is used to parse the task data stream submitted concurrently by the intelligent agent cluster to extract the business ownership identifier, use consistent hashing to map the business ownership identifier to the target virtual computing node to establish a single-lane queue partition, and when an emergency task is parsed out, the emergency task is located in the preparation area at the head of the single-lane queue, and the remaining target tasks are arranged into the single-lane queue partition as regular tasks. An adaptive backoff module is used to generate a service-limited index based on the service-limited response frequency and limitation duration, and construct a backoff delay model based on a log-normal distribution; when the service-limited index exceeds an overload threshold, the position parameter of the backoff delay model is increased, and when it is below a recovery threshold, the position parameter is decreased to a level not lower than a preset lower limit; based on the updated position parameter, a random backoff duration is sampled and sent to an independent asynchronous timer to control the corresponding agent to perform non-blocking backoff waiting; The mutex and transaction module is used to request a mutex lock to bind the business ownership identifier after a regular task is completed and the non-blocking backoff wait is completed, or when an emergency task is awakened; under the protection of the mutex lock, the agent is scheduled to perform network interaction and submit a state snapshot and release the mutex lock after receiving the network response; after releasing the mutex lock, the scheduling wake-up signal of the preparatory area task is triggered.
[0008] Preferably, the application layer message data payload of the concurrently submitted task data stream of the intelligent agent cluster is parsed, and the target network interaction business account identifier is extracted as the business ownership identifier; the business ownership identifier is used as the unique source operand of the hash operation to calculate the mapping address corresponding to the uniquely determined target virtual computing node in the distributed cluster, and a single-lane queue partition is established in the independent memory address space pointed to by the mapping address; if no task is stored in the preparatory area, the single-lane queue partition is controlled to perform first-in-first-out dequeue operation according to the ascending order of the task reception timestamp.
[0009] Preferably, the service-restricted response returned by the external server is obtained within a sliding time window at fixed time steps. The ratio of the occurrence of the service-restricted response to the total number of requests within the sliding time window is calculated to obtain the service-restricted response frequency. The retry waiting time carried by the service-restricted response is analyzed and normalized to obtain the restriction duration. A weighted Euclidean distance is calculated between the service-restricted response frequency and the restriction duration according to preset weights. The calculation result is normalized to between zero and one to obtain the service-restricted index.
[0010] Preferably, the value of the preset recovery threshold in the system is less than the value of the overload threshold; the support set of the backoff delay model based on the log-normal distribution is limited to the positive real number domain; when the service limitation index is greater than the overload threshold, the difference between the service limitation index and the overload threshold is calculated as the limitation excess, the limitation excess is multiplied by the preset first positive adjustment gain coefficient to obtain the backoff increment, and the position parameter is added to the backoff increment to obtain the updated position parameter, thereby increasing the mathematical expectation value of the log-normal distribution.
[0011] Preferably, when the service limitation index is greater than or equal to the recovery threshold and less than or equal to the overload threshold, the control position parameter is kept unchanged at its current value; when the service limitation index is less than the recovery threshold, the total number of tasks queued in the current single-lane queue partition is extracted as the physical backlog length, and the physical backlog length is multiplied by the second positive adjustment gain coefficient to obtain the backlog digestion reduction; the position parameter is subtracted from the backlog digestion reduction to obtain the candidate position parameter, the value of the candidate position parameter is compared with the value of the preset lower limit, and the larger value of the two is used as the updated position parameter.
[0012] Preferably, the system instantiates and allocates a dedicated, independent asynchronous timer for each single-lane queue partition; samples a real-valued duration from a log-normal distribution as the sleep parameter for the independent asynchronous timer; in the non-blocking backoff waiting state, only the dequeue pointer offset operation of the single-lane queue partition that triggered the backoff waiting and the request issuance action of the corresponding agent are suspended.
[0013] Preferably, the mutex is a local mutex within the independent memory address space of the single-lane queue partition. The lifecycle of the local mutex is bound to a single execution context within the single-lane queue partition, providing exclusive control within the execution context. After acquiring exclusive control of the mutex, an external application programming interface is called to send network interaction data packets to an external server, and the dequeue pointer offset of the current single-lane queue partition is suspended. The system waits until a confirmation response message is received from the external server. Subsequently, a state snapshot containing breakpoint location data and response result data is updated in memory. After the database persistent transaction of the state snapshot is committed, an unlock command is issued to cancel the exclusive control and release the mutex.
[0014] Preferably, the reserve area is set in the memory address range that is first in the single-lane queue partition; after releasing the mutex lock, the scheduling wake-up signal of the task in the reserve area is triggered, the memory cursor in the reserve area is forcibly read, and the emergency task corresponding to the memory cursor is loaded and enters the execution phase; the emergency task is controlled to skip the random backoff duration sampling; before applying for the mutex lock, the time difference required to meet the preset minimum emergency protection interval and the remaining retry waiting time indicated by the external server are calculated respectively, and the maximum value of the two is taken as the target compensation time. The independent asynchronous timer is used to perform non-blocking compensation waiting; then the mutex lock is applied for and the intelligent agent is scheduled to initiate network interaction first.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention extracts the target network interaction business account identifier from the task data stream as the unique source operand for consistent hashing, mapping concurrent tasks of the same account to a single-lane queue partition within the same independent memory addressing space. This mechanism transforms spatially distributed, scattered concurrent requests into an ordered, time-dimensional serial queue at the routing layer, avoiding memory race conditions and state overwriting that occur when multiple agent instances concurrently access the same account resources, thus improving the integrity of underlying state data and business consistency during multi-task processing.
[0016] 2. This invention constructs a log-normal distribution backoff delay model based on closed-loop adjustment of the service constraint index. The system integrates the constraint response frequency and constraint duration from the external server for two-dimensional adaptive adjustment. This mechanism accurately distinguishes between short-term network anomalies and persistent constraint states, enabling the backoff strategy to dynamically adapt to the actual availability of the server, thereby effectively dispersing the peak of synchronous requests during multi-task concurrency and reducing the probability of repeated rate limiting.
[0017] 3. This invention employs a local mutex lock bound to a single execution context, coupled with a dedicated independent asynchronous timer. This limits the scope of non-blocking backoff waiting to the target single-lane queue partition itself. After the database persistent transaction, which completes the state snapshot, is committed and the mutex lock is released, the scheduling transition period between releasing the mutex lock and triggering the next regular task dequeue action is utilized to prioritize loading urgent tasks in the reserve area. This scheduling architecture, while ensuring strict serial execution of queued tasks, prevents blocking of the system-level shared event loop and provides a bypass response channel for high-priority intervention commands, balancing the needs of high-concurrency normalized throughput with the agile response requirements of extreme commands. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the structure of a high-concurrency task scheduling system for intelligent agents based on a single-lane queue, according to an embodiment of the present invention. Figure 2 A flowchart of a single-lane queue task scheduling and mutual exclusion execution method provided in an embodiment of the present invention; Figure 3 The flowchart for adaptive backoff parameter adjustment based on the service limitation index is provided for embodiments of the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Please see Figures 1 to 3 This invention provides a high-concurrency task scheduling system for intelligent agents based on a single-lane queue, the technical solution of which is as follows: A high-concurrency task scheduling system for intelligent agents based on a single-lane queue, comprising: The queue construction module is used to parse the task data stream submitted concurrently by the intelligent agent cluster to extract the business ownership identifier, use consistent hashing to map the business ownership identifier to the target virtual computing node to establish a single-lane queue partition, and when an emergency task is parsed out, the emergency task is located in the preparation area at the head of the single-lane queue, and the remaining target tasks are arranged into the single-lane queue partition as regular tasks. An adaptive backoff module is used to generate a service-limited index based on the service-limited response frequency and limitation duration, and construct a backoff delay model based on a log-normal distribution; when the service-limited index exceeds an overload threshold, the position parameter of the backoff delay model is increased, and when it is below a recovery threshold, the position parameter is decreased to a level not lower than a preset lower limit; based on the updated position parameter, a random backoff duration is sampled and sent to an independent asynchronous timer to control the corresponding agent to perform non-blocking backoff waiting; The mutex and transaction module is used to request a mutex lock to bind the business ownership identifier after a regular task is completed and the non-blocking backoff wait is completed, or when an emergency task is awakened; under the protection of the mutex lock, the agent is scheduled to perform network interaction and submit a state snapshot and release the mutex lock after receiving the network response; after releasing the mutex lock, the scheduling wake-up signal of the preparatory area task is triggered.
[0021] Example 1: This embodiment uses the scenario of multiple agents calling an external server interface to perform batch business processing and data synchronization as an application scenario. In this scenario, the system orchestrates multiple agent instances corresponding to different business accounts to perform batch network interaction tasks such as status query, message transmission, and data synchronization. When multiple agent instances send requests in a short period of time, it is easy to form a momentary request peak, causing the external server to return abnormal responses such as rate limiting, service overload, or continuous access restriction; when multiple agents concurrently access the same business account, resource races, disordered execution order, and state data overwriting may also occur. This embodiment aims to achieve ordered task scheduling for the same business account and implement adaptive backoff based on the response status of the external server to ensure the stability of task execution and state consistency.
[0022] As one embodiment of the present invention, refer to Figure 1 A schematic diagram of a high-concurrency task scheduling system for intelligent agents based on a single-lane queue, referring to... Figure 2 Flowchart of single-lane queue task scheduling and mutual exclusion execution method.
[0023] Furthermore, the application layer message data payload of the task data stream submitted concurrently by the intelligent agent cluster is analyzed, and the target network interaction business account identifier is extracted as the business ownership identifier. The business ownership identifier is used as the unique source operand for hash operation to calculate the mapping address corresponding to the uniquely determined target virtual computing node in the distributed cluster, and a single-lane queue partition is established in the independent memory address space pointed to by the mapping address. In the case that no tasks are stored in the preparatory area, the single-lane queue partition is controlled to perform first-in-first-out dequeue operation according to the ascending order of the task reception timestamp.
[0024] Specifically, the system intercepts the task data stream at the application layer of the network protocol stack, parses the payload of the request message, and extracts the target network interaction service account identifier carried by a preset field. The preset field is a field in the application layer message payload used to carry the target network interaction service account identifier; its field name, field path, and data type are pre-configured according to the external server interface document or task message structure. After extracting and verifying the corresponding field value, the system inputs it as a service attribution identifier into a consistent hash operation. The target network interaction service account identifier, as a specific implementation of the service attribution identifier, is a unique string or numeric identifier assigned by the external server, and it can correspond to multiple independent task instances within a task batch. The system inputs the target network interaction service account identifier as the unique source operand of the consistent hash operation into a pre-configured consistent hash ring. Multiple virtual nodes bound to each physical computing node in the distributed cluster are distributed on the consistent hash ring; the binding relationship is stored in a configuration center shared by the distributed cluster. Each physical computing node listens for change notifications from the configuration center, maintains a cached copy of the consistent hash ring topology and the corresponding ring version number locally, and performs mapping calculations only when its local version number matches the configuration center's version number. When a physical computing node joins or leaves the distributed cluster, the binding relationship is updated and the ring version number is incremented. Upon receiving the version change notification, the affected node stops receiving new tasks and continues consuming queued tasks until the physical backlog length reaches zero. It then transfers the state snapshot of the single-lane queue partition and the mutex lock holding state of the corresponding business ownership identifier to the takeover node and cancels the corresponding virtual node binding. After the transfer is complete, the old node clears its local mutex lock variable, and the new node restores the mutex lock state and begins receiving new tasks for that business ownership identifier after receiving the transfer data. During the transfer process, the local mutex lock for that business ownership identifier remains in a released state to prevent both the old and new nodes from simultaneously holding exclusive control.
[0025] The system employs a hash function with an avalanche effect, meaning that any single-bit change in the input string causes approximately half of the bits in the output hash value to flip. Digest calculations are performed on the source operands, ensuring that the hash values of different account identifiers are evenly distributed within the hash ring space, suppressing memory skew caused by uneven hash distribution. The calculated hash value falls at a specific position on the hash ring, and the first virtual node found by the system clockwise along the ring is the target virtual computing node. Within the process of the target virtual computing node, the system allocates a dedicated data structure instance as an independent memory addressing space for the target network interaction service account identifier, and initializes a single-lane queue partition within this data structure instance. This data structure instance includes at least head and tail pointers for the single-lane queue partition, a local mutex lock variable, a physical backlog length counter, and an independent asynchronous timer handle. Data structure instances for different service identifiers are isolated from each other in the process memory. The single-lane queue partition uses a linked list or circular buffer data structure to maintain the head and tail pointers. When no tasks are stored in the preparatory area of the single-lane queue partition, the system performs a first-in-first-out (FIFO) dequeue operation based on the receiving timestamps attached when each task enters the queue, controlling the order of the timestamps in ascending order. When multiple tasks have the same receiving timestamp, the lexicographical order of the task identifiers is used as the secondary sorting key. The receiving timestamp is based on the local monotonic clock of the target virtual computing node receiving the task. When a task retryes, the original receiving timestamp is retained to maintain its sorting position in the queue.
[0026] This invention limits the source operand of consistent hashing to the target network interaction service account identifier, enabling high-concurrency task instances of the same service account to stably converge to the independent memory addressing space of the same virtual computing node on the consistent hashing ring. Compared to the task space scattering caused by using the task identifier as the hash operand, this mechanism ensures that tasks of the same service account are aggregated in the spatial dimension and executed serially in the temporal dimension from the routing layer. This reduces concentrated concurrent requests for the same service account, avoids resource races and state overlap caused by multiple agents accessing the same controlled resource simultaneously, and provides a structural basis for the exclusive control of local mutex locks.
[0027] Furthermore, when the physical backlog length of the single-lane queue partition exceeds a preset memory warning level, the system mounts a persistent overflow buffer on the local non-volatile storage medium of the current target virtual computing node, suspends the single-lane queue partition from receiving task data streams from the network application layer, and appends new tasks to the persistent overflow buffer in the form of write-ahead logs. After the physical backlog length falls back to the preset recovery level due to consumption, the system uses an independent background I / O thread to prefetch tasks in the persistent overflow buffer in the order of the batch in the pre-queue in the independent memory addressing space, and resumes the single-lane queue partition from receiving task data streams. The value of the recovery level is less than the value of the memory warning level, so as to form a hysteresis interval at the boundary of the memory warning level and suppress frequent oscillations between overflow triggering and recovery operations.
[0028] Specifically, the system maintains a physical backlog length counter during the runtime state of the single-lane queue partition. This counter increments when tasks are enqueued and dequeues when tasks complete network interactions and are dequeued. The system presets a memory warning level (e.g., 80% of the allocated memory capacity for the single-lane queue partition) and a recovery level (e.g., 40% of the allocated memory capacity for the queue partition). The recovery level is lower than the memory warning level. When the current value of the physical backlog length counter exceeds the memory warning level, it indicates that the single-lane queue partition is experiencing a traffic spike, and continuing to receive tasks risks triggering a memory overflow exception. At this time, the system executes the following processing procedure: (a) triggering the flow control switch to suspend the reception of new task data streams from the upper network application layer in the single-lane queue partition, returning a backpressure signal upstream, and temporarily storing tasks already in transit in the queue partition in a small-capacity receive buffer; (b) creating or opening a persistent overflow buffer file dedicated to the queue partition on the local non-volatile storage medium (e.g., solid-state drive partition) of the target virtual computing node; (c) writing the metadata (including task identifier, enqueue timestamp, and original request payload) of new tasks belonging to the service's attribution identifier that arrive thereafter into the persistent overflow buffer file in append order as a write-ahead log. During the writing process, a checksum field is appended to the end of each WAL record, and a forced flush operation is performed after the writing is completed to ensure that the confirmed WAL records are not lost in the event of an operating system crash. After the persistent overflow buffer file is created or opened, the system converts the temporarily stored tasks in the receive buffer into WAL records for append writing, and then releases the receive buffer.
[0029] During this period, the dequeueing consumption operation of this single-lane queue partition is unaffected—queued tasks in memory are continuously consumed and network interactions are completed in FIFO order, and the physical backlog length counter decreases sequentially. When the physical backlog length falls below the recovery level, the system initiates the overflow backfilling process: (a) Create an independent background I / O thread to prefetch task metadata in batches from the persistent overflow buffer file in the order of WAL record writing in block read mode; (b) Reconstruct the prefetched task metadata into complete task objects and inject them into the pre-queue in the independent memory address space where the single-lane queue partition is located in ascending order of enqueue timestamp; (c) After the prefetched tasks are dequeued in the memory queue, complete network interactions, and submit a status snapshot, the system updates the consumption completion mark of the corresponding WAL record in the persistent overflow buffer file; after all WAL records are marked as consumed, the persistent overflow buffer file is truncated or deleted to reclaim disk space; (d) Release the flow control switch to restore the normal reception of task data streams for this queue partition.
[0030] This invention addresses the issue of overflowing tasks being pushed to the local non-volatile storage of the same computing node in the form of pre-written logs when the single-lane queue memory reaches a warning level. Once the backlog is cleared, a separate background thread refills the tasks sequentially. This mechanism achieves local memory overload protection without violating the single-lane serialization constraints and the exclusivity boundaries of the local mutex lock. It avoids state races caused by splitting hot services across nodes, and can handle sudden task backlogs without requiring cross-node operations, ensuring system stability and data consistency under high load conditions.
[0031] As an alternative implementation, when the physical backlog length of the single-lane queue partition exceeds a preset memory warning level, the system, while mounting the persistent overflow buffer and appending tasks in the form of write-ahead logs, further activates a background compression thread to scan the write-ahead log records in the persistent overflow buffer that have not yet been prefetched by the background input / output thread. If the background compression thread identifies multiple state overwrite task records targeting the same external server business entity and possessing data overwrite attributes, it retains only the record with the latest timestamp according to the task reception timestamp and physically clears historical redundant records with earlier timestamps, thereby generating semantically compressed write-ahead logs. The independent background input / output thread prefetches task metadata sequentially from the semantically compressed write-ahead logs. This alternative implementation integrates application-layer state update semantics into the underlying persistent queuing process, directly merging and cleaning up high-frequency state overwrite tasks on the disk side. This mechanism significantly reduces the number of invalid redundant requests in the queue, lowers the read / write load on non-volatile storage media, and significantly improves the system's state recovery rate and queue digestion efficiency under extreme concurrent backlog conditions.
[0032] Furthermore, within a sliding time window, service-restricted responses returned by external servers are obtained according to a fixed time step. The ratio of the occurrence of the service-restricted response to the total number of requests within the sliding time window is calculated to obtain the service-restricted response frequency. The retry waiting time carried by the service-restricted response is analyzed and normalized to obtain the restriction duration. A weighted Euclidean distance is calculated between the service-restricted response frequency and the restriction duration according to a preset weight, and the calculation result is normalized to between zero and one to obtain the service-restricted index.
[0033] The system deploys an event-driven response status listener instance in memory. This listener registers callback listeners for network response packets from external servers. When the network response returned by the external server is a service-restricted response, the system records the time of receipt of that service-restricted response. Service-restricted responses are limited to HTTP 429 responses and HTTP 503 responses carrying a Retry-After field. For service-restricted responses without a retry duration, the system's default retry duration is used in subsequent limitation duration calculations. The system advances a fixed-span sliding time window according to a preset time step, counts the number of times a service-restricted response occurs within the window, and divides this count by the total number of network interaction requests issued by the same business account within the same window to obtain the service-restricted response frequency. When the total number of network interaction requests is zero, the frequency is set to zero.
[0034] The system parses the retry wait time carried in the service-limited response and normalizes the retry wait time. Specifically, it calculates the ratio of the parsed retry wait time to the system's preset maximum tolerable wait time. When the ratio is greater than 1, it is truncated to 1, thus obtaining the limitation duration with a value between zero and one (the interval [0,1]). .
[0035] The system calculates the real-time service constraint index according to the weighted aggregation rules. The calculation formula is as follows: ; In this model, the frequency of service-limited responses and the duration of limitation are respectively used as two normalized components of the two-dimensional feature vector, with a state where both components are zero serving as an anomaly-free reference point. Through this weighted Euclidean distance model, the system can simultaneously characterize the occurrence density and duration of service-limited responses, distinguishing between short-term discrete anomalies and persistent service-limited states, ensuring that the final generated backoff parameters accurately match the actual availability of the external server. The first and second preset weights are used to characterize the relative contributions of the two normalized components to the weighted Euclidean distance. The service limitation index has a value range of [0,1]. This represents the number of times a service-restricted response occurs within the current sliding time window. This represents the total number of requests made by this account within the same window. To limit the duration, the value range is [0,1]. and These are the first pre-configured weight coefficient and the second pre-configured weight coefficient, respectively, and satisfy the following conditions: In this embodiment, the values of the two are 0.6 and 0.4, respectively.
[0036] This invention's system obtains a service-limited index by normalizing and weighting the frequency of service-limited responses and the duration of limitation. This mechanism can simultaneously characterize the occurrence density and congestion depth of external server-side rate limiting, accurately distinguish between short-term discrete anomalies and persistent limited states, and ensure that the final generated backoff delay parameters are highly adapted to the actual availability of the server, significantly improving the adaptability of the scheduling system.
[0037] Furthermore, the system's preset recovery threshold is less than the overload threshold; the support set of the backoff delay model based on the log-normal distribution is limited to the positive real number domain; when the service limitation index is greater than the overload threshold, the difference between the service limitation index and the overload threshold is calculated as the limitation excess, multiplied by a preset first positive adjustment gain coefficient to obtain the backoff increment, and the position parameter is added to the backoff increment to obtain the updated position parameter; the system presets an upper limit for the position parameter, and when the updated position parameter exceeds this upper limit, the upper limit value is taken. This upper limit is determined based on the longest tolerable silence interval of a single session on the external server, ensuring that the expected value of the log-normal distribution when the position parameter is at its upper limit and the scale parameter is at its initial value does not exceed the longest tolerable silence interval, thereby limiting the expected delay to a recoverable range under continuous high service limitation conditions.
[0038] When the service limitation index is greater than or equal to the recovery threshold and less than or equal to the overload threshold, the control position parameter remains unchanged. When the service limitation index falls back from above the overload threshold to this range, it needs to remain within this range for two consecutive adjustment cycles to confirm a stable state, in order to avoid parameter jitter caused by fluctuations in the service limitation index near the threshold boundary. When the service limitation index is less than the recovery threshold, the total number of tasks queuing in the current single-lane queue partition is extracted as the physical backlog length. The physical backlog length is multiplied by the second positive adjustment gain coefficient to obtain the backlog reduction. The backlog reduction is subtracted from the position parameter to obtain the candidate position parameter. The value of the candidate position parameter is compared with the value of the preset lower limit, and the larger of the two values is used as the updated position parameter.
[0039] Specifically, the preset recovery threshold value within the system is lower than the overload threshold value. In this embodiment, the recovery threshold... The overload threshold is 0.3. The value is 0.7. The backoff delay model based on the log-normal distribution has its probability density function's support set strictly limited to the positive real number domain. This mathematically eliminates the possibility of negative or zero sampling results, satisfying the non-negativity constraint condition of delay duration as a physical quantity. The system performs parameter adjustment once at the end of each adaptive backoff parameter adjustment cycle, with the adjustment cycle consistent with the time step of the sliding time window; when the service limitation index... Greater than the overload threshold When the service limitation index is greater than or equal to the recovery threshold and less than or equal to the overload threshold, the system performs overload backoff adjustment: The difference between the service limitation index and the overload threshold is calculated as the limitation excess; this limitation excess is multiplied by a preset first positive adjustment gain coefficient to obtain the backoff increment; and the current value of the location parameter is added to this backoff increment to obtain the updated location parameter. This adjustment increases the expected value of the log-normal distribution, thereby prolonging the average latency and reducing the request density sent to external servers per unit time. When the service limitation index is greater than or equal to the recovery threshold and less than or equal to the overload threshold (…), the system performs overload backoff adjustment. When the service limitation index is less than the recovery threshold, the system control position parameters remain unchanged. When the system performs recovery acceleration adjustment, it extracts the total number of tasks queued in the current single-lane queue partition as the physical backlog length, multiplies the physical backlog length by the second positive adjustment gain coefficient to obtain the backlog digestion reduction, subtracts the backlog digestion reduction from the current value of the position parameter to obtain the candidate position parameter, compares the candidate position parameter with the value of the preset lower limit, and takes the maximum value of the two as the updated position parameter. The preset lower limit is the value of the initial value of the basic position parameter minus the preset reduction (e.g., 0.2). This reduction ensures that the mathematical expectation value of the position parameter at the lower limit is not lower than the shortest reasonable interval of a single request from the external server, so as to prevent the latency from decaying to near zero. Among them, the initial value of the basic position parameter is used as the input for the first adjustment cycle, and each subsequent adjustment cycle uses the update result of the previous cycle (i.e., This is used as the current input in the calculation. The above piecewise adjustment strategy is expressed as a unified adjustment equation: ; in, The updated position parameters; Basic position parameters; The position parameter value is from the previous adjustment cycle; and These are the first positive adjustment gain coefficient and the second positive adjustment gain coefficient, respectively; The physical stack length; The lower limit is preset. The first positive adjustment gain coefficient. The preset reference value range is [0.1, 0.5]. This range ensures that, under extreme conditions where the service limitation index approaches its maximum value of 1.0, the single-cycle position parameter increment does not exceed 0.15, corresponding to a single-cycle increase multiple of the expected delay within an engineering-controllable range; the second positive adjustment gain coefficient The value of determines the reduction of the position parameter in a single cycle within the recovery acceleration interval. Not exceeding the basic position parameters With preset lower limit The difference is that it satisfies ,in The system presets the maximum physical backlog length corresponding to the memory warning level of this single-lane queue partition, thereby ensuring that the position parameters smoothly decrease during multiple rounds of continuous acceleration adjustments. Rather than being instantly broken down within a single cycle, its preset reference value range is [0.0001, 0.01].
[0040] This invention constructs a piecewise closed-loop adjustment parameter based on the log-normal distribution of the location parameter, with the service constraint index and the physical backlog length of the queue as input variables. When the service constraint index increases, the system increases the expected backoff time of the backoff delay model to reduce the request density per unit time; when the service constraint index decreases and there is a task backlog in the queue, the system appropriately shortens the backoff time to improve the processing efficiency of the backlog tasks; when the service constraint index is in a stable range, the location parameter remains unchanged. This adjustment method can distribute the task recovery execution time, reduce the peak of synchronous requests, and take into account both external interaction stability and internal task processing efficiency.
[0041] Furthermore, when the service limitation index is greater than the overload threshold, the system, while increasing the location parameter according to the limitation excess, further performs joint adjustment of the scale parameter of the backoff delay model based on the log-normal distribution; the system extracts the sample standard deviation of the time interval of the N consecutive actual network interaction request sending times corresponding to the service home identifier within the most recent sliding time window, calculates the difference between the sample standard deviation and the system preset benchmark standard deviation as the discrete gap quantity, the system multiplies the discrete gap quantity by the third positive adjustment gain coefficient to obtain the discrete increment, and adds the discrete increment to the scale parameter to obtain the candidate scale parameter; the system presets an upper limit threshold for the scale parameter, the... The upper limit threshold of the scale parameter is determined by inverse calculation based on the longest tolerable silence interval of a single session on the external server and the expected value formula of the log-normal distribution. The worst-case scenario is that the position parameter reaches the preset upper limit, so that the mathematical expected value corresponding to the scale parameter reaching the upper limit threshold does not exceed the longest tolerable silence interval. The system compares the candidate scale parameter with the upper limit threshold of the scale parameter and takes the smaller value as the updated scale parameter to ensure that the mathematical expected value of the log-normal distribution under extreme conditions remains within the preset convergence interval, and to avoid the delay time from diverging due to the monotonically increasing scale parameter. The value of the third positive adjustment gain coefficient is less than the value of the first positive adjustment gain coefficient.
[0042] Specifically, when the service limitation index exceeds the overload threshold and the system has already calculated the location parameter increment based on the limitation excess, the system simultaneously executes a joint adjustment process for the scale parameters. The system extracts the time intervals between N consecutive (e.g., N = 20) actual network interaction request transmissions corresponding to the service's attribution identifier within the most recent sliding time window (e.g., the last 60 seconds) from the request transmission history of this single-lane queue partition. Select a reference time unit (e.g., 1 second), calculate the logarithm of each time interval. Sample standard deviation The observed logarithmic dispersion is used as the metric. If the actual number of requests within the window is less than N, the observed logarithmic dispersion is calculated based on the total number of completed requests. If fewer than two requests have been completed, the current scale parameter adjustment is skipped, and the current scale parameter remains unchanged. A baseline logarithmic dispersion is preset within the system. The baseline logarithmic dispersion is a preset parameter for the dispersion of network interaction time intervals in the system. For example, a logarithmic transformation is performed on no fewer than 1000 sets of similar historical network interaction time interval samples, outlier samples below the 1st percentile and above the 99th percentile are removed, the standard deviation of the remaining samples is calculated, and this standard deviation is determined as the baseline logarithmic dispersion. The system calculates the dispersion gap. When the observed logarithmic dispersion is lower than the baseline logarithmic dispersion, it indicates that the current request time interval has low dispersion in the logarithmic domain, suggesting that the sending times of current network interaction requests are too concentrated, easily forming synchronization request peaks. The system multiplies the dispersion gap by the third positive adjustment gain coefficient. The discrete increment is obtained, and the scale parameter is added to the discrete increment to obtain the updated scale parameter. ;in The coefficient is dimensionless. Both are dimensionless. When the service limitation index is greater than or equal to the recovery threshold and less than or equal to the overload threshold, the system multiplies the scale parameter by a preset scale decay factor (preferably 0.8 to 0.98, 0.95 in this embodiment) to slowly decrease it back towards the initial value; when the service limitation index is less than the recovery threshold, the scale parameter is reset to the initial value. The updated location parameter and scale parameter are then substituted into the next round of log-normal distribution sampling to generate a new random backoff duration.
[0043] Among them, the third positive adjustment gain coefficient The value is set to be less than the first positive adjustment gain coefficient. In this embodiment, the first positive adjustment gain coefficient is set to 0.3, and the third positive adjustment gain coefficient is set to 0.1. This value constraint is based on the expected value of the log-normal distribution. right The partial derivatives are ,Right now The amplification effect of increasing the expected value varies with Self-incrementing; within the overload avoidance range, if and The values are similar. The rapid increase will cause the expected delay to grow by a rate exceeding that of the sum of its parts. Adjust to the desired level. The constraint is less than ,make Adjusting for changes in the dominant expectation delay, The adjustment primarily contributes to the increase in the dispersion of the request time interval; The specific value is configured based on the frequency of abnormal responses from the external server and the allowed completion time limit for the task.
[0044] This invention increases the average backoff time and expands its dispersion by jointly adjusting the position and scale parameters within the overload backoff interval. The position parameter is mainly used to adjust the average backoff time, while the scale parameter is mainly used to distribute the timing of different tasks resuming execution and sending network requests. This reduces the peak of synchronization requests caused by multiple tasks resuming at similar times, thereby improving the stability of high-concurrency task scheduling.
[0045] The system presets a request frequency limit for the external server, measured in requests per second (bps). This limit represents the maximum number of requests allowed by the external server per unit time. The value can be obtained during system initialization from the interface frequency description in the external server developer's documentation or by parsing the frequency limit field in the HTTP response header returned by the external server. The system sets the expected value of the log-normal distribution in the initial state as the reciprocal of the request frequency limit. Within the scope of independent scheduling for a single account, the initial average latency matches the upper limit of the request frequency allocated to that single account by the external server, and the initial values of the basic location parameters are calculated accordingly. The initial scale parameter of the log-normal distribution is determined based on the logarithmic standard deviation of the preset network interaction time interval, preferably 0.2 to 0.8; in this embodiment, it is set to 0.4, ensuring that the coefficient of variation of latency is within a predetermined range. The scale parameter has a preset upper limit, which is also constrained by the longest tolerable silent interval, ensuring that the expected value does not exceed the longest tolerable silent interval when the location parameter and scale parameter are both at their upper limits. The longest tolerable silent interval is the minimum value among the external server session failure time, the maximum allowed task completion time, and the business heartbeat timeout time; these times are read from the external server interface documentation, session configuration data, and task service level configuration, respectively. The real-valued duration is measured in milliseconds; before being written to the sleep parameter register of the independent asynchronous timer, the real-valued duration sampled from the log-normal distribution is converted from seconds to milliseconds by the system to match the standard timing precision of the application layer asynchronous timer interface.
[0046] Furthermore, the system instantiates and allocates a dedicated, independent asynchronous timer for each single-lane queue partition; it samples and generates a real-valued duration from a log-normal distribution as the sleep parameter for the independent asynchronous timer; in the non-blocking backoff waiting state, it only suspends the dequeue pointer offset operation of the single-lane queue partition that triggered the backoff waiting and the request issuance action of the corresponding agent.
[0047] Specifically, the system instantiates and allocates a dedicated, independent asynchronous timer for each single-lane queue partition. The lifecycle of each independent asynchronous timer is bound to the execution context of the corresponding single-lane queue partition. When a regular task within a queue partition enters the backoff waiting phase, the system performs a random sampling from the corresponding log-normal distribution using the currently effective position and scale parameters. The real-valued duration generated by the sampling is written to the sleep parameter register of the dedicated asynchronous timer for that queue partition, and a countdown begins. During the countdown, the non-blocking backoff waiting state only suspends the dequeue pointer offset operation and the corresponding agent's request issuance action for that single-lane queue partition itself. System-level shared event loop scheduling resources are unaffected, and the asynchronous timers of other single-lane queue partitions continue to run independently on their respective timelines. When the countdown reaches zero, the independent asynchronous timer sends a ready signal, and the corresponding dequeue pointer offset operation is resumed.
[0048] This invention avoids blocking system-level shared event loop scheduling resources or interfering with the scheduling timelines of other partitions by limiting backoff waiting to suspending only the dequeue pointer of the single-lane queue partition that triggered the waiting and the corresponding agent's request issuance action. This mechanism overcomes the problem of traditional global blocking and sleeping reducing overall concurrent throughput when applying speed reduction to a single account, enabling the system to implement time-isolated adaptive backoff control in parallel for multiple independent accounts' single-lane queue partitions under the same architecture, ensuring the independence of multi-agent cluster concurrent task scheduling and system throughput efficiency.
[0049] As an alternative implementation, before using the real-value duration sampled from the log-normal distribution as the sleep parameter of an independent asynchronous timer, the adaptive backoff module further obtains the hash value of the service affiliation identifier and performs a modulo operation on the hash value with a preset prime number to obtain a micro-phase offset. The system appends the micro-phase offset to the real-value duration to generate the final sleep parameter, which is then written to the sleep parameter register. The prime number is chosen such that the maximum micro-phase offset is less than one-hundredth of the sliding time window time step. This alternative implementation, while maintaining the macro-backoff trend of the log-normal distribution, introduces a deterministic micro-time offset through local calculation, staggering the backoff wake-up times of different service accounts. This mechanism avoids the synchronous wake-up burst traffic caused by multiple single-lane queue partitions obtaining the same value through independent random sampling, improving the anti-collision determinism of global concurrent task scheduling without increasing the network communication overhead between nodes.
[0050] Furthermore, the mutex lock is a local mutex lock within the independent memory address space of the single-lane queue partition. The lifecycle of the local mutex lock is bound to a single execution context within the single-lane queue partition, providing exclusive control within the execution context. After acquiring exclusive control of the mutex lock, an external application programming interface is called to send network interaction data packets to an external server, and the dequeue pointer offset of the current single-lane queue partition is suspended, waiting until an acknowledgment response message is received from the external server. Subsequently, a state snapshot containing breakpoint position data and response result data is updated in memory. Before writing the state snapshot to the database persistent transaction, the system first writes the original acknowledgment response message of this network interaction to the local non-volatile storage medium in the form of a write-ahead log and performs a forced flush to disk. After the database persistent transaction is committed, the write-ahead log record is marked as committed and allowed to be periodically cleaned up. Then, an unlock command is issued to cancel the exclusive control and release the mutex lock. If a process crashes before the database persistent transaction is committed, the system scans the write-ahead log for records that are not marked as committed during restart and recovery, re-queues the corresponding tasks into the single-lane queue partition, and uses the original task execution identifier during retries to support idempotent processing.
[0051] Specifically, the mutex lock is a local mutex lock within the independent memory address space of the single-lane queue partition. Its lifecycle is bound to a single execution context within the single-lane queue partition, providing exclusive control within that execution context. The locking identifier of the local mutex lock is derived from the business ownership identifier corresponding to the queue partition, so that queue partitions with different business ownership identifiers each hold an independent local mutex lock instance. After acquiring exclusive control of the mutex lock, the system calls the external application programming interface to send network interaction data packets to the external server and suspends the dequeue pointer offset of the current single-lane queue partition, waiting until a confirmation response message is received from the external server. If the waiting time exceeds the preset network interaction timeout (99th percentile of historical request response time plus safety margin) and no response is received, the system releases the mutex lock, marks the task as pending retry, and re-queues it to the tail of the single-lane queue partition. At the same time, the network interaction timeout event is recorded. The network interaction timeout event is not included in the service-restricted response frequency. If exclusive control is not acquired during the mutex lock acquisition phase after the preset lock acquisition timeout (single network interaction timeout plus database transaction commit timeout), the system marks the task as pending retry and re-queues it to the end of the queue. Subsequently, the system updates a state snapshot in memory, containing breakpoint location data and response result data. In the database persistence transaction of the state snapshot, in addition to writing the state snapshot data, the system reverts to writing a scheduling pending record. This scheduling pending record contains at least: a globally unique scheduling event identifier, the business affiliation identifier corresponding to the single-lane queue partition, and an event type flag (regular task dequeue or reserve area check). After the database persistence transaction is successfully committed, the system releases the mutex lock. Subsequently, the independent scheduling and distribution component within the system processes the scheduling pending records in a round-robin manner: for records with the event type of regular task dequeue, the dequeue pointer of the single-lane queue partition is offset to schedule the next regular task; for records with the event type of reserve area check, the memory cursor in the reserve area is forcibly read to load the urgent task. Each pending scheduling record is marked as processed after the corresponding scheduling action is completed.
[0052] If a process crashes after the database persistent transaction is committed but before the scheduling and distribution component processes the corresponding pending scheduling record, the system, upon restart and recovery, scans for pending scheduling records not marked as processed and executes the corresponding scheduling actions sequentially according to the record's writing order, ensuring no scheduling events are missed. If a process crashes before the database persistent transaction is committed and the pending scheduling record has not been written, the system, upon restart and recovery, re-queues tasks not marked as committed in the write-ahead log records without generating a dangling scheduling signal.
[0053] This invention confines the storage location of mutex locks to the independent memory addressing space of a single-lane queue partition, transforming lock acquisition and release operations into local memory operations. This avoids latency jitter and availability coupling caused by cross-network middleware lock operations. This mechanism matches the same account task aggregation topology established by the consistent hash routing layer, effectively reducing system control communication overhead while achieving serial network interaction and transactional state persistence at the service ownership identifier level, ensuring data consistency during high-concurrency scheduling of intelligent agents.
[0054] Furthermore, the reserve area is set in the memory address range at the first position in the single-lane queue partition; after releasing the mutex lock, the scheduling wake-up signal of the task in the reserve area is triggered, forcibly reading the memory cursor in the reserve area, loading the emergency task corresponding to the memory cursor, and entering the execution phase; the emergency task is controlled to skip the random backoff duration sampling; before requesting the mutex lock, the time difference required to meet the preset minimum emergency protection interval and the remaining retry waiting time indicated by the external server are calculated respectively, and the maximum value of the two is taken as the target compensation time. The independent asynchronous timer is used to perform non-blocking compensation waiting; then the mutex lock is requested and the intelligent agent is scheduled to initiate network interaction first. If there is no external server retry waiting indication that has not yet expired, the remaining retry waiting time is counted as zero.
[0055] Specifically, the system sets the reserve area in the memory address range at the top of the single-lane queue partition. When parsing the task data stream, if an emergency intervention tag is detected in the message payload, the system writes the memory cursor of that emergency task into the reserve area. The reserve area has a preset capacity limit (determined by the maximum number of emergency tasks per unit time and task processing capacity, such as a reserve area capacity of 8 or 16 tasks). When the reserve area is full, newly arriving emergency tasks overwrite the earliest scheduled emergency task in the reserve area according to the received timestamp order. The memory cursor in the reserve area is included in the database persistent transaction along with the state snapshot of the single-lane queue partition. The system reconstructs the memory cursor in the reserve area from the state snapshot during restart and recovery. After the scheduling and distribution component triggers a scheduling wake-up signal based on the scheduling pending records, the system forcibly reads the memory cursor in the reserve area during the control flow cycle after the current task completely releases its local mutex lock and before the next regular queuing task dequeue action is triggered, loading the emergency task corresponding to that memory cursor and entering the execution phase. Subsequently, the system controls the emergency task to skip the random backoff duration sampling. Before requesting the mutex lock, the system calculates the time difference required to meet the preset minimum emergency protection interval (200 milliseconds in this embodiment) and the remaining retry waiting time indicated by the external server, taking the maximum of the two as the target compensation time. If there is no external server retry waiting indication that has not yet expired, the remaining retry waiting time is counted as zero. The system uses the independent asynchronous timer dedicated to this queue partition to perform non-blocking compensation waiting according to the target compensation time. After completing the waiting, the system requests to bind the local mutex lock and prioritizes scheduling the agent to initiate network interaction. If there are multiple emergency tasks in the reserve area, the system schedules them in ascending order of receiving timestamps, and each scheduling independently performs the above protection interval check.
[0056] This invention enables emergency tasks to bypass random backoff time sampling while introducing an emergency minimum protection interval mechanism, reusing asynchronous timers to ensure that the interval between consecutive requests is not lower than a preset lower limit. This mechanism, without disrupting the global serial architecture of the single-lane queue, balances the low-latency response of emergency tasks with the request frequency limits of external servers, preventing consecutive emergency tasks from forming instantaneous request peaks. Furthermore, while ensuring task state consistency, it allows emergency tasks to gain priority execution at the next scheduling point after the current regular task releases its mutex lock.
[0057] Example 2: This embodiment covers task routing and queue overload protection, dual-parameter adaptive backoff adjustment, non-blocking mutex lock state transition, and emergency task priority bypass mechanism, forming the core control flow for multiple agents to call external servers to execute high-concurrency tasks. This flow is executed by the task scheduling engine in the distributed system, specifically including task access and queue construction, service constraint awareness and parameter adjustment, non-blocking backoff and mutex lock transition, and emergency task priority scheduling.
[0058] During the task access and queue overload protection phase, the system continuously monitors and parses the task data streams submitted concurrently by the agent cluster at the application layer of the network protocol stack. The system extracts the target network interaction service account identifier from the request message payload as the service attribution identifier, and inputs it as a unique source operand into the consistent hash algorithm to locate the uniquely determined target virtual computing node on the consistent hash ring. In the independent memory address space of the target virtual computing node, the system detects the current state of the single-lane queue partition bound to the service attribution identifier. The system extracts the current physical backlog length of the single-lane queue partition and compares it in real time with the system's preset memory warning level. If the physical backlog length is lower than the memory warning level, the system parses the message payload of the current task: if an emergency intervention tag is detected in the message, the system directly writes the task's memory cursor to the pre-ordered reserve area at the beginning of the single-lane queue partition; if no emergency intervention tag is detected, the task is appended to the end of the single-lane queue partition as a regular task. If the physical backlog exceeds the memory warning threshold, the system triggers a flow control switch and mounts a persistent overflow buffer on the target virtual compute node's local non-volatile storage medium. At this point, the system suspends writing new regular tasks to the memory queue and instead appends new tasks to disk as checksum-enabled write-ahead logs. Once the physical backlog in the memory queue falls below the preset recovery threshold due to the dequeueing of regular tasks, the system starts a background I / O thread to pre-fetch tasks from the persistent overflow buffer back into the memory preparation queue, thereby eliminating the risk of memory overflow while maintaining the exclusive control of the single-node mutex lock.
[0059] During the service-constrained awareness and adaptive backoff adjustment phase, the system continuously monitors response messages returned by external servers using a built-in finite state machine. The finite state machine advances a sliding time window with a fixed time step, statistically analyzing the frequency of service-constrained responses within that window. This frequency, combined with the duration of the constraint, is weighted and aggregated using pre-configured weighting coefficients to generate a real-time service-constrained index. Subsequently, the system executes a segmented parameter adjustment process based on this service-constrained index: when the service-constrained index exceeds the overload threshold, the system calculates the difference between the service-constrained index and the overload threshold as the constraint excess. Based on the product of this constraint excess and the first positive adjustment gain coefficient, the system increases the location parameter of the log-normal distribution. Simultaneously, the system extracts the standard deviation of the time interval samples of continuous actual network interaction requests within the most recent sliding time window, calculates the discrete gap between this sample and the preset benchmark standard deviation, and uses the third positive adjustment gain coefficient to calculate the discrete increment, synchronously increasing the scale parameter of the log-normal distribution. When the service-constrained index is between the recovery threshold and the overload threshold, the system maintains the current value of the location parameter unchanged. When the service limitation index is less than the recovery threshold, the system calculates the reduction based on the current physical backlog length in the queue and the second positive adjustment gain coefficient, and reduces the position parameter to no less than the preset lower limit.
[0060] During the non-blocking backoff and mutex lock transition phase, the system uses the currently effective position and scale parameters to randomly sample from a log-normal distribution model to generate a real-valued duration. This real-valued duration is written into a dedicated, independent asynchronous timer for the corresponding single-lane queue partition, and a countdown begins. During this non-blocking backoff waiting period, the system only suspends the dequeue pointer offset operation for the current single-lane queue partition and the corresponding agent's request issuance action; the underlying shared event loop scheduling resources are not blocked, and other queue partitions continue to operate independently. When the independent asynchronous timer for the single-lane queue partition counts down to zero and sends a ready signal, the dequeue pointer offset operation resumes. At this time, the system requests a local mutex lock to bind the business ownership identifier for regular tasks preparing to dequeue. After acquiring exclusive control of the local mutex lock, the system scheduler agent initiates network interaction with the external server and again suspends the current queue partition to await a response. After receiving the confirmation response, the system updates the state snapshot in memory, which includes the breakpoint location data and the response result data. After the database persistent transaction that completes the state snapshot is committed, the system issues an unlock command to cancel the exclusive control and release the local mutex lock.
[0061] During the emergency task and priority bypass phases, the system triggers a scheduling wake-up signal after releasing the mutex lock. Within the control flow cycle after the current task completely releases its local mutex lock and before the next regular queuing task's dequeue action is triggered, the system forcibly reads the memory cursor in the preparation area at the head of the single-lane queue partition. If there is an emergency task waiting in the preparation area, the system directly loads the emergency task corresponding to that cursor into the execution phase. Controlled emergency tasks skip the log-normal distribution random backoff duration sampling process. Before requesting the local mutex lock to bind the service ownership identifier, the system calculates the time difference required to meet the preset minimum emergency protection interval and the remaining retry waiting time indicated by the external server, taking the maximum of the two as the target compensation time, and uses an independent asynchronous timer to execute non-blocking compensation waiting. This mechanism ensures that while the emergency task obtains priority scheduling rights, it still strictly adheres to the rate limiting requirements of the external server. Subsequently, the system requests the local mutex lock to bind the service ownership identifier. After acquiring exclusive control rights, the system prioritizes scheduling the agent to initiate network interaction. If multiple urgent tasks exist within the reserve area, the system executes these scheduling actions strictly in ascending order of their received timestamps. This mechanism ensures that high-priority instructions are scheduled before regular tasks in the queue after the current critical section ends, without disrupting the basic global single-lane serial execution architecture.
[0062] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A high-concurrency task scheduling system for intelligent agents based on a single-lane queue, characterized in that, include: The queue construction module is used to parse the task data stream submitted concurrently by the intelligent agent cluster to extract the business ownership identifier, use consistent hashing to map the business ownership identifier to the target virtual computing node to establish a single-lane queue partition, and when an emergency task is parsed out, the emergency task is located in the preparation area at the head of the single-lane queue, and the remaining target tasks are arranged into the single-lane queue partition as regular tasks. An adaptive backoff module is used to generate a service-limited index based on the service-limited response frequency and limitation duration, and construct a backoff delay model based on a log-normal distribution; when the service-limited index exceeds an overload threshold, the position parameter of the backoff delay model is increased, and when it is below a recovery threshold, the position parameter is decreased to a level not lower than a preset lower limit; based on the updated position parameter, a random backoff duration is sampled and sent to an independent asynchronous timer to control the corresponding agent to perform non-blocking backoff waiting; The mutex and transaction module is used to request a mutex that binds to the business ownership identifier after a regular task has completed non-blocking backoff waiting, or when an emergency task is awakened. Under the protection of a mutex lock, the agent is scheduled to perform network interactions and, upon receiving a network response, submits a state snapshot and releases the mutex lock. After releasing the mutex lock, the scheduling wake-up signal for the preparatory tasks is triggered.
2. The intelligent agent high-concurrency task scheduling system based on a single-lane queue according to claim 1, characterized in that, The application layer message data payload of the concurrently submitted task data stream of the intelligent agent cluster is analyzed, and the target network interaction business account identifier is extracted as the business ownership identifier. The business ownership identifier is used as the unique source operand of the hash operation to calculate the mapping address corresponding to the unique target virtual computing node in the distributed cluster, and a single-lane queue partition is established in the independent memory address space pointed to by the mapping address. In the case that no tasks are stored in the reserve area, the single-lane queue partition is controlled to perform first-in-first-out dequeue operation according to the ascending order of the task reception timestamp.
3. The intelligent agent high-concurrency task scheduling system based on a single-lane queue according to claim 1, characterized in that, The service-restricted response returned by the external server is obtained within a sliding time window according to a fixed time step. The ratio of the occurrence of the service-restricted response to the total number of requests within the sliding time window is calculated to obtain the service-restricted response frequency. The retry waiting time carried by the service-restricted response is analyzed and normalized to obtain the restriction duration. The weighted Euclidean distance between the service-restricted response frequency and the restriction duration is calculated based on preset weights. The calculation result is then normalized to between zero and one to obtain the service-restricted index.
4. The intelligent agent high-concurrency task scheduling system based on a single-lane queue according to claim 1, characterized in that, The preset recovery threshold value within the system is less than the overload threshold value. When the service limitation index is greater than the overload threshold, the difference between the service limitation index and the overload threshold is calculated as the limitation excess. The limitation excess is multiplied by the preset first positive adjustment gain coefficient to obtain the backoff increment. The position parameter is then added to the backoff increment to obtain the updated position parameter, thereby increasing the expected value of the log-normal distribution.
5. The intelligent agent high-concurrency task scheduling system based on a single-lane queue according to claim 1, characterized in that, When the service limitation index is greater than or equal to the recovery threshold and less than or equal to the overload threshold, the control location parameter remains unchanged. When the service limitation index is less than the recovery threshold, the total number of tasks queued in the current single-lane queue partition is extracted as the physical backlog length, and the physical backlog length is multiplied by the second positive adjustment gain coefficient to obtain the backlog digestion reduction. Subtract the backlog digestion reduction from the position parameter to obtain the candidate position parameter. Compare the value of the candidate position parameter with the preset lower limit, and take the larger value of the two as the updated position parameter.
6. The intelligent agent high-concurrency task scheduling system based on a single-lane queue according to claim 1, characterized in that, The system instantiates and allocates a dedicated, independent asynchronous timer for each single-lane queue partition; based on the current position and scale parameters, it samples real-valued durations from a log-normal distribution to serve as sleep parameters for the independent asynchronous timers; In the non-blocking backoff waiting state, only the dequeue pointer offset operation of the single-lane queue partition that triggered the backoff waiting and the corresponding agent's request issuance action are suspended.
7. The intelligent agent high-concurrency task scheduling system based on a single-lane queue according to claim 1, characterized in that, The mutex lock is a local mutex lock located in the independent memory address space of the single-lane queue partition. The lifecycle of the local mutex lock is bound to a single execution context within the single-lane queue partition, providing exclusive control within the execution context. After acquiring exclusive control of the mutex lock, an external application programming interface is called to send network interaction data packets to an external server, and the dequeue pointer offset of the current single-lane queue partition is suspended. The system waits until a confirmation response message is received from the external server. Subsequently, a state snapshot containing breakpoint position data and response result data is updated in memory. After the database persistent transaction of the state snapshot is committed, an unlock command is issued to cancel the exclusive control and release the mutex lock.
8. The intelligent agent high-concurrency task scheduling system based on a single-lane queue according to claim 1, characterized in that, The preparation area is set in the memory address range that is first in the single-lane queue partition; after releasing the mutex lock, the scheduling wake-up signal of the task in the preparation area is triggered, the memory cursor in the preparation area is forcibly read, and the emergency task corresponding to the memory cursor is loaded and enters the execution phase; the emergency task is controlled to skip the random backoff time sampling. Before applying for the mutex lock, the time difference required to meet the preset minimum emergency protection interval and the remaining retry waiting time indicated by the external server are calculated respectively. The maximum value of the two is taken as the target compensation time. The independent asynchronous timer is used to perform non-blocking compensation waiting. Then, the mutex lock is applied for and the intelligent agent is scheduled to initiate network interaction first.
