I have an app that is deployed on AWS using ECS and recently facing some issues with memory utilization.
To give you a little background:
- Our app is Node.js (specifically Sails.js) backend with React used for front-end
- In the ECS task definition, we've set the memory to 900 and cpu to 600 units respectively
- Instance type is t2.micro
- The AMI we use is Amazon ECS optimized (appears to use Docker Docker version 18.06.1-ce)
- We have one service (not separated for frontend/backend) running per container (per EC2 instance)
- Typically have at least 2 instances running with ALB in between
- We use DynamoDB and ElastiCache (Redis)
Accordingly to Cloudwatch logs, memory utilization hovers around ~50-60% utilization.
Running process.memoryUsage() on one of the instances produces the following:
{ rss: 28999680,
heapTotal: 7684096,
heapUsed: 4982976,
external: 16837 }
Is this normal for a production Node/React app?
Must we modify instance type and increase resources?
Does Docker also use additional resources that we must account for?
Any insight or recommendations would be greatly appreciated.