SlideShare a Scribd company logo
Amazon ElastiCache
Andy Dai andy@dorm7.com
2013/10/9
13年10月9⽇日星期三
What is Cache?
IF x is in the cache:
return x
ELSE
generate x
save x to cache
return x
13年10月9⽇日星期三
Cache in Web
given a URL, try finding that page in the
cache
if the page is in the cache:
return the cached page
else:
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
• Node
NODE2
NODE1
CLUSTER1
AZ1
NODE2
NODE1
CLUSTER2
AZ2
13年10月9⽇日星期三
Scaling - redis
• Read Replication Across AZ
MASTER
CLUSTER1
AZ1
SLAVE
CLUSTER1
AZ2
13年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⽇日星期三
USEVarnish
• http://blog.disqus.com/post/62187806135/
scaling-django-to-8-billion-page-views
• 45k req/s -> 15k req/s
13年10月9⽇日星期三

More Related Content

PPT
big web site
PDF
PDF
高可用可扩展数据库架构方案探讨
PDF
TEDxWalledCity Presentation on Cities in India
PPT
PHPUnit Automated Unit Testing Framework
PDF
PhpUnit - The most unknown Parts
PDF
Why documentation osidays
PPTX
Introduction to EC2
big web site
高可用可扩展数据库架构方案探讨
TEDxWalledCity Presentation on Cities in India
PHPUnit Automated Unit Testing Framework
PhpUnit - The most unknown Parts
Why documentation osidays
Introduction to EC2

Similar to ElastiCache (7)

PPTX
Memcached vs redis
PDF
Memcached简介
PDF
Memcached
PDF
Memcached全面剖析
PDF
Memcached
PDF
Memcached
PPT
Redis分享
Memcached vs redis
Memcached简介
Memcached
Memcached全面剖析
Memcached
Memcached
Redis分享
Ad

More from Andy Dai (17)

PDF
Grpc + python.key
PDF
該怎麼樣(認真的)部署你的 Python Web 應用程式?
PDF
Power UP your CLI
PDF
Search search search
PDF
Django channels
PDF
Django Third party packages
PDF
Practical django secuirty
PDF
總之來講講 Search
PDF
Python web meetup 11 18
PDF
Django in heavy load environment
PDF
電腦不只會幫你選土豆,還會幫你選新聞
PDF
用 Python 打造你自己的 summly
PDF
Tradeoffs of replacing core components
PDF
Dynamo db
PDF
Django deploy
PDF
Build your own trello witihin 100 LOC (with Meteor)
PDF
Boost your django admin with Grappelli
Grpc + python.key
該怎麼樣(認真的)部署你的 Python Web 應用程式?
Power UP your CLI
Search search search
Django channels
Django Third party packages
Practical django secuirty
總之來講講 Search
Python web meetup 11 18
Django in heavy load environment
電腦不只會幫你選土豆,還會幫你選新聞
用 Python 打造你自己的 summly
Tradeoffs of replacing core components
Dynamo db
Django deploy
Build your own trello witihin 100 LOC (with Meteor)
Boost your django admin with Grappelli
Ad

ElastiCache