A Golang implemented Redis Server and Cluster. Go 语言实现的 Redis 服务器和分布式集群
See the codeGodis is a golang implementation of Redis Server, which intents to provide an example of writing a high concurrent
middleware using golang.
Key Features:
SELECT commandMSET, MSETNX, DEL, Rename, RenameNX command is supported and atomically executed in cluster mode, allow over multi node.MULTI Commands Transaction is supported within slot in cluster modeIf you could read Chinese, you can find more details in My Blog.
You can get runnable program in the releases of this repository, which supports Linux and Darwin system.
./godis-darwin
./godis-linux

You could use redis-cli or other redis client to connect godis server, which listens on 0.0.0.0:6399 on default mode.

The program will try to read config file path from environment variable CONFIG.
If environment variable is not set, then the program try to read redis.conf in the working directory.
Please see example.conf for all configuration information.
We provide node1.conf and node2.conf for demonstration. use following command line to start a two-node-cluster:
CONFIG=node1.conf ./godis-darwin &
CONFIG=node2.conf ./godis-darwin &
Connect to a node in the cluster to access all data in the cluster:
redis-cli -p 6399
Please refer to example.conf for cluster configuration.
See: commands.md
Environment:
Go version:1.23 System: MacOS Monterey 12.5 M2 Air
Performance report by redis-benchmark:
PING_INLINE: 179211.45 requests per second, p50=1.031 msec
PING_MBULK: 173611.12 requests per second, p50=1.071 msec
SET: 158478.61 requests per second, p50=1.535 msec
GET: 156985.86 requests per second, p50=1.127 msec
INCR: 164473.69 requests per second, p50=1.063 msec
LPUSH: 151285.92 requests per second, p50=1.079 msec
RPUSH: 176678.45 requests per second, p50=1.023 msec
LPOP: 177619.89 requests per second, p50=1.039 msec
RPOP: 172413.80 requests per second, p50=1.039 msec
SADD: 159489.64 requests per second, p50=1.047 msec
HSET: 175131.36 requests per second, p50=1.031 msec
SPOP: 170648.45 requests per second, p50=1.031 msec
ZADD: 165289.25 requests per second, p50=1.039 msec
ZPOPMIN: 185528.77 requests per second, p50=0.999 msec
LPUSH (needed to benchmark LRANGE): 172117.05 requests per second, p50=1.055 msec
LRANGE_100 (first 100 elements): 46511.62 requests per second, p50=4.063 msec
LRANGE_300 (first 300 elements): 21217.91 requests per second, p50=9.311 msec
LRANGE_500 (first 500 elements): 13331.56 requests per second, p50=14.407 msec
LRANGE_600 (first 600 elements): 11153.25 requests per second, p50=17.007 msec
MSET (10 keys): 88417.33 requests per second, p50=3.687 msec
If you want to read my code in this repository, here is a simple guidance.
I suggest focusing on the following directories:
delete command in clustermset command in clusterrename command in clusterThis project is licensed under the GPL license.
59 followers · starred May 2025
81 followers · starred Jun 2021
189 followers · starred Apr 2021
33 followers · starred May 2022
A Golang implemented Redis Server and Cluster. Go 语言实现的 Redis 服务器和分布式集群
See the codeGodis is a golang implementation of Redis Server, which intents to provide an example of writing a high concurrent
middleware using golang.
Key Features:
SELECT commandMSET, MSETNX, DEL, Rename, RenameNX command is supported and atomically executed in cluster mode, allow over multi node.MULTI Commands Transaction is supported within slot in cluster modeIf you could read Chinese, you can find more details in My Blog.
You can get runnable program in the releases of this repository, which supports Linux and Darwin system.
./godis-darwin
./godis-linux

You could use redis-cli or other redis client to connect godis server, which listens on 0.0.0.0:6399 on default mode.

The program will try to read config file path from environment variable CONFIG.
If environment variable is not set, then the program try to read redis.conf in the working directory.
Please see example.conf for all configuration information.
We provide node1.conf and node2.conf for demonstration. use following command line to start a two-node-cluster:
CONFIG=node1.conf ./godis-darwin &
CONFIG=node2.conf ./godis-darwin &
Connect to a node in the cluster to access all data in the cluster:
redis-cli -p 6399
Please refer to example.conf for cluster configuration.
See: commands.md
Environment:
Go version:1.23 System: MacOS Monterey 12.5 M2 Air
Performance report by redis-benchmark:
PING_INLINE: 179211.45 requests per second, p50=1.031 msec
PING_MBULK: 173611.12 requests per second, p50=1.071 msec
SET: 158478.61 requests per second, p50=1.535 msec
GET: 156985.86 requests per second, p50=1.127 msec
INCR: 164473.69 requests per second, p50=1.063 msec
LPUSH: 151285.92 requests per second, p50=1.079 msec
RPUSH: 176678.45 requests per second, p50=1.023 msec
LPOP: 177619.89 requests per second, p50=1.039 msec
RPOP: 172413.80 requests per second, p50=1.039 msec
SADD: 159489.64 requests per second, p50=1.047 msec
HSET: 175131.36 requests per second, p50=1.031 msec
SPOP: 170648.45 requests per second, p50=1.031 msec
ZADD: 165289.25 requests per second, p50=1.039 msec
ZPOPMIN: 185528.77 requests per second, p50=0.999 msec
LPUSH (needed to benchmark LRANGE): 172117.05 requests per second, p50=1.055 msec
LRANGE_100 (first 100 elements): 46511.62 requests per second, p50=4.063 msec
LRANGE_300 (first 300 elements): 21217.91 requests per second, p50=9.311 msec
LRANGE_500 (first 500 elements): 13331.56 requests per second, p50=14.407 msec
LRANGE_600 (first 600 elements): 11153.25 requests per second, p50=17.007 msec
MSET (10 keys): 88417.33 requests per second, p50=3.687 msec
If you want to read my code in this repository, here is a simple guidance.
I suggest focusing on the following directories:
delete command in clustermset command in clusterrename command in clusterThis project is licensed under the GPL license.
59 followers · starred May 2025
81 followers · starred Jun 2021
189 followers · starred Apr 2021
33 followers · starred May 2022