Skip to content

Baseline CPU Performance for Instance Type Selection #8992

@bwagner5

Description

@bwagner5

Description

What problem are you trying to solve?

The EC2 API GetInstanceTypesFromInstanceRequirements supports a parameter called BaselinePerformance. This attribute accepts an instance family and returns back instance types that have comparable CPU performance. This would be an interesting option to add to Karpenter's instance type selection requirement keys. The use-case is for workloads that have been benchmarked on a specific instance family CPU and want to expand instance type flexibility to other similar instance types.

spec:
  template:
    spec:
      requirements:
        - key: kubernetes.io/arch
          operator: In
          values: ["amd64"]
        - key: kubernetes.io/os
          operator: In
          values: ["linux"]
        - key: karpenter.sh/capacity-type
          operator: In
          values: ["spot"]
        - key: karpenter.k8s.aws/baseline-instance-family-performance
          operator: In
          values: ["c6i"]

The requirements from the NodePool above would translate to:

aws ec2 get-instance-types-from-instance-requirements \
    --cli-input-json file://attributes.json
{

    "ArchitectureTypes": [
        "x86_64"
    ],
    "VirtualizationTypes": [
        "hvm"
    ],
    "InstanceRequirements": {
        "VCpuCount": {
            "Min": 1,
            "Max": 4
        },
        "MemoryMiB": {
            "Min": 2048,
            "Max": 8192
        },
        "BaselinePerformanceFactors": {
            "Cpu": {
                 "References": [
                         { "InstanceFamily": "c6i" }
                   ]
            }
        }
    }
}

and produce this list:

{
    "InstanceTypes": [
        {
            "InstanceType": "c5a.large"
        },
        {
            "InstanceType": "c5a.xlarge"
        },
        {
            "InstanceType": "c5ad.large"
        },
        {
            "InstanceType": "c5ad.xlarge"
        },
        {
            "InstanceType": "c6a.large"
        },
        {
            "InstanceType": "c6a.xlarge"
        },
        {
            "InstanceType": "c6i.large"
        },
        {
            "InstanceType": "c6i.xlarge"
        },
        {
            "InstanceType": "c6id.large"
        },
        {
            "InstanceType": "c6id.xlarge"
        },
        {
            "InstanceType": "c6in.large"
        },
        {
            "InstanceType": "c6in.xlarge"
        },
        {
            "InstanceType": "c7a.large"
        },
        {
            "InstanceType": "c7a.medium"
        },
        {
            "InstanceType": "c7a.xlarge"
        },
        {
            "InstanceType": "c7i-flex.large"
        },
        {
            "InstanceType": "c7i-flex.xlarge"
        },
        {
            "InstanceType": "c7i.large"
        },
        {
            "InstanceType": "c7i.xlarge"
        },
        {
            "InstanceType": "m5zn.large"
        },
        {
            "InstanceType": "m6a.large"
        },
        {
            "InstanceType": "m6i.large"
        },
        {
            "InstanceType": "m6id.large"
        },
        {
            "InstanceType": "m6idn.large"
        },
        {
            "InstanceType": "m6in.large"
        },
        {
            "InstanceType": "m7a.large"
        },
        {
            "InstanceType": "m7a.medium"
        },
        {
            "InstanceType": "m7i-flex.large"
        },
        {
            "InstanceType": "m7i.large"
        },
        {
            "InstanceType": "r7a.medium"
        }
    ]
}

These instance types may be filtered further based on other requirements. Note that CPU and Memory is required in the EC2 get-instance-types-from-instance-requirements API, so those requirements would need to be resolved first or include all by specifying a wide range.


From the docs:

The baseline performance to consider, using an instance family as a baseline reference. The instance family establishes the lowest acceptable level of performance. Amazon EC2 uses this baseline to guide instance type selection, but there is no guarantee that the selected instance types will always exceed the baseline for every application. Currently, this parameter only supports CPU performance as a baseline performance factor. For more information, see Performance protection in the Amazon EC2 User Guide .

How important is this feature to you?

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requesttriage/acceptedIndicates that the issue has been accepted as a valid issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions