rediculous: introduction to redis
TRANSCRIPT
REDIculouS TITLE
Philip Poots
@pootsbook
Ruby Developer
Audacio.us
3
18
3
ME
SUBJECT
Redis is…
Remote Dictionary Server NoSQL Key-Value Store Data Structures Server ‘Memcached on steroids’
INTRO.
Redis is not…
SQL Document Store BigTable Store
INTRO.
The Grand Schema of things POSITION
Scal
abili
ty &
Pe
rfo
rman
ce
Depth of Functionality
RDBMS
MongoDB CouchDB
Memcached
Redis
Key Value
Rediculously Fast In Memory Database Non-blocking IO, single threaded 100,000+ read/writes per second Complements your existing storage
BENEFITS
Data Structures
String Hash List Set Sorted Set
DATA
Data Structures
String Hash List Set Sorted Set
DATA
Social Connections
friends
SETS
followers following
SQL
Create a JOIN table allowing self-reference on users Create indices Verify uniqueness Write lots of code w/ slow queries
SETS
Redis
For each user have two sets: - following [1, 3, 5] - followers [ 2, 3, 4, 7, 9]
SETS
Redis: Following
SADDuser:1:following2SADDuser:2:followers1SADDuser:1:following3SADDuser:3:followers1SMEMBERSuser:1:following=>[2,3]
SETS
Redis: Friend
SADDuser:2:following1SADDuser:1:followers2SINTERuser:1:followinguser:1:followers=>[2]
SETS
Social Connections Redis
SINTER user:1:following user:1:followers
SETS
user:1:following user:1:followers
Redis
redis.io
MORE