elasticache

29
Amazon ElastiCache Andy Dai [email protected] 2013/10/9 13年10月9星期三

Upload: andy-dai

Post on 06-May-2015

501 views

Category:

Technology


0 download

DESCRIPTION

An introduction of Amazon ElastiCache

TRANSCRIPT

Page 1: ElastiCache

Amazon ElastiCache

Andy Dai [email protected]/10/9

13年10月9⽇日星期三

Page 2: ElastiCache

What is Cache?

IF x is in the cache: return xELSE generate x save x to cache return x

13年10月9⽇日星期三

Page 3: ElastiCache

Cache in Web

given a URL, try finding that page in the cacheif the page is in the cache: return the cached pageelse: generate the page save the generated page in the cache return the generated page

13年10月9⽇日星期三

Page 4: ElastiCache

memcached

13年10月9⽇日星期三

Page 5: ElastiCache

memcached

• Memcached is an in-memory key-value store for small chunks of arbitrary data

13年10月9⽇日星期三

Page 6: ElastiCache

memcached

• Memcached is an in-memory key-value store for small chunks of arbitrary data

• 其實沒啥好講的...

13年10月9⽇日星期三

Page 7: ElastiCache

redis

13年10月9⽇日星期三

Page 8: ElastiCache

redis

•Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server

13年10月9⽇日星期三

Page 9: ElastiCache

redis

•Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server

•什麼是 data structure server?

13年10月9⽇日星期三

Page 10: ElastiCache

基本款

• SET key value

• GET key

• INCR key

• EXPIRE key time

• TTL key

13年10月9⽇日星期三

Page 11: ElastiCache

LIST

• LPUSH/RPUSH key element

• LPOP/RPOP key

• LRANGE key start stop

13年10月9⽇日星期三

Page 12: ElastiCache

SET

• SADD key element

• SREM key element

• SISMEMBER key element

• SMEMBERS key

• SUNION key1 key2

• SINTER key1 key2

13年10月9⽇日星期三

Page 13: ElastiCache

SORTED SET

• ZADD key score value

• ZRANGE key start stop

13年10月9⽇日星期三

Page 14: ElastiCache

PUB/SUB

• SUBSCRIBE key

• PUBLISH key value

13年10月9⽇日星期三

Page 15: ElastiCache

redis 太超過了!

13年10月9⽇日星期三

Page 16: ElastiCache

One More Thing...

13年10月9⽇日星期三

Page 17: ElastiCache

redis Persistence

• RDB - snapshot

• AOF - logs every write operation

• 參考 http://redis.io/topics/persistence

13年10月9⽇日星期三

Page 18: ElastiCache

Scaling - Memcached

• Cluster

• NodeNODE2

NODE1

CLUSTER1

AZ1

NODE2

NODE1

CLUSTER2

AZ2

13年10月9⽇日星期三

Page 19: ElastiCache

Scaling - redis

• Read Replication Across AZ

MASTER

CLUSTER1

AZ1

SLAVE

CLUSTER1

AZ213年10月9⽇日星期三

Page 20: ElastiCache

AWS 幫你...

• Deploy

• Manage

• Elastic

• Secure

13年10月9⽇日星期三

Page 21: ElastiCache

DEMO 一下

13年10月9⽇日星期三

Page 22: ElastiCache

PRICING

• http://aws.amazon.com/elasticache/pricing/

• 其實不算超貴...

13年10月9⽇日星期三

Page 23: ElastiCache

結論

13年10月9⽇日星期三

Page 24: ElastiCache

結論

• 調整你的程式之前先想想看 Cache

13年10月9⽇日星期三

Page 25: ElastiCache

結論

• 調整你的程式之前先想想看 Cache

• 調整你的 DataBase 之前先想想看 Cache

13年10月9⽇日星期三

Page 26: ElastiCache

結論

• 調整你的程式之前先想想看 Cache

• 調整你的 DataBase 之前先想想看 Cache

• 換掉你的 DataBase 之前先想想看 Cache

13年10月9⽇日星期三

Page 27: ElastiCache

結論

• 調整你的程式之前先想想看 Cache

• 調整你的 DataBase 之前先想想看 Cache

• 換掉你的 DataBase 之前先想想看 Cache

• redis 這麼棒有機會就用一下吧

13年10月9⽇日星期三

Page 28: ElastiCache

如果上了 Memory Cache 還是不夠力...

13年10月9⽇日星期三