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

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

其它文章

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

相关推荐
前端若水17 小时前
【无标题】
java·人工智能·python·机器学习
tongluowan00717 小时前
@Autowired 和 @Resource 有什么区别?
java·spring·bean
无小道17 小时前
Redis——string类型相关指令
redis·指令·string
Maiko Star18 小时前
* SpringBoot整合LangChain4j
java·spring boot·后端·langchain4j
MandalaO_O18 小时前
MyBatis:核心概念 + 环境搭建 + CRUD
java·tomcat·mybatis
DN金猿18 小时前
spring.cloud.nacos.discovery.server-addr和spring.cloud.nacos.server-addr区别
java·开发语言·nacos·springcloud·sca
ChampaignWolf19 小时前
在 Eclipse 中使用 Tabnine
java·ide·eclipse
JAVA面经实录91719 小时前
Java多线程并发高频面试100题(完整版·含答案·背诵版)
java·开发语言·面试
码云骑士19 小时前
Redis 入门实战:从 NoSQL 概念到安装与基础操作详解(一)
数据库·redis·缓存
XiYang-DING19 小时前
【Java EE】TCP—流量控制和拥塞控制
java·tcp/ip·java-ee