日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

Memcached 真的過時(shí)了嗎?

 昵稱9255533 2012-03-28

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

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

  • 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可以使用多核,所以在比較上,平均每一 個(gè)核上Redis在存儲小數(shù)據(jù)時(shí)比Memcached性能更高。而在100k以上的數(shù)據(jù)中,Memcached性能要高于Redis,雖然Redis最近 也在存儲大數(shù)據(jù)的性能上進(jìn)行優(yōu)化,但是比起Memcached,還是稍有遜色。說了這么多,結(jié)論是,無論你使用哪一個(gè),每秒處理請求的次數(shù)都不會(huì)成為瓶 頸。(比如瓶頸可能會(huì)在網(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)存利用率會(huì)高于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)檫@兩個(gè)特性Memcached都不具備。即使你只是希望在升級或者重啟系統(tǒng)后緩存數(shù)據(jù)不會(huì)丟失,選擇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會(huì)是不錯(cuò)的選擇。

    本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多