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
What this template manages
- Memcached container (
bitnamilegacy/memcachedimage, 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)
- Load templates
- Run Memcached with defaults
- Customize configuration (recommended via inheritance)
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
variablesinmemcached/memcached.yaml, thenmonk load MANIFESTand run.
localhost:11211 (or the runnable hostname inside Monk networks) using the configured credentials.
Configuration
Key variables you can customize in this template:Use by inheritance (recommended for apps)
Inherit the Memcached runnable in your application and declare a connection. Example:Ports and connectivity
- Service:
memcachedon TCP port11211 - 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
Related templates
- 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_passwordafter initial setup, ensure your client applications use the updated credentials. - Adjust
memcached_cache_sizeif you’re experiencing evictions or have available memory. - Increase
memcached_max_connectionsif you’re seeing connection refused errors under high load. - Check logs: