Data writing method and device, computer device, and storage medium

By temporarily storing data in the database and file queue, the problem of low data writing efficiency when the main database is abnormal is solved, and an efficient and reliable data writing process is achieved.

CN115712758BActive Publication Date: 2026-03-31SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-22
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing data writing methods require manual switching between master and slave databases when the master database crashes, resulting in low data writing efficiency.

Method used

After receiving data to be written, the system obtains the initial data volume of the database and file queue. If the queue is not full, the data is temporarily written to the corresponding queue to alleviate system pressure. When there is free space in the queue, the data is written to the database in batches to avoid data loss.

Benefits of technology

It improves data writing efficiency, avoids data loss, reduces system pressure, and enhances the reliability and efficiency of data writing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115712758B_ABST
    Figure CN115712758B_ABST
Patent Text Reader

Abstract

The application relates to a data writing method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: after receiving to-be-written data, acquiring a first initial data amount of a database queue; if the first initial data amount is smaller than the queue depth of the database queue, writing the to-be-written data into the database queue, and writing the data in the database queue into a database; if the queue depth of the database queue is equal to the first initial data amount, acquiring a second initial data amount of a file queue; if the second initial data amount is smaller than the queue depth of the file queue, writing the to-be-written data into the file queue, writing the data in the file queue into a service file, and when the data amount in the database queue is smaller than the queue depth of the database queue, writing the data in the service file into the database through the database queue. The method can improve the data writing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data writing method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] With the financial industry's increasing demands for data timeliness and accuracy, the ability to write data plays a crucial role in ensuring the 24 / 7 business continuity of IT systems.

[0003] Existing data writing methods often employ database data replication technology based on a master-slave architecture to achieve database data synchronization. However, this data writing method only allows the master database to provide read and write operations, while the slave database provides read-only capabilities. In the event of a failure of the master database, a manual master-slave switch is required, resulting in low data writing efficiency. Summary of the Invention

[0004] Therefore, it is necessary to provide a data writing method, device, computer equipment, computer-readable storage medium, and computer program product that can improve the efficiency of traditional data writing, addressing the problem of low data writing efficiency.

[0005] Firstly, this application provides a data writing method. The method includes:

[0006] After receiving the data to be written, obtain the initial data volume of the database queue;

[0007] If the initial data volume is less than the database queue depth, the data to be written is written to the database queue, and the data in the database queue is written to the database.

[0008] If the database queue depth is equal to the first initial data volume, obtain the second initial data volume from the file queue. If the second initial data volume is less than the file queue depth, write the data to be written to the file queue, write the data in the file queue to the business file, and write the data in the business file to the database through the database queue when the data volume in the database queue is less than the database queue depth.

[0009] In one embodiment, writing data from the database queue to the database includes:

[0010] Get the first write duration before writing the data to be written to the database queue;

[0011] Detect the current amount of data in the database queue;

[0012] Based on the first write duration or the current data volume in the database queue, write the data in the database queue to the database in batches.

[0013] In one embodiment, writing data from the file queue to a business file includes:

[0014] Get the second write duration for writing the data to be written to the file queue;

[0015] Detect the current amount of data in the file queue;

[0016] Based on the second write duration or the current data volume in the file queue, the data in the file queue is written in batches to the business file.

[0017] In one embodiment, the data writing method further includes:

[0018] In the event of a batch write failure, the data in the database queue is written to the database in a first-in-first-out order, and the single write result for each data item is obtained.

[0019] If a single write operation fails, retrieve the target data and attempt to write it to the database again. If the first preset number of attempts also fails, write the target data to the first failure file. If the amount of data in the database queue is less than the queue depth, write the data from the first failure file to the database through the database queue.

[0020] In one embodiment, based on a first write duration or the current data volume in the database queue, data in the database queue is written to the database in batches, including:

[0021] When the first write duration exceeds the first preset duration, or when the current data volume in the database queue exceeds the first preset quantity, the data in the database queue is written to the database in batches.

[0022] In one embodiment, the data writing method further includes:

[0023] In the event of a batch write failure, attempt to write the data in the file queue to the business file again. If the write still fails after a second preset number of attempts, write the data in the file queue to a second failed file. If the amount of data in the database queue is less than the queue depth of the database queue, write the data in the second failed file to the database through the database queue.

[0024] Secondly, this application also provides a data writing device. The device includes:

[0025] The acquisition module is used to obtain the initial amount of data in the database queue after receiving the data to be written.

[0026] The first write module is used to write the data to be written to the database queue and write the data in the database queue to the database if the initial data volume is less than the queue depth of the database queue.

[0027] The second write module is used to obtain the second initial data volume of the file queue if the queue depth of the database queue is equal to the first initial data volume, and if the second initial data volume is less than the queue depth of the file queue, write the data to be written to the file queue, write the data in the file queue to the business file, and write the data in the business file to the database through the database queue when the data volume in the database queue is less than the queue depth of the database queue.

[0028] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0029] After receiving the data to be written, obtain the initial data volume of the database queue;

[0030] If the initial data volume is less than the database queue depth, the data to be written is written to the database queue, and the data in the database queue is written to the database.

[0031] If the database queue depth equals the first initial data volume, the second initial data volume of the file queue is obtained. If the second initial data volume is less than the file queue depth, the data to be written is written to the file queue, the data in the file queue is written to the business file, and when the data volume in the database queue is less than the database queue depth, the data in the business file is written to the database through the database queue. Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, and when the computer program is executed by a processor, it performs the following steps:

[0032] After receiving the data to be written, obtain the initial data volume of the database queue;

[0033] If the initial data volume is less than the database queue depth, the data to be written is written to the database queue, and the data in the database queue is written to the database.

[0034] If the database queue depth is equal to the first initial data volume, obtain the second initial data volume from the file queue. If the second initial data volume is less than the file queue depth, write the data to be written to the file queue, write the data in the file queue to the business file, and write the data in the business file to the database through the database queue when the data volume in the database queue is less than the database queue depth.

[0035] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0036] After receiving the data to be written, obtain the initial data volume of the database queue;

[0037] If the initial data volume is less than the database queue depth, the data to be written is written to the database queue, and the data in the database queue is written to the database.

[0038] If the database queue depth is equal to the first initial data volume, obtain the second initial data volume from the file queue. If the second initial data volume is less than the file queue depth, write the data to be written to the file queue, write the data in the file queue to the business file, and write the data in the business file to the database through the database queue when the data volume in the database queue is less than the database queue depth.

[0039] The aforementioned data writing method, apparatus, computer equipment, storage medium, and computer program product, upon receiving the data to be written, obtains a first initial data volume in the database queue. If the first initial data volume is less than the queue depth of the database queue (i.e., the database queue is not full), the data to be written is temporarily stored in the database queue. This alleviates the pressure on the system writing to the database when the amount of data to be written is large. Then, the data in the database queue is written to the database, which helps improve the writing efficiency of the data to be written. If the queue depth of the database queue is equal to the first initial data volume, a second initial data volume in the file queue is obtained. If the second initial data volume is less than the queue depth of the file queue (i.e., the database queue is full but the file queue is not full), the data to be written is temporarily stored in the file queue. Then, the data in the file queue is temporarily stored in the business file. This further alleviates the pressure on the system writing to the database when the amount of data to be written is large. Simultaneously, when the amount of data in the database queue is less than the queue depth of the database queue (i.e., the database queue has free space), the data in the business file is written to the database through the database queue. This ensures that the data to be written temporarily stored in the business file is written to the database, avoiding data loss and improving data writing efficiency. Attached Figure Description

[0040] Figure 1 This is an application environment diagram of the data writing method in one embodiment;

[0041] Figure 2 This is a flowchart illustrating a data writing method in one embodiment;

[0042] Figure 3This is a schematic diagram of a sub-process of S204 in one embodiment;

[0043] Figure 4 This is a flowchart illustrating the data writing method in another embodiment;

[0044] Figure 5 This is a schematic diagram of the data to be written in a business process in one embodiment.

[0045] Figure 6 This is a schematic diagram of the overall flow of a data writing method in one embodiment;

[0046] Figure 7 This is a flowchart illustrating an exception handling strategy in one embodiment;

[0047] Figure 8 This is a structural block diagram of a data writing device in one embodiment;

[0048] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0050] The data writing method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with database 104 via a network. After receiving data to be written, terminal 102 obtains the first initial data volume of the database queue. If the first initial data volume is less than the queue depth of the database queue, the data to be written is written to the database queue, and the data in the database queue is written to the database. If the queue depth of the database queue is equal to the first initial data volume, terminal 102 obtains the second initial data volume of the file queue. If the second initial data volume is less than the queue depth of the file queue, the data to be written is written to the file queue, the data in the file queue is written to the business file, and when the data volume in the database queue is less than the queue depth of the database queue, the data in the business file is written to the database through the database queue. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc.

[0051] In one embodiment, such as Figure 2 As shown, a data writing method is provided, which is applied to... Figure 1 Taking terminal 102 as an example, the explanation includes the following steps:

[0052] S202, after receiving the data to be written, obtain the first initial data volume of the database queue.

[0053] The data to be written refers to the data that needs to be written to the database. This data includes data carried over from business requirements or data generated during business operations. In some embodiments, different transaction logs are generated during business execution. These transaction logs, as the data to be written, provide data support for system-level implementation of retransmission control, post-event auditing, and exception handling. Different types of data to be written will be written to different types of databases. The main types of transaction logs include business transaction logs and platform transaction logs. Business transaction logs are mainly used to store business-related data, while platform transaction logs are mainly used to store the status and data during business execution.

[0054] A database queue is a message queue used for data transfers awaiting writing. Data in the database queue will be written to the database. The initial data volume refers to the amount of data initially stored in the database queue.

[0055] Specifically, when the terminal receives a service request, it simultaneously obtains the data to be written, or the terminal receives the data to be written during service operation and obtains the first initial data volume of the database queue.

[0056] S204, if the initial data volume is less than the database queue depth, write the data to be written to the database queue, and write the data in the database queue to the database.

[0057] The queue depth refers to the maximum amount of data a message queue can hold. The database queue depth refers to the maximum amount of data a database queue can hold. An initial data volume less than the database queue depth means that when the database queue receives data to be written, the amount of data stored in the database queue has not reached the database queue depth, i.e., the database queue is not full. When the initial data volume is less than the database queue depth, the terminal writes the data to be written to the database queue. As more data is written, the database queue depth decreases. The database queue follows a first-in, first-out (FIFO) order, writing data that is written to the database queue first into the database. In some embodiments, when the type of data to be written is business transaction data, if the initial data volume is less than the database queue depth, the data to be written is written to the database queue, and the data in the database queue is written to the business transaction database. When the type of data to be written is platform transaction data, the data to be written is written to the database queue, and the data in the database queue is written to the platform transaction database.

[0058] S206. If the queue depth of the database queue is equal to the first initial data volume, obtain the second initial data volume of the file queue. If the second initial data volume is less than the queue depth of the file queue, write the data to be written to the file queue, write the data in the file queue to the business file, and write the data in the business file to the database through the database queue when the data volume in the database queue is less than the queue depth of the database queue.

[0059] The file queue is a message queue used for data transmission to be written. Data in the file queue will be written to the business file. The second initial data volume is the amount of data initially stored in the file queue.

[0060] The queue depth of a file queue refers to the maximum amount of data the file queue can hold. Business files are used to temporarily store data to be written.

[0061] The database queue depth equals the initial data volume, indicating that when data to be written is received, the amount of data stored in the database queue has reached the queue depth, meaning the database queue is full. When the database queue depth equals the initial data volume, the terminal retrieves the second initial data volume from the file queue.

[0062] The second initial data volume being less than the file queue depth indicates that the file queue is not full. If the database queue depth equals the first initial data volume, the second initial data volume of the file queue is obtained. If the second initial data volume is less than the file queue depth, meaning that when data to be written is received, the database queue is full, and the file queue is not full, the data to be written is written to the file queue. As data to be written is written, the file queue depth decreases. The file queue follows a first-in, first-out (FIFO) order, prioritizing data written to the business file first.

[0063] When the amount of data in the database queue is less than the queue depth (i.e., when there is free space in the database queue), the terminal writes the data from the business file to the database through the database queue.

[0064] In the above data writing method, after receiving the data to be written, the first initial data volume of the database queue is obtained. If the first initial data volume is less than the queue depth of the database queue (i.e., the database queue is not full), the data to be written is temporarily stored in the database queue. This can alleviate the pressure on the system writing to the database when the amount of data to be written is large. Then, the data in the database queue is written to the database, which helps to improve the writing efficiency of the data to be written. If the queue depth of the database queue is equal to the first initial data volume, the second initial data volume of the file queue is obtained. If the second initial data volume is less than the queue depth of the file queue (i.e., the database queue is full but the file queue is not full), the data to be written is temporarily stored in the file queue. Then, the data in the file queue is temporarily stored in the business file. This can further alleviate the pressure on the system writing to the database when the amount of data to be written is large. At the same time, when the amount of data in the database queue is less than the queue depth of the database queue (i.e., the database queue is idle), the data in the business file is written to the database through the database queue. This can ensure that the data to be written temporarily stored in the business file is written to the database, avoid data loss, and improve the data writing efficiency.

[0065] In one embodiment, such as Figure 3 As shown, writing data from the database queue to the database includes:

[0066] S302, Get the first write duration for writing the data to be written to the database queue.

[0067] The data to be written includes at least one piece of data. The data to be written is written to the database queue in the order it is received by the terminal. The terminal uses the time elapsed from the moment the first piece of data is written to the database queue to the current moment as the first write duration. The terminal obtains the first write duration for writing the data to be written to the database queue.

[0068] S304, Detect the current amount of data in the database queue.

[0069] Each time the terminal writes a piece of data to the database queue, the amount of data stored in the queue changes. In other words, the current amount of data in the database queue changes in real time. The terminal monitors the current amount of data in the database queue.

[0070] S306, based on the first write duration or the current data volume in the database queue, writes the data in the database queue to the database in batches.

[0071] Batch writing refers to writing data from the database queue to the database simultaneously.

[0072] In some embodiments, the terminal writes at least one piece of data to be written to the database queue within a first write duration, and then writes the data in the database queue into the database in batches. In other embodiments, as data to be written to the database queue is continuously added, the current data volume of the database queue is updated in real time, and the terminal writes the data in the database queue into the database in batches according to the current data volume of the database queue. For example, the terminal uses a separate thread to read the data in the database queue and write the data in the database queue into the database in batches. This method of writing the data in the database queue into the database in batches using a separate thread is beneficial for performing data write operations independently and avoiding conflicts in data write operations.

[0073] In this embodiment, by obtaining the first write duration of writing the data to be written to the database queue, detecting the current data volume of the database queue, and determining to write the data in the database queue to the database in batches based on the write duration of the data to be written or the current data volume of the database queue, it is possible to cache the data to be written in the queue first and then write it to the database in batches when the data volume of the data to be written is large, thereby alleviating the pressure of writing the data to the database and improving the efficiency of writing the data to the database.

[0074] In one embodiment, writing data from a file queue to a business file includes: obtaining a second write duration for writing data to be written to the file queue; detecting the current data volume in the file queue; and writing the data from the file queue to the business file in batches based on the second write duration or the current data volume in the file queue.

[0075] Specifically, the terminal uses the time elapsed from the moment the first piece of data in the data to be written to the file queue to the current moment as the second write duration. The terminal obtains the second write duration for writing the data to be written to the file queue.

[0076] Each time the terminal writes a piece of data to the file queue, the amount of data stored in the file queue changes. In other words, the current amount of data in the file queue changes in real time. The terminal monitors the current amount of data in the file queue.

[0077] Batch writing refers to simultaneously writing data from a file queue to a business file. In some embodiments, the terminal writes at least one piece of data to be written to the file queue within a second writing duration, and then writes the data in the file queue to the file in batches. In other embodiments, as data to be written to the file queue is continuously added, the current data volume of the file queue is updated in real time, and the terminal writes the data in the file queue to the business file in batches according to the current data volume of the file queue. For example, the terminal scans the data in the file queue using a separate thread and writes the data in the file queue to the business file. This method of writing data in the file queue using a separate thread is beneficial for performing data writing operations independently and avoiding conflicts in data writing operations.

[0078] In this embodiment, by obtaining the second write duration for writing the data to be written to the file queue, the current data volume of the file queue is detected. Based on the second write duration or the current data volume of the file queue, the data in the file queue is written to the business file in batches. When the amount of data to be written is large, the data to be written can be cached in the queue first and then temporarily stored in the business file, which alleviates the pressure of writing to the database and improves the efficiency of writing the data to the database.

[0079] In one embodiment, such as Figure 4 As shown, the data writing method also includes:

[0080] S402, in the event of a batch write failure, writes the data in the database queue into the database in a first-in-first-out order, and retrieves the single write result for each piece of data.

[0081] First-In-First-Out (FIFO) order refers to the order in which data written to the message queue first is output. The terminal retrieves the batch write results of data from the database queue to the database. If any data in the database queue fails to be written to the database during batch writing, the terminal sets the batch write result in the database queue to "batch write failed." In the event of a batch write failure, data from the database queue is written to the database one by one in FIFO order. When data is written to the database one by one, the terminal retrieves the individual write result for each data item. The individual write result includes successful and failed writes.

[0082] S404: Obtain the target data whose single write result is failed, and attempt to write the target data to the database again. If the first preset number of attempts still fails, write the target data to the first failure file. If the amount of data in the database queue is less than the queue depth of the database queue, write the data in the first failure file to the database through the database queue.

[0083] The first failed file refers to the file where data to be written is temporarily stored. The temporarily stored data to be written is the data to be written when a single database write fails.

[0084] When a single write operation fails, the terminal retrieves the target data from the failed write operation. The terminal then attempts to write the target data back to the database. If the attempt fails after a first preset number of attempts, the target data is written to the first failed file.

[0085] For the data to be written in the first failed file, if the amount of data in the database queue is less than the queue depth (i.e., there is free space in the database queue), the data in the first failed file is written to the database through the database queue. For example, the terminal writes the first failed file to the database queue, scans the data in the database queue using a separate thread, and writes the data in the database queue to the database. This method of writing data from the database queue to the database using a separate thread is beneficial for performing data write operations independently and avoids conflicts during data write operations.

[0086] In this embodiment, when batch writes fail, data in the database queue is written to the database sequentially in a first-in, first-out (FIFO) order. The target data for a single failed write attempt is retrieved, and another attempt is made to write it to the database. If the first preset number of attempts also fails, the target data is written to a first failure file. When the amount of data in the database queue is less than the queue depth, the data in the first failure file is written to the database via the database queue. This method of converting batch writes to single writes in the database queue improves the integrity of the data to be written and prevents data loss. Furthermore, if multiple single write attempts fail, temporarily storing the target data in a file before writing it to the database further reduces the risk of data loss and improves data writing efficiency.

[0087] In one embodiment, writing data in the database queue to the database in batches based on a first write duration or the current data volume of the database queue includes: writing data in the database queue to the database in batches when the first write duration is greater than a first preset duration, or when the current data volume of the database queue is greater than a first preset quantity.

[0088] In some embodiments, a first write duration exceeding a first preset duration indicates that a certain amount of data to be written has been entered into the database queue. When the first write duration exceeds the first preset duration, the terminal writes the data in the database queue to the database in batches, which improves data writing efficiency. In other embodiments, the current data volume in the database queue exceeds a first preset quantity, indicating that a certain amount of data to be written has been entered into the database queue. When the current data volume in the database queue exceeds the first preset quantity, the terminal writes the data in the database queue to the database in batches, which improves data writing efficiency to the database.

[0089] In other embodiments, based on a second write duration or the current data volume of the file queue, data in the file queue is written in batches to the business file. This includes: when the second write duration is greater than a second preset duration, or when the current data volume of the file queue is greater than a first preset quantity, the terminal writes data in the file queue in batches to the business file. This method of writing data in the file queue in batches to the business file can improve the efficiency of writing data to the database.

[0090] In this embodiment, by writing data in the database queue to the database in batches when the first write duration is greater than the first preset duration, or when the current data volume in the database queue is greater than the first preset quantity, it is beneficial to improve the efficiency of writing data to the database.

[0091] In one embodiment, the data writing method further includes: in the event of a batch write failure, attempting to write the data in the file queue to the business file again; if the write still fails after a second preset number of attempts, writing the data in the file queue to a second failed file; and when the amount of data in the database queue is less than the queue depth of the database queue, writing the data in the second failed file to the database through the database queue.

[0092] Specifically, the terminal retrieves the batch write results of data from the file queue to the business file. If any data in the file queue fails to be written to the business file during the batch write process, the terminal sets the batch write result in the file queue to "batch write failed".

[0093] The second failed file refers to the file that temporarily stores data to be written. The temporarily stored data is the data to be written when the batch writing of business files fails.

[0094] If a batch write operation fails, the terminal will attempt to write the data in the file queue to the business file again. If the second preset number of attempts also fails, the data in the file queue will be written to the second failed file.

[0095] For the data to be written in the second failed file, when the amount of data in the database queue is less than the queue depth (i.e., when there is free space in the database queue), the data in the second failed file is written to the database through the database queue. For example, the terminal writes the second failed file to the database queue, scans the data in the database queue using a separate thread, and writes the data in the database queue to the database. This method of writing data from the database queue to the database using a separate thread is beneficial for performing data write operations independently and avoids conflicts during data write operations.

[0096] In this embodiment, if multiple attempts to write data from the file queue to the business file fail, the data in the file queue is written to a second failed file. Then, when the amount of data in the database queue is less than the queue depth, the data from the second failed file is written to the database via the database queue. This method, which temporarily stores the data in the file queue to a second failed file before writing it to the database, further avoids data loss and improves data writing efficiency when multiple batch write attempts to the business file fail.

[0097] To illustrate the data writing method and its effects in this solution in detail, the following is a detailed example:

[0098] This application scenario involves writing business transaction data and platform transaction data into a database within the financial sector. The data to be written includes both business transaction data and platform transaction data. For example... Figure 5The diagram illustrates the data to be written in a business process. Business transaction data primarily stores business-related data, while platform transaction data mainly stores the status and data during business execution. Business transaction data includes service data, process example data, and reversal data. Service data is the unique transaction data for a single service call, including combined services, local services, external services, and general reversal services. It records basic data request elements such as request transaction number, association number, channel, institution, teller, service name, execution time, input and output parameters, execution status, return code, error information, and detailed exception information. Service data can be used for transaction number deduplication, post-event problem diagnosis, auditing, and exception handling. Service data is recorded in the preprocessing stage; request data is recorded when the service call begins, and status and response data are recorded before the service returns a response after execution. Process example data is the data from the combined service process execution, detailing the status of the process instance, context data, the status of the activity instances contained within the process instance, activity requests, responses, and exception data. Process instance data is used for post-event problem diagnosis, auditing, exception handling, and reversal of combined services. Process instance data is recorded in the service processing section, primarily by the service processor. Reversal data details the real-time automatic reversal, post-processing automatic reversal, and post-processing manual reversal of the process. Automatic reversal tasks can be executed multiple times as configured. If a reversal fails, it will be delayed for a period before being executed again, until it succeeds or the maximum number of reversals is reached. Each reversal generates a process instance reversal data set.

[0099] After receiving the data to be written, the terminal obtains the initial data volume of the database queue. In some embodiments, the terminal converts the received data to be processed into a general data type. For example, this mainly involves general processing for situations that might cause errors when inserting data into the database, such as fields exceeding length limits.

[0100] Two different writing methods are used depending on whether the database queue is full. For example... Figure 6 The diagram shows the overall flow of the data writing method.

[0101] The first approach involves writing the data to the database queue in batches if the initial data volume is less than the queue depth (i.e., the database queue is not full). Specifically, if the initial data volume is less than the database queue depth, the data to be written is written to the database queue, and the data in the database queue is written to the database. This is done by obtaining the first write duration to the database queue, detecting the current data volume in the database queue, and writing the data in the database queue to the database in batches if the first write duration exceeds a first preset duration, or if the current data volume in the database queue exceeds a first preset quantity.

[0102] In the event of a batch write failure, the data in the database queue is written to the database in a first-in-first-out (FIFO) order, and the single write result for each data item is obtained. If the single write result indicates that the target data failed, the target data is attempted to be written to the database again. If the first preset number of attempts still fails, the target data is written to the first failure file. When the amount of data in the database queue is less than the queue depth of the database queue, the data in the first failure file is written to the database through the database queue.

[0103] The second approach involves obtaining the second initial data volume from the file queue if the database queue depth equals the first initial data volume (i.e., the database queue is full). If the second initial data volume is less than the file queue depth (i.e., the file queue is not full), the data to be written is written to the file queue, and the data in the file queue is written to the business file. Specifically, the second write duration for writing the data to be written to the file queue is obtained, and the current data volume in the file queue is detected. Based on the second write duration or the current data volume in the file queue, the data in the file queue is written in batches to the business file. If the batch write fails, the data in the file queue is attempted to be written to the business file again. If the write still fails after a second preset number of attempts, the data in the file queue is written to a second failed file. And if the data volume in the database queue is less than the database queue depth, the data in the second failed file is written to the database through the database queue.

[0104] For data to be processed in a business file, if the amount of data in the database queue is less than the queue depth, the data in the business file is written to the database through the database queue.

[0105] In some embodiments, data from a business file is written to the database via a database queue. Specifically, the terminal obtains the file write result of the data from the business file into the database. If the file write fails, it attempts to write the data from the business file to the database again. If the write still fails after a third preset number of attempts, the data from the business file is written to a third failed file. The data in the third failed file is abandoned and retried to write to the database, avoiding the writing of invalid and abnormal data to the database, which helps improve data writing efficiency. For data to be written to the database that cannot be accurately written under the above mechanism in extreme cases, further manual intervention can be used afterward. If it is determined by manual intervention that it can be supplemented and written to the database, the abnormal file is renamed and added to the database write queue, thereby realizing post-event supplementary writing to the database.

[0106] In some embodiments, the data writing method is applied to common reversal and exception handling scenarios in the financial field. The data writing method in this application overcomes the bottleneck limitations of traditional database architectures by independently developing a distributed architecture and transaction control mechanism based on the business domain; and independently designs basic technical components such as a multi-segment processing architecture, non-blocking I / O, a composite service engine, a serialization algorithm, and an expression engine, maximizing the high-concurrency, high-throughput online transaction processing capabilities of a single node. Business exceptions are categorized into business failures and technical failures. A business failure refers to the successful return of a communication response from the backend service called by the activity, containing explicit business error information such as "insufficient data resources." At this time, the business status of the backend system is deterministic. Technical exceptions refer to technical anomalies occurring during process execution, specifically divided into two categories: platform exceptions and communication exceptions. Platform exceptions refer to errors or anomalies in the execution logic of the platform's internal engine, such as parsing exceptions, mapping exceptions, or queue fullness. Communication exceptions refer to communication anomalies in the backend service called by the business process, such as communication timeouts, unknown status, or socket interruption by the other party. When a platform exception occurs, the business status of the backend system is also deterministic, and all executed activities are in a successful state. However, when communication errors occur, the business state of the backend system is uncertain because the outcome of the service calls made by the abnormal activity is unknown; they may succeed or fail. When a specific composite service encounters an error, the appropriate exception handling mechanisms, such as automatic reversal, should be designed based on the specific business scenario. The design must fully consider the uncertainty of the backend business state to ensure business consistency. In most business scenarios, when a service call times out, due to the uncertainty of the backend business state, an automatic reversal strategy cannot be used, nor can the call be skipped, except in special scenarios. For these reasons, the processing engine at the platform level can execute exception handling according to the exception handling strategies in the orchestrated process. Currently, the platform supports exception handling strategies such as... Figure 7 As shown.

[0107] Furthermore, the data writing method proposed in this application can classify and group database operation transactions in online transaction requests at the platform level, generating batch database commit transactions. This platform-level data synchronous and asynchronous multi-write mechanism can achieve platform-level multi-point write capabilities by configuring multiple databases. Multiple databases can serve as equal primary or backup databases, enabling multiple databases to provide services simultaneously, eliminating the previous asymmetric situation. This ensures different databases have access capabilities, significantly improving the system's concurrent processing capacity, increasing resource utilization, avoiding resource waste in financial institution disaster recovery systems, and effectively improving system availability and concurrent processing capabilities. Simultaneously, the above implementation is independent of business processing logic, transparent to application developers, and effectively guarantees data efficiency, consistency, and accuracy at the platform level. Deployment is simple and flexible, and the system performance features high performance, non-intrusiveness, second-level latency, and low cost, making deployment and use convenient. It also possesses flexible horizontal scaling capabilities, especially for stateless containerized deployments, allowing for one-click horizontal scaling without needing to concern oneself with the underlying data implementation.

[0108] The aforementioned data writing method, upon receiving the data to be written, obtains the first initial data volume of the database queue. If the first initial data volume is less than the queue depth (i.e., the database queue is not full), the data to be written is temporarily stored in the database queue. This alleviates the pressure on the system's database writing when the amount of data to be written is large. Then, the data in the database queue is written to the database, improving the writing efficiency. If the database queue depth equals the first initial data volume, a second initial data volume of the file queue is obtained. If the second initial data volume is less than the file queue depth (i.e., the database queue is full but the file queue is not full), the data to be written is temporarily stored in the file queue. Then, the data in the file queue is temporarily stored in the business file. This further alleviates the pressure on the system's database writing when the amount of data to be written is large. Simultaneously, when the amount of data in the database queue is less than the queue depth (i.e., the database queue has free space), the data in the business file is written to the database through the database queue. This ensures that the data temporarily stored in the business file is written to the database, avoiding data loss and service interruptions caused by data loss, thus improving data writing efficiency. Furthermore, throughout the entire data writing process, the database queue depth, file queue depth, first write duration, second write duration, first preset duration, and first preset quantity can all be flexibly configured according to actual conditions. This allows for the configuration of different optimal performance parameters based on different business needs, which is beneficial for improving data writing efficiency. During the data writing phase, data is grouped according to database operation types (insert, update, delete) and written to the database in batches, reducing database pressure, decoupling the application from the database, and improving platform performance and throughput. Depending on the processing method, synchronous or asynchronous writing can be configured. Simultaneously, the three-level queue asynchronous processing mode and the multi-center concurrent processing multi-active architecture enable peer-to-peer writing to multiple databases. This minimizes the tight coupling between the application and the database, ensuring that horizontal scaling of the application is no longer limited by the performance bottleneck of a single database. The system features a parameterizable mechanism for implementing synchronous and asynchronous database creation, deletion, and modification; a batch data grouping and classification mechanism for converting synchronous data to asynchronous data; a four-level exception handling and compensation mechanism; high concurrency and high throughput on a single node; a hierarchical and categorized exception handling mechanism; and a low-level multi-write mechanism that is transparent to upper-layer applications, all of which effectively improve the efficiency of data writing.

[0109] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated 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 steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0110] Based on the same inventive concept, this application also provides a data writing device for implementing the data writing method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more data writing device embodiments provided below can be found in the limitations of the data writing method described above, and will not be repeated here.

[0111] In one embodiment, such as Figure 8 As shown, a data writing device 100 is provided, including: an acquisition module 120, a first writing module 140, and a second writing module 160, wherein:

[0112] The acquisition module 120 is used to acquire the initial amount of data in the database queue after receiving the data to be written.

[0113] The first writing module 140 is used to write the data to be written into the database queue and write the data in the database queue into the database if the initial data volume is less than the queue depth of the database queue.

[0114] The second writing module 160 is used to obtain the second initial data volume of the file queue if the queue depth of the database queue is equal to the first initial data volume, and if the second initial data volume is less than the queue depth of the file queue, write the data to be written to the file queue, write the data in the file queue to the business file, and write the data in the business file to the database through the database queue when the data volume in the database queue is less than the queue depth of the database queue.

[0115] The aforementioned data writing device, upon receiving data to be written, obtains a first initial data volume in the database queue. If the first initial data volume is less than the queue depth (i.e., the database queue is not full), the data to be written is temporarily stored in the database queue. This alleviates the pressure on the system's database writing when the amount of data to be written is large. Then, the data in the database queue is written to the database, improving the writing efficiency. If the database queue depth equals the first initial data volume, a second initial data volume in the file queue is obtained. If the second initial data volume is less than the queue depth (i.e., the database queue is full but the file queue is not full), the data to be written is temporarily stored in the file queue. Then, the data in the file queue is temporarily stored in the business file. This further alleviates the pressure on the system's database writing when the amount of data to be written is large. Simultaneously, when the amount of data in the database queue is less than the queue depth (i.e., the database queue has free space), the data in the business file is written to the database through the database queue. This ensures that the data temporarily stored in the business file is written to the database, preventing data loss and improving data writing efficiency.

[0116] In one embodiment, in writing data from the database queue to the database, the first writing module 140 is further configured to: obtain a first writing duration for writing the data to be written to the database queue; detect the current data volume of the database queue; and write the data from the database queue to the database in batches based on the first writing duration or the current data volume of the database queue.

