Resource allocation method and device of order matching system based on autoregressive prediction

By employing a resource scheduling method based on autoregressive prediction and dual-threshold decision-making, the problem of untimely resource scheduling in existing systems is solved. This enables the order matching system to achieve low latency and efficient resource allocation under sudden traffic surges, thereby improving the system's responsiveness and resource utilization efficiency.

CN122390864APending Publication Date: 2026-07-14CSC FINANCIAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CSC FINANCIAL CO LTD
Filing Date
2026-04-20
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing system resource scheduling technologies suffer from time lag, failing to respond promptly to sudden traffic surges, leading to system delays and denial-of-service issues, and failing to meet the requirements of microsecond-level low latency and high throughput.

Method used

By acquiring real-time order flow data, extracting high-dimensional feature vectors, using a pre-trained order flow prediction model for autoregressive prediction, generating expected order event sequences, determining the expected load rate of resources to be allocated based on event feature parameters, and employing dual-threshold decision-making for resource scheduling.

Benefits of technology

It reduces the system's passive response delay to sudden traffic peaks, lowers the risk of order matching blockage, improves resource utilization efficiency and response timeliness, and avoids latency jitter introduced by frequent scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122390864A_ABST
    Figure CN122390864A_ABST
Patent Text Reader

Abstract

The application discloses a resource allocation method and device of an order matching system based on autoregressive prediction, relates to the technical field of system operation and maintenance, and mainly aims to solve the problem of untimely system resource scheduling. Mainly includes obtaining real-time order flow data of a target system, and extracting high-dimensional feature vectors of each order event in the real-time order flow data respectively to obtain an order event feature sequence; performing autoregressive prediction on the order event feature sequence based on a pre-trained order flow prediction model to generate an expected order event sequence; determining a resource to be allocated and an expected load rate of the resource to be allocated according to event feature parameters in the expected order event sequence; performing double-threshold decision according to the expected load rate to determine a resource scheduling strategy, and allocating resource configuration of the resource to be allocated according to the resource scheduling strategy. Mainly used for allocating resources of an order matching system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of system operation and maintenance technology, and in particular to a resource allocation method and apparatus for an order matching system based on autoregressive prediction. Background Technology

[0002] In the order matching system (also known as the order processing system) of large financial trading platforms, it is typically necessary to handle hundreds of thousands or even millions of concurrent order events per second, placing stringent requirements on microsecond-level low latency for end-to-end processing and extremely high system throughput. However, in the actual operating environment of the system, there are often sudden events that cause order traffic to surge explosively in a short period of time. These sudden traffic surges can put enormous instantaneous pressure on the CPU thread pool, memory management module, and network routing gateway of the system engine backend.

[0003] Currently, existing system resource scheduling technologies are mainly passive response scheduling based on system monitoring. This involves triggering operations based on real-time monitoring of the system's current CPU utilization, memory level, or network queue depth. However, this response mode based on post-event feedback has a significant time lag, making it impossible to achieve timely scheduling of system resources. When a surge in system load is detected, the system is already congested. At this point, performing thread pool expansion, memory allocation, or route switching will only further exacerbate system latency due to scheduling overhead, and may even lead to partial denial of service, thus causing system resource scheduling to fail to meet timeliness requirements. Summary of the Invention

[0004] In view of this, the present invention provides a resource allocation method and apparatus for an order matching system based on autoregressive prediction, the main purpose of which is to solve the problem of untimely resource scheduling in existing systems.

[0005] According to one aspect of the present invention, a resource allocation method for an order matching system based on autoregressive prediction is provided, comprising: Acquire real-time order stream data of the target system, and extract high-dimensional feature vectors of each order event in the real-time order stream data to obtain the order event feature sequence; The pre-trained order flow prediction model is used to perform autoregressive prediction on the order event feature sequence to generate the expected order event sequence. Based on the event characteristic parameters in the expected order event sequence, determine the resources to be allocated and the expected load rate of the resources to be allocated; Based on the expected load rate, a dual-threshold decision is made to determine the resource scheduling strategy, and the resource configuration of the resources to be scheduled is allocated according to the resource scheduling strategy.

[0006] Furthermore, the event feature parameters include the underlying contract type and the order type for each order event, wherein the underlying contract type is used to characterize the processing unit that performs matching processing on the corresponding order event; Based on the event characteristic parameters in the expected order event sequence, determine the resources to be allocated and the expected load rate of the resources to be allocated, including: Based on the processing units corresponding to different types of underlying contracts, the expected order events in the expected order event sequence are divided to obtain the expected order event sets corresponding to different processing units. For each set of expected order events, the expected order arrival rate of the corresponding processing unit is calculated based on the underlying contract type and order type of each order event in the set. For each processing unit, the resources to be allocated and the expected load rate of the resources to be allocated are determined based on the expected order arrival rate and the event characteristic parameters.

[0007] Furthermore, for each set of expected order events, based on the underlying contract type and order type of each order event in the set, the expected order arrival rate of the corresponding processing unit is calculated, including: The baseline calculation cost weight corresponding to the order event is obtained by matching from the preset calculation cost relationship set of the processing unit; The expected total computational load of the processing unit is obtained by summing the baseline computational cost weights of all the order events. Extract the window duration covered by the order events in the expected order event set, and calculate the quotient of the expected total computing load and the window duration to obtain the expected order arrival rate of the corresponding processing unit.

