Calculations
Last updated
Last updated
In this section we review metrics and calculations provided on the Replex dashboards.
Here is a list of all the calculations described in this section:
Forecasted cost
Cost previous 30 days
Total cost
Idle cost
Savings
Utilized cost
Cluster score
CPU
RAM
Storage
Attached Node Disks
Next 30 days forecast is a prediction of the next month’s costs based on the historical data of the past 7 days.
Costs previous 30 days are the total costs of the cluster resources (VM instances, storage) for the past 30 days.
Total Cost is calculated as the sum of Idle Cost and Utilized Cost.
For example Cluster Total cost is calculated as the sum of Idle Cost and Utilized Cost of all resources in that cluster.
Namespace Total cost is calculated as the sum of Idle Cost and Utilized Cost for all pods running in that Namespace.
Similarly, Team Total cost is calculated as the sum Idle Cost and Utilized Cost for all pods labelled with that specific team.
Cluster Idle cost is calculated as the total cost of cluster resources that are unused.
In the above calculation the Idle CPU cost is a sum of idle CPU cost for all nodes belonging to the cluster. Similarly the Idle RAM cost is a sum of idle RAM cost for all nodes belonging to that cluster.
Node Idle CPU cost is calculated as the cost of un-utilized CPU on that node.
Similarly Node idle RAM cost is calculated as the cost of un-utilized RAM on that node.
Lastly, Node idle PVC cost is calculated as the cost of un-utilized Persistent Volume Storage provisioned for that cluster.
Cluster Savings represent the cost savings that can be made by optimising cluster resource utilization.
On the Replex UI Cluster Savings are calculated as the deviation of the total cluster cost from a best practice utilization baseline of 70%.
Here is an example to make this clearer:
Assume we have a cluster with a total cluster cost of $100 and used costs of $25. In this scenario cluster savings are calculated as follows:
This means that cluster costs can be reduced by $64.29, with a cluster utilization of 70%.
Once optimised, the new cluster cost is $35.71.
Similarly, the new cluster utilization is 70.01%
Utilized Cost is calculated as the sum of Pod CPU cost, Pod RAM cost and Storage cost for all pods.
For example Namespace Utilized costs are calculated as the sum of Pod CPU cost, Pod RAM cost and Storage cost for all pods running in that namespace.
Similarly, Team Utilized costs are calculated as the sum of Pod CPU cost, Pod RAM cost and Storage cost for all pods labelled with that specific team.
Cluster score is calculated based on how much resources were used within the cluster. The efficiency score is the deviation of actually used resources from the expected resources baseline.
where 30% is allowed idle cost.
If used resources are 58% of total cost:
Note, that if used resources go above the requested resources, the efficiency will not exceed 100%, instead the idle costs will increase.
The icon next to the efficiency score is displayed in different colours, based on the actual score value. This ensures a quick overview of the general efficiency of the cluster, wether it is in the cluster list or on the cluster dashboard.
A score between 61 and 100 means that the available cluster resources are used in an efficient way.
A score between 31 and 60 means that the cluster configuration should be improved.
A score between 0 and 30 means that most of the resources in the cluster are idling and the cluster should be downscaled in order to safe money.
Pod Requested CPU is calculated as the sum of CPU requests for all containers in the pod.
Each container can request CPU resources either as a fraction (0.5) or as millicpu (500m) using spec.containers[].resources.requests.cpu
In Kubernetes one CPU is equivalent to 1 vCPU/Core for cloud providers and 1 hyperthread on bare-metal Intel processors.
Below is an example of a pod spec. The pod has two containers, each requesting 250 millicpu of CPU. The first container requests CPU resources as a fraction (.25), whereas the second requests CPU resources in millicpu (250m).
Pod Used CPU is calculated as the sum of CPU resources consumed by all containers in the pod expressed as a percentage.
Pod CPU cost is calculated as the sum of Container CPU cost for all containers in the pod.
Pod Minimum CPU Usage is the minimum amount of CPU used by the pod during the selected time range.
Pod Maximum CPU Usage is the maximum amount of CPU used by the pod during the selected time range.
Recommended CPU is generated by the Replex system and is the recommended CPU requests value for that pod. Recommended CPU is calculated as follows:
Target CPU Utilization in the calculation above is 70%
Standard Deviation outlined in the CPU column is the stddev in CPU usage for that pod during the selected time range.
Container CPU cost is the product of node CPU cost and the fraction of CPU resources consumed by the container during a specific time interval.
Node CPU cost is calculated as the product of CPU cost per core and the total number of cores on that node, for a specific time duration.
cpuCoreHourly (CPU per core per hour) costs are fetched from the cloud providers using Replex’s pricing API.
Pod Requested RAM is calculated as the sum of memory requests for all containers in the pod.
Memory requests are measured in bytes. Each container can request memory resources as a plain integer or as a fixed-point integer with one of these suffixes: E, P, T, G, M, K using spec.containers[].resources.requests.memory.
Memory resources can also be requested as power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki.
Below is an example of a pod spec with two containers. The first container has RAM requests of 128Mi whereas the second has RAM requests of 256 Mi.
Pod Used RAM is calculated as the sum of memory resources consumed by all containers in the pod expressed as a percentage.
Pod RAM cost is calculated as the sum of Container RAM cost for all containers in the pod.
Pod Minimum RAM Usage is the minimum amount of RAM used by the pod during the selected time range.
Pod Maximum RAM Usage is the maximum amount of RAM used by the pod during the selected time range.
Recommended RAM is generated by the Replex system and is the recommended RAM requests value for that pod. Recommended RAM is calculated as follows:
Target RAM Utilization in the calculation above is 70%
Standard Deviation outlined in the RAM column is the stddev in RAM usage for that pod during the selected time range.
Container RAM cost is the product of node RAM cost and the fraction of memory resources consumed by the container during a specific time interval.
Node RAM cost is the product of RAM cost per core and the total number of cores on that node, for a specific time duration.
ramGBHourly (RAM per GB per hour) costs are fetched from the cloud providers using Replex’s pricing API.
Pod Storage Capacity is calculated as the size of the Persistent Volume Claim (PVC) that is provisioned for that pod. This number is based on the pod spec.
Pod Storage cost is calculated as the cost of PVCs attached to that pod.
Total Pod cost is calculated as the sum of CPU cost, RAM cost and Storage cost for all containers in that pod.
Node Disk Cost is calculated with the standard GB price of the particular cloud provider. The price is multiplied with the disk capacity and scaled to the required time interval.
Container Disk Cost are calculated by distributing the node disk cost equally among all containers running on the node.