question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Excessive memory usage using npx nest start service

See original GitHub issue

Firstly, wow this project looks super interesting!

I ran into a snag spinning up each service as suggested in the docs:

NODE_ENV=staging npx nest start service-auth

Each service consumed about 2GB of memory on my poor little machine. With more than half a dozen services to spin up and my machine only having 8GB memory… 😱

It appears to be related to this issue https://github.com/nestjs/nest/issues/2135 where it’s established that ts-node is the culprit. tsc-watch is suggested as a solution there. Perhaps that would be a good idea?

I got around the issue by building each service and running them with node from the dist directory however that felt awkward. Digging deeper I realised you’re using docker (have used a little), terraform, and kubernetes (have not used either of them). I noticed development configs there alongside staging and production… so perhaps I’ve misunderstood and there’s a simpler way to manage devops in development?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
juicycleffcommented, Jan 29, 2020

@av8ta sure thing, I will look into fixing it the ts-node issue. Thank you 😃

1reaction
av8tacommented, Jan 29, 2020

Thanks for the speedy reply. I agree totally with “I believe it’s high time NodeJS gets clearly designed boilerplates or template for building enterprise systems.” and I’m seriously considering using this in production. For now I’m just trying to work out how all the pieces fit together and perhaps as I gain understanding I can help with the documentation. I tried TS_NODE_TRANSPILE_ONLY=true npx nest start service-user --watch but it used only slightly less memory! I’ll have a play with it tomorrow (it’s midnight here) thanks for your time 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get back to point 0 of memory consumption with NestJs
I'm trying to figure out what nest loads into memory on boot. My understanding would be that removing all the modules and clearing...
Read more >
Node.js — Increase the Memory Limit for Your Process
Solution. The solution to run your Node. js app with increased memory is to start the process with an additional V8 flag: --max-old-space-size...
Read more >
Troubleshooting Node.js High Memory scenarios in App ...
Use Startup Command or Custom Startup Script. Update the startup command from Azure Portal -> Select your web app -> Click on Configuration...
Read more >
JavaScript Heap Out Of Memory Error - OpenReplay Blog
A quick solution that you can use to fix "Heap Out Of Memory Error" in JavaScript. We lay out the causes and how...
Read more >
Serverless - FAQ | NestJS - A progressive Node.js framework
With this in place, you can now use $ nest build --webpack to compile your function's code (and then $ npx serverless offline...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found