How to debug unexpected memory consumption in my nextjs app?
peguerosdc
HOBBYOP

a year ago

Last month, I received an unusually high bill due to excessive memory consumption by one of my services. Upon checking the "Metrics" tab, I noticed a steady increase in memory usage, eventually reaching 1.4 GB. I managed to solve it by triggering a new deployment and since then, the memory usage has stayed at a normal level (~250 MB).

The main issues I'm facing are:

  • I can't access HTTP logs or older-than-30-days Metrics' charts, which prevents me from pinpointing when the memory spike began.

  • I can't SSH into my container, so:

    • I’m unable to take memory snapshots without implementing a complex solution, like deploying a custom Docker image with a script for taking snapshots and uploading them somewhere.

Any ideas on how to debug this would be greatly appreciated 🙏🏽

5 Replies

peguerosdc
HOBBYOP

a year ago

Here is a screenshot of my memory consumption

Attachments


a year ago

You would want to run your app locally with Podman for debug purposes.


peguerosdc
HOBBYOP

a year ago

Do you know where I can find the default Dockerfile used for my project?


a year ago

Not quite how it works, nixpacks generates a Dockerfile for you based on your project, going forward it would be best to write your own.


peguerosdc
HOBBYOP

a year ago

That's what I needed to know. Thanks!


Loading...