Information for: DEVELOPERS   PARTNERS

Tuning your Memcached settings

About Memcached

The Memcache Admin Drupal module (included in the Memcache API and Integration project) provides statistics about how Memcached is behaving on your application. By analyzing these statistics, you can decide whether or not you need to allocate more memory to Memcached on your server.

To use the Memcache Admin module, complete the following steps:

  1. Enable the Memcache Admin module in the Memcache API and Integration project. There is no need to enable the Memcache module. However, if you do enable it, you can receive notifications when you need to update the module.
  2. View the Memcache statistics on your Drupal application’s Administration > Reports > Memcache statistics page.

Review the Memcache statistics page to determine how the cache is behaving. This page reports the following:

  • Amount of memory the Memcached daemon is using.

  • Percentage of memcached memory used compared to the total memory allocated to it.

  • Number of evictions since the last time the service was started or the stats were reset.

    Compare the ratio of evictions to total memcache activity. If evictions are a high proportion of total memcache activity, consider whether you should allocate more memory to Memcached. Bear in mind, however, that if you allocate more memory to Memcached on your server, you’ll have less memory for other server functions, including PHP. Proper memory allocation depends on your application configuration.

For more information, see the Memcache monitoring and flush using the nc command Knowledge Base article.

By default (with stampede protection enabled), when a thread encounters a locked cache entry, it waits five seconds, and then attempts to access the cache entry again. The Drupal Memcache module includes a memcache_stampede_wait_time variable that you can use to control the amount of time a thread waits before trying again, and a memcache_stampede_wait_limit variable to control how many attempts are made by a thread. You can also use configuration variables to disable stampede protection for specific cache bins or patterns of cache IDs. For more information, see the ignore settings in the module. If your application is experiencing many threads in a lock wait state, you may be able to improve performance by adjusting these settings.