Next.js Discord

Discord Forum

ec2 becoming unresponsive

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Hey, has anyone had issues with a nextjs app hosted on an EC2 before? We have 2 servers via a load balancer, the same setup on each running pm2 with nextjs. Every so often, our servers go down. They start timing out and then we get a CF gateway error. We can't SSH in locally or via the AWS console. When we inspect the logs it looks like there's a memory leak, but we can't locate it. We've disabled the nextjs image optimisation hoping this might fix it but the memory usage keeps going up gradually. Any help would be great 🙂

5 Replies

Roseate Spoonbill
This would wildly depend on what the app does, what's the EC2 machine (ram, cpu, disk, swap) and how many users are visiting it.
Definitely sounds like memory issue, but it's hard to tell what's the source. On average, standalone next apps are utilizing in my experience 300-700 MB ram, so I wouldn't say this is an issue with framework itself in general.