sofastack/sofa-jraft

RFC: multi-generation log cache

Ouverte

#854 ouverte le 23 juin 2022

 (9 commentaires) (1 réaction) (0 personne assignée)Java (1 125 forks)batch import
enhancementhelp wanted

Métriques du dépôt

Stars
 (3 406 étoiles)
Métriques de merge PR
 (Merge moyen 20h 13m) (3 PRs mergées en 30 j)

Description

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.

Guide contributeur