Ehcache 2.4 User Guide

Total Page:16

File Type:pdf, Size:1020Kb

Ehcache 2.4 User Guide ...................................................................................................................................... Ehcache v. 2.4 User Guide ...................................................................................................................................... Terracotta, Inc. 2011-05-05 T a b l e o f C o n t e n t s i Table of Contents ....................................................................................................................................... 1 Table of Contents . i 2 Preface . 1 3 Introduction . 2 4 Getting Started . 9 5 Dependencies . 11 6 Cache Concepts . 12 7 Configuration . 17 8 Storage Options . 24 9 Cache Consistency Options . 31 10 Cache Eviction Algorithms . 39 11 Big Memory:Off-Heap Store . 42 12 JDBC Caching . 52 13 Spring Caching with Ehcache . 56 14 Code Samples . 58 15 Class loading and Class Loaders . 65 16 Tuning Garbage Collection . 67 17 Cache Decorators . 68 18 Hibernate Caching . 71 19 Web Caching . 83 20 Using ColdFusion with Ehcache . 88 21 Cache Topologies . 91 22 Distributed Caching . 23 Replicated Caching With RMI . 94 24 Replicated Caching With JGroups . 100 25 Replicated Caching With JMS . 104 26 Shutting Down Ehcache . 115 26 Logging . 117 26 Remote Network replication debugging: RMI Replicated Caches . 118 26 JMX Management And Monitoring . 120 26 JTA And Transactions . 127 26 Search . 135 26 Ehcache Monitor . 145 26 Bulk Loading . 26 CacheManager Event Listeners . 151 26 Cache Event Listeners . 154 26 Cache Exception Handlers . 158 26 Cache Extensions . 161 26 Cache Loaders . 164 © 2 0 1 1 , T e r r a c o t t a , I n c . • A L L R I G H T S R E S E R V E D . T a b l e o f C o n t e n t s ii 26 Write-through and write-behind caching with CacheWriters . 168 26 Cache Server with SOAP and RESTful Web Services . 177 26 Explicit Locking API . 195 26 BlockingCache and SelfPopulatingCache . 198 26 OpenJPA Caching . 199 26 Grails Caching . 200 26 JRuby Caching . 202 26 Glassfish HowTo . 206 26 Google App Engine Caching . 208 26 Tomcat Issues and Best Practices . 211 26 JSR107 (JCACHE) Support . 212 26 Building From Source . 218 26 FAQ . 220 © 2 0 1 1 , T e r r a c o t t a , I n c . • A L L R I G H T S R E S E R V E D . 1 P r e f a c e 1 1 Preface ....................................................................................................................................... 1.1 Preface This is a book about Ehcache, a widely used open source Java cache. Ehcache has grown in size and scope since it was introduced in October 2003. As people used it they often noticed it was missing a feature they wanted. Over time, the features that were repeatedly asked for, and make sense for a Cache, have been added. Ehcache is now used for Hibernate caching, data access object caching, security credential caching, web caching, SOAP and RESTful server caching, application persistence and distributed caching. In August 2009, Ehcache was acquired by Terracotta, Inc. and has been continously enhanced since then. 1.1.1 Version This book is for Ehcache version 2.4.1. 1.1.2 Audience The intended audience for this book is developers who use ehcache. It should be able to be used to start from scratch, get up and running quickly, and also be useful for the more complex options. Ehcache is about performance and load reduction of underlying resources. Another natural audience is performance specialists. It is also intended for application and enterprise architects. Some of the features of ehcache, such as distributed caching and Java EE caching, are alternatives to be considered along with other ways of solving those problems. This book discusses the trade-offs in Ehcache's approach to help make a decision about appropriateness of use. 1.1.3 Acknowledgements Ehcache has had many contributions in the form of forum discussions, feature requests, bug reports, patches and code commits. Rather than try and list the many hundreds of people who have contributed to Ehcache in some way it is better to link to the web site where contributions are acknowledged in the following ways: • Bug reports and features requests appear in the changes report here: • Patch contributors generally end up with an author tag in the source they contributed to. • Team members appear on the team list page here: © 2 0 1 1 , T e r r a c o t t a , I n c . • A L L R I G H T S R E S E R V E D . 2 I n t r o d u c t i o n 2 2 Introduction ....................................................................................................................................... 2.1 Introduction Ehcache is a cache library. Before getting into ehcache, it is worth stepping back and thinking about caching generally. 2.1.1 About Caches Wiktionary defines a cache as A store of things that will be required in future, and can be retrieved rapidly. That is the nub of it. In computer science terms, a cache is a collection of temporary data which either duplicates data located elsewhere or is the result of a computation. Once in the cache, the data can be repeatedly accessed inexpensively. 2.1.2 Why caching works 2.1.2.1 Locality of Reference While Ehcache concerns itself with Java objects, caching is used throughout computing, from CPU caches to the DNS system. Why? Because many computer systems exhibit locality of reference. Data that is near other data or has just been used is more likely to be used again. 2.1.2.2 The Long Tail Chris Anderson, of Wired Magazine, coined the term The Long Tail to refer to Ecommerce systems. The idea that a small number of items may make up the bulk of sales, a small number of blogs might get the most hits and so on. While there is a small list of popular items, there is a long tail of less popular ones. The Long Tail The Long Tail is itself a vernacular term for a Power Law probability distribution. They don't just appear in ecommerce, but throughout nature. One form of a Power Law distribution is.
Recommended publications
  • Open Message Queue Mq.Dev.Java.Net
    Open Message Queue mq.dev.java.net Jason Huang Technical Consultant Sun Microsystems, Inc. 1 Objective Understand basic of JMS API and OpenMQ products Copyright 2007 Sun Microsystems Inc. 2 Agenda • Introduction to JMS • What's OpenMQ • Features of OpenMQ • Demo Copyright 2007 Sun Microsystems Inc. 3 What is Java Message Service? • A Java API for Message Oriented Middleware(MOM) > JMS is a specification developed under the Java Community Process as JSR 914. > http://www.jcp.org/en/jsr/detail?id=914 Copyright 2007 Sun Microsystems Inc. 4 What Is Java Message Service? • The Java 2 Platform, Enterprise Edition (J2EE™platform) specification for MOM products • Defines provider-neutral APIs and administered objects that allow client applications to be portable across Java Message Service providers • Is defined as part of the J2EE 1.3 and later specification Copyright 2007 Sun Microsystems Inc. 5 What Is Java Message Service (continued)? • Supports two different messaging models: point-to-point and publish-subscribe • Supports asynchronous messaging and message-driven beans (MDBs) on a J2EE application server • Allows providers to implement additional provider-specific features • Provides the ability to tune applications for performance and reliability Copyright 2007 Sun Microsystems Inc. 6 Point to Point Messaging Message Service Producers Consumers Sender Receiver Queue 1 Queue 2 Receiver Queue 3 Receiver Messages from producers delivered to consumers Held in Queue Delivered, in order – Guaranteed Copyright 2007 Sun Microsystems Inc. 7 Publish and Subscribe Messaging Message Service Producers Consumers Publisher Subscriber Topic Subscriber Subscriber Publishers are independent from subscribers Message expiration is configured Subscriptions may be “durable” Copyright 2007 Sun Microsystems Inc.
    [Show full text]
  • Eclipse Glassfish Server Release Notes, Release 5.1 Table of Contents
    Eclipse GlassFish Server Release Notes, Release 5.1 Table of Contents Eclipse GlassFish Server . 1 Preface. 2 GlassFish Server Documentation Set. 2 Related Documentation. 4 Typographic Conventions. 5 Symbol Conventions . 5 Default Paths and File Names . 6 1 Eclipse GlassFish Server 6.1 Release Notes . 8 Revision History . 8 What’s New in the GlassFish Server 5.1 Release?. 9 Hardware and Software Requirements . 10 Known Issues in GlassFish Server 5.1 . 15 Restrictions and Deprecated Functionality . 17 Documentation Errata . 20 Features Available Only in the Full Platform . 20 Java EE Standards Support . 21 Java EE SDK . 23 How to Report Problems and Provide Feedback . 24 Additional Resources. 24 Eclipse GlassFish Server Eclipse GlassFish Server Release Notes Release 5.1 Contributed 2018, 2019 These Release Notes provide late-breaking information about GlassFish Server 5.1 software and documentation. Also included are a summary of new product features in the 5.1 release, and descriptions and workarounds for known issues and limitations. Eclipse GlassFish Server Release Notes, Release 5.1 Copyright © 2013, 2019 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v. 2.0, which is available at http://www.eclipse.org/legal/epl-2.0. SPDX-License-Identifier: EPL-2.0 Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc.
    [Show full text]
  • Open Message Queue Technical Overview Release 5.0
    Open Message Queue Technical Overview Release 5.0 May 2013 This book provides an introduction to the technology, concepts, architecture, capabilities, and features of the Message Queue messaging service. Open Message Queue Technical Overview, Release 5.0 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007).
    [Show full text]
  • Evaluation of Technologies for a Future Run Control System for The
    Karlsruhe University of Applied Sciences Faculty of Computer Science Bachelor's Thesis Evaluation of Technologies for a Future Run Control System for the CMS Experiment at CERN Author Philipp Brummer orcid.org/0000-0002-3857-3504 Contact [email protected] [email protected] CERN-THESIS-2018-475 //2018 Supervisors Prof. Dr. Thomas Fuchß Dr. Hannes Sakulin Hochschule Karlsruhe CERN February 2018 Abstract The Run Control and Monitoring System (RCMS) of the Compact Muon Solenoid (CMS) experiment at the European Organization for Nuclear Research (CERN) is re- sponsible for controlling and monitoring the data acquisition operations of the experi- ment [52]. The RCMS provides a high-level web-based interface to operators, allowing control of the experiment and the subsystems it is comprised of. As part of the RCMS, the Run Control provides a framework for developing Function Managers, user code that is implemented in accordance with the interfaces and behavior defined by the framework. The Run Control system is also responsible for executing said Function Managers in a distributed environment and handling communication between them and the resources they control. The original Run Control and Monitoring System for the CMS experiment was de- veloped to fulfill the requirements of the experiment for Phase-I and the first run of the Large Hadron Collider (LHC). Since then, various changes were necessary to keep up with the requirements for Run 2. The core of the system being over a decade old, making use of more recent developments in software technology, improved libraries and programming language features may simplify the implementation of the Run Control, making a rewrite or major update of the RCMS for Phase-II and Run 4 [6] of the LHC stand to reason.
    [Show full text]
  • Resource Location Transparency in Clouds
    Project Number: MXC-0360 Resource Location Transparency in Clouds A Major Qualifying Project Report: Submitted to the faculty of the WORCESTER POLYTECHNIC INSTITUTE in partial fulfillment of the requirements for the Degree of Bachelor of Science by: Latiff Seruwagi Linhai Zhu Khanh-Nhan Nguyen Date: April 25, 2012 Professor Michael J. Ciaraldi, Major Advisor Sponsored by Oracle Abstract Cloud systems have become a ubiquitous way of harnessing the power of large numbers of networked computers. One of the important functionalities of these systems is the ability to access a resource seamlessly regardless of where in the cloud it is stored. In this MQP, we provide a design that ensures transparency of a resource using a message-oriented cloud system. We then created a simple implementation of this design that demonstrates how information is transmitted over the cloud. i Acknowledgements We would like to thank Oracle for sponsoring our project and giving us advice and professor Ciaraldi for advising us. Special thanks go to Mike Voorhis of the Computer Science department for setting up our virtual machine testbed and offering us his expertise. ii Table of Contents Abstract ............................................................................................................................................ i Acknowledgements ......................................................................................................................... ii Table of Contents ..........................................................................................................................
    [Show full text]
  • Sun Java System Message Queue 41 Developer's Guide for Java Clients
    Sun Java System Message Queue 4.1 Developer's Guide for Java Clients Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 819–7757 September 2007 Copyright 2007 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more U.S. patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights – Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. This distribution may include materials developed by third parties. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, the Solaris logo, the Java Coffee Cup logo, docs.sun.com, Java, and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees.
    [Show full text]
  • Eclipse Glassfish Server Installation Guide, Release 5.1 Table of Contents
    Eclipse GlassFish Server Installation Guide, Release 5.1 Table of Contents Eclipse GlassFish Server . 1 Preface. 2 GlassFish Server Documentation Set. 2 Related Documentation. 4 Typographic Conventions. 5 Symbol Conventions . 5 Default Paths and File Names . 6 1 Installing Eclipse GlassFish Server 5.1 . 8 Installation Requirements . 8 Installation Files for GlassFish Server 5.1 . 17 Installing GlassFish Server From a ZIP File . 21 2 Uninstalling GlassFish Server 5.0 . 23 Removing a GlassFish Server Installation . 23 Eclipse GlassFish Server Eclipse GlassFish Server Installation Guide Release 5.1 Contributed 2018, 2019 This book contains instructions for installing and uninstalling Eclipse GlassFish Server software. Eclipse GlassFish Server Installation Guide, Release 5.1 Copyright ?? 2010, 2019 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v. 2.0, which is available at http://www.eclipse.org/legal/epl-2.0. SPDX-License-Identifier: EPL-2.0 Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. DRAFT Eclipse GlassFish Server Installation Guide, Release 5.1 1 GlassFish Server Documentation Set Preface This documentation is part of the Java Enterprise Edition contribution to the Eclipse Foundation and is not intended for use in relation to Java Enterprise Edition or Orace GlassFish.
    [Show full text]
  • Message Queue Download
    Message queue download SC Management Pack for Windows 7, Windows Server R2. The Windows Server Operating System Management Pack for Operations Manager is designed for the following versions of System Center Operations Manager. To install Message Queuing on Windows Server or Windows Expand Microsoft Message Queue (MSMQ) Server, expand Microsoft. The Message Queuing Management Pack provides monitoring for Microsoft Message Queuing Services (MSMQ) version The Message Queuing Management Pack provides monitoring for the following: The Message Queuing Management Pack for Operations Manager is designed to monitor. System Center Management Pack for Message Queuing. The Message Queuing Management Pack provides monitoring for Microsoft Message Queuing Services (MSMQ) version Legacy downloads. This page provides download links to legacy editions of Open Message Queue. If you want the most up to date downloads, jump to the main. Downloads. The latest release of Open Message Queue is This is a quality improvement release which supports JMS Open Message Queue is. When I tried to install WinCC V SP3, it prompted that one product has not been installed, which is Mcrosoft Message Queuing V How to. Dramatically speed up mass-sending operations and reduce response time of your mailing applications. Back to Message Queue home. Publish & subscribe. Read and write streams of data like a messaging system. Learn more» · Process. Write scalable stream processing applications that react. Download. Sun GlassFish Message Queue Update 1 - AIX, MB, Grab yourself a Download, try our Getting Started Guide, surf our FAQ or start Smalltalk to talk to ActiveMQ as well as any other popular Message Broker. In Features, expand Message Queuing > Message Queuing Services and select Message Queuing Server.
    [Show full text]
  • Administration Guide Release 4.0
    GlassFish Server Open Source Edition Administration Guide Release 4.0 May 2013 GlassFish Server Open Source Edition 4.0 Administration Guide provides instructions for configuring and administering GlassFish Server Open Source Edition. GlassFish Server Open Source Edition Administration Guide, Release 4.0 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007).
    [Show full text]
  • Glassfish Server Open Source Edition 5.0 Release Notes
    GlassFish Server Open Source Edition Release Notes Release 5.0 September 2017 These Release Notes provide late-breaking information about GlassFish Server 5.0 software and documentation. Also included are a summary of new product features in the 5.0 release, and descriptions and workarounds for known issues and limitations. GlassFish Server Open Source Edition Release Notes, Release 5.0 Copyright © 2013, 2017, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007).
    [Show full text]
  • Message Queue Developer's Guide for C Clients Release 5.0
    Open Message Queue Developer's Guide for C Clients Release 5.0 May 2013 This guide provides programming and reference information for developers working with Message Queue who want to use the C language binding to the Message Queue Service to send, receive, and process Message Queue messages. Open Message Queue Developer's Guide for C Clients, Release 5.0 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007).
    [Show full text]
  • Overview of Glassfish
    Overview of GlassFish Eduardo Pelegri-Llopart, Distinguished Engineer Sun Microsystems, Inc Title Company Name SessioUn IRD L of Company or Project 1 GlassFish Overview Agenda ● JavaEE 5 ● GlassFish Community ● GlassFish v2 ● Other Projects in the Community ● Adoption ● Futures 2 GlassFish Overview For More Information ● http://blogs.sun.com/theaquarium ● http://blogs.sun.com/stories ● http://glassfish.java.net 3 GlassFish Overview A Taste of Java EE 5 4 GlassFish Overview J2EE 1.4 ● J2EE is enormously powerful ● The industry standard for robust enterprise apps ● But that power sometimes gets in the way ● Too difficult to get started ● Even simple apps need boring boilerplate ● Can we keep the power… but make typical development tasks simpler? ● YES… and that is the focus of Java EE 5! 5 GlassFish Overview Java EE 5.0 = (J2EE 1.4).next ● Java EE 5 Theme: Ease of Development ● POJO-based programming ● More freedom, fewer requirements ● Extensive use of annotations ● Reduced need for deployment descriptors ● Annotations are the law ● Resource Injection ● New APIs and frameworks 6 GlassFish Overview Specification Changes in Java EE 5 ● JAX-WS 2.0 & JSR 181 ● Java Persistence ● EJB 3.0 ● JAXB 2.0 ● JavaSever Faces 1.2 – new to Platform ● JSP 2.1 – Unification w/ JSF 1.2 ● StAX – Pull Parser – new to Platform 7 GlassFish Overview <?xml version='1.0' encoding='UTF-8' ?> <webservices xmlns='http://java.sun.com/xml/ns/j2ee' version='1.1'> Using JAX-RPC 1.1 <webservice-description> <webservice-description-name> package endpoint; HelloService</webservice-description-name>
    [Show full text]