sofastack/sofa-jraft

RFC: multi-generation log cache

开放

#854 创建于 2022年6月23日

 (9 条评论) (1 个反应) (0 位负责人)Java (1,125 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (3,406 个星标)
PR 合并指标
 (平均合并 20小时 13分钟) (30 天内合并 3 个 PR)

描述

RFC: multi-generation log cache

As discussion in #840 , jraft keeps a cache for latest log entries, it's unlimited and may consume too much memory under write-heavy workload or catching up replication when node restarts.

I think we can abstracts a cache interface and provide a multi-generation cache to replace current one:

  • Gen-1: totaly in memory with limited capacity.
  • Gen-2: Off-heap cache.When Gen-1 overflows, move the LRU(least recently used) item into off-heap cache such as OHC.

Main goals:

  • Abstracts log cache interface.
  • Provide a multi-generation cache implementation.

贡献者指南