{
  "id": 5063231,
  "title": "next/image Optimization on a Self-Hosted VPS (1 GiB Container)",
  "url": "https://urgent.news/2026/09/02/next-image-optimization-on-a-self-hosted-vps-1-gib-container",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-02T10:00:58.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/iurii_rogulia/nextimage-optimization-on-a-self-hosted-vps-1-gib-container-44h3"
  },
  "original_language": "en",
  "account": "Moving a Next.js application to a self-hosted VPS can expose the image optimization process to the risk of out-of-memory (OOM) errors. Unlike Vercel's infrastructure, a self-hosted 1 GiB container has limited memory and competes with the Node.js process for resources. The next/image optimization, which involves decoding, resizing, and encoding images in memory, can consume a significant amount of RAM, especially when handling high-resolution images and multiple breakpoints. This memory-intensive task can lead to OOM kills when the container's memory limit is reached.\n\nTo prevent OOM crashes while still using next/image, it's important to optimize the configuration. By setting a long minimumCacheTTL of 30 days, the optimizer only re-optimizes images when the original files change, reducing the frequency of memory-intensive operations. Additionally, limiting the deviceSizes and imageSizes arrays to the actual widths and resolutions used in the application reduces the number of optimization jobs and cache entries. This approach conserves memory and keeps the memory footprint within the container's constraints.",
  "summary": "On Vercel, next/image is somebody else's problem. The optimizer runs on their infrastructure, scales on their bill, and you never see it fall over. Move the same app to a self-hosted VPS in a 1 GiB container — which is exactly where this site runs, on a Coolify-managed Docker host — and the optimizer becomes the single most likely thing to get your process OOM-killed. It is not a bug. next/image…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}