elasticache
DESCRIPTION
An introduction of Amazon ElastiCacheTRANSCRIPT
What is Cache?
IF x is in the cache: return xELSE generate x save x to cache return x
13年10月9⽇日星期三
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⽇日星期三
memcached
13年10月9⽇日星期三
memcached
• Memcached is an in-memory key-value store for small chunks of arbitrary data
13年10月9⽇日星期三
memcached
• Memcached is an in-memory key-value store for small chunks of arbitrary data
• 其實沒啥好講的...
13年10月9⽇日星期三
redis
13年10月9⽇日星期三
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⽇日星期三
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⽇日星期三
基本款
• SET key value
• GET key
• INCR key
• EXPIRE key time
• TTL key
13年10月9⽇日星期三
LIST
• LPUSH/RPUSH key element
• LPOP/RPOP key
• LRANGE key start stop
13年10月9⽇日星期三
SET
• SADD key element
• SREM key element
• SISMEMBER key element
• SMEMBERS key
• SUNION key1 key2
• SINTER key1 key2
13年10月9⽇日星期三
SORTED SET
• ZADD key score value
• ZRANGE key start stop
13年10月9⽇日星期三
PUB/SUB
• SUBSCRIBE key
• PUBLISH key value
13年10月9⽇日星期三
redis 太超過了!
13年10月9⽇日星期三
One More Thing...
13年10月9⽇日星期三
redis Persistence
• RDB - snapshot
• AOF - logs every write operation
• 參考 http://redis.io/topics/persistence
13年10月9⽇日星期三
Scaling - Memcached
• Cluster
• NodeNODE2
NODE1
CLUSTER1
AZ1
NODE2
NODE1
CLUSTER2
AZ2
13年10月9⽇日星期三
Scaling - redis
• Read Replication Across AZ
MASTER
CLUSTER1
AZ1
SLAVE
CLUSTER1
AZ213年10月9⽇日星期三
AWS 幫你...
• Deploy
• Manage
• Elastic
• Secure
13年10月9⽇日星期三
DEMO 一下
13年10月9⽇日星期三
PRICING
• http://aws.amazon.com/elasticache/pricing/
• 其實不算超貴...
13年10月9⽇日星期三
結論
13年10月9⽇日星期三
結論
• 調整你的程式之前先想想看 Cache
13年10月9⽇日星期三
結論
• 調整你的程式之前先想想看 Cache
• 調整你的 DataBase 之前先想想看 Cache
13年10月9⽇日星期三
結論
• 調整你的程式之前先想想看 Cache
• 調整你的 DataBase 之前先想想看 Cache
• 換掉你的 DataBase 之前先想想看 Cache
13年10月9⽇日星期三
結論
• 調整你的程式之前先想想看 Cache
• 調整你的 DataBase 之前先想想看 Cache
• 換掉你的 DataBase 之前先想想看 Cache
• redis 這麼棒有機會就用一下吧
13年10月9⽇日星期三
如果上了 Memory Cache 還是不夠力...
13年10月9⽇日星期三
USE Varnish
• http://blog.disqus.com/post/62187806135/scaling-django-to-8-billion-page-views
• 45k req/s -> 15k req/s
13年10月9⽇日星期三