persistent cache 设计

persistent cache

RocksDB 利用分层概念,设计了persistent cache:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//
// PersistentTieredCache architecture:
// +--------------------------+ PersistentCacheTier that handles multiple tiers
// | +----------------+ |
// | | RAM | PersistentCacheTier that handles RAM (VolatileCacheImpl)
// | +----------------+ |
// | | next |
// | v |
// | +----------------+ |
// | | NVM | PersistentCacheTier implementation that handles NVM
// | +----------------+ (BlockCacheImpl)
// | | next |
// | V |
// | +----------------+ |
// | | LE-SSD | PersistentCacheTier implementation that handles LE-SSD
// | +----------------+ (BlockCacheImpl)
// | | |
// | V |
// | null |
// +--------------------------+
// |
// V
// null
  • 在最上层,数据全都是在内存中,这一部分属于易失性数据由 VolatileCacheImpl 实现
  • 其他层,在内存和文件中的数据进行交互,由 BlockCacheImpl 实现。