To delve into the use of Ehcache caching systems in a clustered environment

Source: Internet
Author: User

Introduction to EhCache Caching system

EhCache is a pure Java in-process caching framework, with fast, lean and so on, is the default Cacheprovider in Hibernate.

The following figure is the location of the EhCache in the application:

Figure 1. EhCache Application Architecture Diagram

The main characteristics of EhCache are:

Fast

Simple

multiple caching strategies;

Cache data has level two: memory and disk, so there is no need to worry about capacity issues;

The cached data is written to disk during the restart of the virtual machine;

Distributed caching can be done by means of RMI, pluggable APIs, etc.

A listening interface with cache and cache manager;

Support for multiple cache manager instances, as well as multiple cache regions for an instance;

Provide the Hibernate cache implementation;

Wait a minute...

Because EhCache is a caching system in the process, once the application is deployed in a clustered environment, each node maintains its own cached data, and when a node updates the cached data, the updated data cannot be shared among other nodes, which not only reduces the efficiency of the node's operation, but also causes the data to be unsynchronized. For example, a Web site uses a, b two nodes as a cluster deployment, when the A-node cache is updated, and the B-node cache has not been updated may appear when the user browsing the page, one will be updated data, one is not yet updated data, although we can also through the session Sticky Technology to lock users on a node, but for systems that are more interactive or are not WEB-style, session Sticky is clearly not a good fit. So we need to use the EhCache cluster solution.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.