Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(db): improve performance for db query #4740

Merged
merged 1 commit into from
Nov 30, 2022

Conversation

halibobo1205
Copy link
Contributor

@halibobo1205 halibobo1205 commented Oct 27, 2022

What does this PR do?

1. add cache for db

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@halibobo1205 halibobo1205 force-pushed the feat/second_cache branch 4 times, most recently from e26b1af to 400ccd0 Compare October 30, 2022 07:57
@halibobo1205 halibobo1205 changed the title feat(db):add second-cache for revoking db feat(*): improve performance Oct 30, 2022
@halibobo1205 halibobo1205 force-pushed the feat/second_cache branch 4 times, most recently from fd1d0f1 to 5fb7973 Compare November 1, 2022 09:49
@halibobo1205 halibobo1205 changed the title feat(*): improve performance feat(db): improve performance for db query Nov 1, 2022
@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2022

Codecov Report

Merging #4740 (5a96e5d) into develop (2d88f6e) will decrease coverage by 0.31%.
The diff coverage is 79.24%.

@@              Coverage Diff              @@
##             develop    #4740      +/-   ##
=============================================
- Coverage      54.45%   54.13%   -0.32%     
+ Complexity      7978     7960      -18     
=============================================
  Files            831      834       +3     
  Lines          47117    47234     +117     
  Branches        5104     5111       +7     
=============================================
- Hits           25659    25572      -87     
- Misses         19420    19623     +203     
- Partials        2038     2039       +1     
Impacted Files Coverage Δ
.../java/org/tron/core/db2/core/AbstractSnapshot.java 88.88% <ø> (-1.12%) ⬇️
...src/main/java/org/tron/core/db2/core/Snapshot.java 0.00% <ø> (ø)
...main/java/org/tron/core/db2/core/SnapshotImpl.java 90.00% <ø> (-1.03%) ⬇️
...src/main/java/org/tron/common/cache/TronCache.java 50.00% <50.00%> (ø)
.../main/java/org/tron/common/cache/CacheManager.java 76.47% <76.47%> (ø)
...in/java/org/tron/core/service/MortgageService.java 60.13% <77.77%> (-2.30%) ⬇️
.../org/tron/common/prometheus/GuavaCacheExports.java 79.31% <79.31%> (ø)
...c/main/java/org/tron/core/config/args/Storage.java 75.47% <80.00%> (+0.84%) ⬆️
...rc/main/java/org/tron/core/store/WitnessStore.java 88.46% <83.33%> (-11.54%) ⬇️
...main/java/org/tron/core/db2/core/SnapshotRoot.java 73.83% <96.66%> (+6.75%) ⬆️
... and 30 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@halibobo1205
Copy link
Contributor Author

halibobo1205 commented Nov 15, 2022

Hardware

CPU with 16 cores,32GB RAM

Guava Cache Config

DB maximumSize expireAfterAccess
storage-row 20,000 30s
account 20,000 30s
delegation 10,000 30s
asset-issue-v2 500 30s
contract 500 30s
code 500 30s
properties 500 30s
abi 100 30s
votes 100 30s
DelegatedResource 100 30s
DelegatedResourceAccountIndex 100 30s
recent-block 100 30s
witness_schedule 100 30s
witness 100 30s

Stress Data

TransferContract TransferAssetContract TriggerSmartContract
5,220,514 2,205,603 792,343

TPS

data base cache compare
mixed 518 724 +39.768%
TransferContract 799 1314 +64.456%
TransferAssetContract 757 1242 +64.069%
TriggerSmartContract 298 407 +36.577%

@halibobo1205 halibobo1205 marked this pull request as ready for review November 29, 2022 04:33
@halibobo1205 halibobo1205 merged commit e54c324 into tronprotocol:develop Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants