Operation instruction execution method and device, equipment and medium

By storing operation instructions into different operation tables and reordering, the problem of excessive number of precompilation mode switching is solved, the execution speed and concurrency of operation instructions are improved, and the efficiency of database operations is improved.

CN119201896APending Publication Date: 2024-12-27INFORMATION2 SOFTWARE SHANGHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411352799.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

As the number and type of operation instructions increase, the number of precompilation mode switching is too high, resulting in slow execution of operation instructions and low efficiency.

Method used

By saving operation instructions according to their storage tags and primary key field values ​​into different operation tables and reordering them in the precompilation stage, the number of switching times of precompilation mode is reduced and concurrency is improved.

Benefits of technology

It realizes reducing the number of precompilation mode switching times, improving the precompilation speed and concurrency of operation instructions, and improving the efficiency of database operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201896A_ABST
    Figure CN119201896A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an operation instruction execution method and device, equipment and a medium, and is suitable for the field of data processing.The method comprises the steps that an operation instruction data packet is obtained, an operation instruction is stored in a corresponding storage table according to a storage label of the operation instruction, and for any operation instruction in the storage table, the storage label of the operation instruction is stored in the storage table; storing the operation instruction into an operation table corresponding to the type of the operation instruction according to a primary key field value in the operation instruction and the type of the operation instruction; and according to the type of the operation table and the types and the primary key field values of the operation instructions in the operation table, reordering the operation instructions in the operation table, and executing the operation instructions according to an ordering result. According to the technical scheme provided by the invention, the switching frequency of the pre-compilation mode can be reduced, and the pre-compilation speed and concurrency of the operation instruction can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a method, device, equipment and medium for executing an operation instruction. Background Art

[0002] In the context of database development, modifying data in the database through operation instructions has become a necessary task. Before the operation instructions interact with the database, they will be precompiled through the database's precompilation module to help the database better process the operation instructions.

[0003] When the pre-compilation module pre-compiles the operation instruction, it detects the type of the operation instruction, and then switches the corresponding pre-compilation mode according to the type of the operation instruction, thereby completing the pre-compilation work.

[0004] However, as the number and types of operation instructions continue to increase, the pre-compilation mode may be switched too many times, thereby affecting the efficiency of pre-compilation. Furthermore, most of the current operation instructions are executed sequentially, and the execution speed of the operation instructions is slow and inefficient. Summary of the invention

[0005] The present invention provides a method, device, equipment and medium for executing an operation instruction. Through the technical solution of the embodiment of the present invention, the number of switching times of the pre-compilation mode can be reduced, and the speed and concurrency of the pre-compilation of the operation instruction can be improved.

[0006] In a first aspect, an embodiment of the present invention provides a method for executing an operation instruction, comprising:

[0007] Acquire an operation instruction data packet, and store the operation instruction in a corresponding storage table according to a storage tag of the operation instruction, wherein the operation instruction data packet includes: an operation instruction and a storage tag of the operation instruction, and the operation instruction includes a primary key field, and the primary key field is used to identify the operation instruction;

[0008] For any operation instruction in the storage table, according to the primary key field value in the operation instruction and the type of the operation instruction, the operation instruction is stored in an operation table corresponding to the type of the operation instruction, wherein the operation table includes a first operation table and a second operation table, wherein the types of the operation instructions in the first operation table are the same, and the operation instructions in the second operation table have a hash conflict with the operation instructions in the first operation table;

[0009] The operation instructions in the operation table are reordered according to the type of the operation table and the type of the operation instructions in the operation table and the primary key field value, and the operation instructions are executed according to the ordering result.

[0010] In a second aspect, an embodiment of the present invention provides an execution device for an operation instruction, including:

[0011] an acquisition module, used for acquiring an operation instruction data packet, and storing the operation instruction into a corresponding storage table according to a storage tag of the operation instruction, wherein the operation instruction data packet includes: an operation instruction and a storage tag of the operation instruction, the operation instruction includes a primary key field, and the primary key field is used to identify the operation instruction;

[0012] a classification module, for storing, for any operation instruction in the storage table, the operation instruction into an operation table corresponding to the type of the operation instruction according to the primary key field value in the operation instruction and the type of the operation instruction, wherein the operation table includes a first operation table and a second operation table, wherein the types of the operation instructions in the first operation table are the same, and the operation instructions in the second operation table have a hash conflict with the operation instructions in the first operation table;

[0013] The execution module is used to re-order the operation instructions in the operation table according to the type of the operation table and the type of the operation instructions in the operation table and the primary key field value, and execute the operation instructions according to the order result.

[0014] The third invention, an embodiment of the present invention provides an electronic device, the electronic device comprising:

[0015] at least one processor; and,

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the execution method of any one of the operating instructions in the embodiments of the present invention.

[0018] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement an execution method of any one of the operation instructions in the embodiments of the present invention when executing the instructions.

[0019] An embodiment of the present invention provides a method, apparatus, device and medium for executing an operation instruction, the method comprising: obtaining an operation instruction data packet, storing the operation instruction into a corresponding storage table according to a storage tag of the operation instruction, wherein the operation instruction data packet comprises: an operation instruction and a storage tag of the operation instruction, the operation instruction comprises a primary key field, and the primary key field is used to identify the operation instruction; for any operation instruction in the storage table, storing the operation instruction into an operation table corresponding to the type of the operation instruction according to the primary key field value in the operation instruction and the type of the operation instruction, wherein the operation table comprises a first operation table and a second operation table, wherein the types of the operation instructions in the first operation table are the same, and there is a hash conflict between the operation instructions in the second operation table and the operation instructions in the first operation table; reordering the operation instructions in the operation table according to the type of the operation table and the type and primary key field value of the operation instruction in the operation table, and executing the operation instruction according to the ordering result. Specifically, by moving the operation instructions into different operation tables, the operation instructions can be classified, and then for the same type of operation instructions, there is no need to switch the precompilation mode during the precompilation stage, thereby reducing the number of precompilation mode switching times and improving the precompilation efficiency. Furthermore, the operation tables can be executed concurrently, which can improve the concurrency of the operation instructions. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 A flowchart of a method for executing an operation instruction provided in Embodiment 1 of the present invention;

[0022] Figure 2 A schematic diagram of sorting the second operation table provided in an embodiment of the present invention;

[0023] Figure 3 A flowchart of a method for executing an operation instruction provided in Embodiment 2 of the present invention;

[0024] Figure 4 A flowchart of a method for executing an operation instruction provided in Embodiment 3 of the present invention;

[0025] Figure 5 A schematic diagram of the structure of an execution device for an operation instruction provided in a fourth embodiment of the present invention;

[0026] Figure 6This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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 only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] It should be noted that the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the technical solution of the present disclosure are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0030] Embodiment 1

[0031] Figure 1 A flowchart of a method for executing an operation instruction provided in Embodiment 1 of the present invention is provided. The method is applied to the pre-compilation stage before the operation instruction interacts with the database. The method can be executed by an execution device for the operation instruction, which can be implemented by software and / or hardware and configured in various computers or servers.

[0032] like Figure 1 As shown, including:

[0033] Step 110, obtain an operation instruction data packet, and store the operation instruction into a corresponding storage table according to the storage tag of the operation instruction, wherein the operation instruction data packet includes: an operation instruction and the storage tag of the operation instruction, and the operation instruction includes a primary key field, and the primary key field is used to identify the operation instruction.

[0034] Among them, the operation instruction data packet includes the operation instruction and the storage tag of the operation instruction, wherein the operation instruction is a command for adding, deleting, modifying and checking the database content, and the storage tag of the operation command is used to determine the storage location of the operation command. For example, the storage tag of the operation command for a certain device can be stored in a storage table named after the device.

[0035] Among them, the primary key field is used to identify the operation command. If the primary key fields of the operation commands are the same, the operation command can be considered as a command for the same parameter or text; or it is an associated command for the same parameter or text, without specific restrictions. Specifically, the hash value of the operation command can be determined based on the primary key field of the operation command, and then the hash value can be used to uniquely determine the operation command.

[0036] Specifically, the operation commands for different data or devices may be stored in corresponding storage tables according to storage tags to complete the preliminary classification of the operation commands.

[0037] Step 120: For any operation instruction in the storage table, store the operation instruction in an operation table corresponding to the type of the operation instruction according to the primary key field value in the operation instruction and the type of the operation instruction, wherein the operation table includes a first operation table and a second operation table, wherein the types of the operation instructions in the first operation table are the same, and there is a hash conflict between the operation instructions in the second operation table and the operation instructions in the first operation table.

[0038] Wherein, the operation table includes a first operation table and a second operation table, wherein the types of the operation instructions in the first operation table are the same, and the operation instructions in the second operation table have hash conflicts with the operation instructions in the first operation table. Since the purpose of the technical solution of the present invention is to reduce the excessive number of pre-compilation mode switching caused by the switching of the operation instruction type, it is necessary to move the operation instruction into the corresponding operation table according to the type of the operation instruction. However, since there may be hash conflicts between the operation commands, errors occur when the operation instructions are executed. Therefore, when dividing the table, it is necessary to determine whether there is a hash conflict between the operation instructions, and then store the operation commands that may have hash conflicts with other operation commands separately in the second operation table to reduce the occurrence of errors in the system. Specifically, in an embodiment of the present invention, the types of the operation commands in the first operation table are the same, and there is no mutual conflict between them. There is a hash conflict between the operation commands in the second operation table and the operation commands in the first operation table, and there may be multiple different types.

[0039] Specifically, the corresponding hash value may be determined according to the primary key field value in the operation instruction, and then according to the type of the operation instruction and the hash value, it may be determined whether the operation command should be stored in the first operation table or the second operation table.

[0040] Step 130: re-sort the operation instructions in the operation table according to the type of the operation table and the type and primary key field value of the operation instructions in the operation table, and execute the operation instructions according to the sorting result.

[0041] Specifically, in the first operation table, the operation types of the operation instructions are the same. Therefore, during precompilation, there is no need to switch the precompilation mode, which can reduce the number of precompilation mode switches. However, the operation types of the operation instructions in the second operation table are different. Therefore, they need to be reordered to minimize the number of precompilation mode switches.

[0042] Optionally, the operation instructions in the first operation table can still be further sorted according to the unique key field or primary key field of the operation instructions. For example, for the operation instructions in the linked list storing updates, if there are multiple updates of the same primary key field / unique key field, they can be grouped together through sorting, and then merged into one update operation to reduce the number of precompilation times. The specific method is not limited here.

[0043] Optionally, step 130 includes:

[0044] If the operation table is a second operation table, sorting the second operation table according to the type of operation instructions and the primary key field value in the second operation table;

[0045] In any execution thread, if there is a hash conflict between an operating instruction being executed and an operating instruction to be executed, the execution of the operating instruction to be executed is suspended until the execution of the operating instruction being executed is completed.

[0046] Specifically, the operation table can preset corresponding execution threads to execute the operation instructions in the operation table. The execution threads execute concurrently to improve the execution efficiency of the operation instructions in the data bucket. Furthermore, when the database executes the operation instruction, the hash value of the operation instruction is used as an identifier. Therefore, operation instructions with hash conflicts are not allowed to be executed simultaneously.

[0047] Therefore, in the method of the embodiment of the present invention, before the execution thread executes the operation instruction, it will be determined whether the operation instruction currently executed in the execution thread has a hash conflict with the operation instruction to be executed. If so, the execution of the operation instruction to be executed is suspended until the execution of the operation instruction being executed is completed.

[0048] Optionally, according to the type of the operation table and the type of the operation instruction in the operation table and the primary key field value, it includes:

[0049] Create a sorting table;

[0050] Execute the second loop until there is no operation instruction in the second operation table;

[0051] Wherein, the second cycle comprises:

[0052] Determine the first operation instruction in the second operation table as the target instruction, and determine the instruction following the target instruction as the candidate instruction; move the target instruction into the sorting table, and execute the first loop until the candidate instruction is the last operation instruction in the second operation table;

[0053] Among them, the first loop is an inner loop of the second loop, and the first loop includes: if the type of the candidate instruction is the same as the target instruction, and there is no instruction with the same primary key field value as the candidate instruction in the preceding operation instruction of the candidate instruction, then the candidate instruction is moved to the sorting table, and the next instruction of the candidate instruction is used as the new candidate instruction; otherwise, the subsequent instruction of the candidate instruction is determined as the candidate instruction, wherein the preceding operation instruction of the candidate instruction represents the operation instruction stored in the second operation table before the candidate instruction.

[0054] Specifically, in order to avoid the problem of too many pre-compilation mode switching times caused by confusion in the types of operation instructions in the second operation table, the operation instructions of the same type should be connected in series as much as possible (adjacent in the sorting table). However, since there may be a sequence between the operation instructions themselves, if they are sorted directly by type, the operation instructions executed later may be placed before the operation instructions executed earlier after sorting, which may cause data confusion. Therefore, when sorting the second operation table by type, the order of the operation instructions that have a time relationship must not be disrupted.

[0055] It should be noted that whether the operation instructions have a time sequence relationship can be determined by the primary key field value of the operation instructions. If the operation instructions have the same primary key field value, a time sequence relationship exists.

[0056] Specifically, the method of the embodiment of the present invention will move the first operation instruction in the second operation table as the target instruction into the sorting table, and then determine in turn whether the candidate instructions in the second operation table are of the same type as the target instruction, and there is no instruction with the same primary key field value as the candidate instruction in the preceding operation instruction of the candidate instruction. If this condition is met, the candidate instruction can be moved into the sorting table, otherwise, the next instruction of the candidate instruction is used as a new candidate instruction, and it is determined again whether to move the candidate instruction into the sorting table until the candidate instruction is the last operation instruction in the second operation table. In this way, it can be ensured that the types of candidate instructions connected in series in the sorting table are the same, and the timing relationship between the operation instructions is not affected. Further, the above content is the cyclic process of the first cycle. After each round of the first cycle ends, the target instruction and the candidate instruction will be re-determined, and then the first cycle will be executed until there is no operation instruction in the second operation table, which means that the sorting in the second operation table is completed.

[0057] For example, Figure 2 A schematic diagram of the sorting of the second operation table provided for an embodiment of the present invention, wherein the number on the left side of the operation instruction identifies the position identifier in the second operation table, and the number on the right side indicates its primary key value, the left chart is the sorting table, and the right side is the second operation table. Specifically, during the first sorting process (starting the second cycle of the first round), 1.update1 is moved into the left sorting table as the target instruction, and the candidate instruction is 2.insert2 (starting the first cycle of the first round). However, the candidate instruction is different from the target instruction type, so 3.update2 is used as the candidate instruction (starting the first cycle of the second round). However, since 3.update2 and 2.insert2 have the same primary key value, it means that there is a timing relationship between them. Therefore, 3.update2 is skipped and 4.update3 is used as the candidate instruction (ending the first cycle of the first round). At this time, 4.update3 is the same type as the target instruction, and there is no instruction with the same primary key field value as the candidate instruction in the pre-order operation instruction of the candidate instruction. Therefore, 4.update3 is moved into the sorting table (ending the first cycle of the second round). Further, the 5-8 operation instructions do not meet the above conditions and cannot be moved into the sorting table (ending the second cycle of the first round). Therefore, the result of the first round of sorting is that 1.update1 and 4.update3 are included in the sorting table. Furthermore, 2.insert2 is used as the target instruction and 3.update2 is used as the candidate instruction to start a new second loop and execute the first loop steps until the second round of sorting is completed. Furthermore, only the first sorting process is introduced here, and other sorting processes are not described here. For details about the sorting results, see Figure 2 The rightmost sorted table.

[0058] An embodiment of the present invention provides a method for executing an operation instruction, the method comprising: obtaining an operation instruction data packet, storing the operation instruction into a corresponding storage table according to a storage tag of the operation instruction, wherein the operation instruction data packet comprises: an operation instruction and a storage tag of the operation instruction, the operation instruction comprises a primary key field, and the primary key field is used to identify the operation instruction; for any operation instruction in the storage table, storing the operation instruction into an operation table corresponding to the type of the operation instruction according to the primary key field value in the operation instruction and the type of the operation instruction, wherein the operation table comprises a first operation table and a second operation table, wherein the types of the operation instructions in the first operation table are the same, and there is a hash conflict between the operation instructions in the second operation table and the operation instructions in the first operation table; reordering the operation instructions in the operation table according to the type of the operation table and the type and primary key field value of the operation instruction in the operation table, and executing the operation instruction according to the ordering result. Specifically, by moving the operation instructions into different operation tables, the operation instructions can be classified, and then in the pre-compilation stage, for the same type of operation instructions, there is no need to switch the pre-compilation mode, which has achieved the goal of reducing the number of pre-compilation mode switching and improving the pre-compilation efficiency. It should be noted that the operation instructions in the first operation table are of the same type, and the candidate instructions in the second operation table after sorting are of the same type, and the timing relationship between the operation instructions is not affected. Furthermore, each operation table can be executed concurrently, which can improve the concurrency of the operation instructions.

[0059] Embodiment 2

[0060] Figure 3 This is a flow chart of a method for executing an operation instruction provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment further defines a specific method for storing the operation instruction in an operation table corresponding to the type of the operation instruction.

[0061] like Figure 3 As shown, including:

[0062] Step 310, obtain an operation instruction data packet, and store the operation instruction into a corresponding storage table according to the storage tag of the operation instruction, wherein the operation instruction data packet includes: an operation instruction and the storage tag of the operation instruction, and the operation instruction includes a primary key field, and the primary key field is used to identify the operation instruction.

[0063] Step 320: Determine a target data bucket for the operation instruction according to the primary key field value of the operation instruction and the preset concurrency number of the operation table, wherein the target data bucket includes a set number of first operation tables and second operation tables.

[0064] Since the number of current operation instructions is huge, the operation instructions can be classified multiple times and then the classified operation instructions can be executed concurrently to improve the execution efficiency of the operation instructions. For example, the operation instructions can be divided into multiple data buckets, and then the operation instructions in the data buckets can be divided into multiple operation tables. Among them, the data bucket can preset the corresponding execution thread pool, and the data table can preset the corresponding execution thread. In this way, the synchronization efficiency and concurrency of the operation instructions can be improved.

[0065] The preset concurrency of the operation table is the number of operation instructions that can be processed concurrently by the operation table. For example, the number of threads in the thread pool corresponding to the operation table can be configured as N, and the preset concurrency N=M-2, wherein two threads need to be reserved in the thread pool for hash conflict determination and data interaction respectively.

[0066] Specifically, the target data bucket is the data bucket where the operation instruction is stored, and the target data bucket can be determined specifically by the primary key field value of the operation instruction and the preset concurrency number of the operation table.

[0067] Optionally, determining a hash value of the operation instruction according to a primary key field value of the operation instruction;

[0068] According to the preset concurrency number of the operation table, performing hash modulo on the hash value of the operation instruction to obtain the hash modulo of the operation instruction;

[0069] A preset modulus range of each candidate data bucket is obtained, and if the hash modulus satisfies the preset modulus range of the candidate data bucket, the candidate data bucket is determined as the target data bucket of the operation instruction.

[0070] Specifically, the hash value of the operation instruction can be determined according to the primary key field value of the operation instruction through a preset hash function. Then, according to the preset concurrency number of the operation table, the hash value of the operation instruction is hashed modulo to obtain the hash modulus of the operation instruction. The hash modulo method includes: X=Y%M, where X is the hash modulus, Y is the hash value of the operation instruction, and M is the preset concurrency number.

[0071] The preset modulus range is used to evenly classify each operation instruction, and the preset modulus range can be a fixed value or a continuous value range. Further, if the hash modulus satisfies the preset modulus range of the candidate data bucket, the candidate data bucket is determined as the target data bucket of the operation instruction.

[0072] In this way, the same operation instructions can be evenly divided into each data bucket, thereby improving synchronization efficiency.

[0073] Optionally, when the number of operation instructions in a data bucket reaches a threshold, the operation instructions in the bucket are submitted.

[0074] Optionally, before the operation instruction is stored in the target data bucket, a hash value of the operation instruction is recorded in a hash table of the target data bucket, wherein the hash table includes a plurality of hash sub-tables corresponding to the operation table.

[0075] Specifically, since the hash value of the operation instruction is still needed in the subsequent processing of the operation instruction, the hash value of the operation instruction can be recorded in the hash table of the target data bucket before the operation instruction is stored in the target data bucket. If the hash value of the operation instruction is needed later, a table lookup operation can be performed to reduce the amount of calculation.

[0076] Step 330: For the operation instructions in the target data bucket, store the operation instructions in the first operation table or the second operation table according to the type of the operation instructions and the primary key field value.

[0077] Specifically, in order to reduce the number of times the operation instructions are switched in the pre-compilation mode, the operation instructions need to be divided into tables according to the types of the operation instructions and the primary key field values.

[0078] Optionally, step 330 includes:

[0079] Reading a hash value of the operation instruction from the hash table of the target data bucket;

[0080] If there is a hash conflict between the hash value of the operation instruction and the hash value of any operation instruction in the hash sub-table corresponding to the first operation table, the operation instruction is stored in the second operation table;

[0081] Otherwise, according to the type of the operation instruction, the operation instruction is stored in the corresponding first operation table.

[0082] Specifically, when executing the operation instructions in the first operation table, it is necessary to ensure that there is no hash conflict between the operation instructions in the first operation table to avoid data errors during the execution of the operation instructions. Therefore, the operation instructions can be divided into tables according to the type of operation instructions and the primary key field value.

[0083] Exemplarily, for an update type operation instruction, if there is no hash conflict between the operation instruction and the operation instruction in the first operation table, the update type operation instruction can be stored in the first operation table of the update type; if there is a hash conflict, the instruction is stored in the second operation table to avoid data errors caused by hash conflicts.

[0084] Step 340: re-sort the operation instructions in the operation table according to the type of the operation table and the type and primary key field value of the operation instructions in the operation table, and execute the operation instructions according to the sorting result.

[0085] This embodiment provides an execution method for operation instructions. Through this method, the operation instructions can be divided into target data buckets to improve the synchronization efficiency of operation instruction processing. Furthermore, the operation instructions in the target data bucket are divided into corresponding operation tables, which can reduce the number of switching times of pre-compilation mode in the pre-compilation stage.

[0086] Embodiment 3

[0087] Figure 4 This is a flowchart of a method for executing an operation instruction provided in Embodiment 3 of the present invention, which is a specific implementation process of the above embodiments.

[0088] like Figure 4 As shown, including:

[0089] Step 410: Obtain original data.

[0090] The original data may be an operation instruction data packet, and the original data may be data in JOSN format, including the operation instruction and a storage tag of the operation instruction.

[0091] Step 420: divide the original data into different execution queues.

[0092] Specifically, the operation instructions may be divided into different execution queues according to the storage tags of the operation instructions, and the execution queues correspond to different storage tables.

[0093] Step 430: Thread allocation.

[0094] Specifically, the execution queue or operation table may be assigned to different thread pools for the execution of subsequent operation instructions.

[0095] Step 440: Check whether the data uniqueness is updated.

[0096] Step 450: Submit the data before updating.

[0097] Specifically, since the operation instructions have certain timing restrictions, before the operation instructions are divided into data buckets, if the uniqueness of the operation instructions in the data bucket representing the operation instructions changes, the operation instructions in the data bucket should be submitted first to avoid data confusion during concurrent execution. The uniqueness of the operation instruction can be determined by the primary key and / or unique key of the operation instruction, which is not limited here.

[0098] Step 460: Hash bucketing.

[0099] Specifically, the hash value of the operation instruction may be determined according to the primary key field value of the operation instruction, and then the operation instruction may be bucketed according to the hash value of the operation instruction.

[0100] Step 470: The data is divided into the first operation table.

[0101] Step 480: The data is divided into a second operation table.

[0102] Specifically, before the operation instruction is stored in the target data bucket, the hash value of the operation instruction is recorded in the hash table of the target data bucket, wherein the hash table includes a plurality of hash sub-tables corresponding to the operation table.

[0103] Specifically, if there is a hash conflict between the hash value of the operation instruction and the hash value of any operation instruction in the hash sub-table corresponding to the first operation table, the operation instruction is stored in the second operation table;

[0104] Otherwise, according to the type of the operation instruction, the operation instruction is stored in the corresponding first operation table.

[0105] Step 490, sort the operation data.

[0106] Specifically, if the operation table is a second operation table, the second operation table is sorted according to the type of operation instructions and the primary key field value in the second operation table;

[0107] Step 500: Data execution.

[0108] Specifically, in any execution thread, if there is a hash conflict between an operating instruction being executed and an operating instruction to be executed, the execution of the operating instruction to be executed is suspended until the execution of the operating instruction being executed is completed; otherwise, the operating instructions are executed in a preset order.

[0109] An embodiment of the present invention provides an execution method for operation instructions. Through this method, the operation instructions can be divided into target data buckets to improve the synchronization efficiency of operation instruction processing. Furthermore, the operation instructions in the target data bucket are divided into corresponding operation tables, which can reduce the number of switching times of pre-compilation mode in the pre-compilation stage.

[0110] Embodiment 4

[0111] Figure 5 The schematic diagram of the structure of an execution device of an operation instruction provided in the fourth embodiment of the present invention can be used to execute any execution method of an operation instruction described in the embodiments of the present invention. Figure 3 As shown, the device comprises:

[0112] The acquisition module 510 is used to acquire an operation instruction data packet, and store the operation instruction into a corresponding storage table according to the storage tag of the operation instruction, wherein the operation instruction data packet includes: an operation instruction and the storage tag of the operation instruction, and the operation instruction includes a primary key field, and the primary key field is used to identify the operation instruction;

[0113] A classification module 520 is used for storing any operation instruction in the storage table into an operation table corresponding to the type of the operation instruction according to the primary key field value in the operation instruction and the type of the operation instruction, wherein the operation table includes a first operation table and a second operation table, wherein the types of the operation instructions in the first operation table are the same, and the operation instructions in the second operation table have a hash conflict with the operation instructions in the first operation table;

[0114] The execution module 530 is used to re-order the operation instructions in the operation table according to the type of the operation table and the type and primary key field value of the operation instructions in the operation table, and execute the operation instructions according to the ordering result.

[0115] An embodiment of the present invention provides an execution device for operation instructions. Specifically, by moving the operation instructions into different operation tables, the operation instructions can be classified, and then for the same type of operation instructions, there is no need to switch the pre-compilation mode in the pre-compilation stage, thereby reducing the number of switching pre-compilation modes and improving the pre-compilation efficiency. Furthermore, the operation tables can be executed concurrently, which can improve the concurrency of the operation instructions.

[0116] Optionally, the classification module 520 includes: a bucket division unit and a table division unit.

[0117] The bucketing unit is used to determine the target data bucket of the operation instruction according to the primary key field value of the operation instruction and the preset concurrency number of the operation table, wherein the target data bucket includes a set number of first operation tables and second operation tables;

[0118] The table division unit is used for storing the operation instructions in the target data bucket into the first operation table or the second operation table according to the type of the operation instruction and the primary key field value.

[0119] The bucketing unit includes: a hash calculation subunit, used to determine the hash value of the operation instruction according to the primary key field value of the operation instruction; a hash modulus calculation subunit, used to perform hash modulus on the hash value of the operation instruction according to the preset concurrency number of the operation table to obtain the hash modulus of the operation instruction; a bucketing subunit, used to obtain a preset modulus range of each candidate data bucket, and if the hash modulus satisfies the preset modulus range of the candidate data bucket, the candidate data bucket is determined as the target data bucket of the operation instruction.

[0120] The sub-table unit includes: a reading unit, configured to read the hash value of the operation instruction from the hash table of the target data bucket; a judging unit, configured to store the operation instruction in the second operation table if there is a hash conflict between the hash value of the operation instruction and the hash value of any operation instruction in the hash sub-table corresponding to the first operation table;

[0121] Otherwise, according to the type of the operation instruction, the operation instruction is stored in the corresponding first operation table.

[0122] Optionally, the classification module 520 further includes: a recording unit, configured to record the hash value of the operation instruction into a hash table of the target data bucket before the operation instruction is stored in the target data bucket, wherein the hash table includes a plurality of hash sub-tables corresponding to the operation table.

[0123] Optionally, the execution module 530 includes: a judgment unit, used to sort the second operation table according to the type of operation instructions and the primary key field value in the second operation table if the operation table is a second operation table; and an execution unit, used to suspend the execution of the operation instruction to be executed in any execution thread until the execution of the operation instruction to be executed is completed if there is a hash conflict between the operation instruction being executed and the operation instruction to be executed.

[0124] Wherein, the judgment unit is specifically used to establish a sorting table;

[0125] Execute the second loop until there is no operation instruction in the second operation table;

[0126] Wherein, the second cycle comprises:

[0127] Determine the first operation instruction in the second operation table as the target instruction, and determine the instruction following the target instruction as the candidate instruction; move the target instruction into the sorting table, and execute the first loop until the candidate instruction is the last operation instruction in the second operation table;

[0128] Among them, the first loop is an inner loop of the second loop, and the first loop includes: if the type of the candidate instruction is the same as the target instruction, and there is no instruction with the same primary key field value as the candidate instruction in the preceding operation instruction of the candidate instruction, then the candidate instruction is moved to the sorting table, and the next instruction of the candidate instruction is used as the new candidate instruction; otherwise, the subsequent instruction of the candidate instruction is determined as the candidate instruction, wherein the preceding operation instruction of the candidate instruction represents the operation instruction stored in the second operation table before the candidate instruction.

[0129] The execution device of the operation instruction provided in the embodiment of the present invention can execute the execution method of the operation instruction provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0130] Embodiment 5

[0131] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0132] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0133] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0134] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the execution method of the operation instruction.

[0135] In some embodiments, the execution method of the operation instruction may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the execution method of the operation instruction described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the execution method of the operation instruction by any other appropriate means (e.g., by means of firmware).

[0136] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0137] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0138] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0139] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0140] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0141] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0142] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0143] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for executing an operation instruction, characterized in that: include: Acquire an operation instruction data packet, and store the operation instruction in a corresponding storage table according to a storage tag of the operation instruction, wherein the operation instruction data packet includes: an operation instruction and a storage tag of the operation instruction, and the operation instruction includes a primary key field, and the primary key field is used to identify the operation instruction; For any operation instruction in the storage table, according to the primary key field value in the operation instruction and the type of the operation instruction, the operation instruction is stored in an operation table corresponding to the type of the operation instruction, wherein the operation table includes a first operation table and a second operation table, wherein the types of the operation instructions in the first operation table are the same, and the operation instructions in the second operation table have a hash conflict with the operation instructions in the first operation table; The operation instructions in the operation table are reordered according to the type of the operation table and the type of the operation instructions in the operation table and the primary key field value, and the operation instructions are executed according to the ordering result.

2. The method according to claim 1, characterized in that The step of storing the operation instruction in an operation table corresponding to the type of the operation instruction according to the primary key field value in the operation instruction and the type of the operation instruction includes: Determine a target data bucket of the operation instruction according to the primary key field value of the operation instruction and the preset concurrency number of the operation table, wherein the target data bucket includes a set number of first operation tables and second operation tables; For the operation instructions in the target data bucket, the operation instructions are stored in the first operation table or the second operation table according to the type of the operation instructions and the primary key field value.

3. The method according to claim 2, characterized in that The step of determining a target data bucket of the operation instruction according to the primary key field value of the operation instruction and the preset concurrency number of the operation table includes: Determine a hash value of the operation instruction according to the primary key field value of the operation instruction; According to the preset concurrency number of the operation table, performing hash modulo on the hash value of the operation instruction to obtain the hash modulo of the operation instruction; A preset modulus range of each candidate data bucket is obtained, and if the hash modulus satisfies the preset modulus range of the candidate data bucket, the candidate data bucket is determined as the target data bucket of the operation instruction.

4. The method according to claim 3, characterized in that Also includes: Before the operation instruction is stored in the target data bucket, the hash value of the operation instruction is recorded in a hash table of the target data bucket, wherein the hash table includes a plurality of hash sub-tables corresponding to the operation table.

5. The method according to claim 4, characterized in that The step of storing the operation instruction in the target data bucket into the first operation table or the second operation table according to the type of the operation instruction and the primary key field value includes: Reading a hash value of the operation instruction from the hash table of the target data bucket; If there is a hash conflict between the hash value of the operation instruction and the hash value of any operation instruction in the hash sub-table corresponding to the first operation table, the operation instruction is stored in the second operation table; Otherwise, according to the type of the operation instruction, the operation instruction is stored in the corresponding first operation table.

6. The method according to claim 1, characterized in that The reordering of the operation instructions in the operation table according to the type of the operation table and the type of the operation instructions in the operation table and the primary key field value, and executing the operation instructions according to the ordering result, comprises: If the operation table is a second operation table, sorting the second operation table according to the type of operation instructions and the primary key field value in the second operation table; In any execution thread, if there is a hash conflict between an operating instruction being executed and an operating instruction to be executed, the execution of the operating instruction to be executed is suspended until the execution of the operating instruction being executed is completed.

7. The method according to claim 6, characterized in that The type of the operation table and the type of the operation instruction in the operation table and the primary key field value include: Create a sorting table; Execute the second loop until there is no operation instruction in the second operation table; Wherein, the second cycle comprises: Determine the first operation instruction in the second operation table as the target instruction, and determine the instruction following the target instruction as the candidate instruction; move the target instruction into the sorting table, and execute the first loop until the candidate instruction is the last operation instruction in the second operation table; Among them, the first loop is an inner loop of the second loop, and the first loop includes: if the type of the candidate instruction is the same as the target instruction, and there is no instruction with the same primary key field value as the candidate instruction in the preceding operation instruction of the candidate instruction, then the candidate instruction is moved to the sorting table, and the next instruction of the candidate instruction is used as the new candidate instruction; otherwise, the subsequent instruction of the candidate instruction is determined as the candidate instruction, wherein the preceding operation instruction of the candidate instruction represents the operation instruction stored in the second operation table before the candidate instruction.

8. An execution device for an operation instruction, characterized in that: include: an acquisition module, used for acquiring an operation instruction data packet, and storing the operation instruction into a corresponding storage table according to a storage tag of the operation instruction, wherein the operation instruction data packet includes: an operation instruction and a storage tag of the operation instruction, the operation instruction includes a primary key field, and the primary key field is used to identify the operation instruction; a classification module, for storing, for any operation instruction in the storage table, the operation instruction into an operation table corresponding to the type of the operation instruction according to the primary key field value in the operation instruction and the type of the operation instruction, wherein the operation table includes a first operation table and a second operation table, wherein the types of the operation instructions in the first operation table are the same, and the operation instructions in the second operation table have a hash conflict with the operation instructions in the first operation table; The execution module is used to re-order the operation instructions in the operation table according to the type of the operation table and the type of the operation instructions in the operation table and the primary key field value, and execute the operation instructions according to the order result.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for executing the operating instruction according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the execution method of the operation instruction described in any one of claims 1 to 7 when executing the computer instructions.