Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/EchoVault/SugarDB
Embeddable and distributed in-memory alternative to Redis.
https://github.com/EchoVault/SugarDB
cache client-server cluster consistent database distributed distributed-database go golang in-memory-database lfu-cache lru-cache memory networking pubsub redis store tcp tcp-server
Last synced: 4 months ago
JSON representation
Embeddable and distributed in-memory alternative to Redis.
- Host: GitHub
- URL: https://github.com/EchoVault/SugarDB
- Owner: EchoVault
- License: apache-2.0
- Created: 2023-07-01T15:03:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-22T15:02:22.000Z (4 months ago)
- Last Synced: 2024-09-23T06:07:15.929Z (4 months ago)
- Topics: cache, client-server, cluster, consistent, database, distributed, distributed-database, go, golang, in-memory-database, lfu-cache, lru-cache, memory, networking, pubsub, redis, store, tcp, tcp-server
- Language: Go
- Homepage: https://sugardb.io
- Size: 13.7 MB
- Stars: 372
- Watchers: 5
- Forks: 19
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-repositories - EchoVault/SugarDB - Embeddable and distributed in-memory alternative to Redis. (Go)
README
[![Go](https://github.com/EchoVault/SugarDB/workflows/Go/badge.svg)]()
[![Go Report Card](https://goreportcard.com/badge/github.com/echovault/echovault)](https://goreportcard.com/report/github.com/echovault/echovault)
[![codecov](https://codecov.io/gh/EchoVault/SugarDB/graph/badge.svg?token=CHWTW0IUNV)](https://codecov.io/gh/EchoVault/SugarDB)
[![Go Reference](https://pkg.go.dev/badge/github.com/echovault/echovault.svg)](https://pkg.go.dev/github.com/echovault/sugardb)
[![GitHub Release](https://img.shields.io/github/v/release/EchoVault/SugarDB)]()
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)
[![Discord](https://img.shields.io/discord/1211815152291414037?label=Discord&labelColor=%237289da)](https://discord.com/invite/JrG4kPrF8v)
# Table of Contents
1. [What is SugarDB](#what-is-sugardb)
2. [Features](#features)
3. [Usage (Embedded)](#usage-embedded)
4. [Usage (Client-Server)](#usage-client-server)
1. [Homebrew](#usage-homebrew)
2. [Docker](#usage-docker)
3. [GitHub Container Registry](#usage-container-registry)
4. [Binaries](#usage-binaries)
5. [Clients](#clients)
6. [Benchmarks](#benchmarks)
7. [Commands](#commands)
1. [ACL](#commands-acl)
2. [ADMIN](#commands-admin)
3. [CONNECTION](#commands-connection)
4. [GENERIC](#commands-generic)
5. [HASH](#commands-hash)
6. [LIST](#commands-list)
7. [PUBSUB](#commands-pubsub)
8. [SET](#commands-set)
9. [SORTED SET](#commands-sortedset)
10. [STRING](#commands-string)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 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) 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) Lua Modules
7) JSON
8) Improved Observability
Install SugarDB with: `go get github.com/echovault/sugardb`.
Here's an example of using SugarDB as an embedded library.
You can access all of SugarDB's commands using an ergonomic API.```go
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.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 pull echovault/sugardb`
The full list of tags can be found [here](https://hub.docker.com/r/echovault/sugardb/tags).
`docker pull ghcr.io/echovault/sugardb`
The full list of tags can be found [here](https://github.com/EchoVault/SugarDB/pkgs/container/sugardb).
You can download the binaries by clicking on a release tag and downloading
the binary for your system.SugarDB uses RESP, which makes it compatible with existing
Redis clients.
# Benchmarks
The following benchmark only applies to the TCP client-server mode.Hardware: MacBook Pro 14in, M1 chip, 16GB RAM, 8 Cores
Command: `redis-benchmark -h localhost -p 7480 -q -t ping,set,get,incr,lpush,rpush,lpop,rpop,sadd,hset,zpopmin,lrange,mset`
Result:
```
PING_INLINE: 89285.71 requests per second, p50=0.247 msec
PING_MBULK: 85543.20 requests per second, p50=0.239 msec
SET: 65573.77 requests per second, p50=0.455 msec
GET: 79176.56 requests per second, p50=0.295 msec
INCR: 68870.52 requests per second, p50=0.439 msec
LPUSH: 27601.44 requests per second, p50=1.567 msec
RPUSH: 61842.92 requests per second, p50=0.519 msec
LPOP: 58548.01 requests per second, p50=0.567 msec
RPOP: 68681.32 requests per second, p50=0.439 msec
SADD: 67613.25 requests per second, p50=0.479 msec
HSET: 56561.09 requests per second, p50=0.599 msec
ZPOPMIN: 70972.32 requests per second, p50=0.359 msec
LPUSH (needed to benchmark LRANGE): 26434.05 requests per second, p50=1.623 msec
LRANGE_100 (first 100 elements): 26939.66 requests per second, p50=1.263 msec
LRANGE_300 (first 300 elements): 5081.82 requests per second, p50=9.095 msec
LRANGE_500 (first 500 elements): 2554.87 requests per second, p50=18.191 msec
LRANGE_600 (first 600 elements): 1903.96 requests per second, p50=24.607 msec
MSET (10 keys): 56022.41 requests per second, p50=0.463 msec
```
## ACL
* [ACL CAT](https://sugardb.io/docs/commands/acl/acl_cat)
* [ACL DELUSER](https://sugardb.io/docs/commands/acl/acl_deluser)
* [ACL GETUSER](https://sugardb.io/docs/commands/acl/acl_getuser)
* [ACL LIST](https://sugardb.io/docs/commands/acl/acl_list)
* [ACL LOAD](https://sugardb.io/docs/commands/acl/acl_load)
* [ACL SAVE](https://sugardb.io/docs/commands/acl/acl_save)
* [ACL SETUSER](https://sugardb.io/docs/commands/acl/acl_setuser)
* [ACL USERS](https://sugardb.io/docs/commands/acl/acl_users)
* [ACL WHOAMI](https://sugardb.io/docs/commands/acl/acl_whoami)
## ADMIN
* [COMMAND COUNT](https://sugardb.io/docs/commands/admin/command_count)
* [COMMAND LIST](https://sugardb.io/docs/commands/admin/command_list)
* [COMMANDS](https://sugardb.io/docs/commands/admin/commands)
* [LASTSAVE](https://sugardb.io/docs/commands/admin/lastsave)
* [MODULE LIST](https://sugardb.io/docs/commands/admin/module_list)
* [MODULE LOAD](https://sugardb.io/docs/commands/admin/module_load)
* [MODULE UNLOAD](https://sugardb.io/docs/commands/admin/module_unload)
* [REWRITEAOF](https://sugardb.io/docs/commands/admin/rewriteaof)
* [SAVE](https://sugardb.io/docs/commands/admin/save)
## CONNECTION
* [AUTH](https://sugardb.io/docs/commands/connection/auth)
* [HELLO](https://sugardb.io/docs/commands/connection/hello)
* [PING](https://sugardb.io/docs/commands/connection/ping)
* [SELECT](https://sugardb.io/docs/commands/connection/select)
* [SWAPDB](https://sugardb.io/docs/commands/connection/swapdb)
## GENERIC
* [DECR](https://sugardb.io/docs/commands/generic/decr)
* [DECRBY](https://sugardb.io/docs/commands/generic/decrby)
* [DEL](https://sugardb.io/docs/commands/generic/del)
* [EXPIRE](https://sugardb.io/docs/commands/generic/expire)
* [EXPIRETIME](https://sugardb.io/docs/commands/generic/expiretime)
* [FLUSHALL](https://sugardb.io/docs/commands/generic/flushall)
* [FLUSHDB](https://sugardb.io/docs/commands/generic/flushdb)
* [GET](https://sugardb.io/docs/commands/generic/get)
* [INCR](https://sugardb.io/docs/commands/generic/incr)
* [INCRBY](https://sugardb.io/docs/commands/generic/incrby)
* [MGET](https://sugardb.io/docs/commands/generic/mget)
* [MSET](https://sugardb.io/docs/commands/generic/mset)
* [PERSIST](https://sugardb.io/docs/commands/generic/persist)
* [PEXPIRE](https://sugardb.io/docs/commands/generic/pexpire)
* [PEXPIRETIME](https://sugardb.io/docs/commands/generic/pexpiretime)
* [PTTL](https://sugardb.io/docs/commands/generic/pttl)
* [RENAME](https://sugardb.io/docs/commands/generic/rename)
* [SET](https://sugardb.io/docs/commands/generic/set)
* [TTL](https://sugardb.io/docs/commands/generic/ttl)
## HASH
* [HDEL](https://sugardb.io/docs/commands/hash/hdel)
* [HEXISTS](https://sugardb.io/docs/commands/hash/hexists)
* [HGET](https://sugardb.io/docs/commands/hash/hget)
* [HGETALL](https://sugardb.io/docs/commands/hash/hgetall)
* [HINCRBY](https://sugardb.io/docs/commands/hash/hincrby)
* [HINCRBYFLOAT](https://sugardb.io/docs/commands/hash/hincrbyfloat)
* [HKEYS](https://sugardb.io/docs/commands/hash/hkeys)
* [HLEN](https://sugardb.io/docs/commands/hash/hlen)
* [HRANDFIELD](https://sugardb.io/docs/commands/hash/hrandfield)
* [HSET](https://sugardb.io/docs/commands/hash/hset)
* [HSETNX](https://sugardb.io/docs/commands/hash/hsetnx)
* [HSTRLEN](https://sugardb.io/docs/commands/hash/hstrlen)
* [HVALS](https://sugardb.io/docs/commands/hash/hvals)
## LIST
* [LINDEX](https://sugardb.io/docs/commands/list/lindex)
* [LLEN](https://sugardb.io/docs/commands/list/llen)
* [LMOVE](https://sugardb.io/docs/commands/list/lmove)
* [LPOP](https://sugardb.io/docs/commands/list/lpop)
* [LPUSH](https://sugardb.io/docs/commands/list/lpush)
* [LPUSHX](https://sugardb.io/docs/commands/list/lpushx)
* [LRANGE](https://sugardb.io/docs/commands/list/lrange)
* [LREM](https://sugardb.io/docs/commands/list/lrem)
* [LSET](https://sugardb.io/docs/commands/list/lset)
* [LTRIM](https://sugardb.io/docs/commands/list/ltrim)
* [RPOP](https://sugardb.io/docs/commands/list/rpop)
* [RPUSH](https://sugardb.io/docs/commands/list/rpush)
* [RPUSHX](https://sugardb.io/docs/commands/list/rpushx)
## PUBSUB
* [PSUBSCRIBE](https://sugardb.io/docs/commands/pubsub/psubscribe)
* [PUBLISH](https://sugardb.io/docs/commands/pubsub/publish)
* [PUBSUB CHANNELS](https://sugardb.io/docs/commands/pubsub/pubsub_channels)
* [PUBSUB NUMPAT](https://sugardb.io/docs/commands/pubsub/pubsub_numpat)
* [PUBSUB NUMSUB](https://sugardb.io/docs/commands/pubsub/pubsub_numsub)
* [PUNSUBSCRIBE](https://sugardb.io/docs/commands/pubsub/punsubscribe)
* [SUBSCRIBE](https://sugardb.io/docs/commands/pubsub/subscribe)
* [UNSUBSCRIBE](https://sugardb.io/docs/commands/pubsub/unsubscribe)
## SET
* [SADD](https://sugardb.io/docs/commands/set/sadd)
* [SCARD](https://sugardb.io/docs/commands/set/scard)
* [SDIFF](https://sugardb.io/docs/commands/set/sdiff)
* [SDIFFSTORE](https://sugardb.io/docs/commands/set/sdiffstore)
* [SINTER](https://sugardb.io/docs/commands/set/sinter)
* [SINTERCARD](https://sugardb.io/docs/commands/set/sintercard)
* [SINTERSTORE](https://sugardb.io/docs/commands/set/sinterstore)
* [SISMEMBER](https://sugardb.io/docs/commands/set/sismember)
* [SMEMBERS](https://sugardb.io/docs/commands/set/smembers)
* [SMISMEMBER](https://sugardb.io/docs/commands/set/smismember)
* [SMOVE](https://sugardb.io/docs/commands/set/smove)
* [SPOP](https://sugardb.io/docs/commands/set/spop)
* [SRANDMEMBER](https://sugardb.io/docs/commands/set/srandmember)
* [SREM](https://sugardb.io/docs/commands/set/srem)
* [SUNION](https://sugardb.io/docs/commands/set/sunion)
* [SUNIONSTORE](https://sugardb.io/docs/commands/set/sunionstore)
## SORTED SET
* [ZADD](https://sugardb.io/docs/commands/sorted_set/zadd)
* [ZCARD](https://sugardb.io/docs/commands/sorted_set/zcard)
* [ZCOUNT](https://sugardb.io/docs/commands/sorted_set/zcount)
* [ZDIFF](https://sugardb.io/docs/commands/sorted_set/zdiff)
* [ZDIFFSTORE](https://sugardb.io/docs/commands/sorted_set/zdiffstore)
* [ZINCRBY](https://sugardb.io/docs/commands/sorted_set/zincrby)
* [ZINTER](https://sugardb.io/docs/commands/sorted_set/zinter)
* [ZINTERSTORE](https://sugardb.io/docs/commands/sorted_set/zinterstore)
* [ZLEXCOUNT](https://sugardb.io/docs/commands/sorted_set/zlexcount)
* [ZMPOP](https://sugardb.io/docs/commands/sorted_set/zmpop)
* [ZMSCORE](https://sugardb.io/docs/commands/sorted_set/zmscore)
* [ZPOPMAX](https://sugardb.io/docs/commands/sorted_set/zpopmax)
* [ZPOPMIN](https://sugardb.io/docs/commands/sorted_set/zpopmin)
* [ZRANDMEMBER](https://sugardb.io/docs/commands/sorted_set/zrandmember)
* [ZRANGE](https://sugardb.io/docs/commands/sorted_set/zrange)
* [ZRANGESTORE](https://sugardb.io/docs/commands/sorted_set/zrangestore)
* [ZRANK](https://sugardb.io/docs/commands/sorted_set/zrank)
* [ZREM](https://sugardb.io/docs/commands/sorted_set/zrem)
* [ZREMRANGEBYLEX](https://sugardb.io/docs/commands/sorted_set/zremrangebylex)
* [ZREMRANGEBYRANK](https://sugardb.io/docs/commands/sorted_set/zremrangebyrank)
* [ZREMRANGEBYSCORE](https://sugardb.io/docs/commands/sorted_set/zremrangebyscore)
* [ZREVRANK](https://sugardb.io/docs/commands/sorted_set/zrevrank)
* [ZSCORE](https://sugardb.io/docs/commands/sorted_set/zscore)
* [ZUNION](https://sugardb.io/docs/commands/sorted_set/zunion)
* [ZUNIONSTORE](https://sugardb.io/docs/commands/sorted_set/zunionstore)
## STRING
* [GETRANGE](https://sugardb.io/docs/commands/string/getrange)
* [SETRANGE](https://sugardb.io/docs/commands/string/setrange)
* [STRLEN](https://sugardb.io/docs/commands/string/strlen)
* [SUBSTR](https://sugardb.io/docs/commands/string/substr)