Сервис хранилища данных
Сервисы/Memcached

Сервис Memcached

Распределённый кеш в памяти, который сокращает повторные запросы к базе данных, вызовы API и повторную работу приложения.

Вы добавляете этот сервис в стек и выбираете там его версию и ресурсы. Каждое окружение может их переопределить.

В StackMaster

Как Memcached работает в StackMaster

What Wodby sets up for this Memcached service.

How applications reach it

  • Host: the name of this app service inside the environment. Port: 11211, TCP only (UDP is switched off).
  • There is no password or other authentication, and no token is generated. Access is limited to the environment's internal network.
  • A service linked to this one receives the host and port in variables named by the linking service. Read them in code instead of hardcoding the host.

Configuration

The image turns three settings into memcached command-line options at start. Change them through the service's settings, not with a command or a config file.

SettingVariableOptionDefault
Cache memory (MB)MEMCACHED_MEMORY-m64
Worker threadsMEMCACHED_THREADS-t4
Maximum connectionsMEMCACHED_MAX_CONNECTIONS-c1024

MEMCACHED_MEMORY is the memory for cached items only; the process uses more, so the container memory limit must be higher.

Persistence

  • Nothing is stored on disk and the service has no volume. Every restart and every deployment of the service empties the cache (the service is redeployed by replacing the container, not by a rolling update).
  • When the item memory is full, Memcached evicts the least recently used items. Do not keep data here that cannot be rebuilt.

Check the result

From this service's container:

  • make check-ready -f /usr/local/bin/actions.mk reports whether the server answers.
  • printf 'stats\r\nquit\r\n' | nc localhost 11211 shows limit_maxbytes, curr_items and evictions.

Обзор

Технический профиль Memcached

Здесь перечислены версии, которые можно выбрать для Memcached в стеке или окружении. Сам сервис публикуется ревизиями, и стек ссылается на конкретную ревизию.

Тип сервиса

Сервис хранилища данных

Версии

1.6

Стеки

Стеки, в которые входит Memcached

Memcached входит в эти публичные стеки. Можно создать приложение из публичного стека как есть или добавить сервис в собственный стек.

Конфигурация

Конфигурация сервиса Memcached

Сервис Memcached объявляет следующее. Если значение можно изменить, его задаёт стек, а каждое окружение может его переопределить.

Настройки

3 настройки, которые стек или окружение могут изменить.