VPSNear

How to size a Linux VPS for Docker Compose

Work out how much RAM, CPU and disk your Compose stack needs at peak load and while two app versions overlap during a release.

Size a Compose VPS for the most demanding period your stack has to handle. Measure typical peak traffic and a release on a Linux test host. Include the operating system, persistent data and any old and new containers that run together.

Measure the load you expect to run

Run the app, worker and database on a test host with representative data. Sample CPU and RAM during requests, worker jobs and a deployment. Record request latency and queue depth alongside the resource readings so you can see whether the stack keeps up. Docker container statistics

Also check available memory at the Linux host level. Docker’s Linux CLI subtracts cache from its container memory display. The host reading helps you account for the full system, including the operating system and Docker daemon. Track the low point in available memory and check for out-of-memory kills. Docker memory reporting · Docker memory limits

Test each kind of deployment you expect to run. Replacing the web container in place has different memory needs from starting a replacement while the old version still serves requests. Include a migration or image build if you run either on the same machine. Using Compose in production

Work through a release budget

Suppose a small web app runs with a reverse proxy, a worker and a database. The example uses planning figures in MiB for one workload. Replace them with readings from your own test or estimates you can verify.

  • Running services use 1,920 MiB at the busiest point. That includes 640 MiB for the web app, 256 MiB for the worker, 896 MiB for the database and 128 MiB for the proxy.
  • Allow 512 MiB for Linux and Docker. The steady traffic budget is now 2,432 MiB.
  • A release briefly starts another app container at 640 MiB, bringing the deployment budget to 3,072 MiB. Allow 512 MiB more for variation. The budget is 3,584 MiB with the release overlap included.

For disk, budget 6 GiB for Linux and updates, 7 GiB for current images, 11 GiB for persistent data and 4 GiB for logs. Add 7 GiB for incoming images and deployment files, plus 8 GiB in free space. That comes to 43 GiB. Check free space on the filesystem where Docker and the database store their files. Docker’s disk usage report helps identify images, containers and volumes that take up space. Docker disk usage reference · Docker logging options

Choose a candidate and rerun the test

For this example, a plan labeled 4 GB RAM and 50 GB disk or more is a starting point. Verify the memory Linux can use and the available disk after installation. Even if those figures fit, run the load test on the candidate CPU size. Check for rising request latency or a growing worker queue while the CPU stays busy. Repeat the test during a deployment and check that the host still has free memory and disk space.

Use the resource budget to narrow the plan list. Select a city and operating system, then check the exact Ubuntu or Debian release and available billing periods on each candidate. Compare Docker VPS plans