EchoVault/SugarDB

Embeddable and distributed in-memory alternative to Redis.

Go

539

1,044 commits

updated Apr 24, 2025

See the code

README

Go Go Report Card codecov
Go Reference GitHub Release License
Mentioned in Awesome Go Discord


Table of Contents

  1. What is SugarDB
  2. Features
  3. Usage (Embedded)
  4. Usage (Client-Server)
    1. Homebrew
    2. Docker
    3. GitHub Container Registry
    4. Binaries
  5. Clients
  6. Benchmarks
  7. Commands
    1. ACL
    2. ADMIN
    3. CONNECTION
    4. GENERIC
    5. HASH
    6. LIST
    7. PUBSUB
    8. SET
    9. SORTED SET
    10. STRING

What is SugarDB?

SugarDB is a highly configurable, distributed, in-memory data store and cache implemented in Go. It can be imported as a Go library or run as an independent service.

SugarDB aims to provide a rich set of data structures and functions for manipulating data in memory. These data structures include, but are not limited to: Lists, Sets, Sorted Sets, Hashes, and much more to come soon.

SugarDB provides a persistence layer for increased reliability. Both Append-Only files and snapshots can be used to persist data in the disk for recovery in case of unexpected shutdowns.

Replication is a core feature of SugarDB and is implemented using the RAFT algorithm, allowing you to create a fault-tolerant cluster of SugarDB nodes to improve reliability. If you do not need a replication cluster, you can always run SugarDB in standalone mode and have a fully capable single node.

SugarDB aims to not only be a server but to be importable to existing projects to enhance them with SugarDB features, this capability is always being worked on and improved.

Features

Features offered by SugarDB include:

  1. TLS and mTLS support for multiple server and client RootCAs.
  2. Replication cluster support using the RAFT algorithm.
  3. ACL Layer for user Authentication and Authorization.
  4. Distributed Pub/Sub functionality.
  5. Sets, Sorted Sets, Hashes, Lists and more.
  6. Persistence layer with Snapshots and Append-Only files.
  7. Key Eviction Policies.
  8. Command extension via shared object files.
  9. Command extension via embedded API.
  10. Command extension via Lua Modules.
  11. Command extension via JavaScript Modules.
  12. Multi-database support for key namespacing.

We are working hard to add more features to SugarDB to make it much more powerful. Features in the roadmap include:

  1. Sharding
  2. Streams
  3. Transactions
  4. Bitmap
  5. HyperLogLog
  6. JSON
  7. Improved Observability

Usage (Embedded)

Install SugarDB with: go get github.com/echovault/sugardb/sugardb.

Here's an example of using SugarDB as an embedded library. You can access all of SugarDB's commands using an ergonomic API.

func main() {
  server, err := sugardb.NewSugarDB()
  if err != nil {
    log.Fatal(err)
  }

  _, _, _ = server.Set("key", "Hello, SugarDB!", sugardb.SETOptions{})

  v, _ := server.Get("key")
  fmt.Println(v) // Hello, SugarDB!

  // (Optional): Listen for TCP connections on this SugarDB instance.
  server.Start()
}

An embedded SugarDB instance can still be part of a cluster, and the changes triggered from the API will be consistent across the cluster.

Usage (Client-Server)

Homebrew

To install via homebrew, run:

  1. brew tap echovault/sugardb
  2. brew install echovault/echovault/sugardb

Once installed, you can run the server with the following command: sugardb --bind-addr=localhost --data-dir="path/to/persistence/directory"

Docker

docker pull echovault/sugardb

The full list of tags can be found here.

Container Registry

docker pull ghcr.io/echovault/sugardb

The full list of tags can be found here.

Binaries

You can download the binaries by clicking on a release tag and downloading the binary for your system.

Clients

SugarDB uses RESP, which makes it compatible with existing Redis clients.

Benchmarks

To compare command performance with Redis, benchmarks can be run with:

make benchmark

Prerequisites:

  • brew install redis to run the Redis server and benchmark script
  • brew tap echovault/sugardb & brew install echovault/echovault/sugardb to run the SugarDB Client-Server

Benchmark script options:

  • make benchmark use_local_server=true runs on your local SugarDB Client-Server
  • make benchmark commands=ping,set,get... runs the benchmark script on the specified commands

Supported Commands

ACL

ADMIN

CONNECTION

GENERIC

HASH

LIST

PUBSUB

SET

SORTED SET

STRING

cache
client-server
cluster
consistent
database
distributed
distributed-database
go
golang
in-memory-database
lfu-cache
lru-cache
memory
networking
open-source
pubsub
redis
store
tcp

EchoVault/SugarDB

Embeddable and distributed in-memory alternative to Redis.

Go

539

1,044 commits

updated Apr 24, 2025

See the code

README

Go Go Report Card codecov
Go Reference GitHub Release License
Mentioned in Awesome Go Discord


Table of Contents

  1. What is SugarDB
  2. Features
  3. Usage (Embedded)
  4. Usage (Client-Server)
    1. Homebrew
    2. Docker
    3. GitHub Container Registry
    4. Binaries
  5. Clients
  6. Benchmarks
  7. Commands
    1. ACL
    2. ADMIN
    3. CONNECTION
    4. GENERIC
    5. HASH
    6. LIST
    7. PUBSUB
    8. SET
    9. SORTED SET
    10. STRING

What is SugarDB?

SugarDB is a highly configurable, distributed, in-memory data store and cache implemented in Go. It can be imported as a Go library or run as an independent service.

SugarDB aims to provide a rich set of data structures and functions for manipulating data in memory. These data structures include, but are not limited to: Lists, Sets, Sorted Sets, Hashes, and much more to come soon.

SugarDB provides a persistence layer for increased reliability. Both Append-Only files and snapshots can be used to persist data in the disk for recovery in case of unexpected shutdowns.

Replication is a core feature of SugarDB and is implemented using the RAFT algorithm, allowing you to create a fault-tolerant cluster of SugarDB nodes to improve reliability. If you do not need a replication cluster, you can always run SugarDB in standalone mode and have a fully capable single node.

SugarDB aims to not only be a server but to be importable to existing projects to enhance them with SugarDB features, this capability is always being worked on and improved.

Features

Features offered by SugarDB include:

  1. TLS and mTLS support for multiple server and client RootCAs.
  2. Replication cluster support using the RAFT algorithm.
  3. ACL Layer for user Authentication and Authorization.
  4. Distributed Pub/Sub functionality.
  5. Sets, Sorted Sets, Hashes, Lists and more.
  6. Persistence layer with Snapshots and Append-Only files.
  7. Key Eviction Policies.
  8. Command extension via shared object files.
  9. Command extension via embedded API.
  10. Command extension via Lua Modules.
  11. Command extension via JavaScript Modules.
  12. Multi-database support for key namespacing.

We are working hard to add more features to SugarDB to make it much more powerful. Features in the roadmap include:

  1. Sharding
  2. Streams
  3. Transactions
  4. Bitmap
  5. HyperLogLog
  6. JSON
  7. Improved Observability

Usage (Embedded)

Install SugarDB with: go get github.com/echovault/sugardb/sugardb.

Here's an example of using SugarDB as an embedded library. You can access all of SugarDB's commands using an ergonomic API.

func main() {
  server, err := sugardb.NewSugarDB()
  if err != nil {
    log.Fatal(err)
  }

  _, _, _ = server.Set("key", "Hello, SugarDB!", sugardb.SETOptions{})

  v, _ := server.Get("key")
  fmt.Println(v) // Hello, SugarDB!

  // (Optional): Listen for TCP connections on this SugarDB instance.
  server.Start()
}

An embedded SugarDB instance can still be part of a cluster, and the changes triggered from the API will be consistent across the cluster.

Usage (Client-Server)

Homebrew

To install via homebrew, run:

  1. brew tap echovault/sugardb
  2. brew install echovault/echovault/sugardb

Once installed, you can run the server with the following command: sugardb --bind-addr=localhost --data-dir="path/to/persistence/directory"

Docker

docker pull echovault/sugardb

The full list of tags can be found here.

Container Registry

docker pull ghcr.io/echovault/sugardb

The full list of tags can be found here.

Binaries

You can download the binaries by clicking on a release tag and downloading the binary for your system.

Clients

SugarDB uses RESP, which makes it compatible with existing Redis clients.

Benchmarks

To compare command performance with Redis, benchmarks can be run with:

make benchmark

Prerequisites:

  • brew install redis to run the Redis server and benchmark script
  • brew tap echovault/sugardb & brew install echovault/echovault/sugardb to run the SugarDB Client-Server

Benchmark script options:

  • make benchmark use_local_server=true runs on your local SugarDB Client-Server
  • make benchmark commands=ping,set,get... runs the benchmark script on the specified commands

Supported Commands

ACL

ADMIN

CONNECTION

GENERIC

HASH

LIST

PUBSUB

SET

SORTED SET

STRING

cache
client-server
cluster
consistent
database
distributed
distributed-database
go
golang
in-memory-database
lfu-cache
lru-cache
memory
networking
open-source
pubsub
redis
store
tcp

Project health

Latest release

v0.17.0 · Jan 11, 2025

Releases this year

0

Significant stargazers

Nao Yonashiro

294 followers · starred Sep 2024

Roger Johansson

519 followers · starred Apr 2024

Samy Fodil

82 followers · starred May 2024

Till Klocke

71 followers · starred Jul 2024