[0117] In one embodiment, in writing data from the file queue to a business file, the second writing module 160 is further configured to: obtain a second writing duration for writing data to be written to the file queue; detect the current data volume of the file queue; and write the data from the file queue to the business file in batches based on the second writing duration or the current data volume of the file queue.

[0118] In one embodiment, the data writing device 100 is further configured to: in the event of a batch write failure, write the data in the database queue into the database in a first-in-first-out order, and obtain the single write result for each data; obtain the target data whose single write result is a failure, attempt to write the target data into the database again, and if the attempt fails after a first preset number of times, write the target data into a first failure file, and when the amount of data in the database queue is less than the queue depth of the database queue, write the data in the first failure file into the database through the database queue.

[0119] In one embodiment, regarding writing data from the database queue to the database in batches based on a first write duration or the current data volume of the database queue, the first write module 140 is further configured to: write data from the database queue to the database in batches when the first write duration is greater than a first preset duration, or when the current data volume of the database queue is greater than a first preset quantity.

[0120] In one embodiment, the data writing device 100 is further configured to: in the event of a batch write failure, attempt to write the data in the file queue to the business file again; if the write still fails after a second preset number of attempts, write the data in the file queue to a second failed file; and when the amount of data in the database queue is less than the queue depth of the database queue, write the data in the second failed file to the database through the database queue.

[0121] Each module in the aforementioned data writing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0122] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a data writing method.

[0123] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0124] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0125] Upon receiving the data to be written, the system obtains the first initial data volume of the database queue. If the first initial data volume is less than the queue depth of the database queue, the data to be written is written to the database queue, and the data in the database queue is written to the database. If the queue depth of the database queue is equal to the first initial data volume, the system obtains the second initial data volume of the file queue. If the second initial data volume is less than the queue depth of the file queue, the system writes the data to be written to the file queue, writes the data in the file queue to the business file, and writes the data in the business file to the database through the database queue when the data volume in the database queue is less than the queue depth of the database queue.

[0126] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0127] Get the first write duration for writing data to the database queue; detect the current data volume in the database queue; based on the first write duration or the current data volume in the database queue, write the data in the database queue to the database in batches.

[0128] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0129] Get the second write duration for writing the data to be written to the file queue; detect the current data volume in the file queue; based on the second write duration or the current data volume in the file queue, write the data in the file queue to the business file in batches.

[0130] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0131] In the event of a batch write failure, the data in the database queue is written to the database in a first-in-first-out (FIFO) order, and the single write result for each data item is obtained. If the single write result indicates that the target data failed, the target data is attempted to be written to the database again. If the first preset number of attempts still fails, the target data is written to the first failure file. When the amount of data in the database queue is less than the queue depth of the database queue, the data in the first failure file is written to the database through the database queue.

[0132] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0133] When the first write duration exceeds the first preset duration, or when the current data volume in the database queue exceeds the first preset quantity, the data in the database queue is written to the database in batches.

[0134] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0135] In the event of a batch write failure, attempt to write the data in the file queue to the business file again. If the write still fails after a second preset number of attempts, write the data in the file queue to a second failed file. If the amount of data in the database queue is less than the queue depth of the database queue, write the data in the second failed file to the database through the database queue.

[0136] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0137] Upon receiving the data to be written, the system obtains the first initial data volume of the database queue. If the first initial data volume is less than the queue depth of the database queue, the data to be written is written to the database queue, and the data in the database queue is written to the database. If the queue depth of the database queue is equal to the first initial data volume, the system obtains the second initial data volume of the file queue. If the second initial data volume is less than the queue depth of the file queue, the system writes the data to be written to the file queue, writes the data in the file queue to the business file, and writes the data in the business file to the database through the database queue when the data volume in the database queue is less than the queue depth of the database queue.

[0138] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0139] Get the first write duration for writing data to the database queue; detect the current data volume in the database queue; based on the first write duration or the current data volume in the database queue, write the data in the database queue to the database in batches.

[0140] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0141] Get the second write duration for writing the data to be written to the file queue; detect the current data volume in the file queue; based on the second write duration or the current data volume in the file queue, write the data in the file queue to the business file in batches.

[0142] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0143] In the event of a batch write failure, the data in the database queue is written to the database in a first-in-first-out (FIFO) order, and the single write result for each data item is obtained. If the single write result indicates that the target data failed, the target data is attempted to be written to the database again. If the first preset number of attempts still fails, the target data is written to the first failure file. When the amount of data in the database queue is less than the queue depth of the database queue, the data in the first failure file is written to the database through the database queue.

[0144] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0145] When the first write duration exceeds the first preset duration, or when the current data volume in the database queue exceeds the first preset quantity, the data in the database queue is written to the database in batches.

[0146] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0147] In the event of a batch write failure, attempt to write the data in the file queue to the business file again. If the write still fails after a second preset number of attempts, write the data in the file queue to a second failed file. If the amount of data in the database queue is less than the queue depth of the database queue, write the data in the second failed file to the database through the database queue.

[0148] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0149] Upon receiving the data to be written, the system obtains the first initial data volume of the database queue. If the first initial data volume is less than the queue depth of the database queue, the data to be written is written to the database queue, and the data in the database queue is written to the database. If the queue depth of the database queue is equal to the first initial data volume, the system obtains the second initial data volume of the file queue. If the second initial data volume is less than the queue depth of the file queue, the system writes the data to be written to the file queue, writes the data in the file queue to the business file, and writes the data in the business file to the database through the database queue when the data volume in the database queue is less than the queue depth of the database queue.

[0150] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0151] Get the first write duration for writing data to the database queue; detect the current data volume in the database queue; based on the first write duration or the current data volume in the database queue, write the data in the database queue to the database in batches.

[0152] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0153] Get the second write duration for writing the data to be written to the file queue; detect the current data volume in the file queue; based on the second write duration or the current data volume in the file queue, write the data in the file queue to the business file in batches.

[0154] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0155] In the event of a batch write failure, the data in the database queue is written to the database in a first-in-first-out (FIFO) order, and the single write result for each data item is obtained. If the single write result indicates that the target data failed, the target data is attempted to be written to the database again. If the first preset number of attempts still fails, the target data is written to the first failure file. When the amount of data in the database queue is less than the queue depth of the database queue, the data in the first failure file is written to the database through the database queue.

[0156] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0157] When the first write duration exceeds the first preset duration, or when the current data volume in the database queue exceeds the first preset quantity, the data in the database queue is written to the database in batches.

[0158] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0159] In the event of a batch write failure, attempt to write the data in the file queue to the business file again. If the write still fails after a second preset number of attempts, write the data in the file queue to a second failed file. If the amount of data in the database queue is less than the queue depth of the database queue, write the data in the second failed file to the database through the database queue.

[0160] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0161] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0162] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0163] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A data write method, characterized by, The method comprises: After receiving the to-be-written data, obtaining a first initial data amount of a database queue; the to-be-written data comprises business log data and platform log data in the financial field; the business log data is mainly used to save business data related to the business, and the platform log data is mainly used to save the state and data in the business execution process; If the first initial data amount is less than the queue depth of the database queue, the to-be-written data is written into the database queue, and the data in the database queue is written into a database; If the queue depth of the database queue is equal to the first initial data amount, a second initial data amount of a file queue is obtained, if the second initial data amount is less than the queue depth of the file queue, the to-be-written data is written into the file queue, the data in the file queue is written into a business file, and when the data amount in the database queue is less than the queue depth of the database queue, the data in the business file is written into the database through the database queue. Writing the data in the database queue into the database comprises: obtaining a time length from the time when the first data in the to-be-written data is written into the database queue to the current time as a first writing time length; detecting the current data amount of the database queue; based on the first writing time length or the current data amount of the database queue, batch writing the data in the database queue into the database; The method further comprises: In the case of batch writing failure, the data in the database queue is sequentially written into the database in a first-in-first-out order, and the single-pen writing result of each data is obtained; 2. The method of claim 1, wherein, obtaining target data with a failed single-pen writing result, trying to write the target data into the database again, and in the case of still failure after trying a first preset number of times, writing the target data into a first failure file, and when the data amount in the database queue is less than the queue depth of the database queue, writing the data in the first failure file into the database through the database queue. The method further comprises: In the case of batch writing failure, the data in the database queue is sequentially written into the database in a first-in-first-out order, and the single-pen writing result of each data is obtained; obtaining target data with a failed single-pen writing result, trying to write the target data into the database again, and in the case of still failure after trying a first preset number of times, writing the target data into a first failure file, and when the data amount in the database queue is less than the queue depth of the database queue, writing the data in the first failure file into the database through the database queue.

3. The method of claim 1, wherein, The method further comprises: In the case of batch writing failure, the data in the database queue is sequentially written into the database in a first-in-first-out order, and the single-pen writing result of each data is obtained; obtaining target data with a failed single-pen writing result, trying to write the target data into the database again, and in the case of still failure after trying a first preset number of times, writing the target data into a first failure file, and when the data amount in the database queue is less than the queue depth of the database queue, writing the data in the first failure file into the database through the database queue.

4. The method of claim 1, wherein, ​ In a case that the first writing duration is greater than a first preset duration, or in a case that a current data amount of the database queue is greater than a first preset quantity, the data in the database queue is written into the database in batches.

5. The method of claim 2, wherein, The method further comprises: In a case that the batch writing fails, the data in the file queue is attempted to be written into the business file again, in a case that the writing still fails after a second preset number of attempts, the data in the file queue is written into a second failure file, and in a case that the data amount in the database queue is less than a queue depth of the database queue, the data in the second failure file is written into the database through the database queue.

6. A data writing apparatus characterized by comprising: The apparatus comprises: The acquisition module is configured to acquire a first initial data amount of a database queue after receiving to-be-written data; the to-be-written data comprises business log data and platform log data in the financial field; the business log data is mainly used to save business data related to a business, and the platform log data is mainly used to save states and data in a business execution process; The first writing module is configured to write the to-be-written data into the database queue and write the data in the database queue into a database in a case that the first initial data amount is less than a queue depth of the database queue. The second writing module is configured to acquire a second initial data amount of a file queue in a case that the queue depth of the database queue is equal to the first initial data amount, write the to-be-written data into the file queue in a case that the second initial data amount is less than a queue depth of the file queue, write the data in the file queue into a business file, and write the data in the business file into the database through the database queue in a case that the data amount in the database queue is less than the queue depth of the database queue. The first writing module is further configured to acquire a duration from a time when a first piece of data in the to-be-written data is written into the database queue to a current time as a first writing duration, detect a current data amount of the database queue, and write the data in the database queue into the database in batches based on the first writing duration or the current data amount of the database queue. The first writing module is further configured to write at least one piece of to-be-written data written into the database queue within the first writing duration into the database in batches, or write the data in the database queue into the database according to the current data amount of the database queue; the current data amount is obtained by reading the data in the database queue using a separate thread. 7.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-6 when the computer program is executed by the processor. The processor implements the steps of the method of any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program implements the steps of the method of any one of claims 1 to 5 when executed by the processor.

9. A computer program product comprising a computer program, characterized in that, The computer program implements the steps of the method of any one of claims 1 to 5 when executed by the processor.

Citation Information

Patent Citations

  • Log transmission method and system

    CN108234595A

  • Data storage method and device, computer equipment and storage medium

    CN113901122A