You are here

constant MemcacheBackend::MAX_CHUNK_SIZE in Memcache API and Integration 8.2

The maximum size of an individual cache chunk.

Memcached is about balance. With this area of functionality, we need to minimize the number of split items while also considering wasted memory. In Memcached, all slab "pages" contain 1MB of data, by default. Therefore, when we split items, we want to do to in a manner that comes close to filling a slab page with as little remaining memory as possible, while taking item overhead into consideration.

Our tests concluded that Memached slab 39 is a perfect slab to target. Slab 39 contains items roughly between 385-512KB in size. We are targeting a chunk size of 493568 bytes (482kb) - which will give us enough storage for two split items, leaving as little overhead as possible.

Note that the overhead not only includes metadata about each item, but also allows compression "backfiring" (under some circumstances, compression actually enlarges some data objects instead of shrinking them).

File

src/MemcacheBackend.php, line 40

Class

MemcacheBackend
Defines a Memcache cache backend.

Namespace

Drupal\memcache

Code

const MAX_CHUNK_SIZE = 470000;