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

BELUGA BEHR commented on HDFS-14260:
------------------------------------

Is it a big performance booster?  Probably not.

However, the code is a bit overwhelming, so I am trying to pare it down a bit 
where it makes sense so that it makes it easier to work on in the future.  This 
was low-hanging fruit.

> Synchronized Method in BlockReceiver Can Be Replaced with Atomic Value
> ----------------------------------------------------------------------
>
>                 Key: HDFS-14260
>                 URL: https://issues.apache.org/jira/browse/HDFS-14260
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: datanode
>    Affects Versions: 3.2.0
>            Reporter: BELUGA BEHR
>            Assignee: BELUGA BEHR
>            Priority: Minor
>         Attachments: HDFS-14260.1.patch, HDFS-14260.2.patch
>
>
> This synchronized block is protecting {{lastSentTime}} which is a native 
> long.  Can use AtomicLong and remove this synchronization.
> {code}
>   synchronized boolean packetSentInTime() {
>     long diff = Time.monotonicNow() - lastSentTime;
>     if (diff > maxSendIdleTime) {
>       LOG.info("A packet was last sent " + diff + " milliseconds ago.");
>       return false;
>     }
>     return true;
>   }
> {code}
> https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java#L392-L399



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to