[0008] Furthermore, for each processing unit, the process of determining the resources to be allocated includes: If the expected order arrival rate is greater than the preset arrival rate threshold, the thread is identified as a resource to be allocated; if the proportion of complex order types in all order events is greater than the preset proportion threshold, memory is identified as a resource to be allocated; if the number of different contract types in all order events is greater than the preset routing volume threshold, the gateway is identified as a resource to be allocated. For any resource to be allocated, the calculation process for the expected load rate of the resource to be allocated includes: The unit computing resource quantity and the base processing rate of the unit computing resource to be allocated are retrieved, and the product of the unit computing resource quantity and the base processing rate is used as the performance parameter of the resource to be allocated. The expected load rate of the resources to be allocated is obtained by calculating the quotient of the expected order arrival rate and the performance parameter.

[0009] Furthermore, a dual-threshold decision is made based on the expected load rate to determine the resource scheduling strategy, including: If the expected load rate is greater than the preset high load threshold, and the expected load rate remains greater than the preset high load threshold within a first preset number of rolling prediction windows, the resource scheduling strategy is determined to be an expansion strategy. If the expected load rate is less than the preset low load threshold, and the expected load rate remains less than the preset low load threshold within a second preset number of rolling prediction windows, the resource scheduling strategy is determined to be a scaling-down strategy, wherein the second preset number is greater than the first preset number. If the expected load rate is greater than or equal to the preset low load threshold and less than or equal to the preset high load threshold, the resource scheduling strategy is determined to be a zero scheduling strategy.

[0010] Furthermore, the high-dimensional feature vector extraction process for any order event includes: Parse the order event to obtain a multidimensional tuple of the order event, wherein the multidimensional tuple includes a pricing attribute field, a scale attribute field, a timestamp field, an order operation direction identifier, an order type identifier, and an underlying contract type identifier; Based on a pre-constructed vocabulary corresponding to each dimension, each dimension field or identifier in the multidimensional tuple is mapped to an integer token. The integer tokens corresponding to each dimension field are concatenated into a low-dimensional vector, and the low-dimensional vector is then fused using a nonlinear transformation to obtain the high-dimensional feature vector of the order event.

[0011] Furthermore, the pre-trained order flow prediction model is built based on a decoder-only Transformer model; The pre-trained order flow prediction model performs autoregressive prediction on the order event feature sequence to generate an expected order event sequence, including: By superimposing a multi-head self-attention mechanism with a time decay factor, the temporal dependencies in the order event feature sequence are encoded to obtain encoded features. By jointly decoding the encoded features through a multi-head output layer, the probability distribution of each dimension of the next order event is predicted, and the prediction result is obtained. The prediction results are iteratively fed into the pre-trained order flow prediction model to autoregressively generate the expected order event sequence within a preset time window.

[0012] According to another aspect of the present invention, a resource allocation device for an order matching system based on autoregressive prediction is provided, comprising: The feature extraction module is used to acquire real-time order stream data of the target system and extract high-dimensional feature vectors of each order event in the real-time order stream data to obtain the order event feature sequence. The prediction module is used to perform autoregressive prediction on the order event feature sequence based on a pre-trained order flow prediction model to generate an expected order event sequence. The determination module is used to determine the resources to be allocated and the expected load rate of the resources to be allocated based on the event characteristic parameters in the expected order event sequence. The allocation module is used to make dual-threshold decisions based on the expected load rate, determine the resource scheduling strategy, and allocate the resource configuration of the resources to be allocated according to the resource scheduling strategy.

[0013] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored therein, the executable instruction causing a processor to perform an operation corresponding to the resource allocation method of the order matching system based on autoregressive prediction described above.

[0014] According to another aspect of the present invention, a terminal is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus; The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the resource allocation method of the order matching system based on autoregressive prediction described above.

[0015] By employing the above-described technical solutions, the technical solutions provided by the embodiments of the present invention have at least the following advantages: This invention provides a resource allocation method and apparatus for an order matching system based on autoregressive prediction. In this embodiment, real-time order stream data of the target system is acquired, and high-dimensional feature vectors of each order event in the real-time order stream data are extracted to obtain an order event feature sequence. An autoregressive prediction is performed on the order event feature sequence based on a pre-trained order stream prediction model to generate an expected order event sequence. Based on the event feature parameters in the expected order event sequence, the resources to be allocated and their expected load rates are determined. A dual-threshold decision is made based on the expected load rate to determine a resource scheduling strategy, and the resource allocation of the resources to be allocated is performed according to the resource scheduling strategy. This significantly reduces the system's passive response delay to sudden traffic peaks, lowers the risk of order matching blockage due to insufficient resources, and controls the computational overhead generated by the resource scheduling decision itself, avoiding additional latency jitter introduced by frequent scheduling. This greatly improves the responsiveness and resource utilization efficiency of the order matching system under dynamic load environments.

[0016] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the specification. Furthermore, in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0017] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A flowchart of a resource allocation method for an order matching system based on autoregressive prediction, provided by an embodiment of the present invention, is shown. Figure 2 This diagram illustrates the structural composition of an order flow prediction model provided by an embodiment of the present invention. Figure 3 The flowchart of another resource allocation method for an order matching system based on autoregressive prediction provided by an embodiment of the present invention is shown. Figure 4 This diagram illustrates the composition of a resource allocation device for an order matching system based on autoregressive prediction, as provided in an embodiment of the present invention. Figure 5 A schematic diagram of the structure of a terminal provided in an embodiment of the present invention is shown. Detailed Implementation

[0018] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0019] To address the issue of untimely resource scheduling in existing systems, this invention provides a resource allocation method for order matching systems based on autoregressive prediction. This method is primarily applied to matching trading systems in finance, securities, and cryptocurrencies. The execution entity is a resource scheduler, which can be deployed loosely coupled to the target matching system as a bypass independent service or an embedded module of the matching system. This scheduler bypasses real-time order stream data and, without interfering with the main transaction chain, proactively pre-allocates underlying resources such as threads, memory, and network routing based on the order stream data prediction results. This achieves the goal of ensuring extremely low latency response of the matching system with minimal scheduling overhead. Figure 1 As shown, the method includes: 101. Obtain the real-time order stream data of the target system, and extract the high-dimensional feature vectors of each order event in the real-time order stream data to obtain the order event feature sequence.

[0020] In this embodiment of the invention, the target system is an order matching system that serves as the object of resource allocation. Real-time order stream data refers to order data collected in real-time from the order receiving link, such as an exchange interface. The real-time order stream data includes multiple order events within a preset time window, with each order event indexed by its occurrence time. To predict order events in future time periods based on the real-time order stream data, feature engineering is first performed on the order events to obtain a high-dimensional feature vector corresponding to each order event. Then, these high-dimensional feature vectors are sorted according to the chronological order of the occurrence times of the corresponding order events to construct an order event feature sequence used as the input vector for the order stream prediction model.

[0021] In one embodiment of the present invention, for further explanation and limitation, the high-dimensional feature vector extraction process for any order event includes: The order event is parsed to obtain a multidimensional tuple of the order event.

[0022] Based on a pre-constructed vocabulary corresponding to each dimension, each dimension field or identifier in the multidimensional tuple is mapped to an integer token.

[0023] The integer tokens corresponding to each dimension field are concatenated into a low-dimensional vector, and the low-dimensional vector is then fused using a nonlinear transformation to obtain the high-dimensional feature vector of the order event.

[0024] In this embodiment of the invention, the extraction process of dimensional feature vectors essentially transforms the original order events into a numerical representation that can be understood by a computer. Simultaneously, based on the relationship between different dimensional features and underlying computational complexity, it is also possible to extract features that affect the underlying computational complexity. After obtaining the order stream data, each order event is first structured into a tuple containing multiple key dimensions, i.e., a multidimensional tuple. This multidimensional tuple includes a pricing attribute field, a scale attribute field, a timestamp field, an order operation direction identifier, an order type identifier, and an underlying contract type identifier. The pricing attribute field records the unit product order price for the current order event. The scale attribute field records the product order quantity for the current order event. The timestamp field records the time the order event occurred. The order operation direction identifier is a symbol representing the direction of the order transaction, such as 1 for selling and 0 for buying. The underlying contract type identifier can be extracted from the underlying contract type of the order event, determining which backend matching logic unit, i.e., the processing unit, the current order event needs to be routed to for processing. Order type identifiers are symbols used to represent order types, such as limit orders, market orders, cancellation orders, or complex arbitrage conditional orders. Each order type can be configured with a different identifier. Order type is related to order complexity and data processing methods; therefore, it directly affects the resource consumption of order event processing. A multidimensional tuple can be represented as: ;in, This indicates a pricing attribute field. This indicates a scale attribute field. Indicates the direction of order operation. Indicates the order type. Represents the timestamp field. This indicates the type of contract being contracted.

[0025] After constructing the multidimensional tuple, for each dimension of the tuple, a pre-built independent vocabulary, such as an order type vocabulary and an underlying contract type vocabulary, is used to map the fields or identifiers of that dimension to corresponding integer tokens, achieving the conversion from discrete symbols to continuous integers. Then, the integer tokens obtained from each dimension are concatenated into a low-dimensional vector in a fixed order. The low-dimensional vector is represented as follows: . This represents the timestamp difference. Finally, a nonlinear feature fusion network is used to fuse features and expand the dimensions of this low-dimensional vector, allowing the semantic relationships between different dimensions to fully interact, ultimately outputting a high-dimensional feature vector for use by subsequent prediction models. High-dimensional feature vector Represented as: .

[0026] The nonlinear feature fusion network can be constructed by adding activation functions to fully connected layers. Specifically, based on pre-constructed vocabularies corresponding to different dimensions, the process of mapping each dimension field in a multidimensional tuple to integer tokens includes two processes: direct mapping of identifiers and post-bucketing mapping of fields. Post-bucketing mapping of fields includes: calculating the difference between the value of the pricing attribute field and the baseline value, bucketing the difference to obtain the first bucket interval, and identifying the token matching the first bucket interval from the pricing attribute vocabulary as the integer token of the pricing attribute field; discretizing the value of the scale attribute field through logarithmic bucketing to obtain the second bucket interval, and identifying the token matching the second bucket interval from the scale attribute vocabulary as the integer token of the scale attribute field; calculating the difference between the timestamp of an order event and a previous order event, bucketing the timestamp difference to obtain the third bucket interval, and identifying the token matching the third bucket interval from the time vocabulary as the integer token of the timestamp field. For any other identifier, it is directly mapped to an integer token based on the corresponding vocabulary. For the order operation direction identifier, order type identifier, and underlying contract type identifier, the integer token matching the corresponding identifier is identified from their respective vocabularies. In other words, the vocabulary of a field is a mapping relationship between integer tokens and different bucket intervals, while the vocabulary of an identifier includes the mapping relationship between different identifiers and their corresponding integer tokens.

[0027] 102. Based on the pre-trained order flow prediction model, perform autoregressive prediction on the order event feature sequence to generate the expected order event sequence.

[0028] In this embodiment of the invention, the order event feature sequence is input into a pre-trained order flow prediction model to predict the order event sequence within a future second-level time window, thus obtaining the expected order event sequence. The pre-trained order flow prediction model is a large language model autoregressive architecture that integrates time-aware capabilities. Compared to traditional LSTM and GRU models, the self-attention mechanism of the large language model autoregressive architecture can capture long-range dependencies in the order flow, such as the follow-up order pattern after large orders are split, ensuring prediction accuracy.

[0029] In one embodiment of the present invention, for further explanation and limitation, an autoregressive prediction of the order event feature sequence is performed based on a pre-trained order flow prediction model to generate an expected order event sequence, including: By superimposing a multi-head self-attention mechanism with a time decay factor, the temporal dependencies in the order event feature sequence are encoded to obtain encoded features. By jointly decoding the encoded features through a multi-head output layer, the probability distribution of each dimension of the next order event is predicted, and the prediction result is obtained. The prediction results are iteratively fed into the pre-trained order flow prediction model to autoregressively generate the expected order event sequence within a preset time window.

[0030] In this embodiment of the invention, the pre-trained order flow prediction model is built based on a decoder-only Transformer model. The model structure is as follows: Figure 2 As shown, the structure of the pre-trained order flow prediction model, from input to output, includes stacked self-attention layers of a Transformer-only decoder and a multi-head output layer for the decoding stage. Each attention layer is configured with a multi-head self-attention mechanism with a time decay factor. By assigning decreasing attention weights to events at different time intervals, the model focuses more on the dynamic changes of recent order flows while also considering the long-range dependencies of historical sequences, thus outputting encoded features carrying temporal correlation information. The multi-head output layer contains multiple parallel linear mapping heads. Each output head independently predicts the probability distribution of each feature dimension of the order event, outputting the most likely values ​​for each dimension of the next order event, thus obtaining the prediction result. This prediction result is fed back into the order flow prediction model as a new input, concatenated with the historical sequence, and the above encoding-decoding process is repeated to generate subsequent order events one by one until the preset time window length is filled, resulting in the expected order event sequence.

[0031] The pre-trained order flow prediction model is trained based on historical order flow data of the target system. The specific sample construction and training process is as follows: First, raw order flow data is collected from the historical order logs of the target system, covering various market environments such as normal transactions, high volatility, and major news events. A sliding window method is used, with a fixed-size historical time window (e.g., the order event feature sequence of the previous 10 seconds) as the model input feature, and the immediately following future time window (e.g., the order event sequence of the next 5 seconds) as the prediction target, forming supervised training samples. A two-stage strategy is adopted during training: In the pre-training stage, large-scale historical order data across markets is used for self-supervised learning, aiming to optimize the parameters of the Transformer model (decoder only) to capture the general statistical regularity of order flow time series; in the fine-tuning stage, a small number of iterative training sessions are performed on the supervised training samples, continuously optimizing the model to adapt to the current system's order flow characteristics, while introducing a time decay attention mechanism to strengthen the learning weights of recent events; finally, the model converges through the AdamW optimizer and cosine annealing learning rate scheduling. After training, the model has the ability to perform high-precision autoregressive predictions of order event sequences within a future second-level time window.

[0032] 103. Based on the event characteristic parameters in the expected order event sequence, determine the resources to be allocated and the expected load rate of the resources to be allocated.

[0033] In this embodiment of the invention, the event characteristic parameters carried by each event in the expected order event sequence, such as order type and underlying contract, are used as input. By analyzing the mapping relationship between the event characteristic parameters and the underlying resource consumption, the differences in the consumption of underlying system resources are quantified and converted into expected occupancy values ​​for resources such as threads, memory, and network routing. Simultaneously, the expected load rate of each resource to be allocated within a future time window is quantified and calculated. By transforming the order event sequence generated by upstream prediction into two key elements required for subsequent scheduling decisions—what resources to allocate and how many resources to allocate—standardized input is provided for dual-threshold decision-making. This avoids scheduling biases caused by traditional methods relying solely on experience or simple threshold judgments, and realizes the transformation from order flow prediction to resource load assessment.

[0034] In one embodiment of the present invention, for further illustration and limitation, such as Figure 3 As shown, based on the event characteristic parameters in the expected order event sequence, the resources to be allocated and the expected load rate of the resources to be allocated are determined, including: 1031. Using the processing units corresponding to different target contract types as the dividing criteria, the expected order events in the expected order event sequence are divided to obtain the expected order event sets corresponding to different processing units.

[0035] 1032. For each set of expected order events, calculate the expected order arrival rate of the corresponding processing unit based on the underlying contract type and order type of each order event in the set.

[0036] 1033. For each processing unit, determine the resources to be allocated and the expected load rate of the resources to be allocated based on the expected order arrival rate and the event characteristic parameters.

[0037] In this embodiment of the invention, the event feature parameters include the underlying contract type and order type of each order event. The underlying contract type is used to characterize the processing unit that performs matching processing for the corresponding order event. Based on the matching processing units corresponding to different underlying contract types, the expected order event sequence is grouped according to the underlying contract type, resulting in an expected order event set corresponding to each processing unit. For each expected order event set, the expected order arrival rate of the processing unit within a future time window is calculated based on the underlying contract type and order type of each order event in the set. Finally, for each processing unit, based on the calculated expected order arrival rate and the event feature parameters of each order event, the type of underlying resource that needs to be allocated, such as threads, memory, and gateways, is comprehensively determined, and the expected load rate corresponding to each type of resource to be allocated is quantitatively calculated.

[0038] It should be noted that by grouping predicted order events into fine-grained groups based on the target contract, the decoupling from the global order flow to the independent load assessment of each processing unit is achieved, avoiding assessment distortion caused by resource interference between different product categories. At the same time, using the expected order arrival rate as the core intermediate variable to connect the three stages of grouping, calculation, and resource determination can more directly reflect the core processing pressure of the matching engine, providing more accurate input parameters for subsequent load rate calculation based on queuing theory models, thereby improving the pertinence and effectiveness of the resource pre-allocation strategy.

[0039] In one embodiment of the present invention, for further explanation and limitation, for each set of expected order events, the expected order arrival rate of the corresponding processing unit is calculated based on the underlying contract type and order type of each order event in the set, including: The baseline calculation cost weight corresponding to the order event is obtained by matching from the preset calculation cost relationship set of the processing unit; The expected total computational load of the processing unit is obtained by summing the baseline computational cost weights of all the order events. Extract the window duration covered by the order events in the expected order event set, and calculate the quotient of the expected total computing load and the window duration to obtain the expected order arrival rate of the corresponding processing unit.

[0040] In this embodiment of the invention, the specific method for calculating the expected order arrival rate of the processing unit is as follows: First, from the pre-configured calculation cost relationship set of the processing unit, based on the order type of the i-th expected order event... Contract type of the target The baseline cost weight corresponding to the i-th expected order event is obtained by matching. The weight is used to characterize the relative computing resource consumption required to process this type of order per unit time, such as the required average CPU clock cycles. The preset computing cost relationship set is a pre-built mapping table that includes the correspondence between order event characteristic parameters and benchmark computing cost weights. This relationship set uses order type and underlying contract type as the joint key, and pre-sets a numerical weight value for each combination. This weight value quantifies the relative computing resource consumption required to process this type of order event. The construction of this relationship set can be completed through historical data regression analysis, performance benchmark testing, or expert experience calibration, etc., and this embodiment of the invention does not impose specific limitations. By uniformly quantifying and standardizing the computing overhead of heterogeneous order events, the subsequent calculation of the expected total computing load and the expected order arrival rate becomes operable and consistent, avoiding load assessment bias caused by differences in order type and underlying contract.

[0041] Then, the baseline computational cost weights of all order events in the expected order event set corresponding to the processing unit are summed to obtain the expected total computational load of the processing unit within the future time window. The formula is expressed as: ; in, Let represent the set of expected order events for the j-th processing unit, and e represent the order event. Then, the expected order arrival rate is calculated based on the expected total computational load and the window duration. The formula is expressed as: Where T represents the window duration.

[0042] In one embodiment of the present invention, for further explanation and limitation, the process of determining the resources to be allocated for each processing unit includes: If the expected order arrival rate is greater than the preset arrival rate threshold, the thread is identified as a resource to be allocated; if the proportion of complex order types in all order events is greater than the preset proportion threshold, memory is identified as a resource to be allocated; if the number of different contract types in all order events is greater than the preset routing volume threshold, the gateway is identified as a resource to be allocated. For any resource to be allocated, the calculation process for the expected load rate of the resource to be allocated includes: The unit computing resource quantity and the base processing rate of the unit computing resource to be allocated are retrieved, and the product of the unit computing resource quantity and the base processing rate is used as the performance parameter of the resource to be allocated. The expected load rate of the resources to be allocated is obtained by calculating the quotient of the expected order arrival rate and the performance parameter.

[0043] In this embodiment of the invention, the process of determining the resources to be allocated is based on multi-dimensional condition judgment: If the expected order arrival rate exceeds a preset arrival rate threshold, it indicates that the order traffic density is high and the demand for parallel processing capabilities is increasing, then the thread is determined as a resource to be allocated. If the proportion of complex order types in the expected order event set, such as iceberg orders and stop-loss orders, which require additional calculation logic, is greater than a preset proportion threshold, it indicates that more temporary storage space and state maintenance are needed during order processing, then memory is determined as a resource to be allocated. If the number of different contract types in the expected order event set is greater than a preset routing volume threshold, it indicates that the orders need to be distributed to multiple different matching processing units and the network forwarding capability requirements are high, then the gateway, i.e., the network route, is determined as a resource to be allocated.

[0044] After identifying the resources to be allocated, the calculation process for the expected load rate of any identified resource is as follows: The number of units of computing resources to be allocated for that resource is determined. Such as a single thread, a unit memory page, or a gateway single channel and its corresponding baseline processing speed. This refers to the computational load that can be processed per unit of time. The product of these two parameters is used as the performance parameter of the resource, characterizing the total processing capacity of the matching unit. The performance parameter formula is: Furthermore, to avoid complex queuing delay calculations, a dimensionless expected load rate is used. As a core leading indicator for measuring system congestion, the expected load rate is expressed by the following formula: ;in, This represents the expected order arrival rate. It should be noted that the above formula does not consider dimensions.

[0045] It should be noted that by using differentiated judgment conditions to identify the allocation requirements of three types of resources—threads, memory, and gateways—the resource type identification is matched with the actual pressure characteristics of the order flow. At the same time, using performance parameters as the denominator for load rate calculation ensures that load assessment across different resource types has a unified quantitative standard.

[0046] 104. Based on the expected load rate, make a dual-threshold decision to determine the resource scheduling strategy, and allocate the resource configuration of the resource to be allocated according to the resource scheduling strategy.

[0047] In this embodiment of the invention, to avoid the context switching costs caused by frequent resource switching operations, the algorithm employs a dual-threshold decision-making approach with hysteresis. The calculated expected load rate is compared with preset dual thresholds, such as a high load threshold and a low load threshold. Based on the load rate range and the number of prediction windows that continuously meet the conditions, a corresponding resource scheduling strategy is generated. This scheduling strategy may include scaling up, scaling down, or zero-scheduling strategies. Then, according to this strategy, corresponding resource configuration adjustment operations are performed on the resources to be allocated, such as threads, memory, and gateways, through the underlying resource management interface, achieving a complete closed loop from load assessment to resource action.

[0048] It should be noted that differentiated resource allocation operations are performed for different types of resources to be allocated: Regarding thread pool scaling, backend worker threads handling specific target queues are woken up or suspended at the operating system level to dynamically adjust the number of threads to match the expected load; regarding gateway traffic shaping, traffic is smoothly diverted to idle cluster nodes with lower predicted load rates by modifying the routing table weights of the front-end load balancing gateway, achieving proactive pre-allocation of network routes; regarding memory pool pre-allocation, large page memory is pre-allocated from the kernel and mounted to the memory pool of specific order book objects to eliminate page fault latency during order surges. These three resource allocation methods can be executed independently or collaboratively according to scheduling strategies; this embodiment of the invention does not impose specific limitations.

[0049] In one embodiment of the present invention, for further explanation and limitation, a dual-threshold decision is performed based on the expected load rate to determine a resource scheduling strategy, including: If the expected load rate is greater than the preset high load threshold, and the expected load rate remains greater than the preset high load threshold within a first preset number of rolling prediction windows, the resource scheduling strategy is determined to be an expansion strategy. If the expected load rate is less than the preset low load threshold, and the expected load rate remains less than the preset low load threshold within the second preset number of rolling prediction windows, the resource scheduling strategy is determined to be a scaling-down strategy. If the expected load rate is greater than or equal to the preset low load threshold and less than or equal to the preset high load threshold, the resource scheduling strategy is determined to be a zero scheduling strategy.

[0050] In this embodiment of the invention, the resource scheduling strategy is determined based on a preset high load threshold, a preset low load threshold, and a handover penalty tolerance counter. and The preset high load threshold is preferably 0.85, and the preset low load threshold is preferably 0.4. m is the first preset quantity, and n is the second preset quantity, with the second preset quantity being greater than the first preset quantity. The specific judgment logic for the dual-threshold decision is as follows: If the expected load rate is greater than the preset high load threshold, and the expected load rate remains greater than the preset high load threshold continuously within the first preset quantity of rolling prediction windows, the resource scheduling strategy is determined to be an expansion strategy; if the expected load rate is less than the preset low load threshold, and the expected load rate remains less than the preset low load threshold continuously within the second preset quantity of rolling prediction windows, the resource scheduling strategy is determined to be a shrinking strategy; if the expected load rate is greater than or equal to the preset low load threshold and less than or equal to the preset high load threshold, the resource scheduling strategy is determined to be a zero-scheduling strategy, i.e., no scheduling operation is performed, and the current allocation is locked to achieve zero scheduling overhead. The second preset quantity is greater than the first preset quantity, meaning that the shrinking decision requires a longer observation window than the expansion decision to be triggered, forming an asymmetric hysteresis mechanism to avoid frequent oscillations at the load boundary and reduce ineffective scheduling overhead.

[0051] This invention provides a resource allocation method for an order matching system based on autoregressive prediction. In this embodiment, real-time order stream data of the target system is acquired, and high-dimensional feature vectors of each order event in the real-time order stream data are extracted to obtain an order event feature sequence. An autoregressive prediction is performed on the order event feature sequence based on a pre-trained order stream prediction model to generate an expected order event sequence. Based on the event feature parameters in the expected order event sequence, the resources to be allocated and their expected load rates are determined. A dual-threshold decision is performed based on the expected load rate to determine a resource scheduling strategy, and the resource allocation of the resources to be allocated is performed according to the resource scheduling strategy. This significantly reduces the system's passive response delay to sudden traffic peaks, lowers the risk of order matching blockage due to insufficient resources, and controls the computational overhead generated by the resource scheduling decision itself, avoiding additional latency jitter introduced by frequent scheduling. Therefore, this greatly improves the responsiveness and resource utilization efficiency of the order matching system under dynamic load environments.

[0052] Furthermore, as a response to the above Figure 1 The implementation of the method shown in this embodiment of the invention provides a resource allocation device for an order matching system based on autoregressive prediction, such as... Figure 4 As shown, the device includes: The feature extraction module 31 is used to acquire real-time order stream data of the target system and extract high-dimensional feature vectors of each order event in the real-time order stream data to obtain an order event feature sequence. Prediction module 32 is used to perform autoregressive prediction on the order event feature sequence based on a pre-trained order flow prediction model to generate an expected order event sequence; The determination module 33 is used to determine the resource to be allocated and the expected load rate of the resource to be allocated based on the event characteristic parameters in the expected order event sequence. The allocation module 34 is used to make a dual-threshold decision based on the expected load rate, determine the resource scheduling strategy, and allocate the resource configuration of the resource to be allocated according to the resource scheduling strategy.

[0053] Furthermore, the event feature parameters include the underlying contract type and order type for each order event, wherein the underlying contract type is used to characterize the processing unit that performs matching processing on the corresponding order event; the determining module 33 includes: The partitioning unit is used to partition the expected order events in the expected order event sequence based on the processing unit corresponding to each of the different target contract types, so as to obtain the expected order event set corresponding to each processing unit. The first calculation unit is used to calculate the expected order arrival rate of the corresponding processing unit for each expected order event set, based on the underlying contract type and order type of each order event in the set. A determining unit is configured to, for each processing unit, determine the resources to be allocated and the expected load rate of the resources to be allocated based on the expected order arrival rate and the event characteristic parameters.

[0054] Furthermore, in practical application scenarios, the first computing unit is specifically used to match and obtain the baseline computing cost weight corresponding to the order event from the preset computing cost relationship set of the processing unit; The expected total computational load of the processing unit is obtained by summing the baseline computational cost weights of all the order events. Extract the window duration covered by the order events in the expected order event set, and calculate the quotient of the expected total computing load and the window duration to obtain the expected order arrival rate of the corresponding processing unit.

[0055] Furthermore, in practical application scenarios, the determining unit is specifically used to determine the thread as a resource to be allocated if the expected order arrival rate is greater than a preset arrival rate threshold; to determine memory as a resource to be allocated if the proportion of complex order types in all order events is greater than a preset proportion threshold; and to determine the gateway as a resource to be allocated if the number of different target contract types in all order events is greater than a preset routing volume threshold. For any resource to be allocated, the calculation process for the expected load rate of the resource to be allocated includes: The unit computing resource quantity and the base processing rate of the unit computing resource to be allocated are retrieved, and the product of the unit computing resource quantity and the base processing rate is used as the performance parameter of the resource to be allocated. The expected load rate of the resources to be allocated is obtained by calculating the quotient of the expected order arrival rate and the performance parameter.

[0056] Furthermore, the allocation module 34 includes: The first judgment unit is used to determine the resource scheduling strategy as the expansion strategy when the expected load rate is greater than the preset high load threshold and the expected load rate remains greater than the preset high load threshold within a first preset number of rolling prediction windows. The second judgment unit is used to determine the resource scheduling strategy as a scaling-down strategy when the expected load rate is less than the preset low load threshold and the expected load rate remains less than the preset low load threshold within the second preset number of rolling prediction windows, wherein the second preset number is greater than the first preset number. The third judgment unit is used to determine the resource scheduling strategy as a zero scheduling strategy when the expected load rate is greater than or equal to the preset low load threshold and less than or equal to the preset high load threshold.

[0057] Furthermore, the feature extraction module 31 includes: The parsing unit is used to parse the order event to obtain a multidimensional tuple of the order event, wherein the multidimensional tuple includes a pricing attribute field, a scale attribute field, a timestamp field, an order operation direction identifier, an order type identifier, and an underlying contract type identifier; The mapping unit is used to map each dimension field or identifier in the multidimensional tuple to an integer token based on a pre-constructed vocabulary corresponding to each dimension. The feature extraction unit is used to concatenate the integer tokens corresponding to each dimension field into a low-dimensional vector, and perform feature fusion on the low-dimensional vector through nonlinear transformation to obtain the high-dimensional feature vector of the order event.

[0058] Furthermore, the pre-trained order flow prediction model is built based on a decoder-only Transformer model; prediction module 32 includes: The encoding unit is used to encode each temporal dependency in the order event feature sequence through a multi-head self-attention mechanism superimposed with a time decay factor to obtain encoded features; The decoding unit is used to decode the encoded features through joint multi-head output layers, predict the probability distribution of each dimension of the next order event, and obtain the prediction result; The prediction unit is used to iteratively feed the prediction results into the pre-trained order flow prediction model to autoregressively generate the expected order event sequence within a preset time window.

[0059] This invention provides a resource allocation device for an order matching system based on autoregressive prediction. In this embodiment, real-time order stream data of the target system is acquired, and high-dimensional feature vectors of each order event in the real-time order stream data are extracted to obtain an order event feature sequence. An autoregressive prediction is performed on the order event feature sequence based on a pre-trained order stream prediction model to generate an expected order event sequence. Based on the event feature parameters in the expected order event sequence, the resources to be allocated and their expected load rates are determined. A dual-threshold decision is made based on the expected load rate to determine a resource scheduling strategy, and the resource allocation of the resources to be allocated is performed according to the resource scheduling strategy. This significantly reduces the system's passive response delay to sudden traffic peaks, lowers the risk of order matching blockage due to insufficient resources, and controls the computational overhead generated by the resource scheduling decision itself, avoiding additional latency jitter introduced by frequent scheduling. Therefore, it greatly improves the responsiveness and resource utilization efficiency of the order matching system under dynamic load environments.

[0060] According to one embodiment of the present invention, a storage medium is provided, the storage medium storing at least one executable instruction, which is capable of executing the resource allocation method of the order matching system based on autoregressive prediction in any of the above method embodiments.

[0061] Figure 5 The diagram shows a structural schematic of a terminal according to an embodiment of the present invention. The specific implementation of the present invention does not limit the specific implementation of the terminal.

[0062] like Figure 5 As shown, the terminal may include: a processor 402, a communication interface 404, a memory 406, and a communication bus 408.

[0063] The processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408.

[0064] Communication interface 404 is used for network communication with other devices such as clients or other servers.

[0065] The processor 402 is used to execute program 410, specifically to execute the relevant steps in the above embodiment of the resource allocation method for the order matching system based on autoregressive prediction.

[0066] Specifically, program 410 may include program code that includes computer operation instructions.

[0067] Processor 402 may be a central processing unit (CPU), a specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The terminal may include one or more processors of the same type, such as one or more CPUs; or it may include processors of different types, such as one or more CPUs and one or more ASICs.

[0068] Memory 406 is used to store program 410. Memory 406 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0069] Specifically, program 410 can be used to cause processor 402 to perform the following operations: Acquire real-time order stream data of the target system, and extract high-dimensional feature vectors of each order event in the real-time order stream data to obtain the order event feature sequence; The pre-trained order flow prediction model is used to perform autoregressive prediction on the order event feature sequence to generate the expected order event sequence. Based on the event characteristic parameters in the expected order event sequence, determine the resources to be allocated and the expected load rate of the resources to be allocated; Based on the expected load rate, a dual-threshold decision is made to determine the resource scheduling strategy, and the resource configuration of the resources to be scheduled is allocated according to the resource scheduling strategy.

[0070] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0071] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A resource allocation method for an order matching system based on autoregressive prediction, characterized in that, include: Acquire real-time order stream data of the target system, and extract high-dimensional feature vectors of each order event in the real-time order stream data to obtain the order event feature sequence; The pre-trained order flow prediction model is used to perform autoregressive prediction on the order event feature sequence to generate the expected order event sequence. Based on the event characteristic parameters in the expected order event sequence, determine the resources to be allocated and the expected load rate of the resources to be allocated; Based on the expected load rate, a dual-threshold decision is made to determine the resource scheduling strategy, and the resource configuration of the resources to be scheduled is allocated according to the resource scheduling strategy.

2. The method according to claim 1, characterized in that, The event feature parameters include the underlying contract type and the order type for each order event. The underlying contract type is used to characterize the processing unit that performs matching processing on the corresponding order event. Based on the event characteristic parameters in the expected order event sequence, determine the resources to be allocated and the expected load rate of the resources to be allocated, including: Based on the processing units corresponding to different types of underlying contracts, the expected order events in the expected order event sequence are divided to obtain the expected order event sets corresponding to different processing units. For each set of expected order events, the expected order arrival rate of the corresponding processing unit is calculated based on the underlying contract type and order type of each order event in the set. For each processing unit, the resources to be allocated and the expected load rate of the resources to be allocated are determined based on the expected order arrival rate and the event characteristic parameters.

3. The method according to claim 2, characterized in that, For each set of expected order events, based on the underlying contract type and order type of each order event in the set, calculate the expected order arrival rate for the corresponding processing unit, including: The baseline calculation cost weight corresponding to the order event is obtained by matching from the preset calculation cost relationship set of the processing unit; The expected total computational load of the processing unit is obtained by summing the baseline computational cost weights of all the order events. Extract the window duration covered by the order events in the expected order event set, and calculate the quotient of the expected total computing load and the window duration to obtain the expected order arrival rate of the corresponding processing unit.

4. The method according to claim 2, characterized in that, For each processing unit, the process of determining the resources to be allocated includes: If the expected order arrival rate is greater than the preset arrival rate threshold, the thread is identified as a resource to be allocated; if the proportion of complex order types in all order events is greater than the preset proportion threshold, memory is identified as a resource to be allocated; if the number of different contract types in all order events is greater than the preset routing volume threshold, the gateway is identified as a resource to be allocated. For any resource to be allocated, the calculation process for the expected load rate of the resource to be allocated includes: The unit computing resource quantity and the base processing rate of the unit computing resource to be allocated are retrieved, and the product of the unit computing resource quantity and the base processing rate is used as the performance parameter of the resource to be allocated. The expected load rate of the resources to be allocated is obtained by calculating the quotient of the expected order arrival rate and the performance parameter.

5. The method according to claim 1, characterized in that, Based on the expected load rate, a dual-threshold decision is made to determine the resource scheduling strategy, including: If the expected load rate is greater than the preset high load threshold, and the expected load rate remains greater than the preset high load threshold within a first preset number of rolling prediction windows, the resource scheduling strategy is determined to be an expansion strategy. If the expected load rate is less than the preset low load threshold, and the expected load rate remains less than the preset low load threshold within a second preset number of rolling prediction windows, the resource scheduling strategy is determined to be a scaling-down strategy, wherein the second preset number is greater than the first preset number. If the expected load rate is greater than or equal to the preset low load threshold and less than or equal to the preset high load threshold, the resource scheduling strategy is determined to be a zero scheduling strategy.

6. The method according to any one of claims 1-5, characterized in that, The process of extracting high-dimensional feature vectors for any order event includes: Parse the order event to obtain a multidimensional tuple of the order event, wherein the multidimensional tuple includes a pricing attribute field, a scale attribute field, a timestamp field, an order operation direction identifier, an order type identifier, and an underlying contract type identifier; Based on a pre-constructed vocabulary corresponding to each dimension, each dimension field or identifier in the multidimensional tuple is mapped to an integer token. The integer tokens corresponding to each dimension field are concatenated into a low-dimensional vector, and the low-dimensional vector is then fused using a nonlinear transformation to obtain the high-dimensional feature vector of the order event.

7. The method according to claim 6, characterized in that, The pre-trained order flow prediction model is built based on a decoder-only Transformer model; The pre-trained order flow prediction model performs autoregressive prediction on the order event feature sequence to generate an expected order event sequence, including: By superimposing a multi-head self-attention mechanism with a time decay factor, the temporal dependencies in the order event feature sequence are encoded to obtain encoded features. By jointly decoding the encoded features through a multi-head output layer, the probability distribution of each dimension of the next order event is predicted, and the prediction result is obtained. The prediction results are iteratively fed into the pre-trained order flow prediction model to autoregressively generate the expected order event sequence within a preset time window.

8. A resource allocation device for an order matching system based on autoregressive prediction, characterized in that, The apparatus is used to perform the operation corresponding to the resource allocation method of the order matching system based on autoregressive prediction as described in claim 1, and the apparatus includes: The feature extraction module is used to acquire real-time order stream data of the target system and extract high-dimensional feature vectors of each order event in the real-time order stream data to obtain the order event feature sequence. The prediction module is used to perform autoregressive prediction on the order event feature sequence based on a pre-trained order flow prediction model to generate an expected order event sequence. The determination module is used to determine the resources to be allocated and the expected load rate of the resources to be allocated based on the event characteristic parameters in the expected order event sequence. The allocation module is used to make dual-threshold decisions based on the expected load rate, determine the resource scheduling strategy, and allocate the resource configuration of the resources to be allocated according to the resource scheduling strategy.

9. A storage medium, characterized in that, The storage medium stores at least one executable instruction that causes the processor to perform the operation corresponding to the resource allocation method of the order matching system based on autoregressive prediction as described in any one of claims 1-7.

10. A terminal, characterized in that, include: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the resource allocation method of the order matching system based on autoregressive prediction as described in any one of claims 1-7.