instance writeIOPS 表示单个实例的磁盘写入操作的每秒次数。cluster volumeWriteIOPS 表示整个集群的磁盘写入操作的每秒次数。
volumeWriteIOPS 是 writeIOPS 的 100 倍,原因是 DocumentDB 使用基于 SSD 的分层存储,数据存储在多个卷中,每个卷都有自己的 IOPS 配额。volumeWriteIOPS 是所有卷的 IOPS 配额总和。
以下是 Python 示例,使用 Boto3 库获取 DocumentDB 实例和集群的 IOPS 情况:
import boto3
# Replace placeholders with your own values
db_instance_identifier = 'my-db-instance'
db_cluster_identifier = 'my-db-cluster'
client = boto3.client('docdb')
# Get the Instance's IOPS usage
instance_iops = client.describe_db_instances(
DBInstanceIdentifier=db_instance_identifier)['DBInstances'][0]['PendingModifiedValues']['Iops']
print(f"Instance IOPS: {instance_iops}")
# Get the cluster's IOPS usage
cluster_iops = client.describe_db_clusters(DBClusterIdentifier=db_cluster_identifier)['DBClusters'][0]['PendingModifiedValues']['Iops']
print(f"Cluster IOPS: {cluster_iops}")
如果实例或集群正在等待修改,则可以使用 PendingModifiedValues
返回 IOPS 。如果没有等待的修改,则使用返回的值作为 AllocatedStorage
,并将 IOPS 设置为标准值(3 IOPS/GB)。