Skip to content

Proposal: Enable account asset optimization #473

@xxo1shine

Description

@xxo1shine

Simple Summary

Remove assets from account data structure and store them separately to improve system performance. For more details, please refer to: TIP-382.

Motivation

In the process of executing the transaction, most of the time is spent in the deserialization operation of the account. It is caused by the account asset list being too large. Some accounts have thousands of assets. During the deserialization process, it takes a lot of time.

In order to improve the performance of the blockchain, increase the TPS, it is necessary to reduce the transaction execution time, so it is necessary to optimize the data structure of account assets.

Timeline

Any opinions or discussions about this proposal are welcomed in the next two weeks.

The estimated timeline

  • Creation time of the voting request: 15th November 2022
  • The effective time of voting request: 14:00, 18th November 2022

Hi @TronSpark @fbsobreira, would you please help to raise a proposal to activate it. Thanks a lot.

How to Initialize the Voting Request

  • Open asset optimization proposal.
    • createProposal 66 1

Background

According to the latest online statistics, there are currently 79,185,490 accounts and 6,595 assets. The statistics of the number of account assets are as follows.

range of assets number of accounts
> 1000 2
500 ~ 1000 51
200 ~ 500 1910
100 ~ 200 13219
50 ~ 100 161214

Through the performance analysis of the flame graph, it can be seen that the deserialization of the account takes a lot of time. Randomly select a batch of accounts, and perform 10,000 deserialization of complete data and clear asset data respectively. The analysis results are as follows:

complete data clear asset data
total cost 340,123ms 29,575ms
average cost 69ms 6ms

It can be seen that the performance of the deserialization operation of the account data is improved by more than ten times after the assets are cleared.

Performance Test

Tested under 3 different pressure models and got the results of the performance test

Pressure Model 1

  1. 100% of the traffic is trc20 transfer transaction.
  2. From address has 50 tokens, to address is a random account on the main network.

Test Results:

Before opening proposal 66, packaged qps is 340/s
After opening proposal 66, packaged qps is 417/s
Performance improvement: 22.6%

Pressure Model 2

  1. 100% of the traffic is trc20 transfer transaction.
  2. From address has 200 tokens, to address is a random account on the main network.

Test Results:

Before opening proposal 66,, packaged qps is 226/s
After opening proposal 66, packaged qps is 398/s
Performance improvement: 76%

Pressure Model 3

  1. The traffic is mainnet transactions.

Test Results:

Before opening proposal 66,, packaged qps is 370/s
After opening proposal 66, packaged qps is 484/s
Performance improvement: 30.8%

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions