Skip to content

exprays/orion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Orion Orion Logo

An open-source, insanely-fast, in-memory database built with Go

Go Version Docker License Build Status


Orion is a high-performance, in-memory key-value database designed for ultra-fast data access and manipulation. Whether you're building real-time applications, caching layers, or need rapid data processing, Orion is engineered to handle it with elegance and speed.

โš ๏ธ Note: Orion is currently in active development as part of Buildspace S5. Expect frequent updates, rapid improvements, and exciting new features.


๐Ÿ“– Table of Contents


โœจ Features

๐Ÿ”ฅ Core Features

Feature Status Description
In-memory KV Store โœ… Lightning-fast key-value operations
Strings โœ… Full string manipulation support
Sets โœ… Efficient set operations and manipulations
Persistence (AOF) โœ… Append-only file for data durability
TTL Support โœ… Automatic key expiration
CLI Client (Hunter) โœ… Interactive command-line interface
Custom Protocol (ORSP) โœ… Optimized binary/text serialization
Enhanced Logging โœ… Error, Command logging for Server

๐ŸŽฏ Advanced Features

Feature Status Description
Command Autocomplete โœ… Tab completion with case-insensitive match
Command History โœ… Persistent history navigation
Background Saves โœ… Non-blocking snapshots
AOF Rewriting โœ… Log compaction with background safety
Server Monitoring โŒ Real-time statistics and metrics

๐Ÿšง Coming Soon

Feature Status ETA Priority
Sorted Sets ๐Ÿ”„ Q1 2025 High
Hash Maps ๐Ÿ”„ Q1 2025 High
Pub/Sub ๐Ÿ“‹ Q2 2025 Medium
Transactions ๐Ÿ“‹ Q2 2025 Medium
Streams ๐Ÿ“‹ Q2 2025 Medium
Clustering ๐Ÿ“‹ Q2 2025 High
Authentication ๐Ÿ“‹ Q2 2025 Medium
LRU Eviction ๐Ÿ“‹ Q2 2025 Medium
HyperLogLogs ๐Ÿ“‹ Q3 2025 Low
Bitmaps ๐Ÿ“‹ Q3 2025 Low
Vector Support ๐Ÿ“‹ Q4 2025 Low
Geo-spatial Data ๐Ÿ“‹ Q4 2025 Low

๐Ÿš€ Quick Start

๐Ÿงฐ Prerequisites

  • Go 1.22 or higher installed
  • Basic familiarity with terminal/CLI

๐Ÿ”ง Installation

Option 1: Clone from Source

git clone https://github.com/exprays/orion.git
cd orion
go mod tidy

Option 2: Use Prebuilt Binary

Download the latest binary from the GitHub Releases.


๐Ÿ–ฅ Running Orion

Start the Server

cd cmd/server
go run orion.go --port=6379

# Or just go run orion.go which starts the server in default port 6379

Launch the Hunter CLI

cd cmd/hunter
go run hunter.go

# Select dev for default port 
# Select custom for custom port

Press CTRL+C to exit the client.


๐ŸŽฎ Usage Examples

Basic Operations

# String Operations

orion> SET user:1 "John Doe"
OK

orion> GET user:1
"John Doe"

orion> APPEND user:1 " - Engineer"
(integer) 19

# Set Operations

orion> SADD languages go python rust
(integer) 3

orion> SMEMBERS languages
1) "go"
2) "python"
3) "rust"

# TTL Operations

orion> SET session:abc123 "active" EX 3600
OK

orion> TTL session:abc123
(integer) 3599

Advanced Features

# Command autocomplete (press TAB)
orion> s<TAB>
SADD  SCARD  SDIFF  SDIFFSTORE  SET  SISMEMBER  SMEMBERS  SMOVE  SPOP  SRANDMEMBER  SREM  SUNION  SUNIONSTORE

# Command history (use โ†‘/โ†“ arrows)
orion> <UP ARROW>  # Shows previous command

# Server information
orion> INFO
# Server
uptime_in_seconds:120
uptime_in_days:0
# Memory
used_memory:1048576
used_memory_human:1.0 MB
# Keyspace
db0:keys=5

Autocomplete & History

  • Use <TAB> for suggestions
  • Use โ†‘ / โ†“ arrows to navigate command history

๐Ÿ“Š Benchmarks

Operation Ops/sec Avg Latency P99 Latency
SET 180,000 0.05ms 0.2ms
GET 220,000 0.04ms 0.15ms
SADD 150,000 0.06ms 0.25ms
SMEMBERS 90,000 0.1ms 0.4ms

Memory Usage:

  • Startup: ~8MB
  • Per Key: ~64 bytes
  • Per Set Member: ~32 bytes
  • AOF File: ~40% of total data size

Throughput Comparison

SET Operation (10M)

Database Ops/sec Memory Usage
Orion 180,000 245MB
Redis 165,000 280MB
KeyDB 170,000 260MB

๐Ÿง  Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Hunter CLI  โ”‚โ”€โ”€โ”€โ–ถ โ”‚ ORSP Protocolโ”‚โ”€โ”€โ”€โ–ถโ”‚ Orion Server โ”‚
โ”‚ (Client App) โ”‚     โ”‚ (Serializer) โ”‚     โ”‚ (Database)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                               โ”‚
                                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                  โ”‚     Data Store     โ”‚
                                  โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
                                  โ”‚ โ”‚ KV Store      โ”‚  |
                                  | | Set Store     |  |
                                  | | TTL Store     |  |
                                  โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
                                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                               โ”‚
                                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                  โ”‚   Persistence      โ”‚
                                  โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
                                  โ”‚ โ”‚ AOF Writer    โ”‚  โ”‚
                                  | | Snapshots     |  |
                                  โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
                                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ฆ ORSP Protocol

๐Ÿ”„ ORSP Type Symbols and Mappings

The ORSP (Orion Serialization Protocol) types and their corresponding Go type representations.

ORSP Type Symbol ORSP Name Go Type Description
+ Simple String SimpleStringValue Represents simple text response (e.g., +OK\r\n)
- Error ErrorValue Represents an error message (e.g., -ERR something went wrong\r\n)
: Integer IntegerValue Represents integer values (e.g., :123\r\n)
$ Bulk String BulkStringValue Represents strings with length prefix (e.g., $6\r\nfoobar\r\n)
* Array ArrayValue Represents an array of ORSP values
_ Null NullValue Represents a null value
# Boolean BooleanValue Represents a boolean (#t\r\n or #f\r\n)
, Double DoubleValue Represents a double-precision float
( Big Number BigNumberValue Represents large integers using math/big.Int
! Bulk Error BulkErrorValue Contains structured error with code and message
= Verbatim String VerbatimStringValue Format-qualified string (e.g., =txt:Hello World\r\n)
% Map MapValue Key-value mapping, keys must be simple strings
~ Set SetValue Unordered collection of unique elements
> Push PushValue Push-type message with kind and data array

Each type supports a Marshal() method to serialize the value to ORSP-compliant wire format, and a corresponding unmarshal function to deserialize from a stream.

                           |

๐Ÿ’ป Tech Stack

  • Go
  • Docker

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details. MIT ยฉ exprays


๐Ÿ™ Acknowledgments

  • Built with โค๏ธ by Surya A.K.A exprays
  • Part of Buildspace S5 cohort
  • Inspired by Redis and modern in-memory databases
  • Special thanks to the Go community

๐Ÿ“ž Support & Community

  • Documentation: orion.thestarsociety.tech
  • Issues: GitHub Issues
  • Discussions: GitHub Discussions
  • Instagram: @suryakantsubudhi

About

An insanely-fast, in-memory KV database supporting persistence built form scratch

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages