redis to the rescue?

27
Redis to the Rescue? Berlin Buzzwords 2011-06-07

Upload: tim-lossen

Post on 06-May-2015

1.629 views

Category:

Business


4 download

TRANSCRIPT

Page 1: Redis to the Rescue?

Redis to the Rescue?

Berlin Buzzwords2011-06-07

Page 2: Redis to the Rescue?

Who

• Tim Lossen / @tlossen

• backend developer at wooga

• Berlin, Germany

Page 5: Redis to the Rescue?

Goals

• 1 million players per day (“DAU = daily active users”)

Page 6: Redis to the Rescue?

Goals

• 1 million players per day (“DAU = daily active users”)

• small production cluster

- less operational overhead

- cheaper

Page 7: Redis to the Rescue?

Architecture

Page 9: Redis to the Rescue?

Data Model

• user = single Redis hash

- each entity stored in hash field (serialized to JSON)

• custom Ruby mapping layer (“Remodel”)

Page 10: Redis to the Rescue?

1220032045 u1 {“level”: 4,“xp”: 241}

u1_pets [“p7”, “p8”]

p7 {“pet_type”: “Cat”}

p8 {“pet_type”: “Dog”}

1234599660 u1 {“level”: 1,“xp”: 22}

u1_pets [“p3”]

... ...

Page 11: Redis to the Rescue?

1220032045 u1 {“level”: 4,“xp”: 241}

u1_pets [“p7”, “p8”]

p7 {“pet_type”: “Cat”}

p8 {“pet_type”: “Dog”}

1234599660 u1 {“level”: 1,“xp”: 22}

u1_pets [“p3”]

... ...

Page 12: Redis to the Rescue?

Setup A (July 2010)

Page 13: Redis to the Rescue?

Setup B (Nov 2010)

Page 14: Redis to the Rescue?

Setup B (Dec 2010)

Page 15: Redis to the Rescue?

Analysis

• Redis virtual memory not compatible with:

- persistence

- replication

Page 16: Redis to the Rescue?

Setup B’ (Dec 2010)

Page 17: Redis to the Rescue?

Setup C (Dec 2010)

Page 18: Redis to the Rescue?

Setup D (May 2011)

Page 19: Redis to the Rescue?

Status

• peak traffic:

- 3000 requests/s

- 35000 Redis operations/s

• average backend response time:

- 10 ms

Page 21: Redis to the Rescue?

Goals

• 1 million DAU

• small production cluster

Page 22: Redis to the Rescue?

Production Cluster

Text

(1x intel core i7 X980,6 cores, 24 gig ram)

Page 23: Redis to the Rescue?

Goals

• 1 million DAU

• small production cluster

Page 24: Redis to the Rescue?

Redis Highlights

• high sustained throughput / performance

• very stable

• active & helpful community

Page 25: Redis to the Rescue?

Redis Gotchas

• memory consumption

- fragmentation!

• durability

Page 26: Redis to the Rescue?

Q & A