Skip to content

A Ruby implemented Log-Structured Merge Tree(LSM Tree) for study purpose.

Notifications You must be signed in to change notification settings

yfractal/lsm-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tired LSM Tree

A simple tired compacting Log-Structured Merge Tree(LSM Tree) Ruby implementation which is inspired by cs265-lsm-tree.

Data Structures

Screen Shot 2022-03-28 at 6 02 48 PM

Screen Shot 2022-03-28 at 6 09 07 PM

Operations

LSM::LSMTree#put is for writing key value pair into DB.

LSM::LSMTree#get is for query key into DB.

Demo

Entry will be inserted into memtable first if the memtable is not full.

Screen Shot 2022-03-28 at 6 41 03 PM

When the memtable is full, if we want to insert one more entry, DB will write the memtable to disk.

Screen Shot 2022-03-28 at 6 41 27 PM

If level 0 is full, when we want to add one more sstable in level 0, DB will merge all level0's sstables into a big sstable, then the big sstable will be written into level 1.

Screen Shot 2022-03-28 at 6 41 55 PM

This demo can be generated by the ./bin/demo script.

Status

Current Status

Basic implementation.

Future Plan

  • Crash Recovery
  • Benchmark and Optimization
    • use skip list/AVL tree for Memtable
    • mmap
    • paralle
    • read disk ahead
    • ...
  • Leveled Compaction Strategy

About

A Ruby implemented Log-Structured Merge Tree(LSM Tree) for study purpose.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published