/gredcon

A Redis compatible server framework for Go based on gnet

Primary LanguageGoMIT LicenseMIT

logo

License GoDoc

A Redis compatible server framework for Go based on gnet

Features

  • Create a Fast custom Redis compatible server in Go
  • Simple interface. One function ListenAndServe and two types Conn & 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

Installing

go get -u github.com/nisainan/gredcon

Example

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

Benchmarks

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

License

GRedcon source code is available under the MIT License.

Thanks

redcon,gnet