ECS Instance Size for Node.js Applications
For Flightcontrol Web Server and Worker build types, you can choose a size to use for the Amazon Web Servics (AWS) ECS instance that will run your application.
Generally speaking, the small (0.25 vCPU/512 MB memory) size is not sufficient for running most Node.js applications in production.
We recommend using the medium (0.5 vCPU/1 GB memoty) or large (1 vCPU/2 GB memory) size for most Node.js applications. If you have a very memory-intensive or compute-heavy application, you may need to use the extra-large (2 vCPU/4 GB memory) size, or one of the custom choices for instance size that you can choose from our instance size drop down menu.
Running on Too Small an Instance Size
If your application runs on too small an instance size, you will likely see health check errors in your deployment history. This is because the application takes too long to start up, and the health check fails before the application is ready to serve requests. Or, Node.js may run out of memory and crash, and the health check will fail because the application is not running.
Running on Too Large an Instance Size
We suggest that you run your application on the smallest instance size that it can run on without crashing or failing health checks. This will save you money on your AWS bill. You can use autoscaling to scale your application out to multiple instances if you need to handle more traffic. Set a minimum and maximum number of instances for your application, and AWS will automatically scale the number of instances up and down based on the amount of traffic your application is receiving.
Development, Staging, Preview Environments
We do encourage using the small and medium instance sizes for your testing and preview environments. This minimizes your AWS costs, and will allow you to test your application on a smaller instance size before deploying to production.
It’s a best practice to have your staging environment mimic your production environment to the extent possible, so you should use the same instance size for staging as you do for production.
Number of Instances
We recommend running your production workloads on a minimum of two application instances, so that the load balancer can direct traffic to your other instance while one instance is being deployed to. This will minimize downtime during deployments. This is also a best practice for high availability.
You can also use autoscaling to set a minimum of two instances and a maximum number of instances that fits your application’s traffic patterns.