Question

We have a number of web servers, each running one version of ColdFusion. The cluster has a load balancer on front of it.

Obviously each of these servers has its own CF application running and this implements query caching at the CF application level. However, since all of these servers service the one web application, many of these cached queries are duplicated across CF application instances.

Is there any way to implement query caching at the web application level, i.e. across many CF instances. Or if there is not, is there a better way to set up our cluster to minimise load on our database server?

I hope I made myself clear :)

Cheers, Ciarán

Was it helpful?

Solution 3

Decided to use EHCache on each of our web servers, as it allows partial page caching and can be extended to a centralised cache server i.e. like memcached. Very happy with it so far.

Many thanks for all the suggestions!

OTHER TIPS

You might consider giving memcached a try.

I would look at memcached - there is an open source project for integrating it in ColdFusion here: cfmemcached.

If you happen to be using Railo, I've heard that it also has a "cluster" scope.

If neither of those are available or appeal to you, you could alternatively set up one of your servers to handle the queries you want to cache and then fetch them from that server directly via a webservice. That way you can cache them on just the one server, which will reduce the memory footprint across the cluster and also reduce the frequency of access to the db server. You might want to take the server that's handling the query caching out of the cluster however and simply dedicate it to the query caching and anything else you want to off-load from the front-facing machines while the others handle outside traffic.

you can cluster across and have the application scope shared across the servers, but you must be using the enterprise version of ColdFusion. More information here: http://livedocs.adobe.com/coldfusion/7/htmldocs/00001774.htm

The session scope can be clustered in ColdFusion, if you turn on j2ee sessions. But all a clustered scope does is copy the data across the servers. So the queries would still be copied on all 3 servers. So you would be back to where you are now.

However, I would just use the CachedWithin attribute of cfquery instead of using the application scope. This way you are letting the CF engine do the actually cache management. Keeping memory from getting out of hand, and you don't add the overhead of copying lots of data between servers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top