Determine number of bare metal instances to order
Overview
This page walks you through determining the optimal number of bare metal instances to minimize cost by shifting your base load to bare metal hosts, which are significantly more cost-effective than cloud-based VMs.
Determine Min DSes required
Go to the AMS Fleet Overview dashboard: https://accelbyte.grafana.net/d/ams-fleets-overview-production/ams-fleet-overview, scroll down to the "Running/Max DS by fleet" panel
Find out the minimum number of DSes required by looking at the "Running" graph. E.g. for the screenshot below, the minimum number of running DSes was 60.
Determine current max CPU & memory data per DS
Go to the AMS DS Metrics dashboard: https://accelbyte.grafana.net/d/ams-ds-metrics-production/ams-ds-metrics
Refer to the DS Max CPU Usage and DS Max Memory Usage panels for details on maximum CPU and memory for the DSes. E.g. for the screenshot below, each DS took < 0.5 core CPU and < 512 MiB of memory. We recommend collecting at least one week of data to obtain a reliable estimate of peak CPU and memory usage.
Perform the calculation based on the cpu and memory constraint
- Determine the bare metal VM type: Choosing instance types for your fleet
- compute-intensive -
cpx1.ser.16x
: 16 cores CPU, 32 GiB of memory. - balanced needs -
glx1.ser.16x
: 16 cores CPU, 64 GiB of memory.
- compute-intensive -
- Taking into account the above CPU and memory requirement, we can calculate by utilizing the below formula:
Num bare metal instances = max(Core-Based Constraint, Memory-Based Constraint)
- Formula:
N = max( ceil( (D * C) / C_limit ), ceil( (D * M) / M_limit ) )
- D: Min DSes
- C: # of Core(s) per DS
- M: Memory required per DS (e.g., 512 MiB = 0.5 GiB)
- M_limit: Memory limit per bare metal VM (e.g., 64 GiB for
glx1.ser.16x
) - C_limit: Core limit per bare metal VM (e.g., 16 cores)
- E.g.
- using the balanced VM type:
glx1.ser.16x
- minimum 60 DSes
- DS Max CPU Usage is < 0.5 vCPU/s
- DS Max Memory Usage of < 512 MiB
- Conservative estimate: 1 core/DS:
- Core-based constraint =
ceil( (D * C) / C_limit ) = ceil( (60 * 1) /16 ) = ceil(3.75) = 4
- Memory-based constraint =
ceil( (D * M) / M_limit ) = ceil( (60 * 0.5) / 64 ) = ceil(0.46875) = 1
- Consolidated result:
N = max(4, 1) = 4
- Core-based constraint =
- Conservative estimate: 1 core/DS:
- using the balanced VM type:
- Formula:
One might feel that running more bare metal instances beyond the base load (even though it is mostly partially idling to cover some of the peak load) could further reduce the cost. However after some modeling and experimentation, we have found that replacing exactly the base load with bare metal instances actually is the most optimal.
What's next
- Conduct additional testing to determine if further optimizations can increase the number of DSes per bare metal instance without causing CPU starvation or memory exhaustion.