Rob Brooks-Bilson
Tech, Photography, Stuff
Tech, Photography, Stuff
January 19, 2012
If you happen to be in the Phoenix area on Wednesday, January 25th, stop on by the University of Advancing Technology at 6:30 pm to catch a preview of my upcoming cf.Objective presentation: Ten Steps to Move Your Use of Caching Beyond the Basics. Here's a short description of the presentation:
We all know that caching plays an important part of any performant and
scalable application architecture and that with ColdFusion 9 caching is
easier than ever. This session explores 10 steps you can take to move your
use of caching beyond what ColdFusion provides out of the box.
*Please note that this presentation won't be recorded/streamed. You have to be there in person to see it. Normally I'm all for recording and streaming, but since this is a preview of a talk I'll be giving at an upcoming conference, I want to limit the audience out of respect to those attending the conference.
June 22, 2011
The follow up discussion to a recent blog post by Ray Camden made me realize that there's a lot of misunderstanding (including the ColdFusion documentation) about how ColdFusion's user defined caches work. In this blog post, I hope to clear up some of that confusion.
ColdFusion 9.0 completely overhauled CF's caching mechanism and replaced the old file based system with Ehcache. Out of the box, ColdFusion made two default caches available to every ColdFusion application, an object cache and a template cache. It was also possible to create additional user-defined caches at runtime, but only if you were using the cfcache tag, not the caching functions. Here's an example that puts and gets data from a user defined cache:
ColdFusion 9.0.1 added the ability to use user defined caches in many of the caching functions as well. Here's our previous example written using cacheGet() and cachePut() instead of the cfcache tag:
One thing to note here is that neither cacheGetProperties() nor cacheSetProperties() can be used to configure the properties for a custom cache in ColdFusion 9.0 or 9.0.1. If you want the cache configuration to differ from ColdFusion's default cache configuration, you'll need to configure the cache in your ehcache.xml file:
Obviously it's not always desirable or even possible (say in the case of a shared hosting environment) to hard code configuration settings in the ehcache.xml file. Besides that, anytime you make changes to the XML file you need to restart ColdFusion for them to take effect. While I hope that Adobe adds the ability to set properties for custom caches in a future release of ColdFusion, there is a solution you can take advantage of today in the form of a small UDF I wrote called cacheCreate().
The cacheCreate() UDF allows you to create a new user defined cache at runtime and pass in configuration options that ColdFusion currently requires you to set in your ehcache.xml file. It uses Java to call the underlying Ehcache API and do the heavy lifting for you. Here's the code (you can also get cacheCreate() at cflib.org:
To create and configure a new user defined cache in your application, all you need to do is something like this:
While this won't work in all cases (say you want to cluster your cache or add in a Terracotta Server Array), it should get you thinking about other ways you can extend ColdFusion's ehcache implementation by utilizing some of the Ehcache Java API within CF.
May 24, 2011
As you might have heard, Terracotta -- the makers of Ehcache, the Terracotta Server Array, Quartz Scheduler and Big Memory recently announced their intent to be acquired by German software company Software AG. If you're wondering who Software AG is, you're probably not alone. Until recently, Software AG was a relatively little known company in the US. Although they've been in business since the late 1960's, their main market had been Europe. That all changed in 2007 when they acquired WebMethods, one of the largest providers of integration systems and services. This more than doubled their North American customer base. They continued to fuel their rapid growth from their mainly through acquisition. After WebMethods came IDS Scheer in 2009, Data Foundations in 2010, and now Terracotta. Each of their acquisitions has succeeded in growing their customer base, and in most cases, their revenue as well.
So, why Terracotta when Software AG is known as a business process and SOA infrastructure company? The first reason is for the technology itself, mainly Ehcache, Terracotta, and Big Memory. Software AG has big plans for the cloud, and in-memory capability and scalability play a huge part in building out their PaaS infrastructure. There are other potential benefits as well. Open source Ehcache claims an install base of over 500,000 with a sizeable open source community to back it. Although Software AG has little experience in the open source market, they've committed to the Ehcache and Quartz communities going forward. There's also the opportunity to improve job scheduling within the existing WebMethods suite. If you've ever used their existing scheduler, you know that it leaves much to be desired.
The company I work for has been a Software AG customer for close to 7 years now. We started with their ESB (Crossvision Service Orchestrator) and Tamino XML database, upgraded to WebMethods Integration Server after the merger, and have added capabilities around Business Activity Monitoring and SOA Governance since then. All along the way, Software AG has worked closely with us to meet our often challenging requirements. I think in that respect, Terracotta customers are in good hands. I've also spent considerable time working with Ehcache and Terracotta over the past 3 years now – writing articles and blog posts about their caching technology as well as speaking at several conferences. Although I didn't see the acquisition coming, I think combining the passion and talent of the folks at Terracotta with the resources and track record of Software AG will be a win for everyone involved.
While that last statement might sound like rainbows and unicorns, there is one area where I hope Software AG can learn from Terracotta, and that's community. Having been involved with various technology communities over the years, I feel that the Software AG community could use some help. With the exception of a few sites, there's little evangelism that happens outside of Software AG branded properties. Sure there are official Software AG blogs, and Software AG forums, but what I don't see is a vibrant community outside of Software AG writing about and talking about their products. Contrast that with Terracotta, and especially the Ehcache community and you'll see exactly what I mean. Let's hope that Software AG makes the most of the community they're getting along with the technology.
May 13, 2011
Slides, config files and code for my cf.objective() 2011 presentation, "Undocumented and Off Script: ColdFusion & Ehcache" are now available. You can view the slides inline, or download the attached zip file which contains the presentation and all files/code from the presentations.
As always, if you have questions or want to discuss, leave a comment or hit me up on twitter at @styggiti.
April 27, 2011
Headed to cf.Objective 2011 and want to learn more about caching in ColdFusion with Ehcache? Stop by my session Undocumented and Off Script: ColdFusion & Ehcache on Thursday, May 12th at 10:15 am. I'll cover a broad range of topics including upgrading the version of Ehcache that ships with ColdFusion, clustered caching, distributed caching, cache search, cache monitoring, developer tools, and much, much more.
I hope to see you there!
April 26, 2011
My latest article on Building High Performance Applications with ColdFusion 9 and Ehcache 2.4 is out on DZone. In addition to covering basic caching concepts, the article also walks you through the process of updating the version of Ehcache that ships with Coldfusion from 2.0 to 2.4 as well as installing and configuring a Terracotta server for distributed caching.
August 19, 2010
The Webex recording, Powerpoint slides and example code I used in last week's Boosting Performance and Scale for ColdFusion Applications with Ehcache webinar are now available. You can watch the recording here (note that registration is required):
Boosting Performance and Scale for ColdFusion Applications with Ehcach
Additionally, you can view the presentation slides:
Alternately, you can download the slides.
You can also download the sample code.
Please note that the examples created for blogCFC should only be considered a POC to demonstrate concepts and not production ready code.
August 9, 2010
I submitted a bug for this but the system seems to have swallowed it up without giving me the bug number (probably because I submitted as cf 9.0.1).
I've found what I consider to be a serious bug an issue with ColdFusion's
ehache implementation and query objects that may bite you if you're not aware of how it works. If I take a query object and stick it in cache, then perform an operation on the original query
object such as adding a column or performing certain query of query
operations, ColdFusion is treating the query object that's in cache as
if it were a copy by reference to the original query object. That is,
if I make a change to the original query object, ColdFusion is also
applying the change to the version that's in cache.
As far as I'm concerned, cache represents a boundary that ColdFusion
should not implicitly cross. With most caching systems I've worked with in the past (such as memcached), the cache always acted as a dumb key/value store. Unless I perform an explicit cachePut(), I wouldn't expect that CF would update values in the cache. Here's
two code snippets that reproduces the case. The first uses the
cfartgallery data source:
The second example shows how this can be done with a query of a query, based on a different bug Ray found previously (see http://www.coldfusionjedi.com/index.cfm/2009/8/28/Another-example-of-the-QofQ-Bug). In this sample, note that the date gets reformatted by the query of a query and both the original query and the cached version get updated:
The work around for this problem is to use the duplicate() function to make a clone of the query object before doing the cachePut(). Although this works, there are other potential consequences from having two copies of the query around, so be careful.
Update: It looks like this is actually expected behavior in Ehcache. Unfortunately, it's not documented in the ColdFusion documentation anywhere, but Ehcache actually has two configurable parameters (as of v. 2.10) called copyOnRead and copyOnWrite that determine whether values returned from the cache are by reference or copies of the original values. By default, items are returned by reference. Unfortunately we can't take advantage of these parameters right now as CF 9.0.1 implements Ehcache 2.0.
I can live with this, but it's not what I expected as I've always viewed Ehcache as a "dumb" key-value store and certainly didn't expect this behavior. Even if ColdFusion was running v 2.10 of Ehcache, it's still not something we could easily configure. Since ColdFusion currently doesn't have a cacheNew() function for creating new user-defined cache regions, the only way to turn this functionality off would be to hard-code your cache configuration in your ehcache.xml file for each user-defined region where you want to disable copyOnRead and copyOnWrite.
August 5, 2010
ColdFusion 9.0.1 added a new function called cacheGetSession() that returns the underlying cache object for Ehcache. What's really cool about this is that it allows you to get at just about all of the features available in Ehcache that aren't directly exposed to ColdFusion through built-in functions.
I was recently working on some example code for an upcoming caching presentation when I ran into a situation where I wanted to get a list of all caches that had been created on the server, including custom caches I had created myself. One simple line of code is all it took:
What you should note here is that even though I'm telling cacheGetSession() to get the cache object for the default object cache, getCacheManager() exposes a method called getCacheNames() which returns an array of cache names for the instance of cache manager. In the case of ColdFusion's Ehcache implementation, ColdFusion instantiates cacheManager as a singleton such that all caches are managed by the single cache manager. When you call getCacheNames(), it will return you a list of all caches currently implemented on the instance of ColdFusion.
While this may not be an issue for many people, if you are on a shared server it may be a concern. The only way to disable this is to disable the cacheGetSession() function using sandbox security.
July 27, 2010
If you've been following my series on caching in ColdFusion 9, you know that ColdFusion 9.0 includes the powerful caching platform Ehcache from Terracotta. What you may not know, though, is that in ColdFusion 9.0.1 Adobe upgraded the Ehcache engine from version 1.6 to 2.0. This brings several new caching capabilities to ColdFusion and makes them dead simple to implement. If you're interested in learning more, Mike Allen from Terracotta and I are presenting a webinar on August 12, 2010 at 11am Pacific time. Here's the official announcement:
Join me and Mike Allen, the head of product management at Terracotta in a discussion about simple and effective ways to scale and boost the performance of ColdFusion applications using Ehcache.
In this webcast, you'll learn:
Please register for this webcast even if you are unable to attend and you will get an email with a link to the recording.