aws/amazon-ec2-instance-selector

vcpus=96 returned r5.large which is 2cpu

matti opened this issue · 5 comments

matti commented

ec2-instance-selector --region=eu-north-1 --vcpus=96 --memory-min=192 --hypervisor nitro --cpu-architecture x86_64 --deny-list '^vt.|^inf.|d\.|en\.|dn\.' --gpus 0 --network-performance-max 50 --root-device-type ebs --usage-class=spot --price-per-hour-max 1.4 --max-results 100

returned once

      - c5.24xlarge
      - c5a.24xlarge
      - c6i.24xlarge
      - m5.24xlarge
      - r5.large

couldn't reproduce it, but I'm 100% sure about this as it was in CI/CD and suddenly my 96cpu instances had one 2cpu among them

snay2 commented

I am also unable to reproduce this issue.

Hi,

I have similar issue with

ec2-instance-selector --cpu-architecture x86_64 --base-instance-type t3.medium --usage-class spot --region eu-west-1 --sort-by spot-price --sort-direction asc --price-per-hour-max 0.0408

which returned:

  + instance_types         = [
      + "m3.medium",
      + "m1.medium",
      + "t3a.medium",
      + "t3.medium",
      + "t2.medium",
      + "c5d.large",
      + "c5a.large",
      + "c5ad.large",
      + "c3.large",
      + "c5.large",
      + "c6id.large",
      + "c6i.large",
      + "c6a.large",
      + "c6in.large",
      + "c4.large",
      + "c6gd.16xlarge", # <----- NOT OK
    ]
	
  + instance_types         = [
      + "m3.medium",
      + "m1.medium",
      + "t3a.medium",
      + "t3.medium",
      + "t2.medium",
      + "c5d.large",
      + "c5a.large",
      + "c5ad.large",
      + "c3.large",
      + "c5.large",
      + "c6id.large",
      + "c6in.large",
      + "c6a.large",
      + "c6i.large",
      + "c4.large",
      + "r6g.8xlarge", # <----- NOT OK
    ]
# ec2-instance-selector --version
v2.4.0

After some tests, I've found that, with reproduction ratio around 3%, some random spot instances are returned even with --price-per-hour-max 0.0:

# for f in `seq 200`; do ec2-instance-selector --cpu-architecture x86_64 --base-instance-type t3.large --usage-class spot --region eu-west-1 -o table-wide --price-per-hour-max 0.0; sleep 5; done
NOTE: The criteria was too narrow and returned no valid instance types. Consider broadening your criteria so that more instance types are returned.
NOTE: The criteria was too narrow and returned no valid instance types. Consider broadening your criteria so that more instance types are returned.
(...)
NOTE: The criteria was too narrow and returned no valid instance types. Consider broadening your criteria so that more instance types are returned.
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
c6id.24xlarge  96      192        nitro       true         false                x86_64    37.5 Gigabit         15      0       0              none      $5.4936             $1.73145
(...)
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
c5d.18xlarge   72      144        nitro       true         true                 x86_64    25 Gigabit           15      0       0              none      $3.924              $1.2367
(...)
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
r5d.24xlarge   96      768        nitro       true         false                x86_64    25 Gigabit           15      0       0              none      $7.68               $1.8139
(...)
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
z1d.large      2       16         nitro       true         false                x86_64    Up to 10 Gigabit     3       0       0              none      $0.208              $0.0624
(...)
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
m5zn.12xlarge  48      192        nitro       true         false                x86_64    100 Gigabit          15      0       0              none      $4.4184             $0.8657
(...)
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
c6id.2xlarge   8       16         nitro       true         false                x86_64    Up to 12.5 Gigabit   4       0       0              none      $0.4578             $0.16517
(...)
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
z1d.large      2       16         nitro       true         false                x86_64    Up to 10 Gigabit     3       0       0              none      $0.208              $0.0624
(...)

I thought above could be related with below code:

func (c *SpotPricing) calculateSpotAggregate(spotPriceEntries []*spotPricingEntry) float64 {
	if len(spotPriceEntries) == 0 {
		return 0.0
	}

but this would not explain, why these random instance types are not matching for example --base-instance-type t3.large criterium. After some time with another test (--price-per-hour-min 0.000001 --price-per-hour-max 0.000001) I've got:

for f in `seq 500`; do ec2-instance-selector --cpu-architecture x86_64 --base-instance-type t3.large --usage-class spot --region eu-west-1 -o table-wide --price-per-hour-min 0.000001 --price-per-hour-max 0.000001; sleep 5; done 2>&1 | grep -v "Consider broadening your criteria so that more instance types are returned"
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
x1.32xlarge    128     1,952      xen         true         false                x86_64    25 Gigabit           8       0       0              none      $16.006             $4.8018
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
c6id.12xlarge  48      96         nitro       true         false                x86_64    18.75 Gigabit        8       0       0              none      $2.7468             $1.09795
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
r5d.xlarge     4       32         nitro       true         true                 x86_64    Up to 10 Gigabit     4       0       0              none      $0.32               $0.07967
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
m6in.12xlarge  48      192        nitro       true         false                x86_64    75 Gigabit           8       0       0              none      $3.73464            $0.909
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
m6gd.16xlarge  64      256        nitro       true         false                arm64     25 Gigabit           15      0       0              none      $3.2256             $1.26193
Instance Type  VCPUs   Mem (GiB)  Hypervisor  Current Gen  Hibernation Support  CPU Arch  Network Performance  ENIs    GPUs    GPU Mem (GiB)  GPU Info  On-Demand Price/Hr  Spot Price/Hr (30d avg)
-------------  -----   ---------  ----------  -----------  -------------------  --------  -------------------  ----    ----    -------------  --------  ------------------  -----------------------
t3a.2xlarge    8       32         nitro       true         true                 x86_64    Up to 5 Gigabit      4       0       0              none      $0.3264             $0.12976

So it doesn't looks like related with specific flags, but rather general bug (in cache?), and it is reproducible.

Hi @matti
problem was fixed in v.2.4.1

matti commented

@hfastek cool, should we close this? I'm running 2.4.1 now in production

@matti, I think it can be closed. I am not able to reproduce it, and after code analysis I am pretty sure that now, in general, filters should work without random anomalies.