The “cfcache” tag in Coldfusion 9 can help with load spikes related to traffic.  This can add complexity to a site and should only be used if necessary (do not over optimize!).

  http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d5a.html

In my very rudimentary tests it made a simple page that queries a database run faster (3.4 ms per request vs. 6.1 ms per request).  For spikes like an announcement this could be a pretty big win.  The best optimization is to convert to a static HTML page or using SSI, but that isn’t always possible.  A static page was similar to the performance of using cfcache (3.5 ms).

There could be other issues with using cfcache (exhaust memory, bad cache hits, etc…), but it could be a good back pocket option and one to explore.

Here’s the example code that I did:

 (vanilla CFM)

testcf9-vhost

<cfquery datasource="emc256">

select text from text

</cfquery>

<pre>

<cfoutput query="tobedb">

#text#

</cfoutput>

</pre>

% ab -c 50 -n 5000  "vanilla cfm site"

Time per request:       6.194 [ms] (mean, across all concurrent requests)


 (using cfcache)

<cfcache

    timespan="#createTimeSpan(0,0,10,0)#">

testcf9-vhost

<cfquery datasource="emc256">

select text from text

</cfquery>

<pre>

<cfoutput query="tobedb">

#text#

</cfoutput>

</pre>

</cfcache>

% ab -c 50 -n 5000 "cfcache page"

Time per request:       3.400 [ms] (mean, across all concurrent requests)


(static HTML)

testcf9-vhost

<pre>

To be, or not to be, …pre>

% ab -c 50 -n 5000 "static html page"

Time per request:       3.573 [ms] (mean, across all concurrent requests)

  • No labels