Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev guideRecipesAPI ReferenceChangelog
Dev guideRecipesUser GuidesNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Performance optimization

Optimize the integration performance between Content Management System 12 (CMS 12) and Optimizely Graph.

Optimize the performance of your Optimizely Content Management System 12 (CMS 12) and Optimizely Graph integration. You can improve indexing efficiency and manage system load through batching configuration and content filtering.

Configure batching

Batching controls how content is processed and indexed in groups rather than individually. This approach improves throughput and reduces the frequency of indexing operations.

Configure batching behavior

You can configure batching parameters in the AddContentGraph method.

services.AddContentGraph(options =>
{
    options.BufferedIndexingGracePeriod = 10000; // 10 seconds in milliseconds
    options.MaxBatchSize = 100; // Maximum items per batch
});
  • BufferedIndexingGracePeriod – Defines the time window (in milliseconds) during which content items are buffered before being indexed.
  • MaxBatchSize – Defines the maximum number of items processed per batch during indexing.

Configure event indexing options

You can also configure how referencing content and synchronization tasks behave during indexing.

services.Configure<EventIndexingOptions>(options =>
{
    options.IndexReferencingContent = ReferencingPropertyTypes.Inlined;
    options.SyncContentsInParallelTaskAndForget = false; // Synchronous processing for better control
});
  • IndexReferencingContent – Determines how referenced content is indexed. Setting this to Inlined ensures that references are included within the main content.
  • SyncContentsInParallelTaskAndForget – Controls synchronization mode. Setting this to false enables synchronous indexing, providing better consistency and control.

Filter content

Improve indexing performance by filtering out unnecessary or large content before it is processed by Optimizely Graph.

Implement a content filtering module

The following example shows how to skip large binary content or temporary content during the save event.

public class ContentFilteringModule : IInitializableModule
{
    public void Initialize(InitializationEngine context)
    {
        var events = context.Locate.Advanced.GetInstance<IContentEvents>();
        
        events.SavingContent += (sender, args) =>
        {
            // Skip binary content larger than 10 MB
            if (args.Content is MediaData media && media.BinaryData?.Length > 10 * 1024 * 1024)
            {
                // Use exclude attribute or custom logic to prevent indexing
                return;
            }
            
            // Skip temporary content
            if (args.Content.Name.StartsWith("__temp"))
            {
                // Prevent saving or mark for exclusion
                return;
            }
        };
    }
}

This configuration ensures that only relevant and appropriately sized content is indexed, reducing unnecessary load on the indexing pipeline.