Redis Logo

Redis: open-source In-Memory Database

Redis is an open source in-memory data structure store, used as a database, cache and message broker that supports many types of data structures. It is considered being one of the fastest in-memory key-value database. Redis is a popular choice for caching, session management, gaming, leaderboards, real-time analytics, geospatial, ride-hailing, chat/messaging, media streaming, and pub/sub apps.
Written in: C

Download Redis: Source Code

License: OpenSource BSD License (3-Clause)

Project Website: redis.io

Documentation: redis.io/documentation

Project Goals
  • Redis can deliver sub-millisecond response times enabling millions of requests per second for real-time applications.
  • A typical Redis instance running on a low end, untuned box usually provides good enough performance for most applications.
  • Being single-threaded, Redis favors fast CPUs with large caches and not many cores.
  • Redis employs a primary-replica architecture and supports asynchronous replication where data can be replicated to multiple replica servers.
Project Features
  • Redis supports various data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams.
  • It has built-in replication, LRU eviction and different levels of on-disk persistence.
  • Other features include:
    • Transactions
    • Pub/Sub
    • Lua scripting
    • Keys with a limited time-to-live
Project Design and Security
  • Redis supports atomic operations on data types, like appending to a string; incrementing the value in a hash; pushing an element to a list; computing set intersection, union and difference; or getting the member with highest ranking in a sorted set.
  • It works with an in-memory dataset that can persists by dumping the dataset to disk.
  • All Redis data resides in-memory, in contrast to databases that store data on disk or SSDs.
  • By eliminating the need to access disks, in-memory data stores such as Redis avoid seek time delays and can access data in microseconds.
  • The redis syslog offers a very good logging facility with all the necessary information to run daily or debug

Sample Configuration
## Sample Configuration for Redis @ /etc/redis/redis.conf

bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511

timeout 0
tcp-keepalive 300

daemonize yes
supervised no
pidfile /var/run/redis/redis_6379.pid

loglevel notice
syslog-enabled yes
syslog-ident redis
syslog-facility daemon

databases 16

always-show-logo yes

save 900 1
save 300 10
save 60 10000

stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/redis

replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100

maxclients 96
maxmemory 32GB
maxmemory-policy volatile-lru

lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no

appendonly no
appendfilename "appendonly.aof"
# appendfsync always
appendfsync everysec
# appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes

lua-time-limit 5000

slowlog-log-slower-than 10000
slowlog-max-len 128

latency-monitor-threshold 0

notify-keyspace-events ""

hash-max-ziplist-entries 512
hash-max-ziplist-value 64

list-max-ziplist-size -2
list-compress-depth 0

set-max-intset-entries 512

zset-max-ziplist-entries 128
zset-max-ziplist-value 64

hll-sparse-max-bytes 3000

stream-node-max-bytes 4096
stream-node-max-entries 100

activerehashing yes

client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60

hz 10
dynamic-hz yes

aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes

## END