Cloud Platform

Using Memcached

Memcached is a general-purpose memory cache infrastructure daemon. It can improve Drupal application performance by moving Drupal’s standard caches out of the database and by caching the results of other expensive database operations.

The most common use of Memcached with Drupal is storing Drupal’s cache tables in Memcached instead of in the application database. Storing Drupal’s cache tables in Memcached reduces the load on the database with every page load.

Using Memcached may slow down your application if it is a minimally customized Drupal site or already performant. Memcached is most valuable to large applications with high database activity. Acquia recommends testing your application with Memcache both on and off to determine which improves your site performance.

Installation instructions

For installation instructions, see Enabling Memcached on Cloud Platform.

To learn more about how Memcached can benefit your website, see information about the architecture of Memcached, and how Drupal and the Memcache module work together. To improve Memcached performance on your website, you can tune your Memcached settings for optimal performance, and enable stampede protection by moving locks into memory.

You can also install the PECL Memcache extension to provide an API to communicate with the Memcached service.

Memcached versus Memcache

Memcached is the name of the server-side daemon; Memcache is the name of the PHP extension adding the libraries to create the PHP functions for communication with the daemon; Memcached is a PHP library which facilitates communication with the daemon. Cloud Platform runs the Memcache libraries. The PHP Memcache project at Drupal.org uses the Memcache libraries.

For more information about how to communicate with the Memcached daemon using PHP, see the Memcache reference at php.net.

Memcached availability

Cloud Platform supports Memcached for subscriptions and products based on the following table:

Product nameDescription
Cloud Platform ProfessionalYou can enable and manage Memcached for your applications.
Cloud Platform EnterpriseAcquia will configure your infrastructure with an appropriate amount of memory for Memcached. Subscribers with environments on the Cloud Classic infrastructure can purchase dedicated Memcached capacity.
Site FactoryTo use Memcached with your websites, contact your Technical Account Manager (TAM) or Account Manager to review your infrastructure before implementing a post-settings.php hook.
Cloud Platform CDCloud Platform CD environments meeting certain requirements can use Memcached.
PipelinesMemcached is supported for YAML files using version key 1.3.0 or later.

You can modify Memcached memory allocation on an Cloud Next environment. The default value is 64 MB and is enabled for all environments. You can set the memory limit between 64 MB and 12 GB. However, you can contact Acquia Support to set the memory limit to a value higher than 12 GB. To disable Memcached, set the value to 0 and add the following line to your settings.php file:

define('AH_NO_MEMCACHE_INCLUDE', 1);

Cloud Platform CD prerequisites for using Memcached

Cloud Platform CD subscribers can use Memcached and install it on a per-website basis, and can secure Memcached using SASL credentials. If you need Memcached support for your CD environment, the environment must meet the following prerequisites:

  • The environment uses the PECL Memcached extension.
  • The environment must include the Memcache API and Integration module. If you are using Drupal 7, ensure you use version 7.x-1.6 or later.

After meeting the preceding requirements, CD applications can use the 64 MB of allocated Memcache.