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

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

其它文章

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

相关推荐
墨染点香12 分钟前
LeetCode Hot100【6. Z 字形变换】
java·算法·leetcode
ldj202035 分钟前
SpringBoot为什么使用new RuntimeException() 来获取调用栈?
java·spring boot·后端
超龄超能程序猿36 分钟前
Spring 应用中 Swagger 2.0 迁移 OpenAPI 3.0 详解:配置、注解与实践
java·spring boot·后端·spring·spring cloud
风象南1 小时前
SpringBoot配置属性热更新的轻量级实现
java·spring boot·后端
洛阳泰山1 小时前
Spring Boot 整合 Nacos 实战教程:服务注册发现与配置中心详解
java·spring boot·后端·nacos
Y4090011 小时前
C语言转Java语言,相同与相异之处
java·c语言·开发语言·笔记
YuTaoShao1 小时前
【LeetCode 热题 100】994. 腐烂的橘子——BFS
java·linux·算法·leetcode·宽度优先
布朗克1681 小时前
java常见的jvm内存分析工具
java·jvm·数据库
都叫我大帅哥2 小时前
深入浅出 Resilience4j:Java 微服务的“免疫系统”实战指南
java·spring cloud
Cao_Shixin攻城狮4 小时前
Flutter运行Android项目时显示java版本不兼容(Unsupported class file major version 65)的处理
android·java·flutter