You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Lisheng Sun (Jira)" <ji...@apache.org> on 2020/02/17 07:28:00 UTC

[jira] [Created] (HDFS-15174) Optimize ReplicaCachingGetSpaceUsed by reducing unnecessary io operations

Lisheng Sun created HDFS-15174:
----------------------------------

             Summary: Optimize ReplicaCachingGetSpaceUsed by reducing unnecessary io operations
                 Key: HDFS-15174
                 URL: https://issues.apache.org/jira/browse/HDFS-15174
             Project: Hadoop HDFS
          Issue Type: Improvement
            Reporter: Lisheng Sun
            Assignee: Lisheng Sun


Calculating the size of each block and the size of the meta file requires io operation In ReplicaCachingGetSpaceUsed#refresh(). Pressure on disk performance when there are many block. HDFS-14313 is intended to reduce io operation. So get block size by ReplicaInfo and meta size by DataChecksum#getChecksumSize().
{code:java}
@Override
  protected void refresh() {
      if (CollectionUtils.isNotEmpty(replicaInfos)) {
        for (ReplicaInfo replicaInfo : replicaInfos) {
          if (Objects.equals(replicaInfo.getVolume().getStorageID(),
              volume.getStorageID())) {
            dfsUsed += replicaInfo.getBlockDataLength();
            dfsUsed += replicaInfo.getMetadataLength();
            count++;
          }
        }
      }
  }
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org