rediculous: introduction to redis

16

Click here to load reader

Upload: pootsbook

Post on 12-May-2015

1.298 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: REDIculouS: Introduction to Redis

REDIculouS TITLE

Page 2: REDIculouS: Introduction to Redis

Philip Poots

@pootsbook

Ruby Developer

Audacio.us

3

18

3

ME

Page 3: REDIculouS: Introduction to Redis

SUBJECT

Page 4: REDIculouS: Introduction to Redis

Redis is…

Remote Dictionary Server NoSQL Key-Value Store Data Structures Server ‘Memcached on steroids’

INTRO.

Page 5: REDIculouS: Introduction to Redis

Redis is not…

SQL Document Store BigTable Store

INTRO.

Page 6: REDIculouS: Introduction to Redis

The Grand Schema of things POSITION

Scal

abili

ty &

Pe

rfo

rman

ce

Depth of Functionality

RDBMS

MongoDB CouchDB

Memcached

Redis

Page 7: REDIculouS: Introduction to Redis

Key Value

Rediculously Fast In Memory Database Non-blocking IO, single threaded 100,000+ read/writes per second Complements your existing storage

BENEFITS

Page 8: REDIculouS: Introduction to Redis

Data Structures

String Hash List Set Sorted Set

DATA

Page 9: REDIculouS: Introduction to Redis

Data Structures

String Hash List Set Sorted Set

DATA

Page 10: REDIculouS: Introduction to Redis

Social Connections

friends

SETS

followers following

Page 11: REDIculouS: Introduction to Redis

SQL

Create a JOIN table allowing self-reference on users Create indices Verify uniqueness Write lots of code w/ slow queries

SETS

Page 12: REDIculouS: Introduction to Redis

Redis

For each user have two sets: -  following [1, 3, 5] -  followers [ 2, 3, 4, 7, 9]

SETS

Page 13: REDIculouS: Introduction to Redis

Redis: Following

SADDuser:1:following2SADDuser:2:followers1SADDuser:1:following3SADDuser:3:followers1SMEMBERSuser:1:following=>[2,3]

SETS

Page 14: REDIculouS: Introduction to Redis

Redis: Friend

SADDuser:2:following1SADDuser:1:followers2SINTERuser:1:followinguser:1:followers=>[2]

SETS

Page 15: REDIculouS: Introduction to Redis

Social Connections Redis

SINTER user:1:following user:1:followers

SETS

user:1:following user:1:followers

Page 16: REDIculouS: Introduction to Redis

Redis

redis.io

MORE