Share via


How to Configure the Content Selection Framework for Performance and Scalability

This topic presents tips for how to make sure that your custom extensions to the Content Selection Framework (CSF) maintain maximum performance.

Make Pipeline Components Free-Threaded and Marked as Poolable

For maximum performance, implement your pipeline components in Microsoft Visual C++ by using the Active Template Library (ATL). Make the components both-threaded and be sure to indicate to the pipeline that it can pool the components by adding the Component Object Model (COM) category, CATID_POOLABLE, to the registration information of your component.

Avoid Database Access on a Per-Request Basis

For performance reasons, the CSF was designed to avoid database or disk access on each content request. Instead, it caches all of the content into the in-memory ContentListFactory Object and Dictionary Object. It queues campaign item event data and writes it out the next time Commerce Server Core Systems refreshes the cache. When you write your own extensions to the CSF, try to retain this design point, if possible.

Avoid Too Much Content in a Single In-memory Cache

If the amount of content being served by the CSF grows too large, it might not be possible to store all of the content in a single ContentListFactory object. For example, if the CSF is considering more than 1,000 content items, segment the items into multiple content caches. Find a dimension to segment on, such as a page group or site name.

Alternatively, in the Load Context stage of your CSF pipeline, you can make a query against a content store, such as a Microsoft SQL Server database. Use the results of the query to build a ContentListFactory object unique to the request that contains a small subset of the content. If you use this method, build in filtering as part of your query to avoid building a new index on each ContentListFactory object that you create.

Use Filtering Instead of Expression Evaluation

When you have a dimension that you commonly use for targeting on your site, consider using a filter instead of expressions to target that dimension. Because filters use pre-built indexes on the ContentListFactory object, they are more efficient than expressions. However, filters generally require a site developer to set them up, whereas a business manager can create and manage expressions.

Avoid the "Funnel Effect"

Try to arrange your filtering and scoring operations in order of increasing performance cost. Filtering should be first (hence its order in the CSF pipeline), followed by rudimentary scoring, such as application of exposure limits. The last step should generally be expression evaluation because it is usually the most costly operation. Your goal should be to eliminate as much content as possible, as early as possible. For example, if your site uses multiple ad banner sizes, any given user request is usually for only one of those sizes, so a filter is used to quickly eliminate all ads with a size that does not match the requested size. You should look for other opportunities to apply such filtering.

See Also

Other Resources

Content Selection Framework