A method, device, equipment and readable storage medium for asynchronously deleting transaction tasks
By adopting an asynchronous deletion method in the blockchain network, using the secondary storage block and the list to be deleted, the resource deletion task is delayed, which solves the problem of deletion operation taking up time during peak transactions and improves transaction speed.
Patent Information
- Application Number
- CN202111418252.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-11-26
AI Technical Summary
During the peak transaction period of blockchain networks, the traditional immediate data storage strategy causes the deletion operation to take up a lot of time, thereby reducing the transaction speed.
Using the asynchronous deletion method of transaction tasks, the transaction information is backed up to the secondary storage block and determine whether the processing result has been received within the preset time period. If it is received, it will be added to the list to be deleted, and then when the blockchain system is idle Perform a deletion operation to avoid immediately executing resource deletion tasks during peak periods.
It effectively prevents the transaction speed of the resource deletion task during peak transactions and improves the transaction efficiency of the blockchain network.
Smart Images

Figure CN114281525B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and more specifically to a method, device, equipment and readable storage medium for asynchronously deleting transaction tasks. Background Art
[0002] The traditional blockchain transaction task scheduling method is to send the transaction information and delete the transaction information on the backup storage immediately after the execution server executes it. However, in actual application scenarios, there are transaction peaks, which leads to a large amount of unit transaction information in the blockchain network. If the data storage strategy of immediate deletion is still used, the deletion operation will take up a lot of transaction time, which will lead to a decrease in the transaction speed of the entire blockchain network. Summary of the invention
[0003] The object of the present invention is to provide a method, device, equipment and readable storage medium for asynchronously deleting transaction tasks to improve the above-mentioned problems.
[0004] In order to achieve the above objectives, the present application provides the following technical solutions:
[0005] On the one hand, an embodiment of the present application provides a method for asynchronously deleting a transaction task, the method comprising: responding to a transaction request sent by a client, and generating first transaction information according to the transaction request, the first transaction information comprising a first transaction identifier; backing up the first transaction information to a secondary storage block; adding the first transaction information to an execution list in a primary storage block, the execution list being a table containing a plurality of transaction information to be executed; sending the first transaction information in the execution list to an execution server, the transaction information being used to trigger the execution server to process the first transaction information and return a first processing result; determining whether the processing result is received within a preset time period, and if received, adding the first transaction identifier to a to-be-deleted list in the primary storage block, and deleting the first transaction information in the execution list, the deletion list being used to trigger a resource deletion thread to periodically execute a resource deletion task, the resource deletion task being a task for deleting transaction information in the secondary storage server.
[0006] Optionally, after sending the first transaction information in the execution list to the execution server, the method further includes:
[0007] Determine whether the processing result is received within a preset time period. If not, delete the first transaction information in the execution list, and trigger task compensation detection so that the first transaction information is sent to the execution server again. The task compensation detection is to periodically retrieve multiple third transaction information in the secondary storage block. The third transaction information is other transaction information in the secondary storage block except the multiple second transaction information corresponding to the list to be deleted.
[0008] Optionally, the resource deletion thread periodically executes a resource deletion task, including:
[0009] The current server computing power resource occupancy rate is detected periodically. If the server computing power resource occupancy rate is less than a preset threshold, a deletion operation is performed. The deletion operation is to delete the second transaction information corresponding to multiple second transaction identifiers in the secondary storage block. The second transaction identifier is a transaction identifier in the list to be deleted.
[0010] In a second aspect, an embodiment of the present application provides a device for asynchronously deleting a transaction task, the device comprising:
[0011] A first calculation module, configured to respond to a transaction request sent by a client and generate first transaction information according to the transaction request, wherein the first transaction information includes a first transaction identifier;
[0012] A first backup module, used for backing up the first transaction information to a secondary storage block;
[0013] a second computing module, configured to add the first transaction information to an execution list in a primary storage block, wherein the execution list is a table containing a plurality of transaction information to be executed;
[0014] a third computing module, configured to send the first transaction information in the execution list to an execution server, wherein the transaction information is used to trigger the execution server to process the first transaction information and return a first processing result;
[0015] The fourth computing module is used to determine whether the processing result is received within a preset time period. If received, the first transaction identifier is added to the to-be-deleted list in the primary storage block, and the first transaction information in the execution list is deleted. The deletion list is used to trigger the resource deletion thread to periodically execute the resource deletion task, and the resource deletion task is a task to delete the transaction information in the secondary storage server.
[0016] In a third aspect, an embodiment of the present application provides a transaction task asynchronous deletion device, the device comprising a memory and a processor. The memory is used to store a computer program; the processor is used to implement the steps of the transaction task asynchronous deletion method when executing the computer program.
[0017] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned method for asynchronously deleting transaction tasks are implemented.
[0018] The beneficial effects of the present invention are:
[0019] The present invention saves the transaction identifier in the first transaction information that has been responded to into a to-be-deleted list. When the blockchain network system is relatively busy, the deletion operation is not performed. When the blockchain system is relatively idle, a new resource deletion task is created to delete the transaction information corresponding to the to-be-deleted list in the secondary storage server, thereby effectively preventing the problem of a decrease in the transaction speed of the blockchain network due to the need to immediately execute the resource deletion task during the peak transaction period.
[0020] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by implementing the embodiments of the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 This is a flow chart of a method for asynchronously deleting a transaction task described in an embodiment of the present invention;
[0023] Figure 2 It is a schematic diagram of the structure of a transaction task asynchronous deletion device described in an embodiment of the present invention;
[0024] Figure 3 It is a schematic diagram of the structure of a transaction task asynchronous deletion device described in an embodiment of the present invention;
[0025] Figure 4 It is a schematic diagram of a transaction task execution system described in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0027] It should be noted that similar reference numerals or letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0028] Example 1
[0029] like Figure 1 and Figure 4 As shown, this embodiment provides a method for asynchronously deleting a transaction task, which includes step S1, step S2, step S3, step S4 and step S5.
[0030] Step S1. Responding to a transaction request sent by a client, and generating first transaction information according to the transaction request, wherein the first transaction information includes a first transaction identifier;
[0031] After receiving the transaction request sent by the client, the server will generate transaction information according to the content of the transaction request. The transaction information may include at least the payer account institution identifier, the payer account, and the payee account, and then sign the transaction information and create a first transaction identifier, i.e., transaction ID. The signed transaction information is called the first transaction information.
[0032] Step S2. Backing up the first transaction information to a secondary storage block;
[0033] It is used to prevent the loss of data in the primary storage block and the failure of transactions caused by unexpected situations such as power outages on the server.
[0034] Step S3. Add the first transaction information to the execution list in the primary storage block, wherein the execution list is a table containing a plurality of transaction information to be executed;
[0035] Step S4. Sending the first transaction information in the execution list to the execution server, wherein the transaction information is used to trigger the execution server to process the first transaction information and return a first processing result;
[0036] Step S5. Determine whether the processing result is received within a preset time period. If received, add the first transaction identifier to the to-be-deleted list in the primary storage block, and delete the first transaction information in the execution list. The deletion list is used to trigger the resource deletion thread to periodically execute the resource deletion task, and the resource deletion task is a task to delete the transaction information in the secondary storage server.
[0037] The server system will receive the feedback result of the first transaction data within a preset time period. If the feedback result is received, the execution of this transaction is completed, and the first transaction data in the execution list needs to be deleted, thereby reducing the memory pressure of the primary storage block. Secondly, in the traditional transaction task processing method, the server system also needs to immediately delete the corresponding backup data in the secondary storage block. In this embodiment, the transaction identifier corresponding to the first transaction data is recorded in the list to be deleted, and the operation of deleting the corresponding backup data in the secondary storage block is not immediately executed, so that the system does not need to allocate other computing power to perform the operation.
[0038] In a specific implementation of the present disclosure, after step S4, step S41 may be further included.
[0039] Step S41. Determine whether the processing result is received within a preset time period. If not, delete the first transaction information in the execution list, and trigger task compensation detection so that the first transaction information is sent to the execution server again. The task compensation detection is to periodically retrieve multiple third transaction information in the secondary storage block. The third transaction information is other transaction information in the secondary storage block except the multiple second transaction information corresponding to the list to be deleted.
[0040] This embodiment discloses a method for processing when a processing result is not received within a preset time period. The first transaction information in the execution list is first deleted, and then other transaction information except the transaction information corresponding to the to-be-deleted list is retrieved from the secondary storage server at a regular interval. The transaction information corresponding to the to-be-deleted list is all transaction information that has been successfully executed and is waiting to be deleted.
[0041] In a specific implementation of the present disclosure, the step S5 may further include step S51.
[0042] Step S51. Regularly detect the current server computing power resource occupancy rate. If the server computing power resource occupancy rate is less than a preset threshold, execute a deletion operation. The server computing power resource occupancy rate may be a comprehensive utilization rate of the CPU, memory, number of threads, etc. When the server computing power resource occupancy rate is less than the preset threshold, the system determines that the current server system is relatively idle and can execute a deletion operation. The deletion operation is to delete the second transaction information corresponding to the multiple second transaction identifiers in the secondary storage block, and the second transaction identifier is the transaction identifier in the list to be deleted.
[0043] Example 2
[0044] like Figure 2 As shown, this embodiment provides a device for asynchronously deleting a transaction task, and the device includes a first calculation module 71, a first backup module 72, a second calculation module 73, a third calculation module 74 and a fourth calculation module 75.
[0045] A first calculation module 71, configured to respond to a transaction request sent by a client and generate first transaction information according to the transaction request, wherein the first transaction information includes a first transaction identifier;
[0046] A first backup module 72, configured to back up the first transaction information to a secondary storage block;
[0047] A second calculation module 73, configured to add the first transaction information to an execution list in a primary storage block, wherein the execution list is a table containing a plurality of transaction information to be executed;
[0048] A third calculation module 74, configured to send the first transaction information in the execution list to an execution server, wherein the transaction information is used to trigger the execution server to process the first transaction information and return a first processing result;
[0049] The fourth calculation module 75 is used to determine whether the processing result is received within a preset time period. If received, the first transaction identifier is added to the to-be-deleted list in the primary storage block, and the first transaction information in the execution list is deleted. The deletion list is used to trigger the resource deletion thread to periodically execute the resource deletion task, and the resource deletion task is a task of deleting the transaction information in the secondary storage server.
[0050] It should be noted that, regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0051] Example 3
[0052] Corresponding to the above method embodiment, the embodiment of the present disclosure further provides a transaction task asynchronous deletion device. The transaction task asynchronous deletion device described below and the transaction task asynchronous deletion method described above can refer to each other.
[0053] Figure 3 FIG. 8 is a block diagram of a transaction task asynchronous deletion device 800 according to an exemplary embodiment. Figure 3 As shown, the electronic device 800 may include: a processor 801 and a memory 802. The electronic device 800 may also include one or more of a multimedia component 803, an input / output (I / O) interface 804, and a communication component 805.
[0054] The processor 801 is used to control the overall operation of the electronic device 800 to complete all or part of the steps in the above-mentioned asynchronous deletion method of transaction tasks. The memory 402 is used to store various types of data to support the operation of the electronic device 800, and these data may include, for example, instructions for any application or method used to operate on the electronic device 800, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, which is used to receive external audio signals. The received audio signal may be further stored in the memory 802 or sent through the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above-mentioned other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the electronic device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 805 may include: Wi-Fi module, Bluetooth module, NFC module.
[0055] In an exemplary embodiment, the electronic device 800 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned asynchronous deletion method of transaction tasks.
[0056] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned transaction task asynchronous deletion method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 802 including program instructions, and the above-mentioned program instructions can be executed by the processor 801 of the electronic device 800 to complete the above-mentioned transaction task asynchronous deletion method.
[0057] Example 4
[0058] Corresponding to the above method embodiment, the embodiment of the present disclosure further provides a readable storage medium. The readable storage medium described below and the transaction task asynchronous deletion method described above can refer to each other.
[0059] A readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the transaction task asynchronous deletion method of the above method embodiment.
[0060] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.
[0061] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for asynchronously deleting a transaction task. It is characterized in that include: Responding to a transaction request sent by a client, and generating first transaction information according to the transaction request, wherein the first transaction information includes a first transaction identifier; Backing up the first transaction information to a secondary storage block; Adding the first transaction information to an execution list in a primary storage block, wherein the execution list is a table containing a plurality of transaction information to be executed; Sending the first transaction information in the execution list to an execution server, wherein the transaction information is used to trigger the execution server to process the first transaction information and return a first processing result; Determine whether the processing result is received within a preset time period. If received, add the first transaction identifier to the to-be-deleted list in the primary storage block, and delete the first transaction information in the execution list. When the blockchain network system is busy, do not perform the deletion operation. When the blockchain network system is idle, create a new resource deletion task to delete the transaction information corresponding to the to-be-deleted list in the secondary storage server. The to-be-deleted list is used to trigger the resource deletion thread to periodically execute the resource deletion task. The resource deletion task is a task to delete the transaction information in the secondary storage server. The resource deletion thread periodically executes resource deletion tasks, including: The current server computing power resource occupancy rate is detected regularly. If the server computing power resource occupancy rate is less than a preset threshold, the system determines that the current server system is relatively idle, and then performs a deletion operation. The deletion operation is to delete the second transaction information corresponding to multiple second transaction identifiers in the secondary storage block, and the second transaction identifier is a transaction identifier in the list to be deleted.
2. The method for asynchronously deleting a transaction task according to claim 1, It is characterized in that After sending the first transaction information in the execution list to the execution server, the method further includes: Determine whether the processing result is received within a preset time period. If not, delete the first transaction information in the execution list, and trigger task compensation detection so that the first transaction information is sent to the execution server again. The task compensation detection is to periodically retrieve multiple third transaction information in the secondary storage block. The third transaction information is other transaction information in the secondary storage block except the multiple second transaction information corresponding to the list to be deleted.
3. A transaction task asynchronous deletion device, It is characterized in that include: a first calculation module, configured to respond to a transaction request sent by a client, and generate first transaction information according to the transaction request, wherein the first transaction information includes a first transaction identifier; A first backup module, used for backing up the first transaction information to a secondary storage block; a second computing module, configured to add the first transaction information to an execution list in a primary storage block, wherein the execution list is a table containing a plurality of transaction information to be executed; a third computing module, configured to send the first transaction information in the execution list to an execution server, wherein the transaction information is used to trigger the execution server to process the first transaction information and return a first processing result; The fourth calculation module is used to determine whether the processing result is received within a preset time period. If received, the first transaction identifier is added to the to-be-deleted list in the primary storage block, and the first transaction information in the execution list is deleted; when the blockchain network system is busy, the deletion operation is not performed. When the blockchain network system is idle, a new resource deletion task is created to delete the transaction information corresponding to the to-be-deleted list in the secondary storage server. The to-be-deleted list is used to trigger the resource deletion thread to periodically execute the resource deletion task, and the resource deletion task is a task to delete the transaction information in the secondary storage server; The resource deletion thread periodically executes resource deletion tasks, including: The current server computing resource occupancy rate is detected periodically. If the server computing resource occupancy rate is less than a preset threshold, the system determines that the current server system is relatively idle and executes a deletion operation. The deletion operation is to delete the second transaction information corresponding to multiple second transaction identifiers in the secondary storage block, and the second transaction identifier is a transaction identifier in the list to be deleted.
4. A transaction task asynchronously deletes the device, It is characterized in that include: Memory for storing computer programs; A processor, configured to implement the steps of the method for asynchronously deleting a transaction task as claimed in any one of claims 1 to 2 when executing the computer program.
5. A readable storage medium, Features: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for asynchronously deleting a transaction task as claimed in any one of claims 1 to 2 are implemented.
