Loading repository data…
Loading repository data…
transybao1393 / repository
DiskDB is a high-performance, disk-based key-value database built with Rust, leveraging RocksDB as its storage engine. It is designed as a Redis-like alternative but optimized for persistent storage, enabling efficient read and write operations directly on disk.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
🚀 Lightning-fast, Redis-compatible persistent database built in Rust with RocksDB. Experience the power of in-memory performance with the reliability of disk persistence.
┌─────────────────────────────────────────────────────────────────────┐
│ DiskDB Performance Evolution │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ Original ████████ 796K ops/s │
│ │
│ v0.2 ████████████████████████████████████████ 4.2M ops/s │
│ 5.3x Faster │
│ │
├─────────────────────────────────────────────────────────────────────┤
│ Feature Highlights │
├─────────────────────────────────────────────────────────────────────┤
│ • 5.3x faster protocol parsing • 70% less memory usage │
│ • 2.2x faster memory allocation • Request pipelining │
│ • Zero-copy I/O on Linux • Connection pooling │
└─────────────────────────────────────────────────────────────────────┘
DiskDB is a modern, high-performance database that brings you the best of both worlds:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Python Client │ │ Go Client │ │ Other Clients │
└────────┬────────┘ └────────┬────────┘ └────────┬────────┘
│ │ │
└───────────────────────┴───────────────────────┘
│
TCP/TLS Protocol
│
┌────────┴────────┐
│ DiskDB Server │
│ (Port 6380) │
└────────┬────────┘
│
┌───────────────┴───────────────┐
│ Optimized Engine │
│ ┌─────────────────────────┐ │
│ │ Network I/O Layer │ │
│ │ • Buffer Pool │ │
│ │ • Connection Pool │ │
│ │ • Request Pipeline │ │
│ └───────────┬─────────────┘ │
│ ┌───────────┴─────────────┐ │
│ │ Command Processor │ │
│ │ • Fast Parser (5.3x) │ │
│ │ • Batch Executor │ │
│ └───────────┬─────────────┘ │
│ ┌───────────┴─────────────┐ │
│ │ Storage Engine │ │
│ │ • RocksDB Backend │ │
│ │ • Write Batching │ │
│ │ • Read Cache │ │
│ └─────────────────────────┘ │
└───────────────────────────────┘
SET, GET, INCR, APPENDLPUSH, RPUSH, LPOP, RPOPSADD, SREM, SISMEMBER, SMEMBERSHSET, HGET, HDEL, HGETALLZADD, ZRANGE, ZSCOREJSON.SET, JSON.GET with path queriesXADD, XRANGE, XLENDiskDB is Redis-inspired and implements a subset of Redis commands with the same syntax. While it uses a Redis-like protocol, it currently requires its own client libraries:
DiskDB provides its own client libraries that use Redis-like syntax:
# Python - Using DiskDB client (NOT redis-py)
from diskdb import DiskDB
db = DiskDB(host='localhost', port=6380)
db.set('key', 'value') # Redis-like syntax
# Go - Using DiskDB Go adapter
import "github.com/transybao1393/diskdb/client"
db, _ := client.Connect("localhost:6380")
db.Set("key", "value")
# Direct TCP connection also works
# You can send commands via telnet or netcat
DiskDB currently implements these Redis-like commands:
✅ Implemented:
➕ DiskDB Unique Features:
🚧 Planned Features:
❌ Not Planned:
DiskDB uses a text-based protocol similar to Redis:
# Using telnet or netcat
$ telnet localhost 6380
SET mykey "Hello DiskDB"
OK
GET mykey
Hello DiskDB
# Simple text protocol format
# Send: COMMAND arg1 arg2 ...
# Receive: Response
# Note: DiskDB's protocol is Redis-inspired but not fully RESP-compatible
# Some Redis tools may work, but full compatibility is not guaranteed
DiskDB Client Example:
# Using DiskDB Python client
from diskdb import DiskDB
def cache_user(user_id, data):
db = DiskDB()
db.set(f"user:{user_id}", json.dumps(data))
# Note: No built-in expiration yet (EXPIRE not implemented)
def get_cached_user(user_id):
db = DiskDB()
data = db.get(f"user:{user_id}")
return json.loads(data) if data else None
Important Note: DiskDB requires its own client libraries and is not compatible with Redis ORMs or frameworks like:
pip install diskdbMigrating from Redis to DiskDB requires code changes since DiskDB uses its own client:
# Before - Using Redis
import redis
r = redis.Redis(port=6379)
r.set("key", "value")
# After - Using DiskDB
from diskdb import DiskDB
db = DiskDB(port=6380)
db.set("key", "value")
Migration Strategy:
# Gradual migration with separate clients
import redis
from diskdb import DiskDB
class MigrationCache:
def __init__(self):
self.redis = redis.Redis(port=6379)
self.diskdb = DiskDB(port=6380)
def set(self, key, value):
# Write to both during migration
self.redis.set(key, value)
self.diskdb.set(key, value)
def get(self, key):
# Try DiskDB first, fallback to Redis
value = self.diskdb.get(key)
if value is None:
value = self.redis.get(key)