西沙璞玉
          愛不容易
          posts - 0,comments - 4,trackbacks - 0

          這兩年Redis火得可以,Redis也常常被當(dāng)作Memcached的挑戰(zhàn)者被提到桌面上來。關(guān)于Redis與Memcached的比較更是比比皆是。然而,Redis真的在功能、性能以及內(nèi)存使用效率上都超越了Memcached嗎?

          下面內(nèi)容來自Redis作者在stackoverflow上的一個回答,對應(yīng)的問題是《Is memcached a dinosaur in comparison to Redis?》(相比Redis,Memcached真的過時了嗎?)

          • You should not care too much about  performances. Redis is faster per core with small values, but memcached  is able to use multiple cores with a single executable and TCP port  without help from the client. Also memcached is faster with big values  in the order of 100k. Redis recently improved a lot about big values  (unstable branch) but still memcached is faster in this use case. The  point here is: nor one or the other will likely going to be your  bottleneck for the query-per-second they can deliver.
          • 沒有必要過多的關(guān)心性能,因?yàn)槎叩男阅芏家呀?jīng)足夠高了。由于Redis只使用單核,而Memcached可以使用多核,所以在比較上,平均每一 個核上Redis在存儲小數(shù)據(jù)時比Memcached性能更高。而在100k以上的數(shù)據(jù)中,Memcached性能要高于Redis,雖然Redis最近 也在存儲大數(shù)據(jù)的性能上進(jìn)行優(yōu)化,但是比起Memcached,還是稍有遜色。說了這么多,結(jié)論是,無論你使用哪一個,每秒處理請求的次數(shù)都不會成為瓶 頸。(比如瓶頸可能會在網(wǎng)卡)
          • You should care about memory usage.  For simple key-value pairs memcached is more memory efficient. If you  use Redis hashes, Redis is more memory efficient. Depends on the use  case.
          • 如果要說內(nèi)存使用效率,使用簡單的key-value存儲的話,Memcached的內(nèi)存利用率更高,而如果Redis采用hash結(jié)構(gòu)來做key-value存儲,由于其組合式的壓縮,其內(nèi)存利用率會高于Memcached。當(dāng)然,這和你的應(yīng)用場景和數(shù)據(jù)特性有關(guān)。
          • You should care about persistence and  replication, two features only available in Redis. Even if your goal is  to build a cache it helps that after an upgrade or a reboot your data  are still there.
          • 如果你對數(shù)據(jù)持久化和數(shù)據(jù)同步有所要求,那么推薦你選擇Redis,因?yàn)檫@兩個特性Memcached都不具備。即使你只是希望在升級或者重啟系統(tǒng)后緩存數(shù)據(jù)不會丟失,選擇Redis也是明智的。
          • You should care about the kind of  operations you need. In Redis there are a lot of complex operations,  even just considering the caching use case, you often can do a lot more  in a single operation, without requiring data to be processed client  side (a lot of I/O is sometimes needed). This operations are often as  fast as plain GET and SET. So if you don’t need just GEt/SET but more  complex things Redis can help a lot (think at timeline caching).
          • 當(dāng)然,最后還得說到你的具體應(yīng)用需求。Redis相比Memcached來說,擁有更多的數(shù)據(jù)結(jié)構(gòu)和并支持更豐富的數(shù)據(jù)操作,通常在 Memcached里,你需要將數(shù)據(jù)拿到客戶端來進(jìn)行類似的修改再set回去。這大大增加了網(wǎng)絡(luò)IO的次數(shù)和數(shù)據(jù)體積。在Redis中,這些復(fù)雜的操作通 常和一般的GET/SET一樣高效。所以,如果你需要緩存能夠支持更復(fù)雜的結(jié)構(gòu)和操作,那么Redis會是不錯的選擇。

          來源:Is memcached a dinosaur in comparison to Redis?(其他人的回答同樣值得一看)

          posted on 2012-03-27 18:00 @趙 閱讀(135) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          哥哥最近不是很忙
          主站蜘蛛池模板: 仙居县| 泗洪县| 泽州县| 海林市| 平安县| 嘉义县| 鄂尔多斯市| 广德县| 武穴市| 临夏市| 城步| 榆社县| 建瓯市| 宁波市| 闽侯县| 杭锦旗| 彩票| 长宁县| 兴安县| 金寨县| 定西市| 嵩明县| 四子王旗| 墨江| 莱西市| 宁蒗| 垦利县| 高平市| 鄂州市| 浑源县| 龙海市| 普兰县| 盐山县| 阳江市| 三原县| 大埔区| 淄博市| 台江县| 阿勒泰市| 环江| 都兰县|