`
titanfoot
  • 浏览: 261190 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Ehcache 1.6 2 Orders of Magnitude Faster

阅读更多

I have been waiting for enough people to move to Java 5 to mandate it as a minimum standard for ehcache. At JavaOne 2008 I found out that a lot of people were still to make the move. Now that we are in 2009 I have decided to move to Java 5. As part of this I have done a general cleanup of the core. I can now retire backport-concurrent which has served the project well (thanks guys) and other dependencies. Ehcache-1.6 core has no dependencies.


I decided that with the improvements in concurrency support that have come along, it was time to move beyond the use of synchronized. Years ago I adopted striped locking on BlockingCache which gave amazing results but I left the core pretty much as it was. The rework adopts some new goodness in Java 5 such as CopyOnWriteArray and ConcurrentHashMap. Having said that there is nothing in Java 5 for eviction, so the new work relies heavily on some excellent contributions to provide performance for caching application that is not available in Java 5.

On my own concurrency tests, which use 70 threads simulating a typical load against a single cache, I get the following improvements in ehcache-1.6 over ehcache-1.5. (Note 70 are just for that cache. Ehcache typically has many caches, so this translates to a production system with thousands of threads against all caches)

Operation Number of Times Faster
Than Ehcache-1.5.0
get 92.5 times faster
put 30 times faster
remove 48 times faster
removeAll 80 times faster
keySet 30 times faster


Manik Surtani maintains a cache performance benchmark tool. Using that I have added ehcache-1.6. It shows dramatically the performance increases in Ehcache-1.6.

For those with less than perfect eyesight, the second column, which is too short to even have its time printed, is the ehcache-1.6 performance.


What these charts are saying, is that an ehcache, with 25 concurrent threads, is now much faster than it was. The single threaded case it no faster. But caches are not about single threads.
Now, in case everyone gets preoccupied on the comparsions between Java caches, here is an old Ehcache versus Memcached chart.
If I redid this chart using ehcache, the barely visible columns for ehcache would completely disappear on this scale.
So what is this really saying? An in-process cache, which uses a few tens of CPU operations to access data already held in memory, is much, much, much faster than going out over the network for some data, regardless of how slick the server implementation at the other end is.
But I recognise that Memcached is about a different type of caching: massive partitioned caches. The Ehcache project has the Ehcache Server for that, with RESTful and SOAP APIs. The RESTful implementation uses a variety of tricks such as conditional get, the ability to have hardware and software load balancers (think ngnx) perform URI routing, head, HTTP1.1 compression and pipelining plus the goodness of modern NIO Java Web Containers to seriously give memcached a run for its money. I will be doing some performance comparisons between Memcached and Ehcache Server in the near future.
What else is next? The above numbers are for MemoryStore based caches. I am also going to give the DiskStore a work over, with lots of suggestions made to me in the last year. Stay tuned.
分享到:
评论

相关推荐

    ehcache1.6 和 ehcache-web-2.0.4

    Ehcache 1.6是其早期版本,而ehcache-web-2.0.4则是与Web应用相关的扩展模块。 Ehcache 1.6包含了核心的缓存管理功能,如设置缓存大小、过期策略、缓存分区等。这个版本支持元素(key-value对)的缓存,提供了线程...

    EhcacheUserGuide-1.6

    ### Ehcache 1.6 用户指南关键知识点解析 #### 一、引言 Ehcache 1.6 用户指南深入探讨了缓存技术的核心概念及其在现代应用中的重要作用。缓存,作为提升应用性能和可扩展性的关键策略,通过减少重复数据访问的...

    ehcache和h2 database资料

    【ehcache】 Ehcache是一款广泛使用的Java缓存库,它允许开发人员在应用程序中高效地管理和存储数据,以提高性能和响应速度。Ehcache的核心特性包括内存和磁盘存储、分布式缓存支持、多级缓存结构以及与Java ...

    Ehcache2缓存区配置详解.pdf

    ### Ehcache2缓存区配置详解 #### 一、Ehcache概述 Ehcache,一个备受推崇的开源高速缓存系统,专为提升应用程序性能、减轻数据库负担及简化应用扩展设计。其卓越的稳定性和丰富的特性使其成为Java领域内最受欢迎...

    Struts2+Spring+Hibernate+Ehcache+AJAX+JQuery+Oracle 框架集成用户登录注册Demo工程

    1)Demo 学习要点简介: ...2.Eclipse 导入后可能需要在 Xml Catalog 手动添加:ehcache-spring-1.2.xsd(ehcache-spring-annotations-1.2.0-sources.jar里面有,自己找下)。 3.内附Oracle建表等可执行语句。

    ehcache2-7-3 源码

    2. **缓存分区**:Ehcache支持将缓存数据划分为多个区域(Cache Regions),每个区域有自己的配置,这有利于管理和优化不同业务场景下的缓存需求。源码中会涉及如何创建和管理这些区域。 3. **缓存策略**:Ehcache...

    SpringBoo2.x,整合Ehcache3.x

    其次,Ehcache 3.x的配置与2.x版本有所不同,需要在`resources`目录下创建`ehcache.xml`文件,并按照Ehcache 3.x的格式编写配置。例如: ```xml ***' xmlns:eh='***' xsi:schemaLocation="***"> <!-- 指定缓存...

    Ehcache(2): Ehcache实例在Eclipse中的配置 改进

    2. **配置Hibernate**:在Hibernate的配置文件`hibernate.cfg.xml`中,我们需要指定Ehcache作为二级缓存提供者。添加以下配置: ```xml <property name="hibernate.cache.use_second_level_cache">true ...

    ehcache监控工具ehcache-monitor-kit-1.0.3

    1.解压缩到目录下,复制ehcache-monitor-kit-1.0.0\lib\ehcache-probe-1.0.0.jar包到application的web-inf/lib目录下 2.将以下配置copy的ehcache.xml文件的ehcache标签中,注:上述链接中说的配置少写了个probe包名...

    Ehcache缓存配置

    - 从 Ehcache 1.6 开始,支持 UTF-8 编码的 ehcache.xml 文件,但为了兼容旧版配置文件,ASCII 编码依然有效。 ##### 4.3 多个 CacheManager 使用同一配置文件 当多个 CacheManager 共享相同的配置文件时,可能会...

    ehcache.xsd_ehcache.xml代码提示.rar

    【标题解析】:“ehcache.xsd_ehcache.xml代码提示.rar”这个标题表明这是一个与Ehcache缓存系统相关的资源包,主要目的是为Ehcache的配置文件ehcache.xml提供代码提示功能。Ehcache是一个广泛使用的开源Java缓存...

    ehcache.jar及源码

    3. **缓存区(Cache Regions)**:在Ehcache 2.x中,缓存区类似于分组,允许将相关缓存逻辑组织在一起。在Ehcache 3.x版本中,此概念被“命名空间”取代。 4. **缓存策略**: 包括LRU(Least Recently Used,最近最少...

    ehcache配置使用详解

    2. **简单**:其简洁的API和丰富的文档使ehcache易于集成和使用,即使是对缓存技术不熟悉的开发者也能快速上手。 3. **多种缓存策略**:ehcache支持LRU(Least Recently Used)、LFU(Least Frequently Used)和FIFO...

    ehcache

    随着技术的发展,Ehcache 也经历了多个版本的迭代,如 Ehcache 2.x 和 Ehcache 3.x。Ehcache 3.x 引入了 Java Caching System (JSR 107) 规范,提供了更现代的 API 和更好的性能。 优化 Ehcache 包括调整缓存大小、...

    Ehcache 简单的监控

    Ehcache是一个开源的、高性能的缓存解决方案,广泛应用于Java应用程序中,以提高数据访问的速度和效率。本文将深入探讨Ehcache的简单监控,帮助开发者更好地理解其工作原理和性能状态。 首先,了解Ehcache的核心...

    ehcache-3.3.1-API文档-中文版.zip

    赠送jar包:ehcache-3.3.1.jar; 赠送原API文档:ehcache-3.3.1-javadoc.jar; 赠送源代码:ehcache-3.3.1-sources.jar; 赠送Maven依赖信息文件:ehcache-3.3.1.pom; 包含翻译后的API文档:ehcache-3.3.1-javadoc-...

    ehcache-jgroupsreplication-1.6.jar

    jar包,官方版本,自测可用

    spring struts2 hibernate ehcache整合

    在IT行业中,Spring、Struts2和Hibernate是Java企业级应用开发中常见的三大框架,而Ehcache则是一个广泛使用的缓存解决方案。这篇博客“spring struts2 hibernate ehcache整合”显然探讨了如何将这四个组件集成到同...

    Ehcache分布式缓存与其在SpringBoot应用

    2. **Ehcache配置**:在`ehcache.xml`配置文件中,你可以指定Ehcache如何运行。对于分布式缓存,可以设置UDP多播或TCP单播模式。多播模式下,节点通过网络广播发现彼此;单播模式则需要指定其他节点的IP地址,实现点...

    hibernate+ehcache

    2. **Ehcache**:Ehcache 是一个基于内存的缓存解决方案,支持在 JVM 内部缓存数据,以及可选的分布式缓存功能。它能快速存储和检索数据,提高应用程序性能,尤其适用于高并发场景。 3. **整合 Hibernate 和 ...

Global site tag (gtag.js) - Google Analytics