Memcache和Redis區別

memcache官方定義html

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.java

redis官方定義
Redis is an open source, BSD licensed, 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.web

版權相同redis

它們都是使用的bsd協議,使用它的項目能夠用於商業用戶,沒必要發佈二次修改的代碼,能夠修改源代碼。緩存

數據類型併發

redis數據類型豐富,支持set liset等類型
memcache支持簡單數據類型,須要客戶端本身處理複製對象app

持久性分佈式

redis支持數據落地持久化存儲
memcache不支持數據持久存儲spa

分佈式存儲.net

redis支持master-slave複製模式
memcache能夠使用一致性hash作分佈式

value大小不一樣

memcache是一個內存緩存,key的長度小於250字符,單個item存儲要小於1M,不適合虛擬機使用

數據一致性不一樣

redis使用的是單線程模型,保證了數據按順序提交。
memcache須要使用cas保證數據一致性。CAS(Check and Set)是一個確保併發一致性的機制,屬於「樂觀鎖」範疇;原理很簡單:拿版本號,操做,對比版本號,若是一致就操做,不一致就放棄任何操做

cpu利用

redis單線程模型只能使用一個cpu,能夠開啓多個redis進程

參考

http://www.cnblogs.com/qunshu/p/3196972.html

http://www.blogjava.net/chhbjh/archive/2012/02/21/370472.html

http://maoyidao.iteye.com/blog/1846089

相關文章
相關標籤/搜索