⚡ NubDT

High-Performance AOF Database in Zig

A blazing-fast, AOF-based in-memory database optimized for maximum throughput and minimal latency.

Get StartedView on GitHub
100K+
ops/second
<5µs
SET latency
<1µs
GET latency
12.8MB
Docker image

Features

🚀

Lightning Fast

100K+ ops/second with sub-microsecond latency. Robin Hood hashing for O(1) lookups.

💾

AOF Persistence

Append-Only File for crash recovery and durability with background compaction.

🐳

Docker Ready

Production-ready Docker images with web network integration and service discovery.

🔒

Thread Safe

RwLock for concurrent reads, lock-free operations, atomic counters.

⏱️

TTL Support

Automatic key expiration with lazy cleanup and periodic garbage collection.

🔐

TLS/SSL

Encrypted connections via stunnel proxy for production security.

🌐

TCP Server

Multi-threaded TCP server mode with persistent connections.

🔧

Atomic Ops

INCR/DECR operations with integer values for counters.

Quick Start

# Create web network
docker network create web

# Run NubDT
docker run -d \
  --name nubdb-server \
  --network web \
  -p 6379:6379 \
  -v nubdb-data:/data \
  nubdb:latest

# Test connection
echo "SET hello world" | nc localhost 6379

API Reference

SET

SET key value [ttl]

Store a key-value pair with optional TTL (seconds)

SET mykey "Hello, World!"
SET counter 100 60  # Expires in 60s
Response: OK

GET

GET key

Retrieve value by key

GET mykey
Response: "Hello, World!" or (nil)

DELETE

DELETE key

Remove a key from the database

DELETE mykey
Response: OK or (not found)

EXISTS

EXISTS key

Check if key exists

EXISTS mykey
Response: 1 (exists) or 0 (not found)

INCR

INCR key

Increment integer value by 1

INCR counter
Response: New value (integer)

DECR

DECR key

Decrement integer value by 1

DECR counter
Response: New value (integer)

SIZE

SIZE

Get number of keys in the database

SIZE
Response: N keys

CLEAR

CLEAR

Delete all keys from the database

CLEAR
Response: OK

Code Examples

from nubdb import NubDB

# Plain TCP connection
client = NubDB("localhost", 6379)

# Or with TLS encryption
client = NubDB("nubdbs://your-server:6380")

# Basic operations
client.set("greeting", "Hello from Python!")
result = client.get("greeting")
print(result)  # "Hello from Python!"

# With TTL (expires in 60 seconds)
client.set("temp_key", "temporary", ttl=60)

# Atomic counters
client.set("views", "0")
client.incr("views")  # 1
client.incr("views")  # 2

# Check database size
print(client.size())  # "2 keys"

Performance Benchmarks

Sequential SET

200K+
ops/second
Average latency: <5µs

Sequential GET

1M+
ops/second
Average latency: <1µs

Mixed Workload

300K+
ops/second
50% GET, 40% SET, 10% DELETE

AOF Replay

500K+
ops/second
Fast crash recovery

Latency Percentiles

p50<3µs
p95<10µs
p99<20µs

Resources

📚

GitHub Repository

Source code, issues, and contributions

🐳

Docker Guide

Complete Docker deployment documentation

🐍

Python Client (PyPI)

pip install nubdb — Official client

🖥️

Web Console

Manage instances from the dashboard