reduce initial block cache threshold to a reasonable value

This commit is contained in:
Jared Wasinger 2025-04-25 14:29:46 +08:00
parent e5350c9b81
commit 31f3ddf684
2 changed files with 4 additions and 5 deletions

View file

@ -43,7 +43,7 @@ const (
var ( var (
blockCacheMaxItems = 32768 // Maximum number of blocks to cache before throttling the download blockCacheMaxItems = 32768 // Maximum number of blocks to cache before throttling the download
blockCacheInitialItems = 2048 // Initial number of blocks to start fetching, before we know the sizes of the blocks blockCacheInitialItems = blockCacheMemory / (10 * 1024 * 1024) // Initial number of blocks to start fetching, before we know the sizes of the blocks
blockCacheSizeWeight = 0.1 // Multiplier to approximate the average block size based on past ones blockCacheSizeWeight = 0.1 // Multiplier to approximate the average block size based on past ones
blockCacheMemory uint64 = 2 * 1024 * 1024 * 1024 // Maximum amount of memory to use for block caching blockCacheMemory uint64 = 2 * 1024 * 1024 * 1024 // Maximum amount of memory to use for block caching
) )

View file

@ -73,7 +73,6 @@ func (r *resultStore) SetThrottleTarget(targetRatio common.StorageSize) uint64 {
return r.throttleThreshold return r.throttleThreshold
} }
targetRatio = max(targetRatio, 0.1) targetRatio = max(targetRatio, 0.1)
// use the target ratio to determine // use the target ratio to determine
// (pendingGasUsed / target) <- estimated total size of collective in-flight retrievals // (pendingGasUsed / target) <- estimated total size of collective in-flight retrievals
estBlockSize := common.StorageSize(r.pendingGasUsed/uint64(r.pendingCount)) / targetRatio estBlockSize := common.StorageSize(r.pendingGasUsed/uint64(r.pendingCount)) / targetRatio