Redis [DRAFT]
Created at 2017-04-21T16:32:41+09:00

Build from source

Build from source:

$ mkdir -p _install
$ make install PREFIX=$PWD/_install

Playing with brand-new redis:

# Run server
$ ./_install/bin/redis-server ./redis.conf

# Run client
$ ./_install/bin/redis-cli -h localhost -p 6379
localhost:6379> set foo bar
OK
localhost:6379> get foo
"bar"
localhost:6379> get f00
(nil)

Architecture

redis-cli
hiredis
redis-server

[ Data structure ]
(client: redis-cli using hiredis)
redisContext
redisReply

(server)

redis-server

  • tcp stack
  • background thread use ?
  • threading, forking
  • data layout in memory and in file

Configuration

This config file (https://github.com/antirez/redis/blob/unstable/redis.conf) works as good feature list.

# tcp stack tuning
tcp-backlog ?
tcp-keepalive ?
maxclients

# upstart/systemd integratoin
supervised ?

# log output
logfile
syslog-enabled

# databses
databases

# snapshot frequency
save

# replication
?

# automatic cache out
maxmemory
maxmemory-policy
maxmemory-samples

# append only persistence (aof)
appendonly
fsync

# clustering
cluster-enabled

# built-in latency monitor
latency-monitor-threshold

# pub/sub
notify-keyspace-events

# garbage collection or compaction ?
activerehashing

# disconnect slow-socket-reader (mainly for pub/sub client)
client-output-buffer-limit

# background thread spawning frequency ?
hz

# LFU cache tuning
lfu-log-factor
lfu-decay-time

TODO

  • tcp server implementation
  • data structure/layout in storage and in memory
  • cache implementation
  • pub/sub impl
  • rails usage

Reference