Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Nov 21, 2011

Memcached vs Redis vs MongoDB vs MySQL 效能比較

"記憶體是新一代的硬碟"在高流量網站內已是稀鬆平常的事情,像是採用 Memcached 做分散式快取服務即是典型的應用模式,Memcached 使用概念簡單且相關應用情境、文件、工具、演算法都已相當成熟,許多知名網站都運用 Memcached 提升scalability,像是GAE、Heroku 等PaaS 環境也有提供 Memcached 的收費服務,這些市場訊息已說明大規模的使用記憶體是可以合乎成本效益的。

Redis 是近年隨著 NoSQL 熱潮出現的 Key-Value store,其功能涵蓋了 Memcached 並且提供許多高階功能,在許多應用情境下相較 Memcached,能降低開發與營運複雜度,比如:
  • 豐富的資料結構(strings, hashes, lists, sets and sorted sets) 更易於設計適當的資料粒度增進資料重用的機會,且可依不同的資料結構特性在redis server上做組合與計算,降低開發上的複雜度與資料傳輸
  • 永續保存功能可充當簡易的資料庫降低重覆資料的一致性問題或一些特殊應用,像是當系統當機後能快速回復快取資料,避免大量重建的衝擊
  • 資料覆寫功能 提升讀取效能,提升 availability
  • 2.6可以寫script (lua)
  • 3.0版本預期還會加上Cluster做HA與Balancing有些data grid的樣子

但效能是否能與 Memcached 匹敵呢?以下透過大量的 get/set 操作做簡單的比較,並且加入MySQL與MonogoDB 做為參考