Tuesday, August 9, 2016

Configuration for Handling Failing Thumbnails in Alfresco

Some content cannot be thumbnailed or can take a significant amount of time to generate a thumbnail. Failed thumbnail generation can add up to a significant cpu cost on the repository server. This is the reason Alfresco limits the frequency with which the repository tries to recreate thumbnails. It is based on previous failed thumbnail attempts for that definition on that source node, as well as some configuration data.

The details of how these thumbnail creations are limited is described in JavaDocs for NodeEligibleForRethumbnailingEvaluator class.

When the first attempt to generate a thumbnail for a node fails, Alfresco records that attempt by assigning a cm:failedThumbnailSource aspect to the source node and it also creates a cm:failedThumbnail child to store the failure data.

You can examine the source node in Alfresco Node Browser to see the applied cm:failedThumbnailSource aspect and the cm:failedThumbnail child.

The cm:failedThumbnail child stores failure data like failed thumbnail attempts(cm:failureCount) and the datetime of the last failed thumbnail generation attempt(cm:failedThumbnailTime).

The configuration for handling failing thumbnails is defined in the repository.properties file; here are the default configuration values from repository.properties file:

# Configuration for handling of failing thumbnails.
# See NodeEligibleForRethumbnailingEvaluator's javadoc for details.
# Retry periods limit the frequency with which the repository will attempt to create Share thumbnails
# for content nodes which have previously failed in their thumbnail attempts.
# These periods are in seconds.
# 604800s = 60s * 60m * 24h * 7d = 1 week

These property values can be overridden in the alfresco-global.properties file to change the behavior for how the repository retries to create the thumbnails.
If a thumbnail is not successfully produced for a node after the number of attempts specified in “system.thumbnail.retryCount” then it is considered to be a 'difficult' piece of content with respect to thumbnailing. The attempts to thumbnail difficult pieces of content can be disabled by setting “system.thumbnail.quietPeriodRetriesEnabled” to false.

Increasing the “system.thumbnail.retryPeriod” value would reduce the frequency of the initial tries to produce a thumbnail. If the initial try to produce a thumbnail failed because the server was overloaded at that time and the thumbnail attempt timed out then increasing the "retryPeriod" should help.

If in your installation software patches are installed on a nightly basis then the content may become thumbnailable after the patch is installed so reducing “system.thumbnail.quietPeriod” value from 1 week should help in successfully generating the thumbnail sooner.

These property values can be changed to increase the frequency of the repository retries to create the thumbnail but make sure that the new values don't add significant cpu cost and overload the repository server.

No comments:

Post a Comment