This project was done following the guide build your own database. The result is the equivalent of Part I of that guide: a simple append-only Key Value Store which uses a B+ Tree and a Free List.
Translating the ideas from Go to Java was a challenge and probably some performance was lost on the way, nevertheless this project's goal was to have fun and as a consequence learning as well.
Special thanks to abedmohammed whose project was also a good reference in moments where the previous guide was not clear enough.
- Java 17+
- Maven
- UNIX based OS
Store store = Store.getInstance("mydatabase");
byte[] key = NodeOps.stringToBytes("some key");
byte[] value = NodeOps.stringToBytes("some value");
store.set(key, value);
byte[] retrieved = store.get(key);
System.out.write(retrieved);
System.out.println();
store.delete(key);
See massReadPerformanceTest in KvStoreTest.java
Read 10000 key-value pairs in 432 ms
Average time per read: 0.0432 ms
See massInsertionPerformanceTest
Inserted 10000 key-value pairs in 9529 ms
Average time per insertion: 0.9529 ms
mvn clean verify
- Optimize write speed
- Concurrency control