using ampere for super-fast data caching awesomeness

23
USING AMPERE for Super-Fast Data Caching Awesomeness 1 Tuesday, October 2, 12

Upload: villainous

Post on 07-May-2015

336 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Using Ampere for Super-Fast Data Caching Awesomeness

USING AMPEREfor Super-Fast Data Caching Awesomeness

1

Tuesday, October 2, 12

Page 2: Using Ampere for Super-Fast Data Caching Awesomeness

HII’m Max. I work at Trunk Club. I build and fix stuff a lot. Like

motorcycles and junk.2

Tuesday, October 2, 12

Page 3: Using Ampere for Super-Fast Data Caching Awesomeness

WHAT’S AMPERE?

3

Tuesday, October 2, 12

Page 4: Using Ampere for Super-Fast Data Caching Awesomeness

YET ANOTHER ORMIt’s an object relational model (ORM) like ActiveRecord,

Mongoid, or DataMapper.

Ampere : Redis :: Mongoid : MongoDB :: ActiveRecord : SQL

Tuesday, October 2, 12

Page 5: Using Ampere for Super-Fast Data Caching Awesomeness

WHAT’S REDIS?

5

Tuesday, October 2, 12

Page 6: Using Ampere for Super-Fast Data Caching Awesomeness

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

6

Tuesday, October 2, 12

Page 7: Using Ampere for Super-Fast Data Caching Awesomeness

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

•Durable. Your data’s still there even after a restart.

7

Tuesday, October 2, 12

Page 8: Using Ampere for Super-Fast Data Caching Awesomeness

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

•Durable. Your data’s still there even after a restart.

• Supports more complex data structures like lists, sets, and hashes.

8

Tuesday, October 2, 12

Page 9: Using Ampere for Super-Fast Data Caching Awesomeness

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

•Durable. Your data’s still there even after a restart.

• Supports more complex data structures like lists, sets, and hashes.

• Pub/sub event-driven magic.

9

Tuesday, October 2, 12

Page 10: Using Ampere for Super-Fast Data Caching Awesomeness

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

•Durable. Your data’s still there even after a restart.

• Supports more complex data structures like lists, sets, and hashes.

• Pub/sub event-driven magic.

• Scriptable in Lua (like anyone cares).

10

Tuesday, October 2, 12

Page 11: Using Ampere for Super-Fast Data Caching Awesomeness

A PEEK INSIDE AMPEREHow, exactly, does the magic happen?

Tuesday, October 2, 12

Page 12: Using Ampere for Super-Fast Data Caching Awesomeness

AMPERE AT WORKAmpere stores models as Hashes in Redis at keys defined by

the class name.

Post

post.1

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

Page 13: Using Ampere for Super-Fast Data Caching Awesomeness

Relationships are stored in Redis as Sets of IDs.

Post Comment

post.1 post.1.comments

AMPERE AT WORK

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

Page 14: Using Ampere for Super-Fast Data Caching Awesomeness

AMPERE AT WORKRelationships are stored in Redis as Sets of IDs.

Post CommentComment

post.1 post.1.comments

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

Page 15: Using Ampere for Super-Fast Data Caching Awesomeness

AMPERE AT WORKRelationships are stored in Redis as Sets of IDs.

Post CommentCommentComment

post.1 post.1.comments

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

Page 16: Using Ampere for Super-Fast Data Caching Awesomeness

AMPERE AT WORKRelationships are stored in Redis as Sets of IDs.

Post CommentCommentComment

post.1 post.1.comments

Comment

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

Page 17: Using Ampere for Super-Fast Data Caching Awesomeness

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

Page 18: Using Ampere for Super-Fast Data Caching Awesomeness

•Define fields with the field method

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

Page 19: Using Ampere for Super-Fast Data Caching Awesomeness

•Define fields with the field method

• Store whatever kind of data you want as long as it can be marshaled

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

Page 20: Using Ampere for Super-Fast Data Caching Awesomeness

•Define fields with the field method

• Store whatever kind of data you want as long as it can be marshaled

• Use has_one, has_many, and belongs_to as usual

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

Page 21: Using Ampere for Super-Fast Data Caching Awesomeness

•Define fields with the field method

• Store whatever kind of data you want as long as it can be marshaled

• Use has_one, has_many, and belongs_to as usual

• That’s it. (Srsly.)

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

Page 22: Using Ampere for Super-Fast Data Caching Awesomeness

UNDER CONSTRUCTIONAmpere is under active development.There’s still more awesome to come.

Tuesday, October 2, 12

Page 23: Using Ampere for Super-Fast Data Caching Awesomeness

http://github.com/mstahlhttp://twitter.com/villainous

[email protected]

23

For tracking me down

http://redis.io/

For learning about Redis

Here are some links

Tuesday, October 2, 12