PING_INLINE: 87260.03 requests per second
PING_BULK: 89206.06 requests per second
SET: 85034.02 requests per second
GET: 87565.68 requests per second
INCR: 91157.70 requests per second
LPUSH: 90334.23 requests per second
RPUSH: 90334.23 requests per second
LPOP: 90334.23 requests per second
RPOP: 90415.91 requests per second
SADD: 90909.09 requests per second
HSET: 84104.29 requests per second
SPOP: 82918.74 requests per second
LPUSH (needed to benchmark LRANGE): 78247.26 requests per second
LRANGE_100 (first 100 elements): 26406.13 requests per second
LRANGE_300 (first 300 elements): 11307.10 requests per second
LRANGE_500 (first 450 elements): 7968.13 requests per second
LRANGE_600 (first 600 elements): 6092.73 requests per second
MSET (10 keys): 65487.89 requests per second
Todo List
Multi Command
Watch Command and CAS support
Stream support
RDB file loader
Master-Slave mode
Sentinel
Read My Code
If you want to read my code in this repository, here is a simple guidance.
project root: only the entry point
config: config parser
interface: some interface definitions
lib: some utils, such as logger, sync utils and wildcard
I suggest focusing on the following directories:
tcp: the tcp server
redis: the redis protocol parser
datastruct: the implements of data structures
dict: a concurrent hash map
list: a linked list
lock: it is used to lock keys to ensure thread safety
set: a hash set based on map
sortedset: a sorted set implements based on skiplist
database: the core of storage engine
database.go: a standalone redis server, with multiple database
single_db.go: data structure and base functions of single database
exec.go: the gateway of database
router.go: the command table
keys.go: handlers for keys commands
string.go: handlers for string commands
list.go: handlers for list commands
hash.go: handlers for hash commands
set.go: handlers for set commands
sortedset.go: handlers for sorted set commands
pubsub.go: implements of publish / subscribe
aof.go: implements of AOF persistence and rewrite
geo.go: implements of geography features
sys.go: authentication and other system function
transaction.go: local transaction
cluster:
cluster.go: entrance of cluster mode
com.go: communication within nodes
del.go: atomic implementation of delete command in cluster
keys.go: keys command
mset.go: atomic implementation of mset command in cluster
请发表评论