Another popular use for
cfhttp is to generate static HTML pages from
dynamic content. As useful as dynamically generated pages are, there
are still times when using static HTML pages makes more sense,
because static pages load faster than dynamic pages. Dynamic pages
require more processing overhead, because each request must be passed
to the ColdFusion Application Server in addition to the web server.
This doesn’t include the added time it takes to
process all the CFML code contained in each template. The differences
in load time between static and dynamic pages becomes clear.
Yet, it isn’t practical or even desirable to convert every page in a site to a static page. There are some amazing things that can be done with dynamic pages that just can’t be re-created with static HTML pages. How do you decide which pages in a site or application should be static and which dynamic? There is no simple answer, but there are some useful guidelines to help you decide:
Data that is infrequently refreshed is a prime candidate for static page material. For instance, if you have a ColdFusion template that outputs a table of sales figures that change only once per month, it makes more sense to have the page exist as a static page. Why tie up your server with the additional overhead of running the exact same query over and over only to return the same result set each time? It’s much simpler to write a small ColdFusion template that performs the query and outputs the ...