Content Hub

Working with content dependencies in Content Hub 1.x

Important
  • This page applies to Acquia Content Hub 1.x.
  • Content Hub 1.x will reach end-of-life on September 30, 2024. Acquia recommends you to upgrade to Content Hub 3.x. For more information, see Upgrading from Content Hub 1.x to 3.x.

Drupal content can contain dependencies, such as node references, which rely on other content. Acquia Content Hub can export content to the central hub, including the dependent content. This includes websites with complex, nested, highly interdependent content.

When sharing content with Acquia Content Hub, be aware of what content may relate to it. Acquia Content Hub must examine each of those entities for content related to them. With some complex data relationships, the data may not have room to fit within the memory footprint allowed by the server.

As an example, your website may have content related to a particular office. That office may have relationships with the other members of the office. Those members can have relationships with their work groups, which may have relationships with other offices.

If all your content relates to other content, you can export your entire website to Acquia Content Hub each time a piece of content updates. This approach changes a minor update into a large set of requests sent to Acquia Content Hub, and has the potential to cause serious performance issues for your website.

To prevent these types of occurrences, Acquia Content Hub takes precautionary steps. Users can create their own queue using Drupal’s Queue operations system (or another queue system of your choice).

Setting queue dependency limits

Acquia Content Hub can use the queue to help limit the amount of data processed on both the subscriber and publisher websites.

ConceptDefinitionDefault value
DepthThe number of dependency levels checked30
LoadThe number of dependencies to load500
Sent/ReceiveThe number of dependent entities to send or receive500

In Drupal 7, deferred entities are available to other modules for custom processing by using the following hooks:

  • hook_content_hub_webhook_get_unprocessed_entities()
  • hook_content_hub_connector_defer_entities()
  • hook_content_hub_connector_defer_entities_import()

Setting limits for export

When preparing to publish content, Acquia Content Hub reviews both the number of nodes and how many levels of referenced content to send. This content is then processed, and any remaining content moves to the queue. Variable names are dependent on your Drupal version, and are described as follows:

  • Current Drupal version: The current Drupal version has a single parameter to limit exported dependencies. The dependency_depth parameter limits the level of dependencies to evaluate, but doesn’t limit the actual number of exported items. This parameter can be also set by using Drush.

    drush config-set acquia_contenthub.entity_config dependency_depth 3
    

    This example sets the value to 3 (which is the default), and indicates that exporting collects entities on the first three level of dependencies.

  • Drupal 7: The following variables can be set for export:

    • Depth - content_hub_connector_max_dep_depth
    • Load - content_hub_connector_max_dep_load
    • Send - content_hub_connector_max_dep_send
    • cache_exported - FALSE - When TRUE, this tracks which items that have changed, and doesn’t send unchanged items. This feature is still under development.

    Based on the default values for these variables, Acquia Content Hub will initially evaluate up to 30 levels of dependent content, and then load and send up to 500 items to the service.

    If Acquia Content Hub reaches its send limits, the following warning message displays:

    Content dependency limits were reached. Not all dependencies were
    submitted to Content Hub.
    

    A message also records in the status report (Reports > Status report), from content_hub_connector, which states how many items Acquia Content Hub sent to the queue, and will look like the following message:

    entity limit enforced: X not charted, Y not loaded, Z not sent
    

    where X, Y, and Z are the number of items not processed. The queue will process during standard Drupal cron runs.

Setting limits for import

When importing content from Acquia Content Hub, the amount of discovered and imported content also faces limitations based on dependency levels.

Variable names on the subscribing website:

  • Load - content_hub_connector_max_entities_webhook_request
  • Depth - content_hub_connector_max_dep_depth_import - limits the levels of dependent content to import
  • Send/Receive - content_hub_connector_max_dep_receive

You can use Drush to check the import queue variable values and status, which returns the following items and their current values:

  • Load - max dependencies
  • Depth - max dependency gap
  • Send/Receive - max items

Changing the queue processing class

When using queues for Acquia Content Hub, it’s good practice to switch the default queue processing class from DatabaseQueue to MemoryLimitDatabaseQueue, which the module provides. This class provides a graceful process termination when facing issues related to memory exhaustion.

To switch the default queue processing class, add the following lines to the website’s settings.php file after the Acquia require line:

$settings['queue_service_acquia_contenthub_export_queue'] = 'acquia_contenthub.queue.database.memory_limit';
$settings['queue_service_acquia_contenthub_import_queue'] = 'acquia_contenthub.queue.database.memory_limit';

Queuing for publishing

Acquia Content Hub, by default, uses Drupal’s queueing system. When the system detects an update needs to send to the central hub, it analyzes the number of changes Acquia Content Hub must process. It then sends the first batch of content to the hub, and adds the rest of the content to the queue. Processing the queue should complete in under five minutes in most circumstances.

If you have your own queuing solution, it’s possible to use that solution in place of what Acquia Content Hub provides.