Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (8 sloc) 1.12 KB

消息中间件中的数据存储

持久化策略

WAL

包括数据库内很多的具有持久化能力的中间件都会采用 WAL,Writing Ahead Log 策略来保证数据的安全性与一致性。从客户端获取到的数据往往是会被首先写入到类似于 Commit Log 这样的文件中,该文件是实时顺序追加写入的。当系统发生了某些异常的崩溃后,即可以从这样的 Commit Log 中进行数据恢复。在写入 Commit Log 之后,数据或者对于数据的描述信息才会被写入到实际的表或分区文件中。数据文件往往采用异步刷盘的策略,而刷盘的时候也是依据时间或者数据的策略:

  • Flush driven by timer: There is a backend timer which flushes data in cache periodically to disks. The period is configurable via parameter commitTime in system configuration file taos.cfg.

  • Flush driven by data: Data in the cache is also flushed to disks when the left buffer size is below a threshold. Flush driven by data can reset the timer of flush driven by the timer.

Flush

You can’t perform that action at this time.