Docker Container Memory Calculator
Calculate how much memory to allocate per container based on workload profile.
About Docker Container Memory Calculator
A container's memory limit should cover its baseline footprint plus the incremental memory each in-flight request consumes at your expected concurrency, with a buffer for garbage collection pauses, connection pools and traffic spikes. Formula: limit = (base + per_request × concurrent) × (1 + overhead / 100). Setting the limit too tight risks OOMKills under load; setting it too loose wastes cluster capacity.
Formula
memoryLimit = (baseMemory + perRequestMemory × concurrentRequests) × (1 + overhead / 100)
- B
- App base memory in MB
- R_m
- Memory per request in MB
- C
- Concurrent requests
- O
- Overhead buffer percentage
- M
- Recommended memory limit in MB
Worked example
With the default values below, Docker Container Memory Calculator returns Recommended Memory Limit of 300. Change any input above and every figure here is recalculated in your browser.
Inputs used
- App Base Memoryaccepts 0–100,000 MB
- 150 MB
- Memory per Requestaccepts 0–10,000 MB
- 2 MB
- Concurrent Requestsaccepts 0–100,000 requests
- 50 requests
- Overhead Bufferaccepts 0–200 %
- 20 %
Results
- Recommended Memory Limit
- 300 MB
- Recommended Memory Limit
- 0.29 GiB
- Recommended Memory Request
- 250 MB
- Overhead Buffer
- 50 MB
Step by step
- 1Working set: base + per-request × concurrency= 250.0MB
- 2Overhead buffer= 50.0MB
- 3Memory limit: working set × (1 + overhead)= 300.0MB
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
What should I use for 'memory per request'?
Load test your service and observe RSS growth under increasing concurrency, or divide the delta between idle and peak memory by the number of concurrent requests during the test.
Should the Docker memory limit equal the request?
For predictable workloads, setting them equal avoids being throttled or evicted under memory pressure from neighboring containers. For bursty workloads, a limit 20-50% above the request gives headroom.
What happens if I exceed the memory limit?
The container's cgroup will trigger the OOM killer, terminating the process (or a process inside it) once usage exceeds the limit — this shows up as an OOMKilled container in Docker/Kubernetes.
How much overhead buffer is typical?
15-30% is common for most services. JVM-based services with significant GC pause behavior often need 30-50% to avoid GC-triggered spikes causing an OOMKill.
Related Calculators
You might also need
- Docker CPU Limit CalculatorCommonly used together
- Docker Image Size CalculatorCommonly used together
- Docker Build Time EstimatorCommonly used together
- Docker Multi-stage Build Savings CalculatorCommonly used together
- Pod Resource CalculatorCommonly used together
- Istio Sidecar Memory CalculatorCommonly used together
