You are here

README.txt in Zircon Profile 8

## IMPORTANT NOTE ##

This file contains installation instructions for the 7.x-1.x version of the
Drupal Memcache module. Configuration differs between 7.x and 6.x versions
of the module, so be sure to follow the 6.x instructions if you are configuring
the 6.x-1.x version of this module!

## REQUIREMENTS ##

- PHP 5.1 or greater
- Availability of a memcached daemon: http://memcached.org/
- One of the two PECL memcache packages:
  - http://pecl.php.net/package/memcache (recommended)
  - http://pecl.php.net/package/memcached (latest versions require PHP 5.2 or
    greater)

## INSTALLATION ##

These are the steps you need to take in order to use this software. Order
is important.

 1. Install the memcached binaries on your server and start the memcached
    service.
 2. Install your chosen PECL memcache extension -- this is the memcache client
    library which will be used by the Drupal memcache module to interact with
    the memcached server(s). Generally PECL memcache (3.0.6+) is recommended,
    but PECL memcached (2.0.1+) also works well for some people. Use of older
    versions may cause problems.
 3. Put your site into offline mode.
 4. Download and install the memcache module.
 5. If you have previously been running the memcache module, run update.php.
 6. Edit settings.php to configure the servers, clusters and bins that memcache
    is supposed to use.
 7. Edit settings.php to make memcache the default cache class, for example:
      $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
      $conf['cache_default_class'] = 'MemCacheDrupal';
    The cache_backends path needs to be adjusted based on where you installed
    the module.
 8. Make sure the following line also exists, to ensure that the special
    cache_form bin is assigned to non-volatile storage:
      $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
 9. Bring your site back online.

For more detailed instructions on (1) and (2) above, please see the
documentation online on drupal.org which includes links to external
walk-throughs for various operating systems.

## Advanced Configuration ##

This module is capable of working with one memcached instance or with multiple
memcached instances run across one or more servers. The default is to use one
server accessible on localhost port 11211. If that meets your needs, then the
configuration settings outlined above are sufficient for the module to work.
If you want to use multiple memcached instances, or if you are connecting to a
memcached instance located on a remote machine, further configuration is
required.

The available memcached servers are specified in $conf in settings.php. If you
do not specify any servers, memcache.inc assumes that you have a memcached
instance running on localhost:11211. If this is true, and it is the only
memcached instance you wish to use, no further configuration is required.

If you have more than one memcached instance running, you need to add two arrays
to $conf; memcache_servers and memcache_bins. The arrays follow this pattern:

'memcache_servers' => array(
  server1:port => cluster1,
  server2:port => cluster2,
  serverN:port => clusterN,
  'unix:///path/to/socket' => clusterS
)

'memcache_bins' => array(
   bin1 => cluster1,
   bin2 => cluster2,
   binN => clusterN,
   binS => clusterS
)

The bin/cluster/server model can be described as follows:

- Servers are memcached instances identified by host:port.

- Clusters are groups of servers that act as a memory pool. Each cluster can
  contain one or more servers.

- Bins are groups of data that get cached together and map 1:1 to the $table
  parameter of cache_set(). Examples from Drupal core are cache_filter and
  cache_menu. The default is 'cache'.

- Multiple bins can be assigned to a cluster.

- The default cluster is 'default'.

## LOCKING ##

The memcache-lock.inc file included with this module can be used as a drop-in
replacement for the database-mediated locking mechanism provided by Drupal
core. To enable, define the following in your settings.php:

$conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';

Locks are written in the 'semaphore' table, which will map to the 'default'
memcache cluster unless you explicitly configure a 'semaphore' cluster.

## STAMPEDE PROTECTION ##

Memcache includes stampede protection for rebuilding expired and invalid cache
items.  To enable stampede protection, define the following in settings.php:

$conf['memcache_stampede_protection'] = TRUE;

To avoid lock stampedes, it is important that you enable the memacache lock
implementation when enabling stampede protection -- enabling stampede protection
without enabling the Memache lock implementation can cause worse performance.

Only change the following values if you're sure you know what you're doing,
which requires reading the memcachie.inc code.

The value passed to lock_acquire, defaults to '15':
  $conf['memcache_stampede_semaphore'] = 15;

The value passed to lock_wait, defaults to 5:
  $conf['memcache_stampede_wait_time'] = 5;

