Method for Performance Verification of Cockroach Database System Storage Engine

Through TPCC performance test call information recording and serialization, the key-value storage engine interface of the Cockroach database system is called again, and the storage engine performance verification is realized, which solves the problem of limited performance improvement of the storage layer in the database system, eliminates performance losses, and achieves accurate and fast performance verification.

CN114265781BActive Publication Date: 2025-03-04上海沄熹科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111609410.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2025-03-04
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

When the Cockroach database system ensures high availability and strong consistency of multiple replicas, processes such as SQL execution, distributed transaction processing and multi-replica consistency verification occupy a large part of the database request processing response time, resulting in limited storage layer performance improvement and optimization.

Method used

Through the TPCC performance test call process information, the key-value storage engine interface is re-called, the call information is recorded and serialized, and the call information is written to a file. Through the playback interface call process, data reflecting the performance of the database storage engine is obtained and storage engine performance verification is performed.

Benefits of technology

Eliminate performance losses before calling the underlying key-value storage engine, and realize accurate and fast storage engine performance verification, which can analyze and compare the performance of the database storage engine separately, and eliminate performance overhead in other stages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114265781B_ABST
    Figure CN114265781B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for verifying the performance of a storage engine of a Cockroach database system, and relates to the technical field of distributed databases. The method uses a TPCC performance test to record information of a corresponding storage engine interface called process through a recording function, and serializes the information of the called process and writes it into a file according to a specified path. The file is called according to a storage engine interface corresponding to the file to obtain data reflecting the performance of a database storage engine to verify the storage performance of the storage engine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention discloses a method, which relates to the technical field of distributed databases, and in particular to a method for verifying the performance of a storage engine of a Cockroach database system. Background Art

[0002] CockroachDB is a distributed SQL database built on a key-value storage engine with strong transaction consistency. It uses RocksDB as its storage engine and calls the storage engine through a unified interface.

[0003] To ensure the high availability and strong consistency of its multiple replicas, Cockroach performs a large amount of processing on the key-value storage engine, including SQL execution, distributed transaction processing and scheduling, and multiple replica consistency verification. This processing accounts for a large proportion of the database request processing response time, which is not conducive to performance improvement and optimization of the storage layer. Summary of the invention

[0004] In view of the problems in the prior art, the present invention provides a method for verifying the performance of a storage engine of a Cockroach database system. The method utilizes the TPCC performance test call process information to re-call the interface of a key-value storage engine to implement the storage performance verification method, which is convenient for developers and designers of the underlying key-value storage engine to analyze and compare the performance of the storage layer.

[0005] The specific scheme proposed by the present invention is:

[0006] The method for verifying the performance of the storage engine of the Cockroach database system uses the TPCC performance test to record the information of the corresponding storage engine interface called process through the recording function, and then serializes the information of the called process and writes it to the file according to the specified path.

[0007] The file is called according to the storage engine interface corresponding to the file to obtain data reflecting the performance of the database storage engine to perform storage engine storage performance verification.

[0008] Preferably, the method for verifying the performance of the storage engine of the Cockroach database system uses the TPCC performance test to record the information of the corresponding storage engine interface being called by the recording function, including:

[0009] Using TPCC performance testing, the storage engine interface is called through the libroach layer using CGO, and a flag is added to determine whether call information recording is required when calling the storage engine interface.

[0010] Preferably, in the method for verifying the performance of the storage engine of the Cockroach database system, the step of recording the information of the corresponding storage engine interface being called by recording a function includes:

[0011] For different storage engine interfaces, different recording functions for recording interface call information are set.

[0012] Preferably, in the method for verifying the performance of the storage engine of the Cockroach database system, the recording function corresponds to establishing a ProtocolBuffer object to save information about the process of calling the storage engine interface.

[0013] Preferably, the information of the called process in the method for verifying the performance of the storage engine of the Cockroach database system is serialized and written into a file according to a specified path, including:

[0014] Generate a hierarchical directory according to the specified path, write files according to the hierarchical directory and sort the files, and obtain a file path list after the files are sorted.

[0015] Preferably, the method for verifying the performance of the storage engine of the Cockroach database system calls the file according to the storage engine interface corresponding to the file to obtain data reflecting the performance of the database storage engine, including:

[0016] The corresponding storage engine interface is obtained according to the file corresponding to the order in which the files are sorted in the file path list, and the file is called through the storage engine interface to obtain data reflecting the performance of the database storage engine.

[0017] The present invention also provides a system for verifying the performance of a storage engine of a Cockroach database system, including a recording module and a verification module.

[0018] The recording module uses the TPCC performance test to record the information of the corresponding storage engine interface called process through the recording function, and serializes the information of the called process and writes it into the file according to the specified path.

[0019] The verification module calls the file according to the storage engine interface corresponding to the file to obtain data reflecting the performance of the database storage engine to perform storage engine storage performance verification.

[0020] The present invention also provides a device for verifying the performance of a storage engine of a Cockroach database system, comprising at least one memory and at least one processor;

[0021] The at least one memory is used to store a machine-readable program;

[0022] The at least one processor is used to call the machine-readable program to execute the method for verifying the performance of the Cockroach database system storage engine.

[0023] The benefits of the present invention are:

[0024] The present invention provides a method for verifying the performance of the storage engine of the Cockroach database system, improves the libroach interface call of Cockroach, adds interface call information recording and serialization storage process, obtains relevant data information in the TPCC performance test process, adds the playback processing logic of the storage interface call, and realizes the performance comparison and verification analysis of the Cockroach key-value storage engine in combination with the call information record. The performance loss before calling the underlying key-value storage engine is eliminated, and it is conducive to accurately and quickly verifying the performance of the storage engine. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0026] Figure 1 It is a schematic diagram of the TPCC performance test calling information flow in the method of the present invention.

[0027] Figure 2 It is a schematic diagram of the TPCC performance test call information processing and playback process in the method of the present invention.

[0028] Figure 3 It is a schematic diagram of the database storage engine performance verification process in the method of the present invention. DETAILED DESCRIPTION

[0029] TPCC (TPC-C) is an online transaction processing (OLTP) benchmark program proposed by TPC (Transaction Processing Performance Council), and its output performance test results are widely recognized in the industry.

[0030] ProtocolBuffer is a data exchange format from Google. It is language and platform independent. Google provides implementations in multiple languages. Since it is a binary format, it is much faster than using XML for data exchange. It can be used for data communication between distributed applications or data exchange in heterogeneous environments. As a binary data transmission format with excellent efficiency and compatibility, it can be used in many fields such as network transmission, configuration files, data storage, etc.

[0031] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0032] The present invention provides a method for verifying the performance of a storage engine of a Cockroach database system. The method uses a TPCC performance test to record information of a corresponding storage engine interface called process through a recording function, and then serializes the information of the called process and writes it into a file according to a specified path.

[0033] The file is called according to the storage engine interface corresponding to the file to obtain data reflecting the performance of the database storage engine to perform storage engine storage performance verification.

[0034] The method of the present invention eliminates the performance loss before calling the underlying key-value storage engine as much as possible and verifies and compares the performance of the storage engine alone, which is conducive to accurately and quickly verifying the performance of the storage engine.

[0035] In addition, the method of the present invention, combined with the call information of the storage engine related interface recorded in the TPCC performance test, can exclude other stages above the distributed database system storage engine, such as: SQL execution, transaction processing, multi-copy consistency verification and other performance overheads, and only re-execute the calling process of the storage engine interface, which can be called the replay of the storage engine interface. Therefore, the performance of the database storage engine can be analyzed and compared separately.

[0036] In a specific application, when performing performance verification of the Cockroach database system storage engine in some embodiments of the present invention, the reference process is as follows:

[0037] S1: Start Cockroach to perform TPCC performance testing and start the TPCC performance test call information recording process, in which the rewritten libroach layer CGO calls the storage engine interface and uses the recording function to start recording the information of the called process, including the called interface, incoming parameters, interface caller, etc.

[0038] S2: Store and record the information of the called process according to the specified path and format;

[0039] S3: Each storage engine interface call loops through S1 and S2 until the Cockroach TPCC performance test is completed;

[0040] S4: Start executing the TPCC performance test call information processing flow, process and sort the recorded call information according to the storage rules, output it to the sequence record file in sequence, and obtain the sorted file path list;

[0041] S5: Start to execute the TPCC performance test playback process, which reads the sequential file path list generated by S4, reads the call information record file in sequence to execute the playback process, calls the interface corresponding to the read call information record file, passes in the corresponding information, records the return value or error information, and completes the playback of one call. After the playback of all the call information record files recorded in the sequential table is completed, statistics are collected on relevant information, output results, time, execution interface call times, and other data reflecting the performance of the database storage engine for storage engine storage performance verification.

[0042] On the basis of the above process, in some embodiments of the present invention, when step S1 performs the TPCC performance test call information recording process, Cockroach uniformly implements the call of the underlying key-value storage engine through the libroach layer. Therefore, in order to eliminate the impact of overhead outside the storage engine on the performance test results as much as possible, in the process of the libroach layer calling the underlying key-value storage engine, the storage engine interface call information is recorded, and each interface that calls the underlying key-value storage engine adds a corresponding interface call information recording function, and at the same time, it is to reduce the disk space occupied by the call information record. In step S2, each interface call information recording function can serialize the recorded information using ProtocolBuffer and then write it to the file. The specific execution process is as follows:

[0043] When Cockroach is started and the TPCC performance test is performed, the libroach layer calls the storage engine related interfaces through CGO and passes in the parameters required for calling the interfaces.

[0044] Rewrite the storage engine interface implementation process called by libroach layer CGO. First, to avoid affecting other business executions of the database system, you need to add a control flag, such as a bool flag, or use conditional compilation to determine whether call information recording is required. If not, perform the operation according to the original interface implementation. Otherwise, you need to pass the interface call information and other related information, such as DBEngine pointers, to the call information recording function of the interface. To distinguish different interfaces, you need to define a constint mapping table of interface names, and use a simplified constint value as the interface name to be saved by subsequent operations. This constint value needs to be passed to the interface call information recording function.

[0045] Different interfaces have different implementations of the interface call information recording function to ensure that the call information is fully recorded. Each recording function will create a corresponding ProtocolBuffer object, which is defined in the .proto file. The ProtocolBuffer object saves the incoming call information, that is, initializes it;

[0046] After the Protocol Buffer object is initialized, the recorded information is serialized into a binary string or other type that is easy to store in a file through the serialization method it provides, and passed to the serialization information storage function;

[0047] The serialization information storage function records each interface call as a file. The file is named with the current timestamp and the interface name of the passed-in constint type. At the same time, the storage path is also set to distinguish the call information.

[0048] The storage path of the set TPCC performance test call information, for example:

[0049] In the TPCC performance test call information recording process, the data generated under the initial recorded information storage path has two levels of directories, with a total of four combinations: batch / iter, batch / nil, nil / iter, and nil / nil. Among them, batch and iter are the pointer addresses of DBBatch and DBIter respectively. This address is not reused and is only used to distinguish operations. For the batch / iter directory combination, since batch and engine are the same type of objects in the actual call process, the directory level also contains the DBEngine pointer address, usually only one:

[0050] The batch / iter directory records the creation operation information of DBEngine and DBBatch on the pointer iter;

[0051] The batch / nil directory records a series of operation information of DBBatch as the parameter passed in the function call;

[0052] The nil / iter directory records information about pointer iter operations of DBEngine and DBBatch;

[0053] The nil / nil directory records a series of operation information of DBEngine as the parameters passed in as function calls.

[0054] Through the above process, when the TPCC performance test call information processing flow is performed in step S4, the information record under the nil / iter level directory is first processed, the iter level directory is traversed, and the iter level under the corresponding batch directory is found according to the pointer iter address;

[0055] Sort the operations in the nil / iter directory with the same pointer and the batch or engine pointer iter creation operations in the batch / iter directory together, and then move them all to the corresponding batch / iter directory;

[0056] Through engine-specific operations, find the engine directory (one of the batch / iter directory combinations), and perform similar processing procedures (1) and (2) in the iter level under this directory to move the batch operations corresponding to the engine to this directory. Finally, only one batch directory remains, which is the engine directory. All other operation records are under it, hereinafter referred to as the engine directory.

[0057] Sort and record all operations under the engine directory, where the folder is recorded at the time of creation;

[0058] Sort and record all operations of engine / iter;

[0059] Merge and sort the sorted results, record them, and output the final processing result - a sorted file path list.

[0060] Based on the above process, step S5 starts to execute the TPCC performance test playback process. The specific processing flow can be referred to as follows:

[0061] The ordered file path list obtained by processing the TPCC performance test call information is read into the call information structure api_message established in the memory to reduce the consumption and performance verification error caused by frequent access to the path list file during playback; and api_message mainly stores three kinds of information: interface type, proto information and flag bit. The interface type is determined by the suffix of the read-in file, the proto information is the content of the read-in file, and the flag bit is used to distinguish whether the interface is a batch or db object call;

[0062] Traverse the api_message queue, read one message at a time, determine the playback interface to be called according to the interface type in the message, and pass the message to the interface playback function;

[0063] After the interface playback function is called, it first deserializes the proto information in the incoming message and uses the information to initialize an object required by this interface;

[0064] Call the corresponding interface and pass in the input parameters required by the interface - the object initialized with the deserialized information;

[0065] Record the required return information or handle errors. If there are no errors, continue to traverse the api_message queue;

[0066] After the traversal is completed, performance-related information is returned, such as statistical-related information, output results and time, execution interface call count, and other data reflecting the database storage engine performance, which is used to verify the storage engine storage performance.

[0067] The present invention also provides a system for verifying the performance of a storage engine of a Cockroach database system, including a recording module and a verification module.

[0068] The recording module uses the TPCC performance test to record the information of the corresponding storage engine interface called process through the recording function, and serializes the information of the called process and writes it into the file according to the specified path.

[0069] The verification module calls the file according to the storage engine interface corresponding to the file to obtain data reflecting the performance of the database storage engine to perform storage engine storage performance verification.

[0070] The information interaction, execution process and other contents between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention. For the specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.

[0071] Similarly, the system of the present invention can improve Cockroach's libroach interface call, add interface call information recording and serialization storage process, obtain relevant data information in the TPCC performance test process, add playback processing logic for storage interface calls, and implement performance comparison and verification analysis of Cockroach key-value storage engine in combination with call information recording. It eliminates the performance loss before calling the underlying key-value storage engine, and is conducive to accurate and rapid performance verification of the storage engine.

[0072] The present invention also provides a device for verifying the performance of a storage engine of a Cockroach database system, comprising at least one memory and at least one processor;

[0073] The at least one memory is used to store a machine-readable program;

[0074] The at least one processor is used to call the machine-readable program to execute the method for verifying the performance of the Cockroach database system storage engine.

[0075] As the information interaction, execution of readable program process and other contents of the processor in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.

[0076] Similarly, the device of the present invention can improve the libroach interface call of Cockroach, add interface call information recording and serialization storage process, obtain relevant data information in the TPCC performance test process, add the playback processing logic of the storage interface call, and realize the performance comparison and verification analysis of the Cockroach key-value storage engine in combination with the call information record. It eliminates the performance loss before calling the underlying key-value storage engine, and is conducive to accurate and rapid performance verification of the storage engine.

[0077] It should be noted that not all steps and modules in the above-mentioned processes and system structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.

[0078] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. The performance verification method of the Cockroach database system storage engine is characterized by: Using TPCC performance testing, different recording functions for implementing interface call information recording are set for different storage engine interfaces. The recording function records the information of the corresponding storage engine interface called process, and the information of the called process is serialized and written into the file according to the specified path. The file is called according to the storage engine interface corresponding to the file to obtain data reflecting the performance of the database storage engine to perform storage engine storage performance verification, and the process is as follows: S1: Start Cockroach to perform TPCC performance testing and start the TPCC performance test call information recording process. The rewritten libroach layer CGO calls the storage engine interface and uses the recording function to start recording the information of the called process, including the called interface, incoming parameters, and interface caller. S2: Store and record the information of the called process according to the specified path and format; S3: Each time the storage engine interface is called, S1 and S2 are executed in a loop until the Cockroach TPCC performance test is completed; S4: Start executing the TPCC performance test call information processing flow, process and sort the recorded call information according to the storage rules, output them in sequence to the sequence record file, and obtain the sorted file path list; S5: Start to execute the TPCC performance test playback process, which reads the sequential file path list generated by S4, reads the call information record file in sequence to execute the playback process, calls the interface corresponding to the read call information record file, passes in the corresponding information, records the return value or error information, and after the playback of all the call information record files recorded in the sequential table is completed, statistics reflecting the performance of the database storage engine are generated, including relevant information, output results, time, and the number of execution interface calls.

2. The method for verifying the performance of the Cockroach database system storage engine according to claim 1, characterized in that The TPCC performance test records the information of the corresponding storage engine interface being called by recording functions, including: Using TPCC performance testing, the storage engine interface is called through the libroach layer using CGO, and a flag is added to determine whether call information recording is required when calling the storage engine interface.

3. The method for verifying the performance of the Cockroach database system storage engine according to claim 1, characterized in that The recording function correspondingly establishes a ProtocolBuffer object to save the information of the storage engine interface being called.

4. The method for verifying the performance of the Cockroach database system storage engine according to claim 1, characterized in that The information of the called process is serialized and written into a file according to a specified path, including: Generate a hierarchical directory according to the specified path, write files according to the hierarchical directory and sort the files, and obtain a file path list after the files are sorted.

5. The method for verifying the performance of the Cockroach database system storage engine according to claim 4, characterized in that Calling the file according to the storage engine interface corresponding to the file to obtain data reflecting the performance of the database storage engine includes: The corresponding storage engine interface is obtained according to the file corresponding to the order in which the files are sorted in the file path list, and the file is called through the storage engine interface to obtain data reflecting the performance of the database storage engine.

6. The Cockroach database system storage engine performance verification system is characterized by Including recording module and verification module, The recording module uses TPCC performance testing to set different recording functions for different storage engine interfaces to record interface call information. The recording function records the information of the corresponding storage engine interface called process, and the information of the called process is serialized and written into the file according to the specified path. The verification module calls the file according to the storage engine interface corresponding to the file to obtain data reflecting the performance of the database storage engine to perform storage engine storage performance verification. The execution process of the verification module is as follows: S1: Start Cockroach to perform TPCC performance testing and start the TPCC performance test call information recording process. The rewritten libroach layer CGO calls the storage engine interface and uses the recording function to start recording the information of the called process, including the called interface, incoming parameters, and interface caller. S2: Store and record the information of the called process according to the specified path and format; S3: Each time the storage engine interface is called, S1 and S2 are executed in a loop until the Cockroach TPCC performance test is completed; S4: Start executing the TPCC performance test call information processing flow, process and sort the recorded call information according to the storage rules, output them in sequence to the sequence record file, and obtain the sorted file path list; S5: Start to execute the TPCC performance test playback process, which reads the sequential file path list generated by S4, reads the call information record file in sequence to execute the playback process, calls the interface corresponding to the read call information record file, passes in the corresponding information, records the return value or error information, and after the playback of all the call information record files recorded in the sequential table is completed, statistics reflecting the performance of the database storage engine are generated, including relevant information, output results, time, and the number of execution interface calls.

7. A device for verifying the performance of a storage engine of a Cockroach database system, characterized in that comprising at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is used to call the machine-readable program to execute the method for verifying the performance of the Cockroach database system storage engine according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Log information processing method, device and equipment and storage medium

    CN110928851A

  • KV database access method, device and equipment

    CN111008233A