Learn how to enable cost optimization for your node groups to improve resource efficiency
Porter supports intelligent cost optimization for node groups, allowing you to automatically optimize resource allocation and reduce costs while maintaining performance.
By default, node groups in Porter use a fixed instance type approach. When you create a node group, you select a specific machine type (e.g., t3.xlarge with 4 CPU, 16GB RAM) and Porter scales by adding or removing instances of that exact type. While this works well for predictable workloads, it often leads to resource fragmentation.Let’s look at an example. Say you’re running a web application with 8 replicas, each needing:
2.5 CPU cores
4GB RAM
Total requirements: 20 CPU cores and 32GB RAM
With fixed instance types, you might choose t3.xlarge instances (4 CPU, 16GB RAM each). You would need 5 instances to get enough CPU (20 cores needed), which provides 80GB of RAM - far more than the 32GB you need. At $0.1664 per hour for each instance ($0.832 total per hour), you’re paying for 48GB of unused RAM - a 60% waste in memory.With cost optimization enabled, Porter can intelligently bin pack your workloads using a combination of instance types. Using 3 t3.large instances (2 CPU, 8GB RAM each) at $0.0832/hour ($0.2496 total) and 4 t3.medium instances (2 CPU, 4GB RAM each) at $0.0416/hour ($0.1664 total), Porter achieves the exact capacity needed (20 CPU cores and 32GB RAM) for $0.416/hour - a 50% reduction in cost with the same performance. The machines are reshuffled on a cadence to ensure the best fit as the set of workloads changes.
Health Checks Required: For production applications, ensure proper health checks are configured before scheduling them on cost-optimized node groups. This ensures your applications can be safely rescheduled on new nodes without causing any disruption as nodes are reshuffled.