https://github.com/hivellm/synap
Synap is a modern, high-performance data infrastructure system built in Rust, combining the best features of Redis, RabbitMQ, and Kafka into a unified platform for real-time applications.
https://github.com/hivellm/synap
keyvalue-db pubsub queues rust streaming
Last synced: 4 months ago
JSON representation
Synap is a modern, high-performance data infrastructure system built in Rust, combining the best features of Redis, RabbitMQ, and Kafka into a unified platform for real-time applications.
- Host: GitHub
- URL: https://github.com/hivellm/synap
- Owner: hivellm
- License: apache-2.0
- Created: 2025-10-16T19:09:14.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-12-03T11:36:11.000Z (7 months ago)
- Last Synced: 2025-12-06T15:07:54.221Z (7 months ago)
- Topics: keyvalue-db, pubsub, queues, rust, streaming
- Language: Rust
- Homepage:
- Size: 5.89 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Roadmap: docs/ROADMAP.md
- Agents: AGENTS.md
Awesome Lists containing this project
README
# β‘ Synap
[](LICENSE)
[-orange.svg)](https://www.rust-lang.org/)
[-brightgreen.svg)](#testing--quality)
[](docs/TESTING.md)
[](#project-status)
> **High-Performance In-Memory Key-Value Store & Message Broker**
Synap is a modern, high-performance data infrastructure system built in Rust, combining the best features of Redis, RabbitMQ, and Kafka into a unified platform for real-time applications.
## π― Overview
Synap provides multiple core capabilities in a single, cohesive system:
1. **πΎ Memory Key-Value Store** - Radix-tree based in-memory storage with O(k) lookup
2. **#οΈβ£ Hash Data Structure** - Field-value maps within keys (Redis-compatible HSET, HGET, etc.) β
**v0.6.0**
3. **π List Data Structure** - Ordered sequences with LPUSH, RPOP, LRANGE (Redis-compatible) β
**v0.6.0**
4. **π· Set Data Structure** - Unordered unique collections with SADD, SREM, SINTER, SUNION (Redis-compatible) β
**v0.6.0**
5. **π Sorted Set Data Structure** - Scored members with ranking (ZADD, ZRANGE, ZRANK, ZINTER/ZUNION) β
**v0.7.0**
6. **π’ HyperLogLog** - Probabilistic cardinality estimation with ~0.81% error (~12KB memory) β
**v0.7.0-rc1**
7. **πΊοΈ Geospatial Indexes** - Redis-compatible GEO commands (GEOADD, GEORADIUS, GEOSEARCH) β
**v0.7.0-rc2**
8. **π’ Bitmap Operations** - Redis-compatible bit manipulation (SETBIT, GETBIT, BITCOUNT, BITOP) β
**v0.7.0-rc2**
9. **π String Extensions** - APPEND, GETRANGE, SETRANGE, GETSET, MSETNX β
**v0.7.0-rc1**
10. **π Lua Scripting** - Server-side scripting with EVAL/EVALSHA and redis.call() bridge β
**v0.7.0**
11. **π Transactions** - MULTI/EXEC/WATCH/DISCARD with optimistic locking β
**v0.7.0**
12. **π¨ Acknowledgment Queues** - RabbitMQ-style message queues with delivery guarantees
13. **π‘ Event Streams** - Kafka-style partitioned topics with consumer groups and retention
14. **π Pub/Sub Messaging** - Topic-based publish/subscribe with wildcard support
## β¨ Key Features
### β‘ Performance
- **π Sub-microsecond Operations**: 87ns for GET operations (20,000x better than target)
- **π High Throughput**: 10M+ ops/sec sequential writes (200x better than baseline)
- **πΎ Efficient Memory**: 92MB for 1M keys (54% reduction vs baseline)
- **π 64-Way Sharding**: Linear scalability with CPU core count
- **βοΈ Async I/O**: Built on Tokio for non-blocking operations
- **ποΈ Smart Compression**: LZ4/Zstd compression with minimal CPU overhead
- **π₯ Hot Data Cache**: Decompressed cache for frequently accessed data
### π Security & Authentication (β
PRODUCTION READY - Jan 2025)
- **π Authentication System** - Root user, user management, API keys
- **π‘οΈ Fine-grained Permissions** - Resource-based permissions (RabbitMQ-style)
- **π Audit Logging** - Track all authentication events (login, API key usage, permission denials)
- **π Password Validation** - Configurable password requirements (SHA512 hashing)
- **π IP Filtering** - Restrict API keys to specific IP addresses
- **β
Basic Auth & Bearer Token** - Support for both authentication methods
- **π MCP Authentication** - Full authentication support for MCP protocol
### πͺ Durability (β
COMPLETE - Oct 2025)
- **πΎ Full Persistence**: WAL + Snapshots for KV, Queue, and Stream
- **π OptimizedWAL**: Redis-style batching (10K ops/batch, 100Β΅s window)
- **π¨ Queue Persistence**: RabbitMQ-style durable messaging with ACK tracking
- **π‘ Stream Persistence**: Kafka-style append-only logs per room
- **βοΈ PACELC Model**: PC/EL (Consistency during partition, Latency in normal operation)
- **β±οΈ Recovery Time**: 1-10 seconds from snapshots + WAL replay
### π‘οΈ Reliability & High Availability
- **π Master-Slave Replication**: 1 write master + N read replicas (β
**PRODUCTION READY**)
- TCP binary protocol with length-prefixed framing
- Full sync via snapshot transfer (CRC32 verified)
- Partial sync via replication log (incremental updates)
- Auto-reconnect with intelligent resync
- 51 comprehensive tests (98% passing)
- Stress tested: 5000 operations
- **β
Message Acknowledgment**: Guaranteed message delivery with ACK/NACK
- **π Event Replay**: Stream history and replay capabilities
- **π Manual Failover**: Promote replica to master capability
### π Monitoring & Observability
- **π INFO Command** - Redis-style server introspection (server, memory, stats, replication, keyspace)
- **π SLOWLOG** - Slow query logging with configurable threshold (default 10ms)
- **πΎ MEMORY USAGE** - Per-key memory tracking across all data types
- **π₯ CLIENT LIST** - Active connection tracking and management
- **π Prometheus Metrics** - 17 metric types for comprehensive monitoring
### π¨βπ» Developer Experience
- **π€ AI Integration**: MCP support for Cursor, Claude Desktop, and AI assistants
- **π StreamableHTTP Protocol**: Simple HTTP-based streaming protocol
- **π WebSocket Support**: Persistent connections for real-time updates
- **π Multi-language SDKs**: TypeScript, Python, Rust (with reactive PubSub), PHP, and C# clients with full authentication support
- **π Rich Examples**: Chat, event broadcasting, task queues, authentication examples, and more
### π Protocol Support
- **π€ MCP (Model Context Protocol)**: β
**PRODUCTION READY** - Configurable tools (KV, Hash, List, Set, Queue, Sorted Set) at `/mcp` endpoint with authentication support
- **π UMICP (Universal Matrix Inter-Communication Protocol)**: β
**PRODUCTION READY** - 13 operations via MCP bridge with TLS support
- **π‘ REST API**: Standard HTTP endpoints for all operations
- **π WebSocket API**: Real-time bidirectional communication
### π Scalability
- **π Read Scaling**: Multiple replica nodes for distributed reads
- **π Event Rooms**: Isolated event streams per room/channel
- **π― Partitioned Topics**: Kafka-style horizontal scaling with multiple partitions
- **π₯ Consumer Groups**: Coordinated consumption with automatic rebalancing
- **π Topic Routing**: Efficient pub/sub with wildcard matching
- **π Connection Pooling**: Client-side connection management
## ποΈ Architecture
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Synap Server β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β StreamableHTTP/WebSocket Protocol Layer β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β Key-Valueβ β Queue β β Event β β Pub/Sub β β
β β Store β β System β β Stream β β β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Replication Log (Append-Only) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Master Node Replica Nodes (Read-Only) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
## π Quick Start
### π¦ Installation
**From GitHub Releases** (Recommended):
```bash
# Download pre-built binaries from GitHub Releases
# https://github.com/hivellm/synap/releases
# Linux (x86_64)
wget https://github.com/hivellm/synap/releases/download/v0.3.0/synap-linux-x86_64.tar.gz
tar -xzf synap-linux-x86_64.tar.gz
cd synap-linux-x86_64
./synap-server --config config.yml
# macOS (Intel)
wget https://github.com/hivellm/synap/releases/download/v0.3.0/synap-macos-x86_64.tar.gz
tar -xzf synap-macos-x86_64.tar.gz
cd synap-macos-x86_64
./synap-server --config config.yml
# macOS (Apple Silicon)
wget https://github.com/hivellm/synap/releases/download/v0.3.0/synap-macos-aarch64.tar.gz
tar -xzf synap-macos-aarch64.tar.gz
cd synap-macos-aarch64
./synap-server --config config.yml
# Windows (x86_64)
# Download synap-windows-x86_64.zip from releases page
# Extract and run synap-server.exe
```
**π³ Docker**:
**Quick Start (Docker Hub)**:
```bash
# Pull and run latest image
docker pull hivehub/synap:latest
docker run -d \
--name synap \
-p 15500:15500 \
-p 15501:15501 \
-v synap-data:/data \
hivehub/synap:latest
# Check health
curl http://localhost:15500/health
```
**Build Locally**:
```bash
# Clone and build
git clone https://github.com/hivellm/synap.git
cd synap
docker build -t hivehub/synap:latest .
# Run container
docker run -d \
--name synap-server \
-p 15500:15500 \
-p 15501:15501 \
-v synap-data:/data \
hivehub/synap:latest
```
**With Authentication**:
```bash
docker run -d \
--name synap-server \
-p 15500:15500 \
-p 15501:15501 \
-v synap-data:/data \
-e SYNAP_AUTH_ENABLED=true \
-e SYNAP_AUTH_REQUIRE_AUTH=true \
-e SYNAP_AUTH_ROOT_USERNAME=admin \
-e SYNAP_AUTH_ROOT_PASSWORD=SecurePassword123! \
-e SYNAP_AUTH_ROOT_ENABLED=true \
hivehub/synap:latest
```
**Multi-Architecture Build**:
```bash
# Build and push multi-arch images (AMD64 + ARM64)
./scripts/docker-publish.sh 0.8.1
# Or using PowerShell
.\scripts\docker-publish.ps1 0.8.1
```
**Docker Compose**:
```bash
# Use docker-compose for replication setup
docker-compose up -d
# With authentication (set environment variables)
export SYNAP_AUTH_ENABLED=true
export SYNAP_AUTH_REQUIRE_AUTH=true
export SYNAP_AUTH_ROOT_USERNAME=admin
export SYNAP_AUTH_ROOT_PASSWORD=SecurePassword123!
docker-compose up -d
```
**Available Images**:
- `hivehub/synap:latest` - Latest stable release
- `hivehub/synap:0.8.1` - Specific version
- Supports `linux/amd64` and `linux/arm64` architectures
π **For detailed Docker documentation, see [DOCKER_README.md](DOCKER_README.md)**
**π οΈ From Source**:
```bash
# Clone repository
git clone https://github.com/hivellm/synap.git
cd synap
# Build from source (requires Rust nightly 1.85+)
cargo build --release
# Run server
./target/release/synap-server --config config.yml
```
See [Development Guide](docs/DEVELOPMENT.md) for detailed build instructions.
### π» Basic Usage
```bash
# Start server (default port 15500)
synap-server
# Key-Value Operations
curl -X POST http://localhost:15500/kv/set \
-H "Content-Type: application/json" \
-d '{"key": "user:1", "value": "John Doe", "ttl": 3600}'
curl http://localhost:15500/kv/get/user:1
# Queue Operations
curl -X POST http://localhost:15500/queue/publish \
-d '{"queue": "tasks", "message": "process-video", "priority": 1}'
curl http://localhost:15500/queue/consume/tasks
# Event Stream
curl -X POST http://localhost:15500/stream/publish \
-d '{"room": "chat-room-1", "event": "message", "data": "Hello!"}'
# Pub/Sub
curl -X POST http://localhost:15500/pubsub/publish \
-d '{"topic": "notifications.email", "message": "New order"}'
# With Authentication (if enabled)
curl -X POST http://localhost:15500/kv/set \
-H "Authorization: Basic $(echo -n 'admin:password' | base64)" \
-H "Content-Type: application/json" \
-d '{"key": "user:1", "value": "John Doe"}'
# Or with API Key
curl -X POST http://localhost:15500/kv/set \
-H "Authorization: Bearer sk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"key": "user:1", "value": "John Doe"}'
```
### π Authentication & Security (β
Production Ready)
Authentication is **disabled by default** for development. Enable it for production:
**Features:**
- β
**Root User Management** - Configurable root user with full permissions
- β
**User Management** - Create, delete, enable/disable users
- β
**API Key Management** - Generate, revoke, and manage API keys with expiration
- β
**Fine-grained Permissions** - Resource-based permissions (RabbitMQ-style)
- β
**Basic Auth & Bearer Token** - Support for both authentication methods
- β
**Audit Logging** - Track all authentication events (login, API key usage, permission denials)
- β
**Password Validation** - Configurable password requirements (length, complexity)
- β
**IP Filtering** - Restrict API keys to specific IP addresses
**Via Config File** (`config.yml`):
```yaml
auth:
enabled: true
require_auth: true
root:
username: "root"
password: "your_secure_password"
enabled: true
```
**Via Docker Environment Variables**:
```bash
docker run -d -p 15500:15500 \
-e SYNAP_AUTH_ENABLED=true \
-e SYNAP_AUTH_REQUIRE_AUTH=true \
-e SYNAP_AUTH_ROOT_USERNAME=root \
-e SYNAP_AUTH_ROOT_PASSWORD=your_secure_password \
synap:latest
```
**Using Authentication**:
```bash
# Basic Auth
curl -u root:password http://localhost:15500/kv/get/user:1
# Bearer Token (API Key)
curl -H "Authorization: Bearer sk_XXXXX..." http://localhost:15500/kv/get/user:1
# Query Parameter
curl "http://localhost:15500/kv/get/user:1?api_key=sk_XXXXX..."
```
See [Authentication Guide](docs/AUTHENTICATION.md) for complete details.
### π Replication Setup
Synap supports master-slave replication for high availability and read scaling.
#### Quick Start with Docker
```bash
# Start 1 master + 3 replicas
docker-compose up -d
# Master available at: localhost:15500
# Replica 1 at: localhost:15501
# Replica 2 at: localhost:15502
# Replica 3 at: localhost:15503
```
#### Manual Setup
**Master Node Configuration** (`config-master.yml`):
```yaml
server:
host: "0.0.0.0"
port: 15500
replication:
enabled: true
role: "master"
replica_listen_address: "0.0.0.0:15501"
heartbeat_interval_ms: 1000
max_lag_ms: 10000
buffer_size_kb: 256
replica_timeout_secs: 30
persistence:
enabled: true
wal:
enabled: true
path: "./data/wal/synap.wal"
snapshot:
enabled: true
directory: "./data/snapshots"
```
**Replica Node Configuration** (`config-replica.yml`):
```yaml
server:
host: "0.0.0.0"
port: 15500
replication:
enabled: true
role: "replica"
master_address: "master:15501" # Master's replication port
heartbeat_interval_ms: 1000
max_lag_ms: 10000
buffer_size_kb: 256
auto_reconnect: true
reconnect_delay_ms: 5000
persistence:
enabled: true
wal:
enabled: true
path: "./data/wal/synap.wal"
snapshot:
enabled: true
directory: "./data/snapshots"
```
**Start Nodes**:
```bash
# Terminal 1: Start master
synap-server --config config-master.yml
# Terminal 2: Start replica 1
synap-server --config config-replica-1.yml
# Terminal 3: Start replica 2
synap-server --config config-replica-2.yml
```
#### Usage Patterns
**Write to Master**:
```bash
# All writes go to master
curl -X POST http://localhost:15500/kv/set \
-H "Content-Type: application/json" \
-d '{"key": "user:100", "value": "Alice", "ttl": 3600}'
```
**Read from Replicas** (Load Balancing):
```bash
# Read from replica 1 (eventually consistent, ~5ms lag)
curl http://localhost:15501/kv/get/user:100
# Read from replica 2
curl http://localhost:15502/kv/get/user:100
# Read from replica 3
curl http://localhost:15503/kv/get/user:100
```
**Monitor Replication Status**:
```bash
# Check replication health on master
curl http://localhost:15500/health/replication
# Check replication status on replica
curl http://localhost:15501/health/replication
```
#### Consistency Guarantees
- **Master Reads**: Strongly consistent (immediate)
- **Replica Reads**: Eventually consistent (~5-10ms lag typical)
- **Write Durability**: Writes confirmed after master commit
- **Replication**: Asynchronous to replicas
- **Lag Monitoring**: Real-time offset tracking
See [docs/specs/REPLICATION.md](docs/specs/REPLICATION.md) for complete replication documentation.
For detailed Docker deployment guide, see:
- **[DOCKER_README.md](DOCKER_README.md)** - Complete Docker Hub documentation with examples
- **[docs/DOCKER_DEPLOYMENT.md](docs/DOCKER_DEPLOYMENT.md)** - Advanced deployment guide
## π― Use Cases
### π¬ Real-Time Chat
Use event streams for room-based messaging with message history and guaranteed delivery.
### π Task Distribution
Leverage acknowledgment queues for distributed task processing with retry logic.
### β‘ Cache Layer
Utilize key-value store as a high-speed cache with TTL support.
### π‘ Event Broadcasting
Implement pub/sub for system-wide notifications and event distribution.
### π Microservices Communication
Use queues for reliable inter-service messaging with delivery guarantees.
## π οΈ Technology Stack
- **Language**: Rust (Edition 2024)
- **Runtime**: Tokio (async/await)
- **Web Framework**: Axum
- **Data Structure**: radix_trie (memory-efficient key-value)
- **Serialization**: serde (JSON, MessagePack)
- **Protocols**: StreamableHTTP + WebSocket + MCP + UMICP
## π Documentation
### π Getting Started
- **[User Guide](docs/guides/USER_GUIDE.md)** - Complete getting started guide (Installation, Quick Start, Operations)
- **[Admin Guide](docs/guides/ADMIN_GUIDE.md)** - Operations handbook (Deployment, Monitoring, HA, Security)
- **[Tutorials](docs/guides/TUTORIALS.md)** - 8 practical tutorials (Chat, Queues, Caching, Pub/Sub)
### π§ Core Documentation
- **[Architecture](docs/ARCHITECTURE.md)** - System architecture and components
- **[Roadmap](docs/ROADMAP.md)** - Development roadmap and timeline
- **[Configuration](docs/CONFIGURATION.md)** - Complete configuration reference
- **[CLI Guide](docs/CLI_GUIDE.md)** - Synap CLI usage and commands
### π Security & Authentication
- **[Authentication](docs/AUTHENTICATION.md)** - Complete auth guide (users, roles, API keys, ACL)
- **[Queue Concurrency](docs/QUEUE_CONCURRENCY_TESTS.md)** - Zero-duplicate guarantees
### π API & Protocols
- **[REST API](docs/api/REST_API.md)** - Complete REST API documentation
- **[OpenAPI Spec](docs/api/openapi.yml)** - OpenAPI 3.0 specification (YAML/JSON)
- **[StreamableHTTP](docs/protocol/STREAMABLE_HTTP.md)** - StreamableHTTP protocol
- **[MCP Integration](docs/protocol/MCP_USAGE.md)** - Model Context Protocol β
**PRODUCTION READY**
- **[MCP Test Results](docs/protocol/MCP_TEST_RESULTS.md)** - Live testing via Cursor AI
- **[UMICP Integration](docs/protocol/UMICP_INTEGRATION.md)** - UMICP protocol β
**PRODUCTION READY**
### π Performance & Testing
- **[Benchmark Results](docs/BENCHMARK_RESULTS.md)** - KV performance metrics
- **[Testing Strategy](docs/TESTING.md)** - Test coverage and approach
- **[Phase 1 Summary](docs/PHASE1_SUMMARY.md)** - Phase 1 implementation details
### π§ Development
- **[Development Guide](docs/DEVELOPMENT.md)** - Setup and contribution guide
- **[Design Decisions](docs/DESIGN_DECISIONS.md)** - Technical choices
- **[Project DAG](docs/PROJECT_DAG.md)** - Component dependencies
- **[Deployment](docs/DEPLOYMENT.md)** - Production deployment (planned)
- **[Packaging](docs/PACKAGING_AND_DISTRIBUTION.md)** - Distribution packages (planned)
### π Project Planning
- **[Roadmap](docs/ROADMAP.md)** - Development roadmap and timeline
- **[Project DAG](docs/PROJECT_DAG.md)** - Component dependencies and implementation order
### π§© Component Specifications
- **[Key-Value Store](docs/specs/KEY_VALUE_STORE.md)** - Radix-tree storage system
- **[Queue System](docs/specs/QUEUE_SYSTEM.md)** - Message queues with ACK
- **[Event Stream](docs/specs/EVENT_STREAM.md)** - Room-based broadcasting
- **[Pub/Sub](docs/specs/PUBSUB.md)** - Topic-based messaging
- **[Replication](docs/specs/REPLICATION.md)** - Master-slave architecture
### π¦ SDKs
- **[TypeScript SDK](docs/sdks/TYPESCRIPT.md)** - Node.js and browser support
- **[Python SDK](docs/sdks/PYTHON.md)** - Async/sync Python client
- **[Rust SDK](docs/sdks/RUST.md)** - Native Rust client library
### π‘ Examples
- **[Real-Time Chat](docs/examples/CHAT_SAMPLE.md)** - Multi-room chat application
- **[Event Broadcasting](docs/examples/EVENT_BROADCAST.md)** - System-wide events
- **[Task Queue](docs/examples/TASK_QUEUE.md)** - Distributed task processing
- **[Pub/Sub Pattern](docs/examples/PUBSUB_PATTERN.md)** - Notification system
## π Performance
### β
Performance with Persistence Enabled (October 2025) β‘
**π Realistic Benchmarks - Fair Comparison** β
| Operation | Synap (Periodic fsync) | Redis/RabbitMQ | vs Competitor |
|-----------|------------------------|----------------|---------------|
| **KV Write** | **44K ops/s** (22.5Β΅s) | 50-100K ops/s | π° **Competitive** (2x slower) |
| **KV Read** | **12M ops/s** (83ns) | 80-100K ops/s | β
**120x faster** |
| **Queue Publish** | **19.2K msgs/s** (52Β΅s) | 0.1-0.2K msgs/s | β
**100x faster** |
| **Queue Consume+ACK** | **607Β΅s** | 5-10ms | β
**8-16x faster** |
| **Memory (1M keys)** | **92MB** | ~200MB | β
**54% reduction** |
| **Recovery (1K ops)** | **120ms** | 50-200ms | π° **Similar** |
| **Concurrent Ops** | **64x parallel** | Single-thread | β
**Linear scaling** |
**Note**: Persistence enabled with `fsync_mode: periodic` (10ms batching) - Production config
### π Optimization Results
| Metric | Before | After | Improvement |
|--------|--------|-------|-------------|
| Memory (1M keys) | 200MB | **92MB** | **54% reduction** |
| Write throughput | 50K ops/s | **10M+ ops/s** | **200x faster** |
| Read latency P99 | 2-5ms | **87ns** | **20,000x faster** |
| Concurrent ops | Limited | **64x parallel** | Linear scaling |
| TTL cleanup CPU | 100% | **1-10%** | **10-100x reduction** |
### π Planned
| Operation | Target | Status |
|-----------|--------|--------|
| Event Publish | < 1ms | π In Progress |
| Pub/Sub Publish | < 0.5ms | π΅ Planned |
| Replication Lag | < 10ms | π΅ Planned |
**Test Coverage**: 456+ tests passing (99.30% coverage)
**Scripts**: `./scripts/test-performance.ps1` (full suite), `./scripts/quick-test.ps1` (fast validation)
## βοΈ Comparison
| Feature | Synap | Redis | RabbitMQ | Kafka |
|---------|-------|-------|----------|-------|
| Key-Value | β
| β
| β | β |
| **Hashes** | β
(v0.6.0) | β
| β | β |
| **Lists** | β
(v0.6.0) | β
| β | β |
| **Sets** | β
(v0.6.0) | β
| β | β |
| **Sorted Sets** | β
(v0.7.0) | β
| β | β |
| **Geospatial** | β
(v0.7.0-rc2) | β
| β | β |
| **Bitmaps** | β
(v0.7.0-rc2) | β
| β | β |
| **HyperLogLog** | β
(v0.7.0-rc1) | β
| β | β |
| **Lua Scripting** | β
(v0.7.0) | β
| β | β |
| **Transactions** | β
(v0.7.0) | β
| β | β |
| **String Extensions** | β
(v0.7.0-rc1) | β
| β | β |
| Queues (ACK) | β
| β | β
| β |
| Priority Queues | β
(0-9) | β | β
| β |
| Dead Letter Queue | β
| β | β
| β |
| Event Streams | β
| β
(Limited) | β | β
|
| Partitioned Topics | β
| β | β | β
|
| Consumer Groups | β
| β | β | β
|
| Retention Policies | β
(5 types) | β
(2 types) | β
(1 type) | β
(2 types) |
| Pub/Sub | β
| β
| β
| β
|
| Authentication | β
(Users+API Keys) | β
(ACL) | β
(Users) | β
(SASL) |
| RBAC | β
| β
(Limited) | β
| β
|
| API Key Expiration | β
| β | β | β |
| IP Filtering | β
| β
| β | β |
| Replication | β
(Master-Slave) | β
| β
| β
|
| Persistence | β
(WAL+Snapshot) | β
(AOF/RDB) | β
(Disk) | β
(Log) |
| PACELC Model | PC/EL | PC/EL | PC/EC | PA/EL |
| Native Compression | β
(LZ4/Zstd) | β | β | β
(Snappy) |
| Hot Data Cache | π (L1/L2) | β
(Single) | β | β |
| StreamableHTTP | β
| β | β | β |
| MCP Support | β
(Configurable, Auth) | β | β | β |
| UMICP Support | β
(13 ops, TLS) | β | β | β |
| Enhanced Monitoring | β
(INFO, SLOWLOG, MEMORY) | β
(INFO) | β | β |
| Password Hashing | β
(SHA512) | β
(SHA256) | β
(bcrypt) | β
(SASL) |
| AI Integration | β
(MCP+UMICP) | β | β | β |
| Matrix Operations | β
(via UMICP) | β | β | β |
| Single Binary | β
| β
| β | β |
| Zero-Duplicate Guarantee | β
(Tested) | N/A | β
| β
|
**Legend**: β
Implemented | π In Progress | β Not Available
## π License
Apache License 2.0 - See [LICENSE](LICENSE) for details.
## π€ Contributing
See [DEVELOPMENT.md](docs/DEVELOPMENT.md) for development setup and contribution guidelines.
## π Project Status
**Status**: β
Phase 1-3 Complete | β
Redis Phase 1-2 Complete (Hash, List, Set, Sorted Set, Geospatial, Bitmap, String Extensions)
**Version**: 0.8.1 (Dependency updates + SDK fixes)
**Edition**: Rust 2024 (nightly 1.85+)
**Last Updated**: November 12, 2025
### β
Implementation Complete
#### π― Phase 1: Foundation (v0.1.0-alpha)
- β
Radix tree-based key-value store
- β
GET/SET/DELETE + Atomic (INCR/DECR)
- β
Batch operations (MSET/MGET/MDEL)
- β
TTL support with background cleanup
- β
Extended commands (KEYS, SCAN, FLUSH, EXPIRE, PERSIST)
- β
HTTP REST API (4 KV endpoints)
- β
StreamableHTTP Protocol (15+ commands)
- β
Comprehensive error handling
- β
Advanced logging (JSON + Pretty formats)
#### β
Phase 2: Core Features (v0.2.0-beta) - COMPLETE (Oct 2025)
**π¨ Queue System** β
COMPLETE
- β
FIFO with priority support (0-9)
- β
ACK/NACK mechanism + retry logic
- β
Dead Letter Queue (DLQ)
- β
Background deadline checker
- β
**9 REST API endpoints** (create, publish, consume, ack, nack, etc.)
- β
**Zero-duplicate guarantee** (5 concurrency tests)
- β
Performance: 7,500+ msg/s with 50 concurrent consumers
**π Authentication & Authorization** β
COMPLETE
- β
**User management** (SHA512 password hashing)
- β
**Role-Based Access Control** (admin, readonly, custom roles)
- β
**API Keys** (expiration, IP filtering, usage tracking)
- β
**ACL system** (resource-based permissions)
- β
**Basic Auth + Bearer Token** authentication
- β
**Multi-tenant support** via permission patterns
- β
**23 security tests** (100% auth module coverage)
**ποΈ Compression** β
COMPLETE
- β
LZ4 (fast compression)
- β
Zstandard (better ratio)
- β
Configurable thresholds
- β
6 comprehensive tests
**π‘ Event Streams** β
COMPLETE + KAFKA-STYLE PARTITIONING β
NEW
- β
Ring buffer implementation (VecDeque, 10K msg/room)
- β
Room-based isolation (multi-tenant)
- β
Message history (offset-based replay)
- β
Offset-based consumption (Kafka-style)
- β
Automatic compaction (retention policy)
- β
**Kafka-style persistence** (append-only logs per room)
- β
**Stream recovery** from disk logs
- β
**Master-Slave replication** (full + partial sync)
- β
**Snapshot integration** (stream data in full sync)
- β
**Partitioned Topics** (multiple partitions per topic) β
NEW
- β
**Consumer Groups** (coordinated consumption with rebalancing) β
NEW
- β
**Key-Based Routing** (hash-based partition assignment) β
NEW
- β
**Advanced Retention** (time, size, count, combined, infinite) β
NEW
- β
**Assignment Strategies** (round-robin, range, sticky) β
NEW
- β
**Offset Management** (commit/checkpoint positions) β
NEW
- β
6 simple stream endpoints + 17 Kafka-style endpoints
- β
Performance: 12.5M msgs/s consume, 2.3 GiB/s publish, 10K+ events/sec per partition
**π Pub/Sub System** β
COMPLETE
- β
Topic routing (Radix Trie)
- β
Wildcard subscriptions (`*` and `#`)
- β
Fan-out messaging (concurrent delivery)
- β
Hierarchical topics
- β
Performance: 850K msgs/s, 1.2Β΅s latency
**πΎ Persistence** β
COMPLETE - All Subsystems
- β
**OptimizedWAL** (Redis-style batching, 10K ops/batch) β
NEW
- β
**Queue Persistence** (RabbitMQ-style ACK tracking) β
NEW
- β
**Stream Persistence** (Kafka-style append-only logs) β
NEW
- β
AsyncWAL with group commit (3-5x throughput)
- β
Streaming snapshot v2 (O(1) memory)
- β
Automatic recovery on startup (KV + Queue + Stream)
- β
3 fsync modes: Always, Periodic, Never
- β
Manual snapshot endpoint (POST /snapshot)
#### π Phase 3: Replication (v0.3.0-rc) - COMPLETE (Oct 2025)
**Master-Slave Replication** β
COMPLETE
- β
**TCP communication layer** (length-prefixed binary protocol)
- β
**Full sync** (snapshot transfer with CRC32 verification)
- β
**Partial sync** (incremental replication log updates)
- β
**Circular replication log** (1M operations buffer, like Redis)
- β
**Lag monitoring** (real-time offset tracking)
- β
**Auto-reconnect** (intelligent full/partial resync)
- β
**Manual failover** (promote replica to master)
- β
**Stream replication** (Event Streams included in sync) β
NEW
- β
**Multi-subsystem sync** (KV + Queue + Streams) β
NEW
- β
**67 comprehensive tests** (25 unit + 16 extended + 10 integration + 16 KV operations)
- β
**Stress tested** (5000 operations validated)
- β
**Multiple replicas** (3+ replicas tested simultaneously)
**Performance**:
- Snapshot creation: 1000 keys < 50ms
- Large values: 100KB transfers validated
- Multiple replicas: 3 replicas sync concurrently
- Stress test: 5000 ops in ~4-5 seconds
#### π§ͺ Testing & Quality
- β
**456+ tests passing** (99.30% test coverage)
- 128 library tests (KV, Queue, Streams, Partitioning, Consumer Groups, Persistence, Auth, Compression)
- 67 replication tests (25 unit + 16 extended + 10 integration TCP + 16 KV ops)
- 21 integration tests (performance, hybrid storage, persistence e2e)
- 7 Kafka-style integration tests (partition, consumer groups, retention)
- 40+ geospatial tests (23 unit + 17 integration)
- 12 bitmap integration tests
- 30 Lua scripting tests
- 11 transaction tests
- 58 authentication tests
- Protocol tests across REST, StreamableHTTP, WebSocket
- β
**11 comprehensive benchmark suites**
- `kv_bench`: Memory, sharding, TTL, concurrency
- `queue_bench`: Arc sharing, priority, pending messages
- `persistence_bench`: AsyncWAL, snapshots, recovery
- `hybrid_bench`: Adaptive storage (HashMap/RadixTrie)
- `stream_bench`: Publish, consume, overflow, multi-subscriber
- `pubsub_bench`: Wildcards, fan-out, hierarchy
- `compression_bench`: LZ4/Zstd performance
- `kv_persistence_bench`: With disk I/O (3 fsync modes)
- `queue_persistence_bench`: RabbitMQ-style durability
- `geospatial_bench`: GEO operations performance β
NEW
- `bitmap_bench`: Bit manipulation performance β
NEW
- β
**99.30% test coverage**
- β
Clean `cargo fmt` and `cargo clippy`
- β
WebSocket tests with graceful shutdown (s2s-tests feature)
### π Quick Start
```bash
# Clone and build
git clone https://github.com/hivellm/synap.git
cd synap
cargo build --release
# Run tests (456+ passing)
cargo test
# Run server
./target/release/synap-server --config config.yml
# Server starts at http://0.0.0.0:15500
# Use CLI client
./target/release/synap-cli
synap> SET mykey "Hello World"
synap> GET mykey
# Or via HTTP API
curl -X POST http://localhost:15500/kv/set \
-H "Content-Type: application/json" \
-d '{"key": "test", "value": "hello", "ttl": 3600}'
curl http://localhost:15500/kv/get/test
# Returns: "hello" (plain value, not wrapped JSON)
# Or via MCP (Cursor/Claude Desktop)
# Just ask: "Get the value of key 'test' from Synap"
# MCP tool synap_kv_get will be called automatically
```
### π¨ Queue System Examples
```bash
# Create queue
curl -X POST http://localhost:15500/queue/jobs \
-H "Content-Type: application/json" \
-d '{"max_depth": 10000, "ack_deadline_secs": 30}'
# Publish message
curl -X POST http://localhost:15500/queue/jobs/publish \
-H "Content-Type: application/json" \
-d '{"payload": [72,101,108,108,111], "priority": 9, "max_retries": 3}'
# Consume message
curl http://localhost:15500/queue/jobs/consume/worker-1
# Acknowledge (ACK)
curl -X POST http://localhost:15500/queue/jobs/ack \
-H "Content-Type: application/json" \
-d '{"message_id": "xxx-xxx-xxx"}'
```
### π Authentication Examples
```bash
# Basic Auth (Redis-style)
curl -u admin:password http://localhost:15500/queue/private/stats
# API Key (Bearer Token)
curl -H "Authorization: Bearer sk_XXXXX..." http://localhost:15500/queue/list
# API Key (Query Parameter)
curl http://localhost:15500/queue/list?api_key=sk_XXXXX...
```
See [docs/AUTHENTICATION.md](docs/AUTHENTICATION.md) for complete authentication guide.
### π Next Phases
**β
Phase 2 (Q4 2025)**: Event Streams, Pub/Sub, Persistence - **COMPLETE**
**β
Phase 3 (Q1 2026)**: Master-Slave Replication with TCP - **COMPLETE**
**β
Redis Phase 1 (Oct 2025)**: Hash, List, Set Data Structures + 5 SDKs - **COMPLETE** π
**β
Redis Phase 2 (Jan 2025)**: Sorted Sets, String Extensions, Geospatial, Bitmap - **COMPLETE** π
**β
MCP Integration**: Model Context Protocol with Authentication & Configurable Tools - **COMPLETE**
**β
UMICP Integration**: Universal Matrix Inter-Communication Protocol with TLS - **COMPLETE**
**β
Enhanced Monitoring**: INFO, SLOWLOG, MEMORY USAGE, CLIENT LIST - **COMPLETE**
**β³ Phase 4 (Q2 2026)**: Clustering, Sharding, GUI Dashboard, Distribution packages
See [docs/ROADMAP.md](docs/ROADMAP.md) for details.