-
Notifications
You must be signed in to change notification settings - Fork 43
perf(state): add state cache for trieDB #404
Conversation
Add the benchmark of the executor? You need to make sure that it create a new MPT each time. |
Can you show a result of perf to this PR descriptions? |
use rocksdb::{Options, WriteBatch, DB}; | ||
|
||
use common_apm::metrics::storage::{on_storage_get_state, on_storage_put_state}; | ||
use protocol::{ProtocolError, ProtocolErrorKind, ProtocolResult}; | ||
|
||
const RAND_SEED: u64 = 49999; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it have any relationship with cache length?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing.
/lgtm |
/hold |
/hold cancel |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: yejiayu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
Implement an approximately fixed size cache through HashMap. It caches the data used in the latest block, and it will be flushed when committing a block. The size of the cache is 2000, however, this does not mean that it can only store 2000 data. When the data in the cache is more than 2000 when the cache is refreshed, it will be randomly deleted to 2000. The random seed is the largest prime number within 50000, 49999.
Which issue(s) this PR fixes:
Fixes #
Which docs this PR relation:
Ref nervosnetwork/muta-docs#55
Which toolchain this PR adaption:
No Breaking Change
Special notes for your reviewer: