Order synchronization method and device, computer equipment and storage medium
By optimizing the order synchronization process through a multi-level consumer queue mechanism and machine learning models, the problem of surging Elasticsearch write pressure in traditional methods is solved, achieving efficient and accurate order synchronization and system performance optimization.
Patent Information
- Application Number
- CN202510831375.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-16
AI Technical Summary
Traditional order synchronization methods cause a surge in Elasticsearch write pressure when orders change frequently, affecting query and index update speeds, leading to system performance bottlenecks and a degraded user experience.
A multi-level consumption queue mechanism is adopted. By receiving order synchronization requests, queue division is performed, multi-level consumption queues are built according to system status information, and orders are synchronized to Elasticsearch according to priority. This includes the use of machine learning models for key factor identification and similarity analysis, and dynamic adjustment of resource allocation to optimize system performance.
It improves the efficiency and accuracy of order synchronization, optimizes system performance and stability, and ensures the real-time nature of order data and user experience.
Smart Images

Figure CN120658758A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and is applicable to the financial or medical fields, and in particular to an order synchronization method, apparatus, computer equipment, and storage medium. Background Art
[0002] In the car service order system, order management involves the integration of multiple systems. Order data not only needs to be processed and stored in the service order management system, but also needs to be synchronized to the Elasticsearch (ES) system for subsequent order searches and data export operations. Synchronizing data to ES significantly improves order query efficiency, reduces direct query pressure on the database, and thus optimizes overall system performance.
[0003] An existing order synchronization method directly calls a synchronization interface when an order is generated or its status changes, adding or updating the order data to ES. This synchronization method is synchronous, meaning that every order change in the service management order system immediately triggers a synchronization operation. This synchronization mechanism is designed to ensure the real-time availability of order data, allowing merchants to instantly check the latest order status.
[0004] However, the applicant found that the traditional order synchronization method will frequently trigger write operations to Elasticsearch due to large changes in order data when orders change frequently, such as during promotional activities or business peak periods. Since ES is a powerful search engine, but its write performance is limited, frequent write operations (especially in high-concurrency scenarios) will cause a surge in ES's write pressure, and may even cause performance bottlenecks, affecting the overall query and index update speed; in addition, the synchronous call mechanism means that order updates must wait until ES synchronization is successful before the order interface can return a response. This directly affects the response time of the order change interface when the ES write speed slows down, resulting in a decline in the system's user experience, and merchants will experience significant delays when performing order operations; since Elasticsearch's write operations are relatively heavy, frequent order addition or update operations will occupy a large amount of system resources. In extreme cases, excessive ES load may cause the write operation to timeout or fail, further exacerbating the lag in order data synchronization and may even lead to data inconsistency.
[0005] It can be seen that the traditional order synchronization method has the problem of low synchronization efficiency. Summary of the Invention
[0006] The purpose of the embodiments of the present application is to propose an order synchronization method, apparatus, computer equipment and storage medium to solve the problem of low synchronization efficiency in traditional order synchronization methods.
[0007] In order to solve the above technical problems, the present invention provides an order synchronization method, which adopts the following technical solutions:
[0008] Receiving an order synchronization request sent by a user terminal, wherein the order synchronization request includes a pending order;
[0009] Performing a queue division operation on the pending orders to obtain a queue of orders to be synchronized;
[0010] Read the current status information of the system and build a multi-level consumption queue mechanism based on the current status information of the system;
[0011] The orders to be synchronized in the order queue to be synchronized are synchronized to elasticsearch according to the multi-level message queue mechanism.
[0012] In order to solve the above technical problems, the embodiment of the present application further provides an order synchronization device, which adopts the following technical solution:
[0013] A request receiving module, configured to receive an order synchronization request sent by a user terminal, wherein the order synchronization request includes a pending order;
[0014] A queue division module is used to perform a queue division operation on the pending orders to obtain a queue of orders to be synchronized;
[0015] A consumption mechanism construction module is used to read the current state information of the system and construct a multi-level consumption queue mechanism based on the current state information of the system;
[0016] The order synchronization module is used to synchronize the orders to be synchronized in the order queue to be synchronized to elasticsearch according to the multi-level message queue mechanism.
[0017] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0018] The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the order synchronization method as described above when executing the computer-readable instructions.
[0019] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0020] The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the order synchronization method described above.
[0021] This application provides an order synchronization method, comprising: receiving an order synchronization request from a user terminal, wherein the order synchronization request includes pending orders; partitioning the pending orders into queues to obtain a queue of pending orders; reading current system status information and constructing a multi-level consumption queue mechanism based on the current system status information; and synchronizing the pending orders in the queue to Elasticsearch using the multi-level message queue mechanism. Compared with existing technologies, this application can efficiently process different types of order synchronization requests, ensuring the real-time and accuracy of order data while optimizing system performance and stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0023] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0024] Figure 2 This is a flowchart of the implementation of the order synchronization method provided in the embodiment of the present application;
[0025] Figure 3 This is a schematic diagram of the structure of the order synchronization device provided in an embodiment of the present application;
[0026] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0028] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0029] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0030] like Figure 1 As shown, system architecture 100 may include a terminal device 101, a network 102, and a server 103. Terminal device 101 may be a laptop computer 1011, a tablet computer 1012, or a mobile phone 1013. Network 102 is a medium for providing a communication link between terminal device 101 and server 103. Network 102 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0031] The user can use the terminal device 101 to interact with the server 103 via the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0032] The terminal device 101 can be various electronic devices with a display screen and supporting web browsing. In addition to the laptop computer 1011, tablet computer 1012 or mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer and a desktop computer, etc.
[0033] The server 103 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal device 101 .
[0034] It should be noted that the order synchronization method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the order synchronization device is generally set in the server / terminal device.
[0035] It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0036] Continue to refer Figure 2 , which shows a flow chart of an embodiment of the order synchronization method according to the present application. The order synchronization method includes: step S201, step S202, step S203, step S204, step S205, step S206 and step S207.
[0037] In step S201, an order synchronization request sent by a user terminal is received, wherein the order synchronization request includes pending orders.
[0038] In the embodiments of the present application, the user terminal refers to a terminal device used to execute the image processing method for preventing document abuse provided by the present application. The user terminal can be a mobile terminal such as a mobile phone, a smart phone, a laptop computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a navigation device, etc., as well as a fixed terminal such as a digital TV, a desktop computer, etc. It should be understood that the examples of user terminals here are only for convenience of understanding and are not used to limit the present application.
[0039] In an embodiment of the present application, a user enters a pending order through their terminal device (such as a mobile phone or computer), and this input is received by the system. This pending order is order data that the user hopes the system can quickly synchronize to elasticsearch. Specifically, the pending order can be financial order data related to a financial institution (such as a bank), or medical order data related to a medical scenario. It should be understood that the examples of pending orders here are for convenience only and are not intended to limit this application.
[0040] In the car service order system of an embodiment of the present application, the user terminal (such as the merchant backend, driver-side APP, etc.) will initiate an order synchronization request. These requests may include newly generated orders, order status changes (such as payment success, completed, etc.) or other order information that needs to be synchronized to the Elasticsearch (ES) system.
[0041] In an embodiment of the present application, the order synchronization request will include specific information of the order to be processed, such as order ID, order status, generation time, etc. This information is the basis for subsequent queue division and synchronization operations.
[0042] In step S202, a queue division operation is performed on the pending orders to obtain a queue of orders to be synchronized.
[0043] In an embodiment of the present application, after the system receives an order synchronization request, it will divide the queue according to the type of order to be processed (such as new order generation, order status change, batch status update, nighttime full update, etc.).
[0044] In this embodiment of the present application, different types of orders are assigned to queues of different priorities. For example, tasks requiring high real-time performance, such as new order creation and order status changes, are assigned to the highest priority queue; regular order status modifications or batch updates are assigned to the medium priority queue; and nightly full order updates are assigned to the lowest priority queue.
[0045] In the embodiment of the present application, the result of the queue division is a consumption queue division result, which clarifies the priority queue into which each order should be placed for processing.
[0046] In step S203, the current state information of the system is read, and a multi-level consumption queue mechanism is constructed according to the current state information of the system.
[0047] In an embodiment of the present application, the system reads the current status information in real time, including system load, resource usage, queue length, etc., to evaluate the current processing capacity of the system.
[0048] In this embodiment of the present application, the system constructs or adjusts a multi-level consumer queue mechanism based on the current system status information. For example, when the system load is high, the number of consumer instances in the low-priority queue may be reduced to conserve resources; while during peak business hours, the number of consumer instances in the high-priority queue may be increased to ensure that real-time order update tasks can be processed in a timely manner.
[0049] In the embodiment of the present application, the design of the multi-level consumption queue mechanism is intended to ensure that different types of order synchronization tasks can be processed according to priority, while taking into account the overall performance and stability of the system.
[0050] In step S204, the orders to be synchronized in the order to be synchronized queue are synchronized to elasticsearch according to the multi-level message queue mechanism.
[0051] In an embodiment of the present application, once the consumer queue division results are determined and the multi-level message queue mechanism is constructed, the system will begin to synchronize orders according to these mechanisms.
[0052] In the embodiment of the present application, the message queue consumer will prioritize high-priority order update tasks based on the queue priority setting. For example, during peak business hours, the system will prioritize consuming messages in the highest priority queue to ensure that real-time orders can be updated in a timely manner.
[0053] In an embodiment of the present application, for low-priority queues, the system may set a message expiration time (TTL) mechanism to automatically discard expired messages when the message queue is overloaded, so as to reduce the system burden.
[0054] In an embodiment of the present application, the system also monitors the queue length and message delay. If it is found that the processing delay of a high-priority order update message exceeds a set threshold, the system will trigger an alarm and automatically expand the capacity or perform priority processing to ensure the effective operation of the multi-level queue mechanism.
[0055] In an embodiment of the present application, an order synchronization method is provided, comprising: receiving an order synchronization request from a user terminal, wherein the order synchronization request includes pending orders; partitioning the pending orders into queues to obtain a queue of pending orders; reading current system status information and constructing a multi-level consumer queue mechanism based on the current system status information; and synchronizing the pending orders in the queue to Elasticsearch using the multi-level message queue mechanism. Compared with existing technologies, the present application can efficiently process different types of order synchronization requests, ensuring the real-time and accuracy of order data while optimizing system performance and stability.
[0056] In some optional implementations of the embodiments of the present application, the step of performing a queue division operation on the pending orders to obtain a queue of orders to be synchronized specifically includes the following steps:
[0057] Read the system database and obtain historical order data from the system database;
[0058] Historical order data is input into the machine learning model to perform key factor identification operations and obtain key factor identification results;
[0059] The queues for the orders to be processed are divided according to the key factor identification results to obtain a queue of orders to be synchronized.
[0060] In this embodiment of the present application, the system first connects to the system database storing historical order data through a pre-defined database access interface or query statement. A data retrieval operation is performed, and the historical order data required for analysis is filtered based on criteria such as time range, order status, and customer type. The retrieved historical order data is exported in a structured format (such as CSV, JSON, etc.) to prepare for subsequent data processing and analysis.
[0061] In an embodiment of the present application, the exported historical order data is used as input and loaded into a pre-trained machine learning model. The machine learning model performs feature extraction and pattern recognition on the historical order data to identify key factors that affect order processing efficiency, synchronization priority, etc. These key factors may include order amount, customer type, order urgency, order source channel, etc. The model outputs the key factor identification results, which are usually presented in a structured data format (such as tables, charts, etc.) to facilitate subsequent analysis and application.
[0062] In an embodiment of the present application, the system formulates queue division rules based on the key factor identification results output by the machine learning model. For example, orders can be divided into different priority queues based on factors such as urgency, customer type, and order amount. For newly received pending orders, the system matches the attributes of the order (such as order amount, customer type, etc.) with the queue division rules and assigns the order to the corresponding priority queue. After the queue division operation, the system obtains multiple queues of orders to be synchronized, each queue corresponding to a different priority and processing strategy.
[0063] Compared to existing technologies, this application implements a more intelligent and efficient order synchronization process by reading historical order data from the system database, using machine learning models to identify key factors, and then sorting pending orders into queues based on the key factor identification results. This process not only improves the accuracy and efficiency of order processing, but also provides users with a better service experience.
[0064] In some optional implementations of the embodiments of the present application, the step of performing a queue division operation on the pending orders to obtain a queue of orders to be synchronized specifically includes the following steps:
[0065] Perform similarity and correlation analysis on the orders to be processed and obtain analysis results;
[0066] Based on the analysis results, the pending orders with high similarity are merged into the same batch processing task;
[0067] Perform queue division operations on batch processing tasks to obtain a queue of orders to be synchronized.
[0068] In an embodiment of the present application, first, the order data to be processed is cleaned and standardized to ensure that all order data formats are consistent for subsequent analysis. This may include steps such as removing duplicate data, filling missing values, and unifying data formats. Key features are extracted from the order data, such as order ID, customer ID, order amount, product type, order time, order status, etc. These features will be used to calculate the similarity and correlation between orders. A suitable similarity measurement method (such as cosine similarity, Jaccard similarity, edit distance, etc.) is used to calculate the similarity between orders. For example, for orders containing product types, the Jaccard similarity of the product types can be calculated to measure the similarity between orders. In addition to similarity, the correlation between orders can also be analyzed, such as multiple orders placed by the same customer in a short period of time, the frequency of occurrence of the same product in different orders, etc. Correlation analysis helps to discover potential connections between orders and provides a basis for subsequent merging operations. The results of the similarity and correlation analysis are stored in a structured format, such as a similarity matrix, an association map, etc., for subsequent processing and decision-making.
[0069] In an embodiment of the present application, a similarity threshold is set based on business needs and system performance considerations. Only when the similarity of two or more orders exceeds this threshold are they considered to be merged into the same batch processing task. Traverse all pending orders, and based on the similarity analysis results, merge the orders with higher similarity into the same batch processing task. When merging, the key information of the order (such as order ID, customer ID, etc.) can be retained, and the detailed information of the order (such as product list, amount, etc.) can be merged for subsequent processing. A batch processing task is generated for each merged order group, and the task contains all order information that needs to be synchronized to Elasticsearch.
[0070] In an embodiment of the present application, queue division rules are formulated based on business needs and system performance considerations. These rules can be based on factors such as the size, priority, and estimated processing time of the batch processing tasks. Based on the queue division rules, batch processing tasks are assigned to different queues. For example, large or high-priority batch processing tasks can be assigned to a high-priority queue for faster processing; small or low-priority batch processing tasks can be assigned to a low-priority queue to balance the system load. After the queue division operation, the system obtains multiple queues of orders to be synchronized, each queue corresponding to a different priority and processing strategy. These queues will serve as input for subsequent order synchronization operations.
[0071] Compared to existing technologies, this application implements a more efficient and intelligent order synchronization process by performing similarity and correlation analysis on pending orders, merging highly similar orders into the same batch processing task, and dividing batch processing tasks into queues. This process not only improves the accuracy and efficiency of order processing, but also provides users with a better service experience.
[0072] In some optional implementations of the embodiments of the present application, after the step of reading the current state information of the system and building a multi-level consumption queue mechanism according to the current state information of the system, the following steps are also included:
[0073] Read the system database and obtain historical order data from the system database;
[0074] Build a prediction model and predict the order synchronization request volume and system load in the future based on historical order data and the current system status information to obtain the prediction results;
[0075] Adjust the resource allocation of the multi-level consumption queue mechanism based on the prediction results.
[0076] In an embodiment of the present application, the system is connected to a database storing historical order data through preset database connection parameters (such as database address, user name, password, etc.). Using SQL or other database query languages, query operations are performed to obtain the required historical order data based on conditions such as time range, order status, customer type, etc. The historical order data obtained may contain noise, missing values, or inconsistent formats. Therefore, data cleaning and preprocessing are required, including removing duplicate data, filling missing values, converting data formats, etc., to ensure the quality and consistency of the data. The cleaned and preprocessed historical order data is stored in a data structure suitable for analysis, such as a data frame (DataFrame) or a database table, to provide a data basis for subsequent prediction model construction.
[0077] In an embodiment of the present application, according to business needs and data characteristics, a suitable prediction model is selected, such as a time series analysis model (ARIMA, LSTM, etc.), a regression analysis model or a machine learning model (such as random forest, gradient boosting tree, etc.). Historical order data is used as a training set to build and train a prediction model. In addition to historical order data, the current state information of the system, such as server load, network bandwidth, message queue length, etc., is also considered. These system state information are input into the prediction model as additional features to improve the accuracy of the prediction. The prediction model is trained using a training set, and the model is verified and tuned using a validation set. The optimal model parameters and hyperparameters are found by methods such as cross-validation and grid search. Using the trained prediction model, the order synchronization request volume and system load within a period of time in the future are predicted based on historical order data and the current state information of the system. The prediction results are presented in a structured format (such as tables, charts, etc.) to facilitate subsequent analysis and decision-making.
[0078] In an embodiment of the present application, based on the prediction results, the load situation that the system may face in the future is evaluated. Combined with the system's hardware resources (such as CPU, memory, disk, etc.) and software resources (such as thread pool, connection pool, etc.), a reasonable resource planning scheme is formulated. According to the resource planning scheme, the resource configuration of the multi-level consumption queue mechanism is dynamically adjusted. For example, the number of consumption instances of the high-priority queue is increased to increase the processing speed of high-priority orders; the resource allocation of the low-priority queue is reduced to save system resources. After the resource configuration is adjusted, the operating status and performance indicators of the system are continuously monitored. According to the monitoring results, the resource configuration plan is adjusted in a timely manner to ensure the stability and efficiency of the system.
[0079] Compared to existing technologies, this application implements a more intelligent and efficient order synchronization process by reading historical order data from the system database, building a prediction model to predict the future order synchronization request volume and system load, and adjusting the resource allocation of the multi-level consumption queue mechanism based on the prediction results. This process not only improves the system's processing power and stability, but also provides users with a better service experience.
[0080] In some optional implementations of the embodiments of the present application, after the step of reading the current state information of the system and building a multi-level consumption queue mechanism according to the current state information of the system, the following steps are also included:
[0081] Obtain user behavior data corresponding to pending orders;
[0082] Call the user behavior analysis model to perform behavior analysis operations on user behavior data to obtain user behavior analysis results;
[0083] Perform strategic optimization on the multi-level consumption queue mechanism based on the results of user behavior analysis.
[0084] In the embodiment of the present application, first of all, it is necessary to clarify the source of the user behavior data. These data may be stored in the system's log files, user behavior tracking system, user behavior table in the database, etc. Based on the identification information of the order to be processed (such as order ID, user ID, etc.), an associated query is performed in the user behavior data source to obtain user behavior data related to a specific order. The associated user behavior data is collected and integrated into a structured data set. This may include information such as the user's browsing history, click behavior, purchase history, search keywords, etc. The collected user behavior data is cleaned to remove noise data, duplicate data, or invalid data to ensure the quality and accuracy of the data.
[0085] In an embodiment of the present application, a suitable user behavior analysis model is selected based on business needs and data characteristics. These models may include cluster analysis, association rule mining, sequence pattern mining, deep learning models, etc. The selected model is loaded into the system and prepared for behavior analysis. Key features are extracted from user behavior data, such as user activity, purchase frequency, preferred product categories, etc. The extracted features are preprocessed, such as normalization, encoding, etc., so that the model can better understand and process them. If the user behavior analysis model needs to be trained (such as a supervised learning model), the model is trained using historical user behavior data. For unsupervised learning models or trained models, the preprocessed user behavior data is directly used for prediction or analysis. After the model analyzes the user behavior data, it generates user behavior analysis results. These results may include user portraits, user behavior patterns, user preferences, etc.
[0086] In an embodiment of the present application, an optimization strategy for the multi-level consumption queue mechanism is formulated based on the results of user behavior analysis. For example, for highly active users or users who prefer high-value goods, their orders can be assigned to queues with higher priorities to ensure that these orders can be processed faster. According to the optimization strategy, the multi-level consumption queue mechanism is adjusted. This may include increasing or decreasing the number of queues, adjusting the priority of queues, changing the processing rules of queues, etc. In combination with the results of user behavior analysis and system load, the resource allocation in the multi-level consumption queue mechanism is dynamically adjusted. For example, for high-priority queues, more computing resources or network bandwidth can be allocated to increase their processing speed. After the policy optimization process, the operating status and performance indicators of the multi-level consumption queue mechanism are continuously monitored. Based on the monitoring results, the effectiveness of the optimization strategy is evaluated, and further adjustments and optimizations are made as needed.
[0087] Compared to existing technologies, this application achieves a more intelligent and personalized order processing process by acquiring user behavior data corresponding to pending orders, invoking a user behavior analysis model to perform behavior analysis, and optimizing the multi-level consumption queue mechanism based on the user behavior analysis results. This process not only improves system processing efficiency and user satisfaction, but also provides strong support for the system's continued development and innovation.
[0088] In some optional implementations of the embodiments of the present application, after the step of synchronizing the to-be-synchronized orders in the to-be-synchronized order queue to elasticsearch according to the multi-level message queue mechanism, the following steps are further included:
[0089] Build an anomaly detection model and monitor the status of the order queue to be synchronized and elasticsearch in real time based on the anomaly detection model to see if there are any anomalies.
[0090] When the anomaly detection model detects an anomaly, the fault-tolerant processing mechanism is triggered to repair the anomaly.
[0091] In an embodiment of the present application, first, the normal operating status data of the order queue to be synchronized and Elasticsearch are collected, including but not limited to order processing speed, queue length, Elasticsearch indexing speed, query response time, etc. The collected data is cleaned to remove noise and outliers to ensure data quality. Feature extraction is performed on the data to convert the original data into a format that the model can understand, such as extracting order processing time intervals, queue growth rates, etc. as features. Then, according to business needs and data characteristics, a suitable anomaly detection model is selected, such as a statistical-based method (such as the 3σ principle, box plots), a machine learning model (such as isolation forests, One-Class SVM), or a deep learning model (such as autoencoders, LSTM for time series anomaly detection). The model is trained using historical normal operating status data, and a threshold or pattern of normal behavior is set. Finally, the model is verified using the validation set data to evaluate the accuracy and recall of the model. The model is tuned according to the validation results, such as adjusting model parameters, optimizing feature selection, etc., to improve the detection capability of the model.
[0092] In an embodiment of the present application, a real-time data collection mechanism is set to collect operation status data from the order queue to be synchronized and Elasticsearch on a regular basis (such as every second or every minute). The data collected in real time is input into the trained anomaly detection model, and the model judges the data based on the learned normal behavior pattern. If the data deviates from the normal pattern by more than the set threshold, it is determined to be abnormal. The detected abnormal situation is recorded, including the abnormal time, abnormal type, abnormal data, etc. The alarm mechanism is triggered, such as sending an email, text message or system notification to the relevant personnel, so that the abnormality can be handled in time.
[0093] In the embodiments of the present application, a corresponding fault-tolerant processing mechanism is designed according to the possible abnormal situations. For example, for order queue accumulation abnormalities, processing threads can be added or processing logic can be optimized; for Elasticsearch index abnormalities, re-indexing or repairing index files can be attempted. The fault-tolerant processing mechanism should include two methods: automatic processing and manual intervention. The automatic processing method is suitable for some common and predictable abnormal situations; the manual intervention method is suitable for some complex abnormal situations that require professional knowledge. When the anomaly detection model detects an anomaly, the fault-tolerant processing mechanism is automatically triggered. According to the type and severity of the anomaly, a suitable fault-tolerant processing method is selected for repair. For example, for minor anomalies, you can try to automatically restart the relevant services or reload the configuration file; for serious anomalies, manual intervention is required for in-depth analysis and repair. Feedback and record the processing results of the fault-tolerant processing mechanism, including processing time, processing method, processing results, etc. Evaluate and optimize the fault-tolerant processing mechanism based on the processing results to improve its processing capability and efficiency.
[0094] Compared to existing technologies, this application achieves more intelligent and automated exception management by building an anomaly detection model, monitoring the status of the pending order queue and Elasticsearch in real time, and triggering a fault-tolerant mechanism to correct anomalies. This process not only improves the reliability and stability of the system but also provides strong support for its continued development and innovation.
[0095] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0096] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0097] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware via computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes in the above-described method embodiments. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0098] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0099] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of an order synchronization device. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0100] like Figure 3 As shown, the order synchronization device 200 of the embodiment of the present application includes:
[0101] The request receiving module 210 is configured to receive an order synchronization request sent by a user terminal, wherein the order synchronization request includes a pending order;
[0102] The queue division module 220 is used to perform a queue division operation on the orders to be processed to obtain a queue of orders to be synchronized;
[0103] The consumption mechanism construction module 230 is used to read the current state information of the system and construct a multi-level consumption queue mechanism according to the current state information of the system;
[0104] The order synchronization module 240 is used to synchronize the orders to be synchronized in the order queue to be synchronized to elasticsearch according to the multi-level message queue mechanism.
[0105] In an embodiment of the present application, an order synchronization device 200 is provided, comprising: a request receiving module 210 for receiving order synchronization requests sent by a user terminal, wherein the order synchronization requests include pending orders; a queue partitioning module 220 for partitioning the pending orders into queues to generate a queue of pending orders; a consumption mechanism construction module 230 for reading current system status information and constructing a multi-level consumption queue mechanism based on the current system status information; and an order synchronization module 240 for synchronizing pending orders in the queue to Elasticsearch using a multi-level message queue mechanism. Compared to existing technologies, the present application can efficiently process different types of order synchronization requests, ensuring the real-time and accuracy of order data while optimizing system performance and stability.
[0106] In some optional implementations of the embodiments of the present application, the queue division module includes:
[0107] The historical order acquisition submodule is used to read the system database and obtain historical order data from the system database;
[0108] The key factor identification submodule is used to input historical order data into the machine learning model to perform key factor identification operations and obtain key factor identification results;
[0109] The first queue division submodule is used to perform a queue division operation on the orders to be processed according to the key factor identification result to obtain a queue of orders to be synchronized.
[0110] In some optional implementations of the embodiments of the present application, the queue division module includes:
[0111] The correlation analysis submodule is used to perform similarity and correlation analysis on the orders to be processed and obtain the analysis results;
[0112] The order merging submodule is used to merge pending orders with high similarity into the same batch processing task based on the analysis results;
[0113] The second queue division submodule is used to perform queue division operations on batch processing tasks to obtain a queue of orders to be synchronized.
[0114] In some optional implementations of the embodiments of the present application, the order synchronization device 200 further includes:
[0115] The historical order acquisition module is used to read the system database and obtain historical order data from the system database;
[0116] The prediction model building module is used to build a prediction model and predict the order synchronization request volume and system load in the future based on historical order data and the current system status information to obtain the prediction results;
[0117] A module used to adjust the resource configuration of the multi-level consumption queue mechanism based on prediction results.
[0118] In some optional implementations of the embodiments of the present application, the order synchronization device 200 further includes:
[0119] A user behavior acquisition module is used to obtain user behavior data corresponding to pending orders;
[0120] The behavior analysis module is used to call the user behavior analysis model to perform behavior analysis operations on user behavior data and obtain user behavior analysis results;
[0121] The policy optimization module is used to optimize the multi-level consumption queue mechanism based on the results of user behavior analysis.
[0122] In some optional implementations of the embodiments of the present application, the order synchronization device 200 further includes:
[0123] The anomaly detection module is used to build an anomaly detection model and monitor the status of the order queue to be synchronized and elasticsearch in real time based on the anomaly detection model to see if there are any anomalies.
[0124] The fault-tolerant processing module is used to trigger the fault-tolerant processing mechanism to repair the anomaly when the anomaly detection model detects an anomaly.
[0125] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device according to an embodiment of the present application.
[0126] The computer device 300 includes a memory 310, a processor 320, and a network interface 330 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 300 having components 310-330, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0127] The computer device may be a desktop computer, notebook computer, PDA, cloud server, etc. The computer device may interact with the user via a keyboard, mouse, remote control, touchpad, or voice control device.
[0128] The memory 310 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, magnetic disk, optical disk, etc. In some embodiments, the memory 310 may be an internal storage unit of the computer device 300, such as a hard disk or memory of the computer device 300. In other embodiments, the memory 310 may also be an external storage device of the computer device 300, such as a plug-in hard disk equipped on the computer device 300, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Of course, the memory 310 may also include both the internal storage unit of the computer device 300 and its external storage device. In the embodiment of the present application, the memory 310 is generally used to store the operating system and various application software installed on the computer device 300, such as computer-readable instructions of the order synchronization method. In addition, the memory 310 can also be used to temporarily store various data that has been output or is about to be output.
[0129] In some embodiments, the processor 320 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 320 is generally used to control the overall operation of the computer device 300. In the embodiment of the present application, the processor 320 is used to execute computer-readable instructions stored in the memory 310 or process data, such as computer-readable instructions for executing the order synchronization method.
[0130] The network interface 330 may include a wireless network interface or a wired network interface. The network interface 330 is generally used to establish a communication connection between the computer device 300 and other electronic devices.
[0131] The computer equipment provided in this application can efficiently process different types of order synchronization requests, ensure the real-time and accuracy of order data, and optimize system performance and stability.
[0132] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the order synchronization method as described above.
[0133] The computer-readable storage medium provided in this application can efficiently process different types of order synchronization requests, ensure the real-time and accuracy of order data, and optimize system performance and stability.
[0134] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0135] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.
Claims
1. An order synchronization method, characterized in that: The steps include: Receiving an order synchronization request sent by a user terminal, wherein the order synchronization request includes a pending order; Performing a queue division operation on the pending orders to obtain a queue of orders to be synchronized; Read the current status information of the system and build a multi-level consumption queue mechanism based on the current status information of the system; The orders to be synchronized in the order queue to be synchronized are synchronized to elasticsearch according to the multi-level message queue mechanism.
2. The order synchronization method according to claim 1, characterized in that: The step of dividing the queues of the pending orders into queues to obtain a queue of orders to be synchronized specifically includes the following steps: Reading a system database, and obtaining historical order data from the system database; The historical order data is input into the machine learning model to perform a key factor identification operation to obtain a key factor identification result; The pending orders are divided into queues according to the key factor identification results to obtain a queue of orders to be synchronized.
3. The order synchronization method according to claim 1, characterized in that: The step of dividing the queues of the pending orders into queues to obtain a queue of orders to be synchronized specifically includes the following steps: Performing similarity and correlation analysis operations on the pending orders to obtain analysis results; Merging pending orders with high similarity into the same batch processing task based on the analysis results; A queue division operation is performed on the batch processing tasks to obtain the queue of orders to be synchronized.
4. The order synchronization method according to claim 1, characterized in that: After the step of reading the current state information of the system and building a multi-level consumption queue mechanism according to the current state information of the system, the following steps are also included: Reading a system database, and obtaining historical order data from the system database; Constructing a prediction model and predicting the order synchronization request volume and system load in the future based on the historical order data and the current state information of the system to obtain a prediction result; The resource configuration of the multi-level consumption queue mechanism is adjusted according to the prediction result.
5. The order synchronization method according to claim 1, characterized in that: After the step of reading the current state information of the system and building a multi-level consumption queue mechanism according to the current state information of the system, the following steps are also included: Obtaining user behavior data corresponding to the pending order; Calling a user behavior analysis model to perform a behavior analysis operation on the user behavior data to obtain a user behavior analysis result; The multi-level consumption queue mechanism is subjected to strategy optimization processing according to the user behavior analysis result.
6. The order synchronization method according to claim 1, characterized in that: After the step of synchronizing the to-be-synchronized orders in the to-be-synchronized order queue to elasticsearch according to the multi-level message queue mechanism, the following steps are also included: Construct an anomaly detection model, and monitor the status of the to-be-synchronized order queue and the elasticsearch in real time based on the anomaly detection model to determine whether there are any anomalies; When the anomaly detection model detects an anomaly, the fault-tolerant processing mechanism is triggered to repair the anomaly.
7. An order synchronization device, characterized in that: include: A request receiving module, configured to receive an order synchronization request sent by a user terminal, wherein the order synchronization request includes a pending order; A queue division module is used to perform a queue division operation on the pending orders to obtain a queue of orders to be synchronized; A consumption mechanism construction module is used to read the current state information of the system and construct a multi-level consumption queue mechanism based on the current state information of the system; The order synchronization module is used to synchronize the orders to be synchronized in the order queue to be synchronized to elasticsearch according to the multi-level message queue mechanism.
8. The order synchronization device according to claim 7, characterized in that: The queue division module includes: A historical order acquisition submodule is used to read a system database and acquire historical order data from the system database; A key factor identification submodule is used to input the historical order data into a machine learning model to perform a key factor identification operation and obtain a key factor identification result; The first queue division submodule is configured to perform a queue division operation on the pending orders according to the key factor identification result to obtain a queue of orders to be synchronized.
9. A computer device comprising a memory and a processor, characterized in that: The memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the order synchronization method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the order synchronization method according to any one of claims 1 to 6.