gredis

package module
v0.0.0-...-828dd00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

Instruction

high-performance, non-blocking network IO Redis frameworks for Go, based on epoll gnet network model

Installing

go get -u github.com/leslie-fei/gredis

Example

Here's a full example of a Redis clone that accepts:

  • SET key value
  • GET key
  • DEL key
  • PING
  • QUIT

Benchmarks

Redis: Single-threaded, no disk persistence.
$ redis-server --port 6379 --appendonly no
[root@localhost ~]# redis-benchmark -h 127.0.0.1 -p 6379 -t set,get -n 10000000 -q -P 512 -c 512
SET: 987166.81 requests per second
GET: 1220405.12 requests per second
GRedis
GOMAXPROCS=1 go run example/main.go
[root@localhost ~]# redis-benchmark -h 127.0.0.1 -p 6380 -t set,get -n 10000000 -q -P 512 -c 512
SET: 1199328.38 requests per second
GET: 1218769.00 requests per second
GOMAXPROCS=0 go run example/main.go
[root@localhost ~]# redis-benchmark -h 127.0.0.1 -p 6380 -t set,get -n 10000000 -q -P 512 -c 512
SET: 2018978.38 requests per second
GET: 5611672.50 requests per second
Redcon
$ GOMAXPROCS=1 go run example/clone.go
[root@localhost ~]# redis-benchmark -h 127.0.0.1 -p 6380 -t set,get -n 10000000 -q -P 512 -c 512
SET: 1331557.88 requests per second
GET: 1638538.38 requests per second
$ GOMAXPROCS=0 go run example/clone.go
[root@localhost ~]# redis-benchmark -h 127.0.0.1 -p 6380 -t set,get -n 10000000 -q -P 512 -c 512
SET: 1685772.00 requests per second
GET: 5246589.50 requests per second

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandHandler

type CommandHandler func(conn gnet.Conn, cmd resp.Command) (out []byte, err error)

type GRedis

type GRedis interface {
	Serve(addr string, tc *tls.Config, options ...gnet.Option) error
	OnCommand(h CommandHandler)
	Subscribe(conn gnet.Conn, pattern bool, channels []string)
	Publish(channel, message string) int
}

func NewGRedis

func NewGRedis() GRedis

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL