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

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

其它文章

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

相关推荐
京东云开发者26 分钟前
自增主键去哪了?---一次开发过程中的思考
java
点点滴滴的记录33 分钟前
Sentinel 相关知识点
java·微服务·sentinel
东东__net38 分钟前
1_vue基本_插件
java·前端·javascript
一只小闪闪42 分钟前
langchain4j搭建失物招领系统(四)---实现更新功能
java·人工智能·后端
小安同学iter1 小时前
SpringBoot(三)环境隔离/外部化配置/单元测试/可观测性/生命周期
java·spring boot·后端
pilgrim531 小时前
【二刷代码随想录】双指针-数组相关题型、推荐习题
java·数据结构·算法·leetcode
xcbeyond2 小时前
Kubernetes 中 Java 应用性能调优指南:从容器化特性到 JVM 底层原理的系统化优化
java·jvm·云原生·kubernetes
蓝白咖啡2 小时前
华为OD机试 - 王者荣耀匹配机制 - 回溯(Java 2024 D卷 200分)
java·python·算法·华为od·机试
一人の梅雨2 小时前
西域平台关键字搜索接口开发指南
java·开发语言·数据库