sbtourist / Journal.IO

Journal.IO is a zero-dependency, fast and easy-to-use journal storage implementation.
Apache License 2.0
260 stars 39 forks source link

Improve read performance #28

Closed sbtourist closed 11 years ago

sbtourist commented 11 years ago

Read performances can be improved by: 1) Avoiding disk seeks during sequential (i.e. redo) access. 2) Minimise disk seeks during random access.

sbtourist commented 11 years ago

Sequential read performance has been greatly increased by avoiding any disk seeks during redoing: read Locations are augmented with extra informations about their physical position in the data file, so that subsequent reads will just keep reading from the latest position if it matches the information stored in the (previously read) Location (that is, if the client didn't read/write something else in the meantime).

Random read performance has been increased, most notably, by introducing the concept of "hints": more specifically, every time a batch is stored on disk, its physical file position is stored in memory; next time a random read happens, the nearest saved batch position is used as an hint to start looking (seeking) for the requested location, reducing so the number of disk seeks.