diff --git a/db/rocksdb.go b/db/rocksdb.go index c181ab20..2618d4b3 100644 --- a/db/rocksdb.go +++ b/db/rocksdb.go @@ -58,7 +58,7 @@ const ( ) const addrContractsCacheMinSize = 300_000 // limit for caching address contracts in memory to speed up indexing -const addrContractsCacheAlwaysSize = 1_000_000 +const addrContractsCacheAlwaysSize = 600_000 const addrContractsCacheHotMinScore = 2.0 const addrContractsHotHalfLife = 45 * time.Minute const addrContractsHotEvictAfter = 8 * time.Hour diff --git a/db/rocksdb_ethereumtype.go b/db/rocksdb_ethereumtype.go index e9346840..4c619f19 100644 --- a/db/rocksdb_ethereumtype.go +++ b/db/rocksdb_ethereumtype.go @@ -2147,9 +2147,6 @@ func (d *RocksDB) logAddrContractsCacheMetrics(period time.Duration) { flushes := atomic.SwapUint64(&d.addrContractsCacheState.cacheFlushes, 0) total := hits + misses - if total == 0 && writes == 0 && cacheWrites == 0 && skipped == 0 && flushes == 0 { - return - } hitRate := 0.0 if total > 0 { hitRate = float64(hits) * 100 / float64(total) diff --git a/docs/env.md b/docs/env.md index bc99d981..4001576f 100644 --- a/docs/env.md +++ b/docs/env.md @@ -14,7 +14,7 @@ Some behavior of Blockbook can be modified by environment variables. The variabl Default: `300000` Description: Minimum packed size (bytes) to consider addressContracts hotness/caching. Accepts bytes or `K/M/G/T` suffixes (e.g. `300000`, `300K`, `1MiB`). - `_ADDR_CONTRACTS_CACHE_ALWAYS_SIZE` - Default: `1000000` + Default: `600000` Description: Always cache addressContracts above this packed size (bytes). Accepts bytes or `K/M/G/T` suffixes. - `_ADDR_CONTRACTS_CACHE_HOT_MIN_SCORE` Default: `2`