The Performance Impact of Returning Metadata

  • Updated

This article describes the performance impact on APIs when returning additional metadata.

Ektron recognizes that a great deal of metadata can be associated with any content item. So from a performance perspective, the relevant properties are set to false to reduce the database retrieval time. This is true for a single and a list retrieval. The ContentManager has the following methods.

(This is taken from the definition in the Ektron.Cms.Framework.dll.)

        //   returnMetadata:
        //     Flag indicating whether or not ContentMetadata should also be retreived with
        //     the content item.
        public ContentData GetItem(long id, bool returnMetadata = false);

To return metadata, the user must set the second parameter to true. This consideration becomes more important when working with large lists.

        // Returns:
        //     List of ContentData objects matching the supplied criteria
        public List GetList(ContentCriteria criteria);

It is also set to false by default. The property is found in the criteria itself.  For example:

Ektron.Cms.Content.ContentCriteria criteria = new Ektron.Cms.Content.ContentCriteria(Ektron.Cms.Common.ContentProperty.Id, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
criteria.ReturnMetadata = true;

This impacts performance if the expectation is to return large lists of content, each with potentially large amounts of metadata. In extreme cases, Ektron recommends breaking the list retrieval to smaller lists and using a caching implementation to further reduce the load on the database. For more information on caching, click here.