hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiroshi Ikeda (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-14268) Improve KeyLocker
Date Fri, 04 Sep 2015 08:03:46 GMT

    [ https://issues.apache.org/jira/browse/HBASE-14268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14730483#comment-14730483

Hiroshi Ikeda commented on HBASE-14268:

For performance tests in much GC, I multiplied LOOP_COUNT by 10 or 100 and run the test application
with the VM option -verbose:gc. The new KeyLocker works well. The old KeyLocker immediately
drops released locks and GC happens frequently.

new KeyLocker, LOOP_COUNT=1,000,000
[GC 33280K->789K(124928K), 0.0018632 secs]
[GC 34069K->733K(124928K), 0.0015329 secs]
[GC 34013K->733K(124928K), 0.0012143 secs]
[GC 34013K->733K(158208K), 0.0012232 secs]

new KeyLocker, LOOP_COUNT=10,000,000
[GC 33280K->757K(124928K), 0.0021142 secs]
[GC 34037K->693K(124928K), 0.0046123 secs]
[GC 33973K->725K(124928K), 0.0128241 secs]
[GC 34005K->725K(158208K), 0.0012777 secs]
[GC 67285K->693K(158208K), 0.0013967 secs]
[GC 67253K->725K(220672K), 0.0012992 secs]
[GC 133845K->838K(220672K), 0.0014905 secs]
[GC 133958K->870K(353792K), 0.0004786 secs]

old KeyLocker, LOOP_COUNT=1,000,000
[GC 33280K->1032K(124928K), 0.0018203 secs]
[GC 34312K->789K(124928K), 0.0014084 secs]
[GC 34069K->853K(124928K), 0.0012749 secs]
[GC 34133K->853K(158208K), 0.0012367 secs]
[GC 67413K->853K(158208K), 0.0013319 secs]
[GC 67413K->821K(220672K), 0.0012880 secs]
[GC 133941K->882K(220672K), 0.0015950 secs]
[GC 134002K->882K(354304K), 0.0005267 secs]
[GC 267122K->882K(354304K), 0.0007189 secs]
[GC 267122K->818K(514048K), 0.0087180 secs]
[GC 426802K->882K(514048K), 0.0008262 secs]
[GC 426866K->914K(770048K), 0.0005164 secs]
[GC 682898K->914K(770048K), 0.0005015 secs]
[GC 682898K->914K(780288K), 0.0004968 secs]
[GC 693138K->850K(780288K), 0.0005118 secs]
[GC 693074K->882K(746496K), 0.0005215 secs]
[GC 660338K->914K(716288K), 0.0005057 secs]
[GC 629138K->914K(685568K), 0.0005206 secs]
[GC 599442K->882K(658432K), 0.0061237 secs]
[GC 571250K->882K(630784K), 0.0005043 secs]
[GC 544626K->850K(605696K), 0.0004590 secs]

On the other hand, I found that, in the case of locking and releasing new keys at all times,
the new KeyLocker has less performance. That is because weak references may require a several
GC, and I think that happens especially when there are too many weak references. I'll append
later such a test application and its result.

> Improve KeyLocker
> -----------------
>                 Key: HBASE-14268
>                 URL: https://issues.apache.org/jira/browse/HBASE-14268
>             Project: HBase
>          Issue Type: Improvement
>          Components: util
>            Reporter: Hiroshi Ikeda
>            Assignee: Hiroshi Ikeda
>            Priority: Minor
>             Fix For: 2.0.0, 1.3.0
>         Attachments: 14268-V5.patch, HBASE-14268-V2.patch, HBASE-14268-V3.patch, HBASE-14268-V4.patch,
HBASE-14268-V5.patch, HBASE-14268-V5.patch, HBASE-14268-V6.patch, HBASE-14268-V7.patch, HBASE-14268-V7.patch,
HBASE-14268.patch, KeyLockerPerformance.java
> 1. In the implementation of {{KeyLocker}} it uses atomic variables inside a synchronized
block, which doesn't make sense. Moreover, logic inside the synchronized block is not trivial
so that it makes less performance in heavy multi-threaded environment.
> 2. {{KeyLocker}} gives an instance of {{RentrantLock}} which is already locked, but it
doesn't follow the contract of {{ReentrantLock}} because you are not allowed to freely invoke
lock/unlock methods under that contract. That introduces a potential risk; Whenever you see
a variable of the type {{RentrantLock}}, you should pay attention to what the included instance
is coming from.

This message was sent by Atlassian JIRA

View raw message