The maximum number of calls to lock_wait() due to stampede protection during a
single request, defaults to 3:
  $conf['memcache_stampede_wait_limit'] = 3;

When adjusting these variables, be aware that:
 - there is unlikely to be a good use case for setting wait_time higher
   than stampede_semaphore;
 - wait_time * wait_limit is designed to default to a number less than
   standard web server timeouts (i.e. 15 seconds vs. apache's default of
   30 seconds).

## EXAMPLES ##

Example 1:

First, the most basic configuration which consists of one memcached instance
running on localhost port 11211 and all caches except for cache_form being
stored in memcache. We also enable stampede protection, and the memcache
locking mechanism.

  $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
  $conf['memcache_stampede_protection'] = TRUE;
  $conf['cache_default_class'] = 'MemCacheDrupal';
  // The 'cache_form' bin must be assigned to non-volatile storage.
  $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

Note that no servers or bins are defined.  The default server and bin
configuration which is used in this case is equivalant to setting:

  $conf['memcache_servers'] = array('localhost:11211' => 'default');


Example 2:

In this example we define three memcached instances, two accessed over the
network, and one on a Unix socket -- please note this is only an illustration of
what is possible, and is not a recommended configuration as it's highly unlikely
you'd want to configure memcache to use both sockets and network addresses like
this, instead you'd consistently use one or the other.

The instance on port 11211 belongs to the 'default' cluster where everything
gets cached that isn't otherwise defined. (We refer to it as a "cluster", but in
this example our "clusters" involve only one instance.) The instance on port
11212 belongs to the 'pages' cluster, with the 'cache_page' table mapped to
it -- so the Drupal page cache is stored in this cluster.  Finally, the instance
listening on a socket is part of the 'blocks' cluster, with the 'cache_block'
table mapped to it -- so the Drupal block cache is stored here. Note that
sockets do not have ports.

  $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
  $conf['memcache_stampede_protection'] = TRUE;
  $conf['cache_default_class'] = 'MemCacheDrupal';

  // The 'cache_form' bin must be assigned no non-volatile storage.
  $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

  // Important to define a default cluster in both the servers
  // and in the bins. This links them together.
  $conf['memcache_servers'] = array('10.1.1.1:11211' => 'default',
                                    '10.1.1.1:11212' => 'pages',
                                    'unix:///path/to/socket' => 'blocks');
  $conf['memcache_bins'] = array('cache' => 'default',
                                 'cache_page' => 'pages',
                                 'cache_block' => 'blocks');


Example 3:

Here is an example configuration that has two clusters, 'default' and
'cluster2'. Five memcached instances running on four different servers are
divided up between the two clusters. The 'cache_filter' and 'cache_menu' bins
go to 'cluster2'. All other bins go to 'default'.

  $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
  $conf['memcache_stampede_protection'] = TRUE;
  $conf['cache_default_class'] = 'MemCacheDrupal';
  // The 'cache_form' bin must be assigned no non-volatile storage.
  $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

  $conf['memcache_servers'] = array('10.1.1.6:11211' => 'default',
                                    '10.1.1.6:11212' => 'default',
                                    '10.1.1.7:11211' => 'default',
                                    '10.1.1.8:11211' => 'cluster2',
                                    '10.1.1.9:11211' => 'cluster2');

  $conf['memcache_bins'] = array('cache' => 'default',
                                 'cache_filter' => 'cluster2',
                                 'cache_menu' => 'cluster2');
  );


## PREFIXING ##

If you want to have multiple Drupal installations share memcached instances,
you need to include a unique prefix for each Drupal installation in the $conf
array of settings.php:

$conf['memcache_key_prefix'] = 'something_unique';

Note: if the length of your prefix + key + bin combine to be more than 250
characters, they will be automatically hashed. Memcache only supports key
lengths up to 250 bytes. You can optionally configure the hashing algorithm
used, however sha1 was selected as the default because it performs quickly with
minimal collisions.

$conf['memcache_key_hash_algorithm'] = 'sha1';

Visit http://www.php.net/manual/en/function.hash-algos.php to learn more about
which hash algorithms are available.

## MULTIPLE SERVERS ##

To use this module with multiple memcached servers, it is important that you set
the hash strategy to consistent. This is controlled in the PHP extension, not the
Drupal module.

If using PECL memcache:
Edit /etc/php.d/memcache.ini (path may changed based on package/distribution) and
set the following:
memcache.hash_strategy=consistent

You need to reload apache httpd after making that change.

If using PECL memcached:
Memcached options can be controlled in settings.php.  The following setting is
needed:
$conf['memcache_options'] = array(
  Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
);

## SESSIONS ##

NOTE: Session.inc is not yet ported to Drupal 7 and is not recommended for use
in production.

Here is a sample config that uses memcache for sessions. Note you MUST have
a session and a users server set up for memcached sessions to work.

$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';

// The 'cache_form' bin must be assigned no non-volatile storage.
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['session_inc'] = './sites/all/modules/memcache/memcache-session.inc';

$conf['memcache_servers'] = array(
    '10.1.1.1:11211' => 'default',
    '10.1.1.1:11212' => 'filter',
    '10.1.1.1:11213' => 'menu',
    '10.1.1.1:11214' => 'page',
    '10.1.1.1:11215' => 'session',
    '10.1.1.1:11216' => 'users',
);
$conf['memcache_bins'] = array(
    'cache' => 'default',
    'cache_filter' => 'filter',
    'cache_menu' => 'menu',
    'cache_page' => 'page',
    'session' => 'session',
    'users' => 'users',
);

## TROUBLESHOOTING ##

PROBLEM:
Error:
Failed to set key: Failed to set key: cache_page-......

SOLUTION:
Upgrade your PECL library to PECL package (2.2.1) (or higher).

WARNING:
Zlib compression at the php.ini level and Memcache conflict.
See http://drupal.org/node/273824

## MEMCACHE ADMIN ##

A module offering a UI for memcache is included. It provides aggregated and
per-page statistics for memcache.

## Memcached PECL Extension Support

We also support the Memcached PECL extension. This extension backends
to libmemcached and allows you to use some of the newer advanced features in
memcached 1.4.

NOTE: It is important to realize that the memcache php.ini options do not impact
the memcached extension, this new extension doesn't read in options that way.
Instead, it takes options directly from Drupal. Because of this, you must
configure memcached in settings.php. Please look here for possible options:

http://us2.php.net/manual/en/memcached.constants.php

An example configuration block is below, this block also illustrates our
default options (selected through performance testing). These options will be
set unless overridden in settings.php.

$conf['memcache_options'] = array(
  Memcached::OPT_COMPRESSION => FALSE,
  Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
);

These are as follows:

 * Turn off compression, as this takes more CPU cycles than it's worth for most
   users
 * Turn on consistent distribution, which allows you to add/remove servers
   easily

Other options you could experiment with:
 + Memcached::OPT_BINARY_PROTOCOL => TRUE,
    * This enables the Memcache binary protocol (only available in Memcached
      1.4 and later). Note that some users have reported SLOWER performance
      with this feature enabled. It should only be enabled on extremely high
      traffic networks where memcache network traffic is a bottleneck.
      Additional reading about the binary protocol:
        http://code.google.com/p/memcached/wiki/MemcacheBinaryProtocol

 + Memcached::OPT_TCP_NODELAY => TRUE,
    * This enables the no-delay feature for connecting sockets; it's been
      reported that this can speed up the Binary protocol (see above). This
      tells the TCP stack to send packets immediately and without waiting for
      a full payload, reducing per-packet network latency (disabling "Nagling").

File

