If your web pages consist of many content fragments and are delivered rather leisurely, we recommend taking a look at your caches and at the ways these pages are put together. Here are a couple of hints for you:
- Combine as much data as possible into one object. If, for example, your website offers detailed product information, e.g. descriptions, specifications, data sheets, prices, etc., do not spread these pieces all over your CMS object hierarchy but keep them together in as few objects as possible. This significantly reduces the number of objects to be fetched for the purpose of rendering a single page.
- Avoid chained lookups. It is common practice to use a linklist, reference, or referencelist attribute for accessing pieces of data that are related to a CMS object, but are stored separately. However, fetching an object just to access another attribute of one of these types doubles the number of requests required for getting at this related data.
- Publish working copies sparingly. Of course, when the CMS is initially filled with content, the working copies used for this need to be published in quick succession. However, using a script that repeatedly touches a couple of objects and then publishes the working copy causes the caches to be cleared every time. This, in turn, reduces the performance of content delivery for most visitors, and not just for a few, because the number of cache hits is so low.
- Think in terms of caching. There are several types of caches. They differ in what they cache, and how they work, but their common goal is to speed up the delivery of your content. Do not subvert them. Rails has built-in caching.