Related Products


Date Published: February 18, 2025

How to Avoid Acquia Purge Queue errors

Issue

Your Drupal site using Acquia Purge module shows messages similar to:

The system cannot publicly refresh the changes you just made, because of the following error conditions: 

Your queue contains [N] items and crossed the safety limit of [N] items, Acquia Purge has shut itself down to prevent your system from thrashing. What this means is that you are either purgingtoo broadly (domains, http:// and https://) or that your installation is not able to keep up. If you are not using cron for processing, set this up now and if you already are, increase your croninterval! If you have many domain names, reduce the list. Clear Varnish manually and run drush ap-forget to clear your queue and unblock the safety shutdown. 

Please contact your system administrator or development partner!

Or

Your queue exceeded 100 000 items! This volume is extremely high and not sustainable at all,so Purge has shut down cache invalidation to prevent your servers from actually crashing. This can happen when no processors are clearing your queue, or when queueing outpaces processing
 

Resolution

Short-term fix

The queue is safe to clear so that Acquia Purge resumes normal processing. You can do this with the following command

# Drupal 7
drush @SITE.ENV --uri=[DOMAIN] ap-forget

# Drupal 8/9
drush @SITE.ENV --uri=[DOMAIN] pqe

After this, you should clear Varnish cache for the domain, so that changes are reflected to your visitors. Note you may experience higher site load while your cache is rebuilt.

Long-term fix

It's best to heed that Acquia Purge warning, and adjust the settings so that:

  • the task the Acquia Purge used to clear the queue runs more frequently
  • the domains that are listed by Acquia Purge, are targeted for each site so the right content is getting cleared out at the right time.

You can also try to determine what is causing a large amount of items in the Purge queue by inspecting it:

  • Run the Drush command `drush --uri=[DOMAIN] p:queue-browse` and manually page through items to see what kind they are.
  • Look for clues like many items added at the same time or duplicate entries (which may point to some batch/mass process creating a lot of items in the queue) .
  • Optionally you can dump the queue into a text file using mysql, for example:
    # Run this from the Drupal document root.
    echo 'select data FROM purge_queue' | drush --uri=[DOMAIN] sqlc --extra=--skip-binary-as-hex >/tmp/purge-queue-dump.txt

Adding a cron task to Acquia Purge to remove stale content more frequently

Acquia Purge by default only does purging at the end of some web requests. This may not be frequent enough. It is safe to run this process as often as needed via a scheduled task. 

Add this to your settings.php file:

// Drupal 7 only
$conf['acquia_purge_cron'] = TRUE;

Then, add a scheduled (cron) task to run as often as necessary.

// Drupal 7 onlydrush @SITE.ENV --uri=[DOMAIN] -dv ap-process >> /var/log/sites/${AH_SITE_NAME}/logs/$(hostname -s)/drush-cron.log 2>&1

// for Drupal 9/Drush 10
drush @SITE.ENV --uri=[DOMAIN] -d -v pqw >> /var/log/sites/${AH_SITE_NAME}/logs/$(hostname -s)/drush-cron.log 2>&1

Limiting the number of domains covered Acquia Purge

You should use the diagnostic command drush apd to check the number of domains purged by Acquia Purge. Depending upon your site architecture, you may need to run that same test with Drush for each of the live sites to double-check that you are not purging content from too many domains.

// Drupal 7
drush apd --uri=[DOMAIN]

// Drupal 9+
drush p:diagnostics --uri=[DOMAIN]

Note that it will only list the schemes that are covered. If you only see http listed then it will only clear URLs that start with http://. To automatically purge HTTPS URLs, you need to configure Purge to include the acquia_purge_https configuration variable set to TRUE.

For much more information see Acquia Purge Domain Detection.

Sample output looks like this:

[ok]      HOSTING ENVIRONMENT         acquia cloud (site)
 [ok]      LOAD BALANCERS              172.16.0.191, 172.16.1.99
 [ok]      MODULE CONFLICTS            none
 [ok]      PURGED DOMAINS              www.example.com
 [ok]      CACHE EXPIRATION            delegated
 [info]    LOGGING VERBOSITY           failures only
 [error]   ANONYMOUS PAGE CACHE        disabled
 
           Your site has Drupal page caching disabled, which is of
           extreme importance to every website that gets traffic.
           Once enabled your load balancer will be instructed to
           start serving pages from its cache to offload traffic
           from your web servers. The more traffic served from your
           load balancer, the faster your site will be!
 
 [warning] EXPIRATION OF CACHED PAGES  3 hours
 
           The "expiration of cached pages"-setting of your website
           is set to 3 hours, while we strongly recommend to put it
           to 6 hours or longer in combination with the Acquia
           Purge module. The setting determines how long external
           caches (like our load balancers) are instructed to keep
           a cached copy of content. With your current
           configuration, your load balancer is not used
           effectively and your web servers will likely be under
           stress, causing a slow site and system resources being
           wasted.
 
 [ok]      PROCESSING MODE(S)          ajax
 [ok]      PROCESSING CAPACITY         50 items per run, slowdown factor=2x
 [ok]      PURGED SCHEMES              http
 [ok]      QUEUE BACKEND               database
 [ok]      QUEUE VOLUME                0 (warning: 1500, shutdown: 5000)
 [info]    STATE DATA LOCATION         memcache
 [info]    STATUS                      idle

 

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation
Back to Site navigation