12. Memcached简介
Free & open source, high-performance, distributed
memory object caching system, generic in nature, but
intended for use in speeding up dynamic web
applications by alleviating database load.
13. Memcached简介
• Key-Value
• Simple Protocol
– set/get
– incr/decr
– stats
• Lazy Expiration
• LRU
• Not Support Traversal
• Access
– Telnet
– printf 'statsrn' | nc ip port
– Java client
14. Memcached简介
The primary goal of the slabs subsystem in memcached
was to eliminate memory fragmentation issues
totally by using fixedsize memory chunks coming from a
few predetermined size classes.
15. Feed Timeline
• Memcached使用示例
– 单条微博数据结构
• key:status id
• value:content protocol buffer object(why not json?)
– 用户微博列表数据结构
• key:user id
• value:status id array(bytes,why not java long[]?)
– nio byte buffer convert long[] to byte[]
56. Redis简介
Redis is an open source, advanced key-value store. It is
often referred to as a data structure server since keys
can contain strings, hashes, lists, sets and sorted sets.
REmote DIctionary Server
57. Redis简介
• Advanced、Fast Key-Value Store
• Rich Data Types
– Strings:get/set/incr/decr
– Hash:hget/hgetall/hset
– List:lpush/lpop/lrange
– Set:sadd/srem/smembers
– Info
• Uses Memory As Main Storage
• Single Thread
• Uses Disk For Persistence
– rdb
– aof
• Replication
• Access
– Telnet
– printf ‘info rn' | nc ip port
– Java client