Search This Blog

Monday, April 26, 2010

Release It! - Chapter 10.3 Precompute Content

Precomputing, at least in the context of this chapter, means "you don't have to make every web page dynamic".  The cost of generating dynamic HTML adds up and can really tax a system.  How often do those dynamic portions of the site really change?  Maybe you can rebuild a web page once an hour instead of every hit and still keep a site fresh? Precomputing content isn't free, however.  It requires storage space for each piece of computed content. There is some runtime cost to mapping an identifier to a file and reading the file. For commonly used content, this cost might motivate you to cache the content itself in memory. The cost of generating the content mainly occurs when the content changes. If the content gets used many times before it changes, then precomputing it is worthwhile. Personalization works against precomputed content. If entire pages are personalized, then precomputed content is impossible. On the other hand, if just a few fragments or sections are personalized, then the majority of the page can be precomputed with a “punch out” for the personalized content. Precomputed content does not need to be an all-or-nothing approach. Some high-traffic areas of the site can be precomputed, while less frequently visited pages can be fully dynamic.
  • Precompute content that changes infrequently - Any content that you present many times before it changes could be precomputed to save time during request handling. Factor the cost of generating the content out of individual requests and into the deployment process.

No comments:

Post a Comment