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

Evaluate the performance gain of using trie node memory cache #30099

Open
rjl493456442 opened this issue Jul 1, 2024 · 0 comments
Open

Evaluate the performance gain of using trie node memory cache #30099

rjl493456442 opened this issue Jul 1, 2024 · 0 comments

Comments

@rjl493456442
Copy link
Member

The fastcache in pathdb is used to cache clean trie nodes in memory, aiming to reduce database reads and improve performance. Given that the operating system will also use all available memory for the OS page cache, it’s interesting to compare the performance differences between these two caching mechanisms.


There is no big difference between these two caching mechanisms.

I have deployed the benchmarks for 163 hours, the master branch (fastcache) is 3hours ahead. In another word, it's 1.8% faster than the experimental branch (os native cache)

截屏2024-07-01 11 49 16

There are approximately 30 billion node retrievals in total, with 2.5 billion of these retrievals being hits in the clean cache. This means that 8.3% of node retrievals are handled by fastcache.

The average speed difference between os native cache and fastcache is 4.32 microsecond, which is neglibible.

截屏2024-07-01 11 52 01 截屏2024-07-01 11 53 05

The performance difference can also be reflected in account update and triedb commit. The experimental branch spends 0.7ms more on account update and 0.6ms less on triedb commit. The former comes from the clean cache hitting and the latter one comes from the overhead of clean cache insertion and eviction.

截屏2024-07-01 11 59 04

I think we can conclude that the performance gain of using fastcache is very limited (considering the overhead of cache maintaining). It might be reasonable to remove the clean cache in total.

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

No branches or pull requests

1 participant