GCP Compute Engine library API call does not give disk IOPS

165 Views Asked by At

My objective is to get the maximum allowed disk IOPS and Egress bandwidth details of my nodes and disks running in GKE through an API call or similar procedure. I am using compute_v1.DisksClient to get details of node disks of my cluster. The output given here has a field of provisioned IOPS. I am running the code below:

from google.cloud import compute_v1
PROJECT_ID = "my-project-id"
x=compute_v1.DisksClient()
ZONE="us-central1-c"
request=compute_v1.ListDisksRequest(project=PROJECT_ID, zone="us-central1-c")
print(x.list(request))

The output does not include any such field; in fact, many fields are missing. Can one please tell the mistake, or/and give a method to extracting max disk IOPS and egress bandwidth?

1

There are 1 best solutions below

2
Ray John Navarro On

The compute_v1.DisksClient API call will not return a disk's maximum allowed IOPS or egress bandwidth. These details are tied to the type of persistent disk (standard vs SSD) and the size of the disk, and are not exposed via API.

Here are helpful information about IOPS:

  • For Persistent Disk Standard (HDD) in GCP, IOPS can vary but it is typically lower than SSDs and does not scale linearly with disk size.
  • For Persistent Disk SSDs in GCP, the IOPS scales with the size of the disk. You can calculate IOPS as a range from 0.4 to 30 IOPS/GB, up to a maximum of 100,000 read IOPS per instance and 30,000 write IOPS per instance. [1]

Unfortunately there is no API to directly fetch the maximum allowed disk IOPS or Egress bandwidth. However, you can configure your disks to meet your performance requirements by issuing enough I/O requests in parallel[2]. Also, here are some documentations that can support your use case.[3][4]

Lastly, the egress bandwidth is not directly linked to the disk but is more of an instance-level or network-level concept, also not exposed via APIs.[5]

I hope this helps!

[1] https://cloud.google.com/compute/docs/disks/performance#pd-performance

[2] https://cloud.google.com/compute/docs/disks/performance.

[3] https://cloud.google.com/compute/docs/disks/

[4] https://cloud.google.com/storage/docs/apis

[5] https://cloud.google.com/vpc/docs/vpc#egress_throughput_caps