Memcached
Bahriya lets you deploy managed Memcached instances alongside your containers. Memcached is a high-performance, in-memory key-value cache commonly used to speed up applications by reducing database load.
Creating a Memcached instance
You can create a Memcached instance from the console or the Reis CLI. Each instance requires:
- Name — A display name for the instance.
- Handle — A permanent, URL-friendly identifier (cannot be changed after creation).
- Project — The project this instance belongs to.
- Regions — Which regions to deploy to.
Configuration options
| Setting | Options | Description |
| Memory | 64 MB, 128 MB, 256 MB, 512 MB, 1 GB, 2 GB, 4 GB, 8 GB | Amount of memory allocated for caching. This is the primary sizing control. |
| Nodes | 1 to 9 (default: 1) | Number of cache nodes. More nodes increase throughput and provide redundancy. |
| Max item size | 1 MB to 128 MB (default: 1 MB) | The largest single item that can be stored. Increase this if you cache large objects like rendered pages or serialised datasets. |
The console shows a real-time pricing estimate as you adjust memory, nodes, and regions.
Connecting from your containers
Memcached instances are accessible to containers within the same project over the internal network on port 11211. The connection address follows the pattern:
<memcached-handle>.<org-handle>-<project-handle>:11211
No authentication is required — access is restricted by network isolation at the project level.
Multi-region deployment
When you deploy a Memcached instance to multiple regions, each region gets its own independent cache. Caches are not synchronised across regions — each region maintains its own data. This means:
- A cache miss in one region does not check other regions.
- Cache warming happens independently in each region.
- This is the expected behaviour for most applications — the cache sits close to the containers that use it.
Scaling
You can adjust the number of nodes to scale throughput. Adding nodes distributes the cache keyspace across more instances, which increases total available memory and connection capacity.
When using multiple nodes, clients should use consistent hashing to distribute keys, so adding a node only redistributes a fraction of keys rather than invalidating the whole cache.
Resource allocation
Bahriya automatically provisions CPU and memory for your Memcached nodes based on the memory you configure. You do not need to set CPU or memory limits manually — they are calculated to ensure stable operation with headroom for connection handling and internal overhead.
Lifecycle
Memcached instances go through these states:
| Status | Meaning |
| Provisioning | Being set up in your chosen regions |
| Running | Healthy and accepting connections |
| Suspended | Temporarily paused (e.g. due to billing) |
| Terminating | Being removed |
| Terminated | Fully removed, no longer accessible |
| Error | Something went wrong during provisioning or operation |
Billing
Memcached is billed based on the amount of memory, the number of nodes, and the number of regions. See the billing documentation for pricing details.