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

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)恢复。
  • 支持事务,事务中的所有命令序列化的按顺序执行,要么全部执行,要么全部不执行。
  • 支持多种内存汰换策略。
  • 支持主从、哨兵、集群等多种模式。

其它文章

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

相关推荐
callJJ6 分钟前
Spring Data Redis 两种编程模型详解:同步 vs 响应式
java·spring boot·redis·python·spring
wbs_scy1 小时前
Linux线程同步与互斥(三):线程同步深度解析之POSIX 信号量与环形队列生产者消费者模型,从原理到源码彻底吃透
java·开发语言
KmSH8umpK1 小时前
Redis分布式锁从原生手写到Redisson高阶落地,附线上死锁复盘优化方案进阶第七篇
数据库·redis·分布式
0xDevNull2 小时前
Linux 中 Nginx 代理 Redis 的详细教程
redis·后端
jinanwuhuaguo2 小时前
(第三十三篇)五月的文明奠基:OpenClaw 2026.5.2版本的文明级解读
android·java·开发语言·人工智能·github·拓扑学·openclaw
倒霉蛋小马2 小时前
【Redis】什么是缓存穿透?
缓存
xmjd msup3 小时前
spring security 超详细使用教程(接入springboot、前后端分离)
java·spring boot·spring
952363 小时前
SpringBoot统一功能处理
java·spring boot·后端
MiNG MENS3 小时前
nginx 代理 redis
运维·redis·nginx
Lyyaoo.3 小时前
优惠券秒杀业务分析
java·开发语言