Welcome to SmartStashDB, a blazing-fast, Go-powered key-value store built from scratch using LSM-Tree, Skip-List, and Write-Ahead Logging (WAL). Designed for high throughput and low latency, SmartStashDB is perfect for applications demanding scalable, reliable, and efficient data storage.
SmartStashDB combines cutting-edge data structures and techniques to deliver top-tier performance:
[Client] --> [API: Get/Put/Delete] --> [MemTable (Skip-List)]
|
v
[WAL (Disk)]
|
v
[SSTables (LSM-Tree)]
bash
git clone https://github.com/johnsoy/SmartStashDB.git
cd SmartStashDBbash
go mod tidybash
go build
./SmartStashDBpackage main
import (
"fmt"
"github.com/johnsoy/SmartStashDB"
)
func main() {
// Initialize SmartStashDB
kv, err := SmartStashDB.NewSmartStashDB("./data")
if err != nil {
panic(err)
}
defer kv.Close()
// Put key-value pair
kv.Put([]byte("key1"), []byte("value1"))
// Get value
value, err := kv.Get([]byte("key1"))
if err != nil {
panic(err)
}
fmt.Printf("Key: key1, Value: %s\n", value)
// Delete key
kv.Delete([]byte("key1"))
}
SmartStashDB is designed for speed and scalability. Preliminary benchmarks (on a standard laptop with SSD): - Write Throughput: ~500,000 ops/sec - Read Throughput: ~600,000 ops/sec - Latency: < 1ms for 99th percentile reads/writes
Run benchmarks yourself:
go test -bench=.
Customize SmartStashDB via the config.yaml file:
data_dir: "./data" # Storage directory
memtable_size: 1048576 # Max MemTable size (bytes)
compaction_interval: 60 # Compaction interval (seconds)
wal_flush_interval: 10 # WAL flush interval (seconds)
Load config programmatically:
kv, err := SmartStashDB.NewSmartStashDBWithConfig("config.yaml")
Contributions are welcome! Whether it's bug fixes, new features, or documentation improvements, here's how to get started:
1. Fork the repository.
2. Create a feature branch: git checkout -b feature/awesome-feature.
3. Commit your changes: git commit -m "Add awesome feature".
4. Push to the branch: git push origin feature/awesome-feature.
5. Open a Pull Request.
Please read our CONTRIBUTING.md for more details.
SmartStashDB is licensed under the MIT License. Feel free to use, modify, and distribute it as you see fit!
Star ⭐ this repo if you find SmartStashDB awesome, and let's build the fastest KV store together! 🚀
$ claude mcp add SmartStashDB \
-- python -m otcore.mcp_server <graph>