modules/memcache/README.txt
View source
  1. ## IMPORTANT NOTE ##
  2. This file contains installation instructions for the 7.x-1.x version of the
  3. Drupal Memcache module. Configuration differs between 7.x and 6.x versions
  4. of the module, so be sure to follow the 6.x instructions if you are configuring
  5. the 6.x-1.x version of this module!
  6. ## REQUIREMENTS ##
  7. - PHP 5.1 or greater
  8. - Availability of a memcached daemon: http://memcached.org/
  9. - One of the two PECL memcache packages:
  10. - http://pecl.php.net/package/memcache (recommended)
  11. - http://pecl.php.net/package/memcached (latest versions require PHP 5.2 or
  12. greater)
  13. ## INSTALLATION ##
  14. These are the steps you need to take in order to use this software. Order
  15. is important.
  16. 1. Install the memcached binaries on your server and start the memcached
  17. service.
  18. 2. Install your chosen PECL memcache extension -- this is the memcache client
  19. library which will be used by the Drupal memcache module to interact with
  20. the memcached server(s). Generally PECL memcache (3.0.6+) is recommended,
  21. but PECL memcached (2.0.1+) also works well for some people. Use of older
  22. versions may cause problems.
  23. 3. Put your site into offline mode.
  24. 4. Download and install the memcache module.
  25. 5. If you have previously been running the memcache module, run update.php.
  26. 6. Edit settings.php to configure the servers, clusters and bins that memcache
  27. is supposed to use.
  28. 7. Edit settings.php to make memcache the default cache class, for example:
  29. $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  30. $conf['cache_default_class'] = 'MemCacheDrupal';
  31. The cache_backends path needs to be adjusted based on where you installed
  32. the module.
  33. 8. Make sure the following line also exists, to ensure that the special
  34. cache_form bin is assigned to non-volatile storage:
  35. $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
  36. 9. Bring your site back online.
  37. For more detailed instructions on (1) and (2) above, please see the
  38. documentation online on drupal.org which includes links to external
  39. walk-throughs for various operating systems.
  40. ## Advanced Configuration ##
  41. This module is capable of working with one memcached instance or with multiple
  42. memcached instances run across one or more servers. The default is to use one
  43. server accessible on localhost port 11211. If that meets your needs, then the
  44. configuration settings outlined above are sufficient for the module to work.
  45. If you want to use multiple memcached instances, or if you are connecting to a
  46. memcached instance located on a remote machine, further configuration is
  47. required.
  48. The available memcached servers are specified in $conf in settings.php. If you
  49. do not specify any servers, memcache.inc assumes that you have a memcached
  50. instance running on localhost:11211. If this is true, and it is the only
  51. memcached instance you wish to use, no further configuration is required.
  52. If you have more than one memcached instance running, you need to add two arrays
  53. to $conf; memcache_servers and memcache_bins. The arrays follow this pattern:
  54. 'memcache_servers' => array(
  55. server1:port => cluster1,
  56. server2:port => cluster2,
  57. serverN:port => clusterN,
  58. 'unix:///path/to/socket' => clusterS
  59. )
  60. 'memcache_bins' => array(
  61. bin1 => cluster1,
  62. bin2 => cluster2,
  63. binN => clusterN,
  64. binS => clusterS
  65. )
  66. The bin/cluster/server model can be described as follows:
  67. - Servers are memcached instances identified by host:port.
  68. - Clusters are groups of servers that act as a memory pool. Each cluster can
  69. contain one or more servers.
  70. - Bins are groups of data that get cached together and map 1:1 to the $table
  71. parameter of cache_set(). Examples from Drupal core are cache_filter and
  72. cache_menu. The default is 'cache'.
  73. - Multiple bins can be assigned to a cluster.
  74. - The default cluster is 'default'.
  75. ## LOCKING ##
  76. The memcache-lock.inc file included with this module can be used as a drop-in
  77. replacement for the database-mediated locking mechanism provided by Drupal
  78. core. To enable, define the following in your settings.php:
  79. $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
  80. Locks are written in the 'semaphore' table, which will map to the 'default'
  81. memcache cluster unless you explicitly configure a 'semaphore' cluster.
  82. ## STAMPEDE PROTECTION ##
  83. Memcache includes stampede protection for rebuilding expired and invalid cache
  84. items. To enable stampede protection, define the following in settings.php:
  85. $conf['memcache_stampede_protection'] = TRUE;
  86. To avoid lock stampedes, it is important that you enable the memacache lock
  87. implementation when enabling stampede protection -- enabling stampede protection
  88. without enabling the Memache lock implementation can cause worse performance.
  89. Only change the following values if you're sure you know what you're doing,
  90. which requires reading the memcachie.inc code.
  91. The value passed to lock_acquire, defaults to '15':
  92. $conf['memcache_stampede_semaphore'] = 15;
  93. The value passed to lock_wait, defaults to 5:
  94. $conf['memcache_stampede_wait_time'] = 5;
  95. The maximum number of calls to lock_wait() due to stampede protection during a
  96. single request, defaults to 3:
  97. $conf['memcache_stampede_wait_limit'] = 3;
  98. When adjusting these variables, be aware that:
  99. - there is unlikely to be a good use case for setting wait_time higher
  100. than stampede_semaphore;
  101. - wait_time * wait_limit is designed to default to a number less than
  102. standard web server timeouts (i.e. 15 seconds vs. apache's default of
  103. 30 seconds).
  104. ## EXAMPLES ##
  105. Example 1:
  106. First, the most basic configuration which consists of one memcached instance
  107. running on localhost port 11211 and all caches except for cache_form being
  108. stored in memcache. We also enable stampede protection, and the memcache
  109. locking mechanism.
  110. $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  111. $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
  112. $conf['memcache_stampede_protection'] = TRUE;
  113. $conf['cache_default_class'] = 'MemCacheDrupal';
  114. // The 'cache_form' bin must be assigned to non-volatile storage.
  115. $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
  116. Note that no servers or bins are defined. The default server and bin
  117. configuration which is used in this case is equivalant to setting:
  118. $conf['memcache_servers'] = array('localhost:11211' => 'default');
  119. Example 2:
  120. In this example we define three memcached instances, two accessed over the
  121. network, and one on a Unix socket -- please note this is only an illustration of
  122. what is possible, and is not a recommended configuration as it's highly unlikely
  123. you'd want to configure memcache to use both sockets and network addresses like
  124. this, instead you'd consistently use one or the other.
  125. The instance on port 11211 belongs to the 'default' cluster where everything
  126. gets cached that isn't otherwise defined. (We refer to it as a "cluster", but in
  127. this example our "clusters" involve only one instance.) The instance on port
  128. 11212 belongs to the 'pages' cluster, with the 'cache_page' table mapped to
  129. it -- so the Drupal page cache is stored in this cluster. Finally, the instance
  130. listening on a socket is part of the 'blocks' cluster, with the 'cache_block'
  131. table mapped to it -- so the Drupal block cache is stored here. Note that
  132. sockets do not have ports.
  133. $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  134. $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
  135. $conf['memcache_stampede_protection'] = TRUE;
  136. $conf['cache_default_class'] = 'MemCacheDrupal';
  137. // The 'cache_form' bin must be assigned no non-volatile storage.
  138. $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
  139. // Important to define a default cluster in both the servers
  140. // and in the bins. This links them together.
  141. $conf['memcache_servers'] = array('10.1.1.1:11211' => 'default',
  142. '10.1.1.1:11212' => 'pages',
  143. 'unix:///path/to/socket' => 'blocks');
  144. $conf['memcache_bins'] = array('cache' => 'default',
  145. 'cache_page' => 'pages',
  146. 'cache_block' => 'blocks');
  147. Example 3:
  148. Here is an example configuration that has two clusters, 'default' and
  149. 'cluster2'. Five memcached instances running on four different servers are
  150. divided up between the two clusters. The 'cache_filter' and 'cache_menu' bins
  151. go to 'cluster2'. All other bins go to 'default'.
  152. $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  153. $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
  154. $conf['memcache_stampede_protection'] = TRUE;
  155. $conf['cache_default_class'] = 'MemCacheDrupal';
  156. // The 'cache_form' bin must be assigned no non-volatile storage.
  157. $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
  158. $conf['memcache_servers'] = array('10.1.1.6:11211' => 'default',
  159. '10.1.1.6:11212' => 'default',
  160. '10.1.1.7:11211' => 'default',
  161. '10.1.1.8:11211' => 'cluster2',
  162. '10.1.1.9:11211' => 'cluster2');
  163. $conf['memcache_bins'] = array('cache' => 'default',
  164. 'cache_filter' => 'cluster2',
  165. 'cache_menu' => 'cluster2');
  166. );
  167. ## PREFIXING ##
  168. If you want to have multiple Drupal installations share memcached instances,
  169. you need to include a unique prefix for each Drupal installation in the $conf
  170. array of settings.php:
  171. $conf['memcache_key_prefix'] = 'something_unique';
  172. Note: if the length of your prefix + key + bin combine to be more than 250
  173. characters, they will be automatically hashed. Memcache only supports key
  174. lengths up to 250 bytes. You can optionally configure the hashing algorithm
  175. used, however sha1 was selected as the default because it performs quickly with
  176. minimal collisions.
  177. $conf['memcache_key_hash_algorithm'] = 'sha1';
  178. Visit http://www.php.net/manual/en/function.hash-algos.php to learn more about
  179. which hash algorithms are available.
  180. ## MULTIPLE SERVERS ##
  181. To use this module with multiple memcached servers, it is important that you set
  182. the hash strategy to consistent. This is controlled in the PHP extension, not the
  183. Drupal module.
  184. If using PECL memcache:
  185. Edit /etc/php.d/memcache.ini (path may changed based on package/distribution) and
  186. set the following:
  187. memcache.hash_strategy=consistent
  188. You need to reload apache httpd after making that change.
  189. If using PECL memcached:
  190. Memcached options can be controlled in settings.php. The following setting is
  191. needed:
  192. $conf['memcache_options'] = array(
  193. Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
  194. );
  195. ## SESSIONS ##
  196. NOTE: Session.inc is not yet ported to Drupal 7 and is not recommended for use
  197. in production.
  198. Here is a sample config that uses memcache for sessions. Note you MUST have
  199. a session and a users server set up for memcached sessions to work.
  200. $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  201. $conf['cache_default_class'] = 'MemCacheDrupal';
  202. // The 'cache_form' bin must be assigned no non-volatile storage.
  203. $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
  204. $conf['session_inc'] = './sites/all/modules/memcache/memcache-session.inc';
  205. $conf['memcache_servers'] = array(
  206. '10.1.1.1:11211' => 'default',
  207. '10.1.1.1:11212' => 'filter',
  208. '10.1.1.1:11213' => 'menu',
  209. '10.1.1.1:11214' => 'page',
  210. '10.1.1.1:11215' => 'session',
  211. '10.1.1.1:11216' => 'users',
  212. );
  213. $conf['memcache_bins'] = array(
  214. 'cache' => 'default',
  215. 'cache_filter' => 'filter',
  216. 'cache_menu' => 'menu',
  217. 'cache_page' => 'page',
  218. 'session' => 'session',
  219. 'users' => 'users',
  220. );
  221. ## TROUBLESHOOTING ##
  222. PROBLEM:
  223. Error:
  224. Failed to set key: Failed to set key: cache_page-......
  225. SOLUTION:
  226. Upgrade your PECL library to PECL package (2.2.1) (or higher).
  227. WARNING:
  228. Zlib compression at the php.ini level and Memcache conflict.
  229. See http://drupal.org/node/273824
  230. ## MEMCACHE ADMIN ##
  231. A module offering a UI for memcache is included. It provides aggregated and
  232. per-page statistics for memcache.
  233. ## Memcached PECL Extension Support
  234. We also support the Memcached PECL extension. This extension backends
  235. to libmemcached and allows you to use some of the newer advanced features in
  236. memcached 1.4.
  237. NOTE: It is important to realize that the memcache php.ini options do not impact
  238. the memcached extension, this new extension doesn't read in options that way.
  239. Instead, it takes options directly from Drupal. Because of this, you must
  240. configure memcached in settings.php. Please look here for possible options:
  241. http://us2.php.net/manual/en/memcached.constants.php
  242. An example configuration block is below, this block also illustrates our
  243. default options (selected through performance testing). These options will be
  244. set unless overridden in settings.php.
  245. $conf['memcache_options'] = array(
  246. Memcached::OPT_COMPRESSION => FALSE,
  247. Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
  248. );
  249. These are as follows:
  250. * Turn off compression, as this takes more CPU cycles than it's worth for most
  251. users
  252. * Turn on consistent distribution, which allows you to add/remove servers
  253. easily
  254. Other options you could experiment with:
  255. + Memcached::OPT_BINARY_PROTOCOL => TRUE,
  256. * This enables the Memcache binary protocol (only available in Memcached
  257. 1.4 and later). Note that some users have reported SLOWER performance
  258. with this feature enabled. It should only be enabled on extremely high
  259. traffic networks where memcache network traffic is a bottleneck.
  260. Additional reading about the binary protocol:
  261. http://code.google.com/p/memcached/wiki/MemcacheBinaryProtocol
  262. + Memcached::OPT_TCP_NODELAY => TRUE,
  263. * This enables the no-delay feature for connecting sockets; it's been
  264. reported that this can speed up the Binary protocol (see above). This
  265. tells the TCP stack to send packets immediately and without waiting for
  266. a full payload, reducing per-packet network latency (disabling "Nagling").