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

Yongjun Zhang commented on HDFS-6788:
-------------------------------------

I thought I made a mistake in earlier patch after seeing Arpit's comment, but 
after careful reviewing, it looks fine to me. 
 
Hi [~andrew.wang], 

I uploaded a patch to address the second comments of yours. For the extra 
newline in the imports section, it's added by eclipse to separate the imports 
comp.google and org.apache into different sections , and I think it's not bad 
and didn't change it. Would you please take a look at the new revision? Thanks. 
 

Hi [~arpitagarwal], thanks for reviewing it earlier, if you have time, I will 
appreciate that you look at it again.

BTW Andrew, I saw that both FSDirection and FSNameSystem's lock code have quite 
some indirection (thus a bit more runtime) when making a call, say,
{code}
  void readLock() {
    this.dirLock.readLock().lock();
  }
{code}
It go through several "." and each of them is an indirection. This can be 
improved. For example,  we can create a class member, e.g., {{mReadLock = 
this.dirLock.readLock();}}, then modify the readLock() methods to
{code}
 void readLock() {
    mReadLock.lock();
 }
{code}
I can create a jira to change both classes if you agree. Thanks.


> Improve synchronization in BPOfferService with read write lock
> --------------------------------------------------------------
>
>                 Key: HDFS-6788
>                 URL: https://issues.apache.org/jira/browse/HDFS-6788
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: datanode
>    Affects Versions: 2.5.0
>            Reporter: Yongjun Zhang
>            Assignee: Yongjun Zhang
>         Attachments: HDFS-6788.001.patch, HDFS-6788.002.patch
>
>
> Threads in DN (DataXceiver, PacketResponder, Async disk worker etc) may block 
> at BPOfferService.getBlockPoolId() when calling BPOfferService.checkBlock(), 
> though they are just reading the same blockpool id. This is unnecessary 
> overhead and may cause performance hit when many threads compete. Filing this 
> jira to replace synchronized method with read write lock 
> (ReentrantReadWriteLock).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to