A Redis compatible server framework for Go based on gnet
- Create a Fast custom Redis compatible server in Go
- Simple interface. One function
ListenAndServe
and two typesConn
&Command
- Support for pipelining and telnet commands
- Works with Redis clients such as redigo, redis-py, node_redis, and jedis
- Compatible pub/sub support
- Multithreaded
go get -u github.com/nisainan/gredcon
Here's a full example of a Redis clone that accepts:
- SET key value
- GET key
- DEL key
- PING
You can run this example from a terminal:
go run example/main.go
Redis: Single-threaded, no disk persistence.
$ redis-server --port 6379 --appendonly no
redis-benchmark -p 6379 -t set,get -n 10000000 -q -P 512 -c 512
SET: 941265.12 requests per second
GET: 1189909.50 requests per second
Redcon: Single-threaded, no disk persistence.
$ GOMAXPROCS=1 go run example/clone.go
redis-benchmark -p 6380 -t set,get -n 10000000 -q -P 512 -c 512
SET: 2018570.88 requests per second
GET: 2403846.25 requests per second
Redcon: Multi-threaded, no disk persistence.
$ GOMAXPROCS=0 go run example/clone.go
$ redis-benchmark -p 6380 -t set,get -n 10000000 -q -P 512 -c 512
SET: 1944390.38 requests per second
GET: 3993610.25 requests per second
Running on a MacBook Pro 15" 2.8 GHz Intel Core i7 using Go 1.7
GRedcon: multicore, no disk persistence.
$ redis-benchmark -p 9876 -c 120 -n 20000000 -t get,set -P 2000 -q
SET: 5630630.50 requests per second
GET: 11428028.00 requests per second
Running on a Ubuntu20.04 i7-9700 CPU @ 3.00GHz using Go 1.7
GRedcon source code is available under the MIT License.