【系统设计】高可用之各种缓存对比

Guava

Local caching, done right, and supporting a wide variety of expiration behaviors.

Guava Caches是轻量的本地缓存,生命周期随着JVM的销毁而结束,相比于自己使用map来说,它提供了缓存汰换、回调、过期、并发等多种能力,并且编程实现简单。它的主要特点:

  • 缓存过期和淘汰机制。
  • 并发处理。
  • 访问高效。
  • 多实例各自保持数据,缓存不具有一致性。

Tair

Tair is fast-access memory (MDB)/persistent (LDB) storage service. Using a high-performance and high-availability distributed cluster architecture, Tair can meet businesses' high requirements for read/write performance and scalable capacity.

Tair是阿里巴巴内部使用的缓存,早期版本已经开源,阿里云上有售卖Redies版本的。根据文档,它具有三种底层引擎,根据场景的特性,就可以选择具体的引擎。Tair的好处是将不同的引擎做好了统一的封装,使用起来非常方便。

  • MDB,使用 Memcached。Memcached是一个高性能的分布式内存KV对象缓存系统。
  • RDB,使用 Redis。使用Redis是基于内存的数据结构存储系统,可以用作数据库、缓存和消息中间件。支持丰富的数据类型。
  • LDB,使用 LevelDB。LevelDB是一个单进程的持久化KV数据库。

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.

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
Memcached是典型的内存KV存储系统.Mem-Cache-D(aemon),意为内存缓存的守护进程。支持以下基本操作:

  • set:将数据存储到缓存中。
  • get:从缓存中读取数据。
  • delete:从缓存中删除数据。
  • incr/decr:对缓存中的数值进行增加或减少操作。

Memcached的具有以下特点:

  • 只支持KV结构。
  • 多线程,速度特别快。
  • 通过LRU(Least Recently Used,最近最少使用)算法淘汰旧数据。
  • 不支持持久化。
  • 数据全部在内存,down掉后不可恢复。

EVCache

EVCache is a memcached & spymemcached based caching solution that is mainly used for AWS EC2 infrastructure for caching frequently used data.

EVCacheEphemeralVolatileCache的简称。

  • Ephemeral - 短暂的,数据根据定义的TTL(Tine To Live)短暂存储。
  • Volatile - 易丢失的,数据可能在任何时间消失。
  • Cache - 内存KV存储。
  • 线性扩展,可以一分钟扩容,几分钟完成负载均衡和缓存预热。

Redis

Redis is an in-memory data store used by millions of developers as a cache, vector database, document database, streaming engine, and message broker. Redis has built-in replication and different levels of on-disk persistence. It supports complex data types (for example, strings, hashes, lists, sets, sorted sets, and JSON), with atomic operations defined on those data types.

Redis是现在风头最盛的缓存。它

  • 提供了丰富的数据类型,包括hashlistsetzset等。
  • 支持数据持久化。
  • 数据丢失可以通过AOF(Append Only File)恢复。
  • 支持事务,事务中的所有命令序列化的按顺序执行,要么全部执行,要么全部不执行。
  • 支持多种内存汰换策略。
  • 支持主从、哨兵、集群等多种模式。

其它文章

【系统设计】高可用之缓存基础

相关推荐
IDRSolutions_CN20 分钟前
PDF 转 HTML5 —— HTML5 填充图形不支持 Even-Odd 奇偶规则?(第二部分)
java·经验分享·pdf·软件工程·团队开发
hello早上好23 分钟前
Spring不同类型的ApplicationContext的创建方式
java·后端·架构
HelloWord~1 小时前
SpringSecurity+vue通用权限系统2
java·vue.js
让我上个超影吧1 小时前
黑马点评【基于redis实现共享session登录】
java·redis
BillKu2 小时前
Java + Spring Boot + Mybatis 插入数据后,获取自增 id 的方法
java·tomcat·mybatis
全栈凯哥2 小时前
Java详解LeetCode 热题 100(26):LeetCode 142. 环形链表 II(Linked List Cycle II)详解
java·算法·leetcode·链表
chxii2 小时前
12.7Swing控件6 JList
java
全栈凯哥2 小时前
Java详解LeetCode 热题 100(27):LeetCode 21. 合并两个有序链表(Merge Two Sorted Lists)详解
java·算法·leetcode·链表
YuTaoShao2 小时前
Java八股文——集合「List篇」
java·开发语言·list
PypYCCcccCc2 小时前
支付系统架构图
java·网络·金融·系统架构