Skip to main content

Overview

This template provides a production‑ready Memcached instance as a Monk runnable. You can:
  • Run it directly to get a managed Memcached container with sensible defaults
  • Inherit it in your own runnable to seamlessly add a distributed memory cache to your stack
It exposes Memcached on port 11211, supports authentication, and allows fine-tuning of cache size, connections, threads, and item size limits.

What this template manages

  • Memcached container (bitnamilegacy/memcached image, configurable tag)
  • Network service on port 11211
  • Memory allocation and cache management
  • Optional authentication with username and password
  • Performance tuning via threads, connections, and cache size

Quick start (run directly)

  1. Load templates
  1. Run Memcached with defaults
  1. Customize configuration (recommended via inheritance)
Running directly uses the defaults defined in this template’s variables. Secrets added with monk secrets add will not affect this runnable unless you inherit it and reference those secrets.
  • Preferred: inherit and replace variables with secret("...") as shown below.
  • Alternative: fork/clone and edit the variables in memcached/memcached.yaml, then monk load MANIFEST and run.
Once started, connect to localhost:11211 (or the runnable hostname inside Monk networks) using the configured credentials.

Configuration

Key variables you can customize in this template:
Inherit the Memcached runnable in your application and declare a connection. Example:
Then set the secrets once and run your app group:

Ports and connectivity

  • Service: memcached on TCP port 11211
  • From other runnables in the same process group, use connection-hostname("\<connection-name>") to resolve the cache host.

Features

  • Simple key-value storage
  • Fast in-memory caching
  • Distributed architecture
  • Multiple client libraries
  • LRU eviction policy
  • Configurable cache size and performance tuning
  • Optional authentication support
  • See other templates in this repository for complementary services
  • Combine with monitoring tools (prometheus-grafana/) for observability
  • Integrate with your application stack as needed

Troubleshooting

  • If you changed memcached_password after initial setup, ensure your client applications use the updated credentials.
  • Adjust memcached_cache_size if you’re experiencing evictions or have available memory.
  • Increase memcached_max_connections if you’re seeing connection refused errors under high load.
  • Check logs: