CFUnited Session Review: Cashing in on Caching by Tyson Vanek

 
Jul 02, 2007

by Doug Boude, CFUnited Correspondent
http://www.dougboude.com

Before this session began, I wrote down my expectations so that I would have a standard to judge how useful it was.

My expectations:

  • To hear this man's philosophy on caching
  • To learn where caching is typically a viable option
  • To hear some techniques for implementing caching
  • To see some demonstrable metrics showing how effective caching can be

Tyson shared a truly constant stream of nuggets for any developer who longs to see his app run at maximum potential. With the grace of a seasoned speaker and the confidence of a true expert, he explained the definition and goals of caching within an application, as well as a myriad of techniques and tools to help us judge where caching would be advantageous and how to go about it.

For most of us, our caching experience has been limited to adding a 'CachedWithin' attribute to our CFQUERY tags. This can indeed have a very positive effect on performance (it can also have adverse effects when implemented in certain situations), but CachedWithin is just the tip of the iceburg of the options available to us.

Beyond caching queries, what other areas are potential candidates? How about caching the execution plan of a CFML template itself! What? You didn't know that your templates had an execution plan, known to the ColdFusion Server as the 'trusted cache'? They certainly do, and every time you call a template, the Server has to process and evaluate your page in order to decide exactly what it needs to do and in what order. If you enable ColdFusion Server to cache this plan in the Administrator, it won't bother parsing and evaluating templates once it has already done so, but will use the trusted cache instead.

Or how about enabling ColdFusion Server to "Save Class Files," which goes one step beyond caching a template's execution plan and actually saves a copy of the Java class version of your template, using this instead of re-creating the template each time? Then there's the ultimate built-in caching mechanism: the CFCACHE tag. This tag, when present anywhere in a template, even an include, tells ColdFusion to store a hard copy of the completely html-rendered template to disk, and use that copy whenever the template is requested rather than re-rendering it.

These are just the built-in caching elements of Coldfusion! Beyond these are yet another wonderland of techniques that can implemented to cache instances of CFCs, portions of rendered HTML, query results, and anything else that lends overhead to the execution and rendering of a template. All of them require the developer to build his or her own cache management code; however, there's good news. Many developers have already done the work and shared it with us as custom tags and snippets such as "CF_Supercache" and "JohnnyCache."

We should be aware that caching comes with some caveats. For example, most of the time, we'll only want to implement caching in production, as the very nature of caching prevents a developer from seeing code changes until the cache is flushed in some manner. Also, caching of queries does not work for queries that utilize CFQUERYPARAM tags (up to version 7.02...but CF 8 handles it just fine!). The bottom line is that every form of caching has its pros and cons, and you may find that some areas of your apps are not good candidates for caching.

Tyson also spent some quality time teaching the audience approaches to identifying good cache candidates. Look for things that are global to all users, he said, such as application settings, static values, etc. Examine log files and debugging to find those portions of a template that are consuming the most time to execute; and ask yourself questions about the potential candidates, such as:

  • How often will this information change?
  • Is it critical that this information always be real-time data?
  • How big will this item be in memory?

I can't give enough praise to Tyson for the content, organization, and delivery of this presentation...it was absolutely outstanding and far exceeded my expectations.


Having spent four years disarming bombs for the Air Force, Doug Boude is now a Senior Web Application Architect for Fiserv Health in San Antonio, TX. He has been developing with ColdFusion since version 4.0.

Perlen schmuck's Gravatar http://www.toperlen.de
Großhandel Perlenschmuck,Süßwasserperlen,Akoyaperlen: Perlenketten,Perlen Armbänder,Perlenringe,Perlen Ohrstecker,Perlen Ohrringe und Perlenschmuck Set,Brautschmuck.
# Posted By Perlen schmuck | 03-Dec-08 02:48 AM
Perlenkette's Gravatar http://www.topearl.com/de
Perlenschmuck - Süßwasserperlen, Perlenkette, Armbänder, Ohrringe
# Posted By Perlenkette | 03-Dec-08 02:51 AM
Pearl jewelry's Gravatar http://www.topearl.com - online wholesale jewelry store, supplies Pearl jewelry,
coral,turquoise jewelry, shell,gemstone jewelry, pearl bridal jewelry and wish pearls gifts
# Posted By Pearl jewelry | 03-Dec-08 03:03 AM
Bijoux en perles's Gravatar Perles d’eau douce,Perles de culture,Perles d’Akoya,Bijoux en perles - Collier de perles,Bracelets de Perles,Boucles d’oreilles Perle,Pendentifs de perles,Bagues de perles. - http://www.toperles.fr
# Posted By Bijoux en perles | 03-Dec-08 03:06 AM
Fine jewelry's Gravatar http://www.hydiapearl.com - Fine jewelry & pearl jewelry wholesaler, wholesales freshwater pearl beads,akoya pearls,
handmade pearl necklace,bracelet,earring and pendant and so on.
# Posted By Fine jewelry | 03-Dec-08 04:24 AM
Zuchtperlen's Gravatar http://www.toperlen.com
Chinesische Süßwasser perlen,Perlenschmuck,Brautschmuck,
Perlenkette,Perlenarmband,Perlenohrringe,zuchtperlen
# Posted By Zuchtperlen | 03-Dec-08 04:27 AM
Perlenschmuck's Gravatar Großhandel Süßwasserperlen,Akoya Perlen,Zuchtperlen - chinesische Perlen,perlenschmuck,Perlenketten,Perlen Armbänder,Perlen,Perlen Sets & Lose Perlen. - http://www.zuchtperlenschmuck.com
# Posted By Perlenschmuck | 03-Dec-08 04:30 AM
Wholesale jewelry's Gravatar Wholesale jewelry supplies pearl jewelry, sterling silver jewelry, handmade beaded jewelry, fashion jewelry, stainless steel jewelry in China.
- http://www.towholesalejewelry.com
# Posted By Wholesale jewelry | 03-Dec-08 04:37 AM
Gioielli Perle's Gravatar Gioielli Perle–Perle Akoya,Perle di Tahiti,Perle di Acqua Dolce,Perle Australiane,Collane di Perle,Orecchini in perle,Pendenti con perla,Anelli con Perle. - http://www.toperla.it
# Posted By Gioielli Perle | 03-Dec-08 04:48 AM
Joyas en perlas's Gravatar Joyas en perlas,perlas cultivadas–Perlas de Agua Dulce,perlas Akoya,collar perlas,Perlas Tahiti,Perlas Australianas,Pendientes,Colgantes,Anillos de Perlas. - http://www.toperlas.es
# Posted By Joyas en perlas | 03-Dec-08 04:53 AM
jewelry pearl's Gravatar http://www.jewelrypearl.ca
Wholesale cultured akoya pearls,freshwater pearls and pearl jewelry– Pearl necklace,pearl pendant,earring,bracelet,pearl ring,pearl strands from China.
# Posted By jewelry pearl | 03-Dec-08 04:57 AM
Pearl-jewelry's Gravatar Wholesale cultured pearls: South sea pearls,Tahitian pearls,loose pearls,black pearl beads, pearl jewelry,pearl necklace,pendant,earring
- http://www.pearl-jewelry.com.au
# Posted By Pearl-jewelry | 03-Dec-08 05:01 AM
pearl jewellery's Gravatar http://www.pearlsjewelry.co.uk
Wholesale pearl jewellery – cultured pearl necklace,freshwater pearls,pearl bracelet,pearl pendant,pearl earrings,Chinese akoya pearls.
# Posted By pearl jewellery | 03-Dec-08 05:05 AM
Add a Comment
(If you subscribe, any new posts to this thread will be sent to your email address.)
  
Privacy | FAQ | Site Map | About | Guidelines | Contact | Advertising | What is ColdFusion?
House of Fusion | ColdFusion Jobs | Blog of Fusion | AHP Hosting