[
https://issues.apache.org/jira/browse/HBASE-14268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14733306#comment-14733306
]
Hiroshi Ikeda commented on HBASE-14268:
---------------------------------------
Run with -verbose:gc -Xmx2m -XX:+PrintGCDetails
{code}
[GC [PSYoungGen: 731K->501K(2560K)] 731K->509K(3584K), 0.0011476 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
[Full GC [PSYoungGen: 501K->0K(2560K)] [ParOldGen: 8K->437K(1024K)]
509K->437K(3584K) [PSPermGen: 2561K->2560K(21504K)], 0.0096799 secs] [Times:
user=0.01 sys=0.00, real=0.02 secs]
----start----
[GC [PSYoungGen: 2048K->96K(2560K)] 2485K->533K(3584K), 0.0007277 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
[GC [PSYoungGen: 2144K->64K(2560K)] 2581K->501K(3584K), 0.0004147 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
java.lang.Object@3ccd5b3d
---- end ----
Heap
PSYoungGen total 2560K, used 270K [0x00000000ffd00000,
0x0000000100000000, 0x0000000100000000)
eden space 2048K, 10% used
[0x00000000ffd00000,0x00000000ffd33aa8,0x00000000fff00000)
from space 512K, 12% used
[0x00000000fff00000,0x00000000fff10000,0x00000000fff80000)
to space 512K, 0% used
[0x00000000fff80000,0x00000000fff80000,0x0000000100000000)
ParOldGen total 1024K, used 437K [0x00000000ff800000,
0x00000000ff900000, 0x00000000ffd00000)
object space 1024K, 42% used
[0x00000000ff800000,0x00000000ff86d508,0x00000000ff900000)
PSPermGen total 21504K, used 2567K [0x00000000fa600000,
0x00000000fbb00000, 0x00000000ff800000)
object space 21504K, 11% used
[0x00000000fa600000,0x00000000fa881ff0,0x00000000fbb00000)
{code}
> java.lang.Object@3ccd5b3d
The soft reference's referent is there and not garbage-collected against 2
Scavenge GCs.
> eden space 2048K ...
You can causes a Scavenge GC with creating 2048kB objects.
----
Run with -verbose:gc -Xmx2m -XX:+PrintGCDetails -XX:SoftRefLRUPolicyMSPerMB=0
{code}
[GC [PSYoungGen: 680K->485K(2560K)] 680K->509K(3584K), 0.0013846 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
[Full GC [PSYoungGen: 485K->0K(2560K)] [ParOldGen: 24K->425K(1024K)]
509K->425K(3584K) [PSPermGen: 2561K->2560K(21504K)], 0.0109427 secs] [Times:
user=0.01 sys=0.00, real=0.02 secs]
----start----
[GC [PSYoungGen: 2048K->96K(2560K)] 2473K->521K(3584K), 0.0005523 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
[GC [PSYoungGen: 2144K->32K(2560K)] 2569K->457K(3584K), 0.0005309 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
null
---- end ----
Heap
PSYoungGen total 2560K, used 238K [0x00000000ffd00000,
0x0000000100000000, 0x0000000100000000)
eden space 2048K, 10% used
[0x00000000ffd00000,0x00000000ffd33aa8,0x00000000fff00000)
from space 512K, 6% used
[0x00000000fff00000,0x00000000fff08000,0x00000000fff80000)
to space 512K, 0% used
[0x00000000fff80000,0x00000000fff80000,0x0000000100000000)
ParOldGen total 1024K, used 425K [0x00000000ff800000,
0x00000000ff900000, 0x00000000ffd00000)
object space 1024K, 41% used
[0x00000000ff800000,0x00000000ff86a7c0,0x00000000ff900000)
PSPermGen total 21504K, used 2567K [0x00000000fa600000,
0x00000000fbb00000, 0x00000000ff800000)
object space 21504K, 11% used
[0x00000000fa600000,0x00000000fa881ff0,0x00000000fbb00000)
{code}
> null
With -XX:SoftRefLRUPolicyMSPerMB=0, The soft reference's referent is
garbage-collected.
----
Run with -verbose:gc -Xmx2m -XX:+PrintGCDetails -XX:SoftRefLRUPolicyMSPerMB=0,
reducing the object creation to 2048kB:
{code}
[GC [PSYoungGen: 732K->501K(2560K)] 732K->517K(3584K), 0.0014023 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
[Full GC [PSYoungGen: 501K->0K(2560K)] [ParOldGen: 16K->425K(1024K)]
517K->425K(3584K) [PSPermGen: 2561K->2560K(21504K)], 0.0097419 secs] [Times:
user=0.02 sys=0.00, real=0.02 secs]
----start----
[GC [PSYoungGen: 2048K->96K(2560K)] 2473K->521K(3584K), 0.0005010 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
java.lang.Object@74ed41f8
---- end ----
Heap
PSYoungGen total 2560K, used 241K [0x00000000ffd00000,
0x0000000100000000, 0x0000000100000000)
eden space 2048K, 7% used
[0x00000000ffd00000,0x00000000ffd24428,0x00000000fff00000)
from space 512K, 18% used
[0x00000000fff80000,0x00000000fff98000,0x0000000100000000)
to space 512K, 0% used
[0x00000000fff00000,0x00000000fff00000,0x00000000fff80000)
ParOldGen total 1024K, used 425K [0x00000000ff800000,
0x00000000ff900000, 0x00000000ffd00000)
object space 1024K, 41% used
[0x00000000ff800000,0x00000000ff86a7c0,0x00000000ff900000)
PSPermGen total 21504K, used 2567K [0x00000000fa600000,
0x00000000fbb00000, 0x00000000ff800000)
object space 21504K, 11% used
[0x00000000fa600000,0x00000000fa881df0,0x00000000fbb00000)
{code}
> java.lang.Object@74ed41f8
The soft reference's referent is not garbage-collected against just 1 Scavenge
GC.
----
Run with -verbose:gc -Xmx2m -XX:+PrintGCDetails, changing the code to use
{{WeakReference}} instead of {{SoftReference}}, and reducing the object
creating to 2048kB:
{code}
[GC [PSYoungGen: 732K->501K(2560K)] 732K->525K(3584K), 0.0011397 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
[Full GC [PSYoungGen: 501K->0K(2560K)] [ParOldGen: 24K->437K(1024K)]
525K->437K(3584K) [PSPermGen: 2561K->2560K(21504K)], 0.0100745 secs] [Times:
user=0.02 sys=0.00, real=0.02 secs]
----start----
[GC [PSYoungGen: 2048K->96K(2560K)] 2485K->533K(3584K), 0.0004483 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
null
---- end ----
Heap
PSYoungGen total 2560K, used 241K [0x00000000ffd00000,
0x0000000100000000, 0x0000000100000000)
eden space 2048K, 7% used
[0x00000000ffd00000,0x00000000ffd24428,0x00000000fff00000)
from space 512K, 18% used
[0x00000000fff80000,0x00000000fff98000,0x0000000100000000)
to space 512K, 0% used
[0x00000000fff00000,0x00000000fff00000,0x00000000fff80000)
ParOldGen total 1024K, used 437K [0x00000000ff800000,
0x00000000ff900000, 0x00000000ffd00000)
object space 1024K, 42% used
[0x00000000ff800000,0x00000000ff86d508,0x00000000ff900000)
PSPermGen total 21504K, used 2567K [0x00000000fa600000,
0x00000000fbb00000, 0x00000000ff800000)
object space 21504K, 11% used
[0x00000000fa600000,0x00000000fa881df0,0x00000000fbb00000)
{code}
> null
The weak reference's referent can be garbage-collected by just 1 Scavenge GC.
----
Run with -verbose:gc -Xmx2m -XX:+PrintGCDetails, using {{WeakReference}} and
reducing the object creating to 1024kB:
{code}
[GC [PSYoungGen: 732K->501K(2560K)] 732K->509K(3584K), 0.0013515 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
[Full GC [PSYoungGen: 501K->0K(2560K)] [ParOldGen: 8K->437K(1024K)]
509K->437K(3584K) [PSPermGen: 2561K->2560K(21504K)], 0.0094317 secs] [Times:
user=0.00 sys=0.00, real=0.00 secs]
----start----
java.lang.Object@4336a26f
---- end ----
Heap
PSYoungGen total 2560K, used 1151K [0x00000000ffd00000,
0x0000000100000000, 0x0000000100000000)
eden space 2048K, 56% used
[0x00000000ffd00000,0x00000000ffe1ff50,0x00000000fff00000)
from space 512K, 0% used
[0x00000000fff00000,0x00000000fff00000,0x00000000fff80000)
to space 512K, 0% used
[0x00000000fff80000,0x00000000fff80000,0x0000000100000000)
ParOldGen total 1024K, used 437K [0x00000000ff800000,
0x00000000ff900000, 0x00000000ffd00000)
object space 1024K, 42% used
[0x00000000ff800000,0x00000000ff86d508,0x00000000ff900000)
PSPermGen total 21504K, used 2567K [0x00000000fa600000,
0x00000000fbb00000, 0x00000000ff800000)
object space 21504K, 11% used
[0x00000000fa600000,0x00000000fa881df0,0x00000000fbb00000)
{code}
> java.lang.Object@4336a26f
There is no GC and the weak referent is there.
> 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, KeyLockerIncrKeysPerformance.java,
> KeyLockerPerformance.java, ReferenceTestApp.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
(v6.3.4#6332)