[ 
https://issues.apache.org/jira/browse/HDFS-10804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15528661#comment-15528661
 ] 

Fenghua Hu commented on HDFS-10804:
-----------------------------------

Thanks [~arpitagarwal] for updating the description to reflect the recent 
changes in HDFS-10828. I updated a new version, could you please review it? 

Note that I haven't change other places, i think if it's feasible, we will need 
to change many places, for example:
we could safely remove datasetLock.acquire() from following code:

  public FsVolumeImpl getVolume(final ExtendedBlock b) {
    try (AutoCloseableLock lock = datasetLock.acquire()) {
      final ReplicaInfo r =
          volumeMap.get(b.getBlockPoolId(), b.getLocalBlock());
      return r != null ? (FsVolumeImpl) r.getVolume() : null;
    }
  }

similar functions include: getStoredBlock() and some others functions which 
uses lock for ReplicaMap exclusive access.
Once we agree to use separate lock for ReplicaMap, I'll modify them 
correspondingly. It's expected to improve performance.

> Use separate lock for ReplicaMap
> --------------------------------
>
>                 Key: HDFS-10804
>                 URL: https://issues.apache.org/jira/browse/HDFS-10804
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: hdfs
>    Affects Versions: 3.0.0-beta1
>            Reporter: Fenghua Hu
>            Assignee: Fenghua Hu
>            Priority: Minor
>         Attachments: HDFS-10804-001.patch, HDFS-10804-002.patch, 
> HDFS-10804-003.patch
>
>
> In currently implementation, ReplicaMap takes an external lock for 
> synchronization.
> In function FsDatasetImpl#FsDatasetImpl(), the object is for synchronization 
> is the same lock object used by FsDatasetImpl routines.
> and in private FsDatasetImpl#addVolume(), the same lock is used for 
> synchronization as well.
> {code}
> ReplicaMap tempVolumeMap = new ReplicaMap(datasetLock);
> {code}
> We can potentially eliminate the heavyweight lock for synchronizing 
> ReplicaMap instances. If it's not necessary, this could reduce lock 
> contention on the datasetLock object and improve performance. 
> Could you please give me some suggestions? Thanks a lot!
> Fenghua



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to