Dec 14 2010

Clustering EHCACHE With ColdFusion - Step by Step

Posted by Mike Brunt at 3:41 PM
- Categories: Web Servers | DataBase | Tomcat | Performance | Caching | ColdFusion | JRun-J2EE


Effective caching is one of the most cost-effective ways to improve performance, the likes of FaceBook, Twitter, Google and MySpace use distributed, redundant caches to support huge amounts of traffic.  This capability is now easily available to us in the ColdFusion world with the integration of EHCACHE into ColdFusion 9 and 9.0.1.

In concert with the good people at EHCACHE we have been evolving a good way to use distributed-clustered caching with ColdFusion and this work continues.  Through CFUNITED and cf.Objective we evolved a demonstration showing a ColdFusion application under load in an uncached and cached mode with EHCACHE in a clustered-distributed, out-of-process mode.  One important point that we observed is that if EHCACHE is out of process (that is not running in the same JVM as ColdFusion) and if EHCACHE then becomes unavailable, ColdFusion immediately hangs with nothing in any of the logs.  For this reason, we strongly advise that if EHCACHE will be used out of process, it is very important that it is set up with a minimum of two EHCHACHE instances set up in a clustered-distributed mode, which is exactly what we have done.  We are working with EHCACHE to test a new version, with ColdFusion, which should get us around this CF hanging issue, more information on that soon.

We just released a video showing the test we evolved to demonstrate clustered-distributed caching with ColdFusion and EHCACHE and this blog post will put more detail to the video which is located here.  These are the parts needed to make clustered-distributed caching work.


ColdFusion Standard 9.0.1: Installed in {drive}:\ColdFusion9\lib (ehcache.xml is where all the settings are).

ColdFusion Enterprise Multiple Instance 9.0.1: Installed in {drive}:\JRun4\servers\{instance}\cfusion.ear\cfusion.war\WEB-INF\cfusion\lib (ehcache.xml is where all the settings are).

ehcache.jar, ehcache-web.jar, ehcache.xml


The basic needs are as shown in the ColdFusion details above and this what you have after installing ColdFusion.  In order to enable clustered-distributed caching in ColdFusion we need to add another jar file - 

ehcache-terracotta-2.0.0.jar into the same directory, so them we have...

ehcache.jar, ehcache-terracotta-2.0.0.jar, ehcache-web.jar, ehcache.xml

In the ehcache.xml file we enter/edit the following; the two IP Addresses and ports are pointing to the clustered instances on each server and with multiple ColdFusion instances we need this in each ehcache.xml file...















On the two servers we install Terraccotta (on a Windows server here {drive}:\etc\terracotta-3.2.1) in the {drive}:\etc\terracotta-3.2.1\ehcache\ehcache.xml for each server we enter/edit the following code...  












We also make sure the following is in the {drive}:\etc\terracotta-3.2.1\ehcache\ehcache.xml file (server 1) (server 2).

We also edit the {drive}\etc\terracotta-3.2.1\bin\config.xml file on both servers as follows...


















We created a simple batch file to start the clustered-distributed cache (this is from server 2)...

@echo off

cd \etc\terracotta-3.2.1\bin

start "" start-tc-server.bat -n Cache2 -f .\config.xml

Once the first instance starts up and if all goes OK we will see this message in the terminal (note the "ACTIVE-COORDINATOR" status)...

2010-12-13 15:09:15,281 INFO - Terracotta 3.2.1, as of 20100302-130324 (Revision

 14673 by cruise@su10mo5 from 3.2)

2010-12-13 15:09:16,984 INFO - Configuration loaded from the file at 'C:\etc\ter


2010-12-13 15:09:17,609 INFO - Log file: 'C:\etc\terracotta-3.2.1\bin\.\terracot


2010-12-13 15:09:21,484 INFO - Available Max Runtime Memory: 494MB

2010-12-13 15:09:26,781 INFO - JMX Server started. Available at URL[service:jmx:


2010-12-13 15:09:38,625 INFO - Becoming State[ ACTIVE-COORDINATOR ]

2010-12-13 15:09:38,750 INFO - Terracotta Server instance has started up as ACTIVE node on successfully, and is now ready for work.

Next we start up EHCACHE on a second server (note Moved to State[ PASSIVE-STANDBY ])...

2010-12-13 15:14:30,421 INFO - Terracotta 3.2.1, as of 20100302-130324 (Revision

 14673 by cruise@su10mo5 from 3.2)

2010-12-13 15:14:37,421 INFO - Configuration loaded from the file at 'C:\etc\ter


2010-12-13 15:14:40,453 INFO - Log file: 'C:\etc\terracotta-3.2.1\bin\.\terracot


2010-12-13 15:14:47,843 INFO - Available Max Runtime Memory: 494MB

2010-12-13 15:14:56,250 INFO - JMX Server started. Available at URL[service:jmx:


2010-12-13 15:15:12,500 INFO - NodeID[] joined the cluster

2010-12-13 15:15:12,515 INFO - Moved to State[ PASSIVE-UNINITIALIZED ]

2010-12-13 15:15:12,781 INFO - Moved to State[ PASSIVE-STANDBY ]

So we now have two EHCACHE external instances which are clustered, distributed and replicating in an active/passive mode.




Mike Brunt

Mike Brunt wrote on 12/18/10 5:31 PM

My apologies for the malformed configuration file extracts above, I will find a way to put good examples here.
Aaron West

Aaron West wrote on 12/22/10 3:26 PM

Thanks for posting this Mike. It seems mostly straightforward, with the exception of some tasks / configuration changes that aren't clear due to the formatting in the blog post. But, if you clear that up this will be a great resource for folks trying to do out of process caching.

ColbyA wrote on 01/12/11 4:29 PM

Something like the code below could be useful for making sure you don't lock up your server with the " block until connectivity is restored" behavior of Ehcache in CF9:

//Run cacheGet in a seperate thread in case it blocks (e.g. terracotta cluster down)
THREAD name="cacheThread" cacheKey=cacheKey {
Thread.cachedObject = cacheGet(cacheKey);
threadJoin("cacheThread", 1500);

if (cacheThread.status == 'RUNNING' || cacheThread.status == 'NOT_STARTED') {

if (IsDefined("cacheThread.cachedObject") ) {
return cacheThread.cachedObject;

//not in cache, create/fetch object

pakhot wrote on 01/19/11 9:57 AM

thanks for sharing this post, i am going to bookmark this share with my fellows
Custom flag

Custom flag wrote on 07/12/11 3:04 AM

ohh man this is awesome post.i think they should usebanner to get more flow in look.
you know this is great working by the writer.The writer has done a great job in speniding his time in
research about this article. can i subscribe all his posts ?
I am really happy to read this. i was searching this from last two months and atlast i got it. hurrah..!!
superdry uk

superdry uk wrote on 11/18/11 6:13 PM

Every superdry sale fans convinced superdry will be next huge designer. The colors of superdry uk are just amazing because they are universally flattering! It is a great alternative for people who are tired of buying out the entire superdry outlet line and are finished shopping at Our Superdry uk sale store.
Cold Fusion

Cold Fusion wrote on 03/07/12 2:00 PM

Cold Fusion is a great program, i don't know what else to say.
mutuelle obligatoire

mutuelle obligatoire wrote on 04/12/13 12:38 PM

Encore merci. J'ai vraiment apprecié de lire cette article. Bonne journée

afaghc wrote on 10/21/13 9:15 AM

Good!Your blog ended up being quality when i feel as though mcdougal offers comprehensive knowledge on this area. Developments within bio-acceleration technology get resulted in the design of condensed sports activities shirts in which reduce muscle exhaustion of sportsmen along with boost muscles functionality. Inside cheap nike football boots football planet, developments inside boots in the last several years have the entire world by simply surprise Nike Hypervenom .These kinds of soccer footwear would also provide steel studs or tacks killed straight into the crooks to boost terrain grip which can be eye-catching, light-weight along with able to attaining a number of feats Nike HyperVenom Phantom although providing maximum speed, comfort and ease, grasp, control and also defense. To top it all , amazing promotional initiatives as well as recognition by simply professional football superstars add to the nonsense involving shoes or boots. The usage of the right spikes according to the terrain how the sport is going to be played is really a key factor to stop blistering and also accidents that could be severe.Little league people should arranged cr nike mercurial an illustration and make use of the best kind of little league cleats as well as the suppliers need to advise your client for the far better technique football cleats. The boots have got nike mercurial vapor 9 directionally placed blades that increase cutting and invite for rapid modifications involving direction, and also secondary foot grip which offers additional feet away electrical power.
chaussure foot mercurial

chaussure foot mercurial wrote on 10/28/13 2:21 AM

Ce blog contient des articles merveilleux .
f50 chaussure de foot

f50 chaussure de foot wrote on 10/28/13 5:31 AM

great blog,thanks for your revealing so competent write-up.

darrendemers12 wrote on 11/20/13 2:30 AM

Wonderful subject and fair ... you simply have to do more study to come to be many more specific. Yet it's not that bad, it's amazing
sparxx rx

sparxx rx wrote on 10/16/14 8:52 AM

All of our products come in a discreet package so that no one will even know what is on your front doorstep.
caree ramazon

caree ramazon wrote on 11/02/14 12:47 AM

Natural skin care products, or as I prefer to call them these days Holistically-Natural skin care products are most definitely the only answer to responsible healthy skin care.
construction career austin

construction career austin wrote on 11/02/14 12:47 AM

The Center is located between Cesar Chavez to the South, 4th Street to the north, and Red River on one side and Trinity on the other. It covers numerous city blocks, and is practically a city inside a city.
sanderson construction

sanderson construction wrote on 11/02/14 12:48 AM

The Sanderson Field RC Fliers (SFRCF) hosts several sanctioned Academy of Model Aeronautics (AMA) pylon competitions each year. The competitions are sponsored and organized by the Pylon Racers of Puget Sound (PROPS).
orkney news today

orkney news today wrote on 11/19/14 6:52 AM

Exchanging within the foreign currency market is not invariably going to get difficult. The truth is, most traders have realized great good results and profit over the latest fx news right now. Do certainly not leave just about any trading gemstone unturned.
business in arts

business in arts wrote on 11/19/14 6:52 AM

Though the business involving art have to be infallible. Where you acquire the artwork is equally important as what we buy. A good source that could stand guiding what that they sell is surely an imperative.
united small business

united small business wrote on 11/19/14 6:53 AM

Be able to acquire merchandise at affordable by adding from north america using methods created to save people money. Talk of cutting down or eradicating freight prices and brokerage house charges.

click wrote on 12/26/14 10:34 PM

Talk of cutting down or eradicating freight prices and brokerage house charges. wrote on 01/26/15 11:37 PM

Olympic Hockey 2008 finds the usa in any mammoth battle to thwart the particular emerging dominance of The japanese and Cuba regarding baseball supremacy around the world. The XXIXth Olympiad with the Modern Era with the Olympic Hockey 2008 Game titles may allow the curtain fall around the game regarding baseball. wrote on 02/13/15 4:34 AM

Have you been seriously thinking about minority loans as a supply of business launch funding for the new endeavor? Stop your own search! Minority small company loans simply don't exist.
clothing manufacturer

clothing manufacturer wrote on 07/04/15 4:19 AM

Every superdry sale fans convinced superdry will be next huge designer. The colors of superdry uk are just amazing because they are universally flattering! It is a great alternative for people who are tired of buying out the entire superdry outlet line and are finished shopping at Our Superdry uk sale store.

シャネルコピー wrote on 11/12/15 12:35 AM


Ledger Note

Ledger Note wrote on 05/16/16 6:30 AM

It is a great alternative for people who are tired of buying out the entire super dry outlet line and are finished shopping at Our Super dry UK sale store
Hugo Handyman

Hugo Handyman wrote on 06/27/16 7:03 AM

Howdy, it turned out to be such a wonderful experience to have checked out this webpage. I just wanted to commend you on the exceptional quality of your work and to send you good luck with it as you grow down the road. It was a pleasure to browse this website and I will undoubtedly be calling back again shortly to find precisely how you're progressing. All the best and I will see you here very soon - Hugo Handyman
مواقيت الصلاة القاهرة

مواقيت الصلاة القاهرة wrote on 07/19/16 11:32 PM

Thank you for sharing all these informations with us. i find your blog verry informative when it comes about it world and mobile world. keep it up!
مواعيد الصلاة

مواعيد الصلاة wrote on 07/19/16 11:40 PM

zdxncfhvgh tgufyuytnydf

followthefashion wrote on 11/05/16 2:46 AM

Manner doesn’t get any mature, time or maybe span; it can’t always be limited so as to any certain kind. Fashion gives spread across for most possible area of our lifetime. Be this specific clothes, add-ons, make-up, lifestyle merchandise or curly hair it’s a perception which demonstrates one’s selection and state of mind.

advancedlawyer wrote on 11/05/16 2:46 AM

Eventually in every single individual's life that is known they undoubtedly and at last come all-around to problem their function for active.
review site

review site wrote on 07/07/17 9:28 AM

This is very impressive article.
organifi review

organifi review wrote on 07/07/17 9:29 AM

I am happy when reading your blog

Numerologist wrote on 07/07/17 9:29 AM

This post was very nicely written. Review Review wrote on 07/07/17 9:30 AM

Nice to read your article
survival book

survival book wrote on 07/07/17 9:30 AM

I am very glad to see this blog

choosebestinfo wrote on 04/07/19 9:00 AM

Thank you for sharing your article with us and it is very useful for us

Write your comment

(it will not be displayed)

Leave this field empty: