A method and apparatus for characterizing a blockchain system at the microarchitecture level
By collecting and analyzing the microarchitecture events during the blockchain system runtime and using machine learning algorithms to sort importance, the problem that the existing technology cannot evaluate the performance of blockchain system from the microarchitecture level is solved, and more accurate performance analysis and more efficient system operation is achieved.
Patent Information
- Application Number
- CN201910923005.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-27
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2039-09-27
AI Technical Summary
Existing blockchain system performance evaluation tools such as Blockbench and Hyperledger Caliper only perform performance evaluation from the overall level and fail to characterize blockchain systems from the microarchitecture level, resulting in the inability to clearly understand the reasons for poor performance and it is difficult to select or design a suitable CPU microarchitecture.
By collecting the microarchitecture events when the blockchain system runs the benchmark test program, building a correlation model between the microarchitecture events and the performance of the blockchain system, using machine learning algorithms to determine the importance of events, and then characterizing the blockchain system from the microarchitecture level.
Able to clearly show the reasons for poor performance of blockchain systems and help select or design a suitable CPU microarchitecture to enable more efficient operation of blockchain systems.
Smart Images

Figure CN112579555B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular, to a method and device for characterizing a blockchain system at the microarchitecture level based on machine learning. Background Art
[0002] In recent years, blockchain technology has become popular all over the world, and more and more companies and users have started using blockchain applications. As a disruptive technology, blockchain is leading a new round of technological and industrial revolutions globally, and is expected to become the "source" of global technological innovation and model innovation, promoting the transformation from the "information Internet" to the "value Internet". As a cutting-edge technology, innovation, experimentation, and application of new technologies such as blockchain need to be strengthened.
[0003] In the prior art, blockchain systems suffer from various performance problems. Blockchain is often regarded as a new generation of database systems, but these systems are still far from replacing the current database systems in traditional data processing workloads. To measure the performance of blockchain systems, researchers need to use appropriate blockchain benchmark programs. The most commonly used blockchain benchmark program frameworks currently are Blockbench and Hyperledger Caliper, both of which can evaluate the performance of blockchain systems from the system level. Researchers use these two blockchain system benchmark program frameworks to measure the performance of current blockchain systems in terms of throughput, latency, scalability, etc.
[0004] However, both Blockbench and Hyperledger Caliper only focus on overall performance indicators (such as throughput, latency, etc.), but do not characterize the blockchain system from the microarchitecture level, which will lead to an unclear understanding of the reasons for the poor performance of the blockchain system. In addition, people also do not know which existing CPU microarchitecture should be selected, or how to design the microarchitecture of the CPU to run the blockchain system more efficiently. Summary of the Invention
[0005] The purpose of the present invention is to overcome the above-mentioned defects of the prior art, and provide a method and device for characterizing a blockchain system at the microarchitecture level based on machine learning. By ranking the importance of microarchitecture events, events closely related to the performance of the blockchain system are obtained, so as to characterize the blockchain system from the microarchitecture level.
[0006] According to the first aspect of the present invention, there is provided a method for characterizing a blockchain system at the microarchitecture level. The method includes the following steps:
[0007] Collect microarchitecture events when running a benchmark program for a blockchain system, where the microarchitecture events are used to reflect the performance of interacting with a microprocessor architecture;
[0008] Build a correlation model between microarchitecture events and blockchain system performance based on the collected microarchitecture events;
[0009] Use a machine learning algorithm to determine the correlation degree of the input microarchitecture events of the correlation model with respect to the performance of the blockchain system, and obtain an importance ranking result of the microarchitecture events.
[0010] In one embodiment, the performance of the blockchain system is node-level performance characterized by the collected microarchitecture events.
[0011] In one embodiment, the performance of the blockchain system is the number of instructions per cycle collected when running a benchmark program.
[0012] In one embodiment, the collection of microarchitecture events when running a benchmark program for a blockchain system includes:
[0013] Collect multiple microarchitecture events each time the blockchain system benchmark program is run, including the number of instructions "instruction" and the number of cycles "cycle", and represent the result of each collection as:
[0014] v i ={IPC i ,e 1 ,e 2 ,…,e k}
[0015] where IPC i is the number of instructions per cycle for the i-th round of testing, and the e k value represents the k-th microarchitecture event.
[0016] In one embodiment, obtaining the importance ranking of the microarchitecture events includes:
[0017] Represent the correlation model between the microarchitecture events and the performance of the blockchain system as:
[0018] IPC = pred(e 1 ,e 2 ,…e n )
[0019] where e i is the value of the i-th microarchitecture event, n is the total number of input microarchitecture events, and the output IPC represents the number of instructions per cycle;
[0020] Quantify the importance of each input microarchitecture event in the correlation model for the output IPC using a machine learning algorithm.
[0021] In one embodiment, the machine learning algorithm is a random gradient boosted regression tree, a random forest, or a gradient boosting decision tree.
[0022] In one embodiment, select or customize the CPU suitable for the blockchain system based on the obtained importance ranking result of the microarchitecture events.
[0023] According to a second aspect of the present invention, there is provided an apparatus for characterizing a blockchain system at the microarchitecture level. The apparatus includes:
[0024] An event collection unit: which is used to collect microarchitecture events when the blockchain system runs a benchmark program, and the microarchitecture events reflect the performance of interacting with the microprocessor architecture;
[0025] A model construction unit: which is used to construct a correlation model between the microarchitecture events and the performance of the blockchain system based on the collected microarchitecture events;
[0026] A ranking unit: which is used to determine the correlation degree of the input microarchitecture events of the correlation model for the performance of the blockchain system using a machine learning algorithm, and obtain an importance ranking result of the microarchitecture events.
[0027] In one embodiment, the performance of the blockchain system is the number of instructions per cycle collected when running a benchmark program.
[0028] Compared with the prior art, the advantages of the present invention are as follows: By collecting the microarchitecture events during the running of the blockchain system benchmark program, and ranking the importance of these events to obtain the events with high importance rankings, and then characterizing the blockchain system at the microarchitecture level. In this way, it is possible to clearly show the reasons for the poor performance of the blockchain system, and help people select a suitable CPU microarchitecture, or design a suitable CPU microarchitecture to match different blockchain systems, so as to achieve the purpose of running different blockchain systems more efficiently. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The following drawings are only schematic illustrations and explanations of the present invention, and are not used to limit the scope of the present invention, wherein:
[0030] Figure 1 is a flowchart of a method for characterizing a blockchain system at the microarchitecture level according to an embodiment of the present invention;
[0031] Figure 2A schematic diagram of the data relationship of the collected microarchitecture events according to an embodiment of the present invention;
[0032] Figures 3(a) to 3(c) A schematic diagram of the importance ranking of microarchitecture events in a blockchain system according to an embodiment of the present invention. Detailed implementation manners
[0033] In order to make the objectives, technical solutions, design methods, and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the accompanying drawings through specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0034] In all the examples shown and discussed herein, any specific value should be construed as merely exemplary and not as a limitation. Therefore, other examples of the exemplary embodiments may have different values.
[0035] Technologies, methods, and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the said technologies, methods, and devices should be regarded as part of the specification.
[0036] According to an embodiment of the present invention, a method for characterizing a blockchain system at the microarchitecture level is provided. The method generally includes two parts. One is to collect microarchitecture events during the operation of a blockchain system benchmark program, and the other is to use machine learning algorithms to rank the importance of these microarchitecture events and select events that are relatively more important for the performance of the blockchain system for analysis.
[0037] Specifically, referring to Figure 1 As shown, the method of the embodiment of the present invention includes the following steps:
[0038] Step S110, collect microarchitecture events when the blockchain system runs a benchmark program.
[0039] In this article, microarchitecture events refer to performance indicators that reflect interactions with a microarchitecture (e.g., CPU). For example, microarchitecture events include, but are not limited to: BMMR, the number of retired macro branch instructions with incorrect predictions; BIOT, the number of retired branch instructions with unexecuted computations; CA1P, the number of loops with suspended L1 data caches; CAS1, the number of execution stalls due to unloaded L1 data caches, etc.
[0040] Modern processors usually have 4 - 8 performance counters. When hundreds of microarchitecture events need to be collected, there are two methods: (1) One performance counter collects one event, which is called the OCOE method in this article; (2) One performance counter collects multiple microarchitecture events, which is called the multiplexing method (MLPX) in this article. The OCOE method is more accurate, but the collection speed is very slow. The MLPX method has a fast collection speed but lower accuracy. This article first proposes a method for characterizing the performance of a blockchain system at the microarchitecture level of the blockchain. Preferably, the more accurate OCOE method is selected to verify the effectiveness of the method.
[0041] For example, for the case where each CPU in the hardware configuration has 6 performance counters, six events are collected each time the blockchain system benchmark program runs. Among them, the two microarchitecture events, the number of instructions "instruction" and the number of cycles "cycle", always exist during collection and are used to calculate the number of instructions executed per cycle, denoted as IPC (instruction per cycle). For example, IPC is the ratio of the number of instructions "instruction" to the number of cycles. The other four performance counters are respectively used to statistically replace the values of other microarchitecture events.
[0042] In one embodiment, performance metrics of 236 microarchitecture events are collected, which can more comprehensively characterize the blockchain system at the microarchitecture level. For example, the statistical data from all performance counter groups are synthesized into a table form for subsequent processing. See Figure 2 shown, where for each group of performance counters, it includes the number of instructions "instruction" and the number of cycles "cycle", and four other microarchitecture events (such as e 1 to e 4 or e 5 to e 8 etc.). Specifically, the area outside the "event values" block is filled with 0, and a sparse matrix is obtained accordingly. Each row is a vector, denoted as:
[0043] v i ={IPC i ,e 1 ,e 2 ,…,e k ,…,e 234}
[0044] IPC i is the analysis of the i-th round of IPC, and the value of e k is the k-th microarchitecture event, and this value depends on the running time of the benchmark program. For each v i, at most four events are non - zero values, because when using the OCOE method, only four events are collected and analyzed each time except for IPC.
[0045] It should be understood that in addition to using the number of instructions per cycle IPC to measure the node - level performance in the blockchain system, other performance metrics can also be used, such as the number of incorrect instructions per cycle, the average execution time of instructions, etc.
[0046] Step S120, construct an association model between micro - architecture events and the performance of the blockchain system.
[0047] In this article, the number of instructions per cycle IPC is taken as an example of a reliable indicator of node - level performance for introduction. IPC is closely related to node performance, and the higher the value, the better the performance.
[0048] In one embodiment, an association model between micro - architecture events and the performance of the blockchain system is constructed to quantify the importance of events to IPC (instructions per cycle). The association model is generally represented as:
[0049] IPC = pred(e 1 ,e 2 ,…e n )
[0050] Where the input e of the association model i is the value of the i - th micro - architecture event, n is the total number of input micro - architecture events, and the output of the association model is the number of instructions per cycle IPC.
[0051] Step S130, use a machine - learning algorithm to obtain the ranking result of the importance of the input micro - architecture events of the association model to the performance of the blockchain system.
[0052] In one embodiment, a machine - learning algorithm is used to obtain the degree of relevance or importance of micro - architecture events to IPC. For example, the random gradient - boosted regression tree (SGBRT) in the ensemble learning algorithm is used to train the constructed association model. The key point is that SGBRT combines many tree models in a staged manner, where each tree model reflects a part of the performance, and the final model is called an ensemble model. By constructing an association model (or performance model), the importance of micro - architecture events and their interactions can be quantified using this model. Obviously, a more accurate performance model can produce a better quantification of event importance. To make the results more intuitive, the importance of events can be standardized so that the sum of the importance of all events is 100%, and the higher the percentage of the importance of each event, the greater the impact of the event on the performance of the blockchain system.
[0053] It should be noted that, in addition to using random gradient boosted regression trees, other machine learning algorithms such as random forests and gradient boosting decision trees can also be used to obtain the importance ranking results of microarchitecture events.
[0054] Corresponding to the above method, the present invention also provides a device for characterizing a blockchain system at the microarchitecture level. This device can implement one or more aspects of the above embodiments. For example, the device includes: an event collection unit for collecting microarchitecture events when the blockchain system runs a benchmark program, where the microarchitecture events reflect the performance of interacting with the microprocessor architecture; a model construction unit for constructing an association model between the microarchitecture events and the performance of the blockchain system based on the collected microarchitecture events; and a ranking unit for using a machine learning algorithm to determine the relevance degree of the input microarchitecture events of the association model to the performance of the blockchain system and obtaining the importance ranking results of the microarchitecture events.
[0055] In a practical application, Blockbench was used to collect data of 11 parts of programs of 7 benchmark programs of two blockchain systems, Ethereum and Hyperledger Fabric (where two programs collected three parts of programs by changing different input data sets), and Hyperledger Caliper was used to collect data of 6 parts of programs of 6 benchmark programs of two blockchain systems, Hyperledger Fabric and Hyperledger Sawtooth. Therefore, a total of 17 programs' data was collected. The importance ranking method provided by the present invention was used to rank the microarchitecture events of these 17 programs, and different blockchain systems were characterized according to the most important events in the ranking.
[0056] Furthermore, after obtaining the importance ranking results of the microarchitecture events, the reasons for the poor performance of the blockchain system can be found through analysis, and it can help people select or design a more suitable CPU for different blockchain systems to run the blockchain system more efficiently.
[0057] To verify the feasibility and effectiveness of the present invention, the machine learning algorithms in the embodiments of the present invention are all implemented using Python. The experimental scheme mainly involves ranking the importance of the metrics of the microarchitecture events of these 17 blockchain benchmark programs, obtaining the relative importance rankings of each program, and analyzing the microarchitecture characteristics of different blockchain systems through these top-ranked microarchitecture events. Finally, the reasons for the poor performance of the blockchain system are found, and it helps people choose which existing CPU microarchitecture or how to design the CPU microarchitecture to match different blockchain systems, so as to run different blockchain systems more efficiently.
[0058] Specifically, Figures 3(a) to 3(b) is the importance ranking of 17 blockchain systems. Due to space limitations, only the top ten events are shown. Among them, the abscissa (events) is the abbreviation of the microarchitecture event name, and the ordinate (importance) is the percentage of the importance ranking. Figure 3(a) represents the name of the benchmark program of Ethereum, and in Figures 3(b) and 3(c), E, F, and S respectively represent that the blockchain benchmark program belongs to Ethereum, Fabric, and Sawtooth.
[0059] From Figures 3(a) to 3(c) the experimental results, the following two points can be obtained: (1) The microarchitecture events related to branches are among the top 10 most important events in most benchmarks. For example, BMMR, which represents retired macro branch instructions for misprediction, is in the list of the top 10 most important events for 10 out of the 17 benchmark tests. In addition, the top 10 most important events in 14 out of the 17 benchmarks include branch-related events. This indicates that the reason for the poor performance of the blockchain system may be related to branch prediction; (2) Different blockchain systems have different orders of importance of microarchitecture events. For example, Ethereum shows greater importance in instruction length decoder and L1 data cache misses; Fabric shows greater importance in L2 cache access, ITLB misses, DTLB misses caused by the instruction decode queue, etc.; Sawtooth is more important in Uops distribution and occupancy of the private offcore request queue. Therefore, based on the performance of these different blockchain systems, existing suitable CPUs can be selected, and at the same time, hardware designers can also design customized CPUs according to the characteristics of different blockchain systems.
[0060] It should be understood that the method for characterizing blockchain systems at the microarchitecture level provided by the present invention can not only be used in blockchain systems, but also in other systems such as big data systems, etc., and can also analyze the performance of these systems at the microarchitecture level.
[0061] Compared with the prior art, the present invention has the following advantages:
[0062] First of all, existing blockchain benchmark programs only focus on performance metrics at the overall level (such as throughput, latency, etc.), which will lead to an inability to clearly understand the reasons for the poor performance of the blockchain system. Therefore, people do not know which existing CPU microarchitecture should be selected, or how to design the microarchitecture of the CPU to run the blockchain system more efficiently. The present invention characterizes the blockchain system at the microarchitecture level by collecting microarchitecture events during the operation of the blockchain system benchmark program. By analyzing the importance ranking results of the microarchitecture events, the reasons for the poor performance of the blockchain system can be clearly shown, thereby helping people select a suitable existing CPU microarchitecture, or design the microarchitecture of the CPU to match different blockchain systems.
[0063] Secondly, the present invention ranks the importance of microarchitecture events based on machine learning, obtains events that are relatively more important for different blockchain systems, and can understand the reasons for the poor performance of the blockchain system by analyzing these events, without having to analyze all microarchitecture events, saving time in the analysis process and reducing the overhead of the analysis process. At the same time, the training results of machine learning have an extremely low error rate (not exceeding 2%), so the present invention can obtain more accurate importance ranking results of microarchitecture events.
[0064] In summary, the method for ranking the importance of blockchain microarchitecture events based on machine learning proposed by the present invention can accurately obtain events that have the most important impact on different blockchain systems and the performance of the blockchain system when running different tasks. Using the method of the present invention can find out the reasons for the poor performance of the blockchain system, and then assist people in selecting or designing a more suitable CPU for different blockchain systems to run the blockchain system more efficiently.
[0065] It should be noted that although the above steps are described in a specific order, it does not mean that the steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently or even in a different order, as long as the required functions can be achieved.
[0066] The present invention can be a system, method, and / or computer program product. The computer program product can include a computer-readable storage medium having computer-readable program instructions thereon for causing a processor to implement various aspects of the present invention.
[0067] A computer-readable storage medium can be a tangible device that holds and stores instructions for use by an instruction execution device. A computer-readable storage medium may include, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include: 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), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanically encoded device such as a punched card or raised structures in grooves having instructions stored thereon, and any suitable combination of the foregoing.
[0068] The embodiments of the present invention have been described above. The above description is exemplary and not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations are obvious to those of ordinary skill in the art in the technical field without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, the practical application, or the improvement of the technology in the market, or to enable other ordinary skill in the art in the technical field to understand the embodiments disclosed herein.
Claims
1. A method for characterizing a blockchain system at the microarchitecture level, comprising the following steps: Collect microarchitecture events when the blockchain system runs a benchmark program, where the microarchitecture events are used to reflect the performance of the blockchain system interacting with the microprocessor architecture when running the benchmark program; Build a correlation model between the microarchitecture events and the performance of the blockchain system based on the collected microarchitecture events; Use a machine learning algorithm to determine the degree of correlation of the input microarchitecture events of the correlation model with the performance of the blockchain system, and obtain the importance ranking result of the microarchitecture events; wherein the performance of the blockchain system is the number of instructions per cycle collected when running the benchmark program; wherein the collection of microarchitecture events when the blockchain system runs the benchmark program includes: Collect multiple microarchitecture events each time the blockchain system benchmark program runs, including the number of instructions instruction and the number of cycles cycle, and represent the result of each collection as: v i = {IPC i , e 1 , e 2 , …, e k} Among them, IPC i is the number of instructions per cycle for the i-th round of testing, and the e k value represents the k-th microarchitecture event; wherein obtaining the importance ranking of the microarchitecture events includes: Represent the correlation model between the microarchitecture events and the performance of the blockchain system as: IPC = pred(e 1 , e 2 , … e n ) where, e n is the value of the nth microarchitecture event, n is the total number of input microarchitecture events, and the output IPC represents the number of instructions per cycle; Use a machine learning algorithm to quantify the importance of each input microarchitecture event in the correlation model for the output IPC; wherein obtaining the importance ranking of the microarchitecture events includes: Represent the correlation model between the microarchitecture events and the performance of the blockchain system as: IPC = pred(e 1 , e 2 , …e n ) where e n is the value of the n-th microarchitecture event, n is the total number of input microarchitecture events, and the output IPC represents the number of instructions per cycle; Use a machine learning algorithm to quantify the importance of each input microarchitecture event in the correlation model for the output IPC.
2. The method according to claim 1, wherein, the machine learning algorithm is a random gradient boosting regression tree, a random forest, or a gradient boosting decision tree.
3. The method according to claim 1, wherein, select or customize the CPU suitable for the blockchain system based on the obtained importance ranking result of the microarchitecture events.
4. A device for characterizing a blockchain system at the microarchitecture level, wherein, comprises: An event collection unit: which is used to collect microarchitecture events when the blockchain system runs a benchmark program, and the microarchitecture events reflect the performance of interacting with the microprocessor architecture; A model construction unit: which is used to build a correlation model between the microarchitecture events and the performance of the blockchain system based on the collected microarchitecture events; A ranking unit: which is used to use a machine learning algorithm to determine the degree of correlation of the input microarchitecture events of the correlation model with the performance of the blockchain system, and obtain the importance ranking result of the microarchitecture events; wherein the performance of the blockchain system is the number of instructions per cycle collected when running the benchmark program; wherein the collection of microarchitecture events when the blockchain system runs the benchmark program includes: Collect multiple microarchitecture events each time the blockchain system benchmark program runs, including the number of instructions instruction and the number of cycles cycle, and represent the result of each collection as: v i ={IPC i ,e 1 ,e 2 ,…,e k} Among them, IPC i is the number of instructions per cycle for the i-th round of testing, and e k value represents the k-th microarchitecture event; wherein obtaining the importance ranking of the microarchitecture events includes: Represent the association model between the microarchitecture events and the blockchain system performance as: IPC = pred(e 1 , e 2 , …e n ) where e n is the value of the nth microarchitecture event, n is the total number of input microarchitecture events, and the output IPC represents the number of instructions per cycle; Use a machine learning algorithm to quantify the importance of each input microarchitecture event in the association model for the output IPC.
5. The apparatus according to claim 4, wherein, the blockchain system performance is the number of instructions per cycle collected when running a benchmark program.
6. A computer-readable storage medium having a computer program stored thereon, wherein, when the program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Performance testing method and device based on block chain, electronic device and storage medium
CN109753434A
Performance testing method of block chain system, corresponding device and electronic equipment
CN109815098A