leebenson / reactql

Universal React+GraphQL starter kit: React 16, Apollo 2, MobX, Emotion, Webpack 4, GraphQL Code Generator, React Router 4, PostCSS, SSR
https://reactql.org
MIT License
1.82k stars 173 forks source link

App exceeding Heroku Memory Quota of 512 MB #142

Closed ponty96 closed 5 years ago

ponty96 commented 5 years ago

I just deployed an app using this boilerplate, it works probably when I run npm run production on my Mac OS X but on Heroku I get this(attached image) error

screen shot 2019-01-24 at 2 45 58 am
Ciberusps commented 5 years ago

Try to restart all dynos image

leebenson commented 5 years ago

Node is quite memory-intensive. It's normal for a single Node.js process, serving no traffic, to eat 200-400mb idly in between GC events.

During compilation, this can balloon by 100mb+ with the potential of multiple processes being spawned to transpile concurrently, and execute binaries for gzip compression, etc.

On my Macbook Pro running Node 11.6, this usually settles down to ~200mb after compilation.

Since much of that 512mb is likely already taken with the underlying OS and other libs, it's not surprising therefore that you're running into memory issues.

I'd recommend at least 1GB - and 2-4GB min in production.