Next.js Discord

Discord Forum

High memory usage on an openshift environment during build

Answered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
Hi,

We're experiencing a problem on an OpenShift environment on which we're building a website of around 1400 pages in SSG.

The behaviour on a local environment (docker-compose with node:18-alpine image) with the same code and the same data consumes a maximum of 1.5 GB of ram.

The exactly same build on an openshift pod (same image, same code, same data) consumes between 9GB and 32GB of ram.

What could explain such a difference?

Thank you very much for your help.
Answered by Asiatic Lion
We finally solved this issue by updating the build command to
"build": "node --max-old-space-size=4096 --gc-interval=100 --clear-free-memory --optimize-for-size --memory-reducer-single-gc

and the next config to
const nextConfig = {
  experimental: {
    cpus: 1,
  }


the build is now using only 250mb of ram both on local and openshift environments
View full answer

1 Reply

Asiatic LionOP
We finally solved this issue by updating the build command to
"build": "node --max-old-space-size=4096 --gc-interval=100 --clear-free-memory --optimize-for-size --memory-reducer-single-gc

and the next config to
const nextConfig = {
  experimental: {
    cpus: 1,
  }


the build is now using only 250mb of ram both on local and openshift environments
Answer