From a921f768e1ba41b3cf5b62966ce318c8085c835d Mon Sep 17 00:00:00 2001 From: yihuang Date: Fri, 26 Jul 2024 15:14:47 +0800 Subject: [PATCH] Problem: memory leak in archive node (backport #1526) (#1527) - Suspect large `application.db` - try cache index/filters Update CHANGELOG.md Signed-off-by: yihuang --- .github/workflows/test.yml | 3 +++ CHANGELOG.md | 1 + cmd/cronosd/opendb/opendb_rocksdb.go | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5fc931c6d..cbf1248110 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,6 +23,9 @@ jobs: env: TESTS_TO_RUN: ${{ matrix.tests }} steps: + - name: Create more disk space + run: sudo rm -rf /usr/share/dotnet && sudo rm -rf /opt/ghc && sudo rm -rf "/usr/local/share/boost" && sudo rm -rf "$AGENT_TOOLSDIRECTORY" + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ca3b89e5b..542589d8aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * (store) [#1510](https://github.com/crypto-org-chain/cronos/pull/1510) Upgrade rocksdb to `v9.1.1`. * (store) [#1511](https://github.com/crypto-org-chain/cronos/pull/1511) Upgrade rocksdb to `v9.2.1`. * (e2ee) [#1513](https://github.com/crypto-org-chain/cronos/pull/1513) Add pubkey subcommand to e2ee cli. +* (store) [#1526](https://github.com/crypto-org-chain/cronos/pull/1526) Cache index/filters in rocksdb application.db to reduce ram usage. *Jul 7, 2024* diff --git a/cmd/cronosd/opendb/opendb_rocksdb.go b/cmd/cronosd/opendb/opendb_rocksdb.go index bcb0401c22..0e4e079422 100644 --- a/cmd/cronosd/opendb/opendb_rocksdb.go +++ b/cmd/cronosd/opendb/opendb_rocksdb.go @@ -110,6 +110,10 @@ func NewRocksdbOptions(opts *grocksdb.Options, sstFileWriter bool) *grocksdb.Opt bbto.SetPartitionFilters(true) bbto.SetOptimizeFiltersForMemory(true) + // reduce memory usage + bbto.SetCacheIndexAndFilterBlocks(true) + bbto.SetPinTopLevelIndexAndFilter(true) + // hash index is better for iavl tree which mostly do point lookup. bbto.SetDataBlockIndexType(grocksdb.KDataBlockIndexTypeBinarySearchAndHash)