HBASE-9430 Memstore heapSize calculation - DEEP_OVERHEAD is incorrect
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1524914 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ab5e4b98d0
commit
0541a8da5c
|
@ -103,6 +103,12 @@ public class ClassSize {
|
||||||
/** Overhead for timerange */
|
/** Overhead for timerange */
|
||||||
public static final int TIMERANGE;
|
public static final int TIMERANGE;
|
||||||
|
|
||||||
|
/** Overhead for TimeRangeTracker */
|
||||||
|
public static final int TIMERANGE_TRACKER;
|
||||||
|
|
||||||
|
/** Overhead for KeyValueSkipListSet */
|
||||||
|
public static final int KEYVALUE_SKIPLIST_SET;
|
||||||
|
|
||||||
/* Are we running on jdk7? */
|
/* Are we running on jdk7? */
|
||||||
private static final boolean JDK7;
|
private static final boolean JDK7;
|
||||||
static {
|
static {
|
||||||
|
@ -181,6 +187,10 @@ public class ClassSize {
|
||||||
COPYONWRITE_ARRAYLIST = align(OBJECT + (2 * REFERENCE) + ARRAY);
|
COPYONWRITE_ARRAYLIST = align(OBJECT + (2 * REFERENCE) + ARRAY);
|
||||||
|
|
||||||
TIMERANGE = align(ClassSize.OBJECT + Bytes.SIZEOF_LONG * 2 + Bytes.SIZEOF_BOOLEAN);
|
TIMERANGE = align(ClassSize.OBJECT + Bytes.SIZEOF_LONG * 2 + Bytes.SIZEOF_BOOLEAN);
|
||||||
|
|
||||||
|
TIMERANGE_TRACKER = align(ClassSize.OBJECT + Bytes.SIZEOF_LONG * 2);
|
||||||
|
|
||||||
|
KEYVALUE_SKIPLIST_SET = align(OBJECT + REFERENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,7 +44,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
* get and set and won't throw ConcurrentModificationException when iterating.
|
* get and set and won't throw ConcurrentModificationException when iterating.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
class KeyValueSkipListSet implements NavigableSet<KeyValue> {
|
public class KeyValueSkipListSet implements NavigableSet<KeyValue> {
|
||||||
private final ConcurrentNavigableMap<KeyValue, KeyValue> delegatee;
|
private final ConcurrentNavigableMap<KeyValue, KeyValue> delegatee;
|
||||||
|
|
||||||
KeyValueSkipListSet(final KeyValue.KVComparator c) {
|
KeyValueSkipListSet(final KeyValue.KVComparator c) {
|
||||||
|
|
|
@ -962,8 +962,8 @@ public class MemStore implements HeapSize {
|
||||||
|
|
||||||
public final static long DEEP_OVERHEAD = ClassSize.align(FIXED_OVERHEAD +
|
public final static long DEEP_OVERHEAD = ClassSize.align(FIXED_OVERHEAD +
|
||||||
ClassSize.REENTRANT_LOCK + ClassSize.ATOMIC_LONG +
|
ClassSize.REENTRANT_LOCK + ClassSize.ATOMIC_LONG +
|
||||||
ClassSize.COPYONWRITE_ARRAYSET + ClassSize.COPYONWRITE_ARRAYLIST +
|
(2 * ClassSize.TIMERANGE_TRACKER) +
|
||||||
(2 * ClassSize.CONCURRENT_SKIPLISTMAP));
|
(2 * ClassSize.KEYVALUE_SKIPLIST_SET) + (2 * ClassSize.CONCURRENT_SKIPLISTMAP));
|
||||||
|
|
||||||
/** Used for readability when we don't store memstore timestamp in HFile */
|
/** Used for readability when we don't store memstore timestamp in HFile */
|
||||||
public static final boolean NO_PERSISTENT_TS = false;
|
public static final boolean NO_PERSISTENT_TS = false;
|
||||||
|
|
|
@ -47,7 +47,10 @@ import org.apache.hadoop.hbase.io.hfile.CachedBlock;
|
||||||
import org.apache.hadoop.hbase.io.hfile.LruBlockCache;
|
import org.apache.hadoop.hbase.io.hfile.LruBlockCache;
|
||||||
import org.apache.hadoop.hbase.regionserver.HRegion;
|
import org.apache.hadoop.hbase.regionserver.HRegion;
|
||||||
import org.apache.hadoop.hbase.regionserver.HStore;
|
import org.apache.hadoop.hbase.regionserver.HStore;
|
||||||
|
import org.apache.hadoop.hbase.regionserver.KeyValueSkipListSet;
|
||||||
import org.apache.hadoop.hbase.regionserver.MemStore;
|
import org.apache.hadoop.hbase.regionserver.MemStore;
|
||||||
|
import org.apache.hadoop.hbase.regionserver.MemStoreLAB;
|
||||||
|
import org.apache.hadoop.hbase.regionserver.TimeRangeTracker;
|
||||||
import org.apache.hadoop.hbase.util.ClassSize;
|
import org.apache.hadoop.hbase.util.ClassSize;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -225,7 +228,23 @@ public class TestHeapSize {
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TimeRangeTracker
|
||||||
|
cl = TimeRangeTracker.class;
|
||||||
|
expected = ClassSize.estimateBase(cl, false);
|
||||||
|
actual = ClassSize.TIMERANGE_TRACKER;
|
||||||
|
if (expected != actual) {
|
||||||
|
ClassSize.estimateBase(cl, true);
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
// KeyValueSkipListSet
|
||||||
|
cl = KeyValueSkipListSet.class;
|
||||||
|
expected = ClassSize.estimateBase(cl, false);
|
||||||
|
actual = ClassSize.KEYVALUE_SKIPLIST_SET;
|
||||||
|
if (expected != actual) {
|
||||||
|
ClassSize.estimateBase(cl, true);
|
||||||
|
assertEquals(expected, actual);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -288,17 +307,19 @@ public class TestHeapSize {
|
||||||
expected = ClassSize.estimateBase(cl, false);
|
expected = ClassSize.estimateBase(cl, false);
|
||||||
expected += ClassSize.estimateBase(ReentrantReadWriteLock.class, false);
|
expected += ClassSize.estimateBase(ReentrantReadWriteLock.class, false);
|
||||||
expected += ClassSize.estimateBase(AtomicLong.class, false);
|
expected += ClassSize.estimateBase(AtomicLong.class, false);
|
||||||
expected += ClassSize.estimateBase(ConcurrentSkipListMap.class, false);
|
expected += (2 * ClassSize.estimateBase(KeyValueSkipListSet.class, false));
|
||||||
expected += ClassSize.estimateBase(ConcurrentSkipListMap.class, false);
|
expected += (2 * ClassSize.estimateBase(ConcurrentSkipListMap.class, false));
|
||||||
expected += ClassSize.estimateBase(CopyOnWriteArraySet.class, false);
|
expected += (2 * ClassSize.estimateBase(TimeRangeTracker.class, false));
|
||||||
expected += ClassSize.estimateBase(CopyOnWriteArrayList.class, false);
|
|
||||||
if(expected != actual) {
|
if(expected != actual) {
|
||||||
ClassSize.estimateBase(cl, true);
|
ClassSize.estimateBase(cl, true);
|
||||||
ClassSize.estimateBase(ReentrantReadWriteLock.class, true);
|
ClassSize.estimateBase(ReentrantReadWriteLock.class, true);
|
||||||
ClassSize.estimateBase(AtomicLong.class, true);
|
ClassSize.estimateBase(AtomicLong.class, true);
|
||||||
|
ClassSize.estimateBase(KeyValueSkipListSet.class, true);
|
||||||
|
ClassSize.estimateBase(KeyValueSkipListSet.class, true);
|
||||||
ClassSize.estimateBase(ConcurrentSkipListMap.class, true);
|
ClassSize.estimateBase(ConcurrentSkipListMap.class, true);
|
||||||
ClassSize.estimateBase(CopyOnWriteArraySet.class, true);
|
ClassSize.estimateBase(ConcurrentSkipListMap.class, true);
|
||||||
ClassSize.estimateBase(CopyOnWriteArrayList.class, true);
|
ClassSize.estimateBase(TimeRangeTracker.class, true);
|
||||||
|
ClassSize.estimateBase(TimeRangeTracker.class, true);
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue