Skip to content

Build a benchmark of data growth impact on TVM opcodes  #6292

Open

Description

@kongchi-ken

Background

High performance has always been one of the core competencies of the TRON network. TVM, as the core smart contract execution environment for TRON, directly impacts transaction throughput, resource efficiency, and developer experience.

As the data scale in TRON continues to grow, currently reaching 2.7TB, it is crucial to understand how the increase in data volume affects the performance of TVM opcodes. Recent discussions have highlighted an execution time limit of 80ms for TVM. A systematic benchmark of TVM opcodes is necessary to determine whether this limit remains justified.

Furthermore, the Gas pricing design for TVM opcodes partially references the Gas pricing of EVM opcodes. However, the EVM has made adjustments to opcode gas pricing in several EIPs that have not yet been implemented in TVM. Conducting a benchmark of TVM opcodes may assist in correcting the gas prices for certain opcodes.

Related issues: #6266, #6288

Rationale

A benchmark of TVM opcode performance can provide the following benefits:

  • Performance Optimization: A clear understanding of the performance of TVM opcodes will help developers optimize smart contracts, thereby improving overall network efficiency.
  • Impact of Data Scale: As data scale increases, the performance of certain opcodes may be affected. A benchmark can reveal these potential issues.
  • Reasonable Gas Pricing: Evaluating the reasonableness of Gas pricing for TVM opcodes can help mitigate the risk of DDoS attacks.

Specification

Several considerations for the benchmark include:

  • Execution Count for Each Opcode: Each opcode should be executed a sufficient number of times to ensure the reliability and stability of the results.
  • Data Scale Expansion: The benchmark should account for the expansion of data scale in the TRON network, recording performance changes for each opcode under varying data scales.

Implementation:

Here are some ideas for the benchmarking:

  1. Sync Mainnet Transactions: Track event data for opcode execution time, aggregating performance data for every 10,000 blocks.
    • Pros: This method is easy to implement and can reveal the influence of data scale on opcode performance. It is based on real mainnet transactions, providing accurate insights.
    • Cons: Some opcodes may not be executed frequently enough in mainnet transactions. This method does not account for read-only request traffic and lacks flexibility.
  2. Build Test Cases: Create various test cases covering different logical branch conditions and data scale for each opcode, executing each test case multiple times to collect performance data.
    • Pros: This method ensures that all opcodes are executed enough times to provide accurate performance data.
    • Cons: This approach is challenging to implement, as it requires substantial effort to build comprehensive test cases for each opcode and prepare different data scales.

Considering the input-output ratio, I currently prefer the first method, as it can effectively reveal the actual performance of TVM opcodes on the mainnet. For opcodes with poor execution times, we may consider switching to the second method for further analysis.

Additionally, to simulate future data scales, we should develop the capability to expand the database without interfering with normal block synchronization and transaction executions.

If you have any questions, ideas, or suggestions, please feel free to share and discuss them.

Activity

  1. lxcmyf commented on Apr 20, 2025

    @lxcmyf
    Collaborator
    1. How to accurately simulate the impact of future data scales (such as 5TB/10TB) on opcode performance without interfering with the synchronization of the main network?
    2. Do we need to build an independent sandbox environment for benchmark testing? If so, how can we ensure the consistency between the data in the testing environment (such as status, transaction history) and the real data on the main network?
  2. leonway336 commented on Apr 21, 2025

    @leonway336

    In the database design of java-tron, different types of data are dispersed in different databases, and the whole huge full amount of data is not actually accessed during TVM execution.

    At the same time, the k-v storage structure used in the various databases of java-tron means that when trying to access the value corresponding to a certain key, the actual overhead only consists of accessing the database file to read the data, deserializing the protobuf structure, and so on.

    Am I right?

  3. kongchi-ken commented on Apr 21, 2025

    @kongchi-ken
    ContributorAuthor
    1. How to accurately simulate the impact of future data scales (such as 5TB/10TB) on opcode performance without interfering with the synchronization of the main network?
    2. Do we need to build an independent sandbox environment for benchmark testing? If so, how can we ensure the consistency between the data in the testing environment (such as status, transaction history) and the real data on the main network?
    1. Expanding DB with random keys and existing values might work. As most of the tron database keys are address or bytes32, with the key range more than 2**160, it's unlikely to create a collision when we expand the current data scale (around 300m accounts on TRON) by 5 or 10 times. These data will occupy the disk space but not interfere the synchronization. There might be a problem that the expand process is irreversible as we cann't distinguish the mock data from the origin ones.
    2. I don't think we need a long-term running benchmark environment. Periodic benchmarking in sync mode should be enough.
  4. kongchi-ken commented on Apr 21, 2025

    @kongchi-ken
    ContributorAuthor

    In the database design of java-tron, different types of data are dispersed in different databases, and the whole huge full amount of data is not actually accessed during TVM execution.

    At the same time, the k-v storage structure used in the various databases of java-tron means that when trying to access the value corresponding to a certain key, the actual overhead only consists of accessing the database file to read the data, deserializing the protobuf structure, and so on.

    Am I right?

    Thank you for your time. Yes, you are right. The java-tron storage design is some kind of flatten, so it doesn't require multiple visits to the databse to get to the data, regardless of the data scale.

    However, the data size may affect the performance of the underlying storage engine (LevelDB or RocksDB), and the time taken to access the data once may vary a lot at different data sizes. That's why I think a benchmarking at different data scale is neccesary.

  5. changed the title [-]Build a Benchmark of TVM Opcodes Performance[/-] [+]Build a benchmark of data growth impact on TVM opcodes [/+] on Apr 21, 2025
  6. added theissue type on May 29, 2025
  7. FriendlyCM commented on May 29, 2025

    @FriendlyCM

    Hi, will you test all opcodes in this banchmark? Cloud you add more tests for these two situations:

    1. performance between jdk 8 and jdk 17 on x86 platform
    2. performance between jdk 8 on x86 and jdk 17 on arm
      I think these test results will be great helpful for Expand ARM Architecture Compatibility #5954 and Upgrade to JDK 17 for ARM Architecture #5976
  8. moved this to In Progress in java-tronon May 29, 2025
  9. kongchi-ken commented on May 30, 2025

    @kongchi-ken
    ContributorAuthor

    Hi, will you test all opcodes in this banchmark? Cloud you add more tests for these two situations:

    1. performance between jdk 8 and jdk 17 on x86 platform
    2. performance between jdk 8 on x86 and jdk 17 on arm
      I think these test results will be great helpful for Expand ARM Architecture Compatibility #5954 and Upgrade to JDK 17 for ARM Architecture #5976

    Yes, we will test all opcodes, especially those related to DB data scales.

    I think it's a good idea to extend the test situation to JDK17 and ARM platform, as java-tron is working on upgrade to JDK 17. We will take them into consideration.

  10. kongchi-ken commented on Jun 13, 2025

    @kongchi-ken
    ContributorAuthor

    design: https://uke4ml20ix.feishu.cn/docx/RIk3dnarwozQbYxk7o4cH3bHnjb?from=from_copylink

    Thank you for your time.
    We will check the design in detail. If you have any other suggestions, please feel free to comment.

  11. 3 remaining items

  12. kongchi-ken commented on Jul 11, 2025

    @kongchi-ken
    ContributorAuthor

    Hi, how is the testing going on the ARM platform? Since version 4.8.1 will include support for ARM, this test is an important factor in determining whether the code is ready for release. If there’s any progress, please share an update here. Thank you very much!

    In our performance testing on X86 and ARM platforms, there isn't much performance difference between these two platforms.

    The cpu benchmark (sysbench cpu --cpu-max-prime=20000 --threads=1) shows the single core computility is around 1600 on X86 and around 1100 on ARM for our test machines. Our experiments show that the execution on X86 is slightly faster than ARM and the ratio on the two platforms is 1:1.3. Considering the cpu benchmark difference of these machines, we think the performance of java-tron on X86 and ARM platform are basically on the same level.

  13. FriendlyCM commented on Jul 15, 2025

    @FriendlyCM

    Hi, how is the testing going on the ARM platform? Since version 4.8.1 will include support for ARM, this test is an important factor in determining whether the code is ready for release. If there’s any progress, please share an update here. Thank you very much!

    In our performance testing on X86 and ARM platforms, there isn't much performance difference between these two platforms.

    The cpu benchmark (sysbench cpu --cpu-max-prime=20000 --threads=1) shows the single core computility is around 1600 on X86 and around 1100 on ARM for our test machines. Our experiments show that the execution on X86 is slightly faster than ARM and the ratio on the two platforms is 1:1.3. Considering the cpu benchmark difference of these machines, we think the performance of java-tron on X86 and ARM platform are basically on the same level.

    Very glad to see this — thank you for the work!
    If there’s any abnormal situation, please leave a comment here.

  14. undertaker86001 commented on Oct 29, 2025

    @undertaker86001

    design: https://uke4ml20ix.feishu.cn/docx/RIk3dnarwozQbYxk7o4cH3bHnjb?from=from_copylink

    Thank you for your time. We will check the design in detail. If you have any other suggestions, please feel free to comment.

    Hello, I haven't been using the Tron protocol for a long time. I would like to try some issues to understand the protocol itself. Could you recommend some issues to me?

  15. halibobo1205 commented on Oct 29, 2025

    @halibobo1205
    Collaborator
  16. ferdinand026 commented on Mar 19, 2026

    @ferdinand026

    With the successful release of 4.8.1, I was wondering if there’s been any further movement on this issue. Looking forward to your updates!

  17. kongchi-ken commented on Mar 20, 2026

    @kongchi-ken
    ContributorAuthor

    With the successful release of 4.8.1, I was wondering if there’s been any further movement on this issue. Looking forward to your updates!

    Thanks for following up! 🙌

    Yes, work on this is actively in progress. With 4.8.1 now out, we'll be basing the benchmark implementation on that release as our stable foundation. Any meaningful findings or incremental progress will be shared directly in this issue, so feel free to subscribe for updates.

    Appreciate the interest — stay tuned!

  18. halibobo1205 commented on May 15, 2026

    @halibobo1205
    Collaborator

    @kongchi-ken 4.8.2 is currently in its testing phase — just wanted to check whether there's any incremental benchmark data from the past couple of months you could share here?

  19. yanghang8612 commented on May 15, 2026

    @yanghang8612
    Collaborator

    @halibobo1205 Thanks for checking in.

    Since I am now assigned to this issue, I will keep it open as an ongoing tracker for TVM opcode performance benchmarking and stress testing, especially around data-scale growth, JDK versions, and platform architecture comparisons.

    For the 4.8.2 testing cycle, I will continue following the benchmark results and check whether there is any meaningful incremental data from recent runs that can be shared. At the moment, there is no consolidated benchmark report ready to publish yet. If we identify abnormal performance behavior or get shareable incremental results, I will update this issue here.

    cc @kongchi-ken in case there are additional recent benchmark results from the previous experiments.

  20. yanghang8612 commented on May 29, 2026

    @yanghang8612
    Collaborator

    Progress update on the TVM opcode data-growth benchmark.

    Status: the benchmark harness is being set up against the 4.8.2 (Pyrrho) codebase as the stable baseline. Scope being measured:

    • Opcode set: state-touching opcodes most sensitive to data-scale growth — SLOAD/SSTORE, BALANCE, EXTCODESIZE/EXTCODEHASH/EXTCODECOPY, and the *CALL family — plus the MODEXP precompile path given the concurrent TIP-7823/7883 work.
    • Data-scale dimension: per-opcode cost as the state trie grows (account / storage-entry count), to characterize how latency degrades with on-chain data size rather than at a fixed snapshot.
    • Environment matrix: JDK version and platform-architecture comparisons, since these materially affect the wall-clock side of the energy model.

    No consolidated report to publish yet — I don't want to post partial numbers that could be misread before the methodology is locked and runs are repeated for variance. Once the 4.8.2 testing cycle produces stable, repeatable measurements, I'll post the results and methodology here.

  21. yanghang8612 commented on Sep 3, 2026

    @yanghang8612
    Collaborator

    The earlier x86 and ARM testing addressed the platform-comparison part of this issue, but the broader objective remains measuring how increasing state size affects database-sensitive TVM opcodes. We will therefore keep this issue open as a long-term benchmark tracker.

    With java-tron 4.8.2 now available, the current benchmark work will use it as the stable baseline. Before publishing a consolidated report, the methodology still needs to be made reproducible across data scales, storage engines, JDK versions, and x86/ARM environments. The initial focus remains on state-access-heavy opcodes such as SLOAD/SSTORE, BALANCE, EXTCODE*, and the *CALL family, together with relevant precompile paths.

    There is no consolidated dataset ready to publish yet. Once the methodology is stable and the measurements are repeatable, we will share both the test setup and results here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

  • Status
    In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions