Java 缓存介绍:Ehcache、Hazelcast、Infinispan

对于这样的一个问题:最好的 Java 缓存解决方案是哪个? 很难有一个简单的答案,这依赖于不同的应用场景:

  • 是否只需要一个本地的缓存,或者是需要在应用集群中使用的缓存分区
  • 在数据一致性和延迟方面的权衡
  • 是不是在固定的硬件架构上的静态发布,或者是不断增长的应用服务器数量

下面我们会介绍 Java 应用服务器方面的一些缓存解决方案,包括 Ehcache、Hazelcast 和 Infinispan,将介绍在不同的应用场景下不同的特点。

下面是三个解决方案一个简单的对比表格:

  Ehcache Hazelcast Infinispan
支持点对点模式下的分布式哈希表 no yes yes
支持点对点模式下的全复制架构 yes no yes
点对点模式下原子操作确保数据的一致性,甚至是缓存配置是错误的情况下 yes yes no
C/S 模式下明确的硬件配置 yes no no
C/S 模式下的可伸缩配置发布 no yes yes
C/S 模式下原子操作确保数据的一致性 no yes no

下面是全系列文章目录:

Contents

  • Part 0: Introduction
    • Part 0.1: Overview.
    • Part 0.2: Caches and Big Data.
  • Part 1: Example Application
    • Part 1.1: Brief introduction to the features of the User Event Cache.
    • Part 1.2: REST interface exposed.
    • Part 1.3: The common data types used.
    • Part 1.4: Reference implementation with a ConcurrentHashMap.
  • Part 2: Local caches with eviction
    • Part 2.1: Introduction to JSR 107.
    • Part 2.2: Local cache with Ehcache.
    • Part 2.3: Local cache with Hazelcast.
    • Part 2.4: Local cache with Infinispan.
  • Part 3: Peer-to-peer clustering
    • Part 3.1: Introduction to peer-to-peer architectures.
    • Part 3.2: Peer-to-peer with Ehcache.
    • Part 3.3: Peer-to-peer with Hazelcast.
    • Part 3.4: Peer-to-peer with Infinispan.
  • Part 4: Client-Server clustering
    • Part 4.1: Introduction to client-server architectures.
    • Part 4.2: Client-server with Ehcache.
    • Part 4.3: Client-server with Hazelcast.
    • Part 4.4: Client-server with Infinispan.
  • Part 5: Advanced Topics
    • Part 5.1 Second-level caches for databases.
    • Part 5.2 Advanced features.
  • Summary

OSC 译自 http://labs.consol.de/java-caches/

你可能感兴趣的:(JAVA,企业级开发,系统架构,互联网)