LeisureLink / write-ahead-log

An implementation of write-ahead logging (WAL) for nodejs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Block read, write-through

opened this issue · comments

The MVP ~v0.9.1 version performs IO via the ranfile module, which was carved out of this module during the initial spike...

ranfile performs fairly direct random-access IO on the underlying file, which while accurate is probably inefficient in the face of the dominant read scenario for WAL. A dramatic improvement should be able to be achieved by performing the actual IO in half-buffered manner where the underlying file is read into memory in blocks since a majority of the reading occurs in sequence between the commit head and the write head.

The implementation would probably also benefit from block allocating ahead of the writes since there is heavy write pressure beyond the commit head.

Also, even though it may go without saying, the mechanism that fulfills this enhancement should be configurable so that the user/caller can ensure the block-size matches the underlying device, e.g. 4k, 8k, 16k etc., also for efficiency.