Java Code Examples for java.lang.management.MemoryType#NON_HEAP

The following examples show how to use java.lang.management.MemoryType#NON_HEAP . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryLogger.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the memory pool statistics from the JVM.
 *
 * @param poolBeans The collection of memory pool beans.
 * @return A string denoting the names and sizes of the memory pools.
 */
public static String getMemoryPoolStatsAsString(List<MemoryPoolMXBean> poolBeans) {
	StringBuilder bld = new StringBuilder("Off-heap pool stats: ");
	int count = 0;
	
	for (MemoryPoolMXBean bean : poolBeans) {
		if (bean.getType() == MemoryType.NON_HEAP) {
			if (count > 0) {
				bld.append(", ");
			}
			count++;

			MemoryUsage usage = bean.getUsage();
			long used = usage.getUsed() >> 20;
			long committed = usage.getCommitted() >> 20;
			long max = usage.getMax() >> 20;
			
			bld.append('[').append(bean.getName()).append(": ");
			bld.append(used).append('/').append(committed).append('/').append(max);
			bld.append(" MB (used/committed/max)]");
		}
	}

	return bld.toString();
}
 
Example 2
Source File: RegionProcedureStorePerformanceEvaluation.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Override
protected RegionProcedureStore createProcedureStore(Path storeDir) throws IOException {
  Pair<Long, MemoryType> pair = MemorySizeUtil.getGlobalMemStoreSize(conf);
  long globalMemStoreSize = pair.getFirst();
  boolean offheap = pair.getSecond() == MemoryType.NON_HEAP;
  float poolSizePercentage = offheap ? 1.0F :
    conf.getFloat(MemStoreLAB.CHUNK_POOL_MAXSIZE_KEY, MemStoreLAB.POOL_MAX_SIZE_DEFAULT);
  float initialCountPercentage =
    conf.getFloat(MemStoreLAB.CHUNK_POOL_INITIALSIZE_KEY, MemStoreLAB.POOL_INITIAL_SIZE_DEFAULT);
  int chunkSize = conf.getInt(MemStoreLAB.CHUNK_SIZE_KEY, MemStoreLAB.CHUNK_SIZE_DEFAULT);
  ChunkCreator.initialize(chunkSize, offheap, globalMemStoreSize, poolSizePercentage,
    initialCountPercentage, null);
  conf.setBoolean(MasterRegionFactory.USE_HSYNC_KEY, "hsync".equals(syncType));
  CommonFSUtils.setRootDir(conf, storeDir);
  MockServer server = new MockServer(conf);
  region = MasterRegionFactory.create(server);
  return new RegionProcedureStore(server, region, (fs, apth) -> {
  });
}
 
Example 3
Source File: MemorySizeUtil.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * @return Pair of global memstore size and memory type(ie. on heap or off heap).
 */
public static Pair<Long, MemoryType> getGlobalMemStoreSize(Configuration conf) {
  long offheapMSGlobal = conf.getLong(OFFHEAP_MEMSTORE_SIZE_KEY, 0);// Size in MBs
  if (offheapMSGlobal > 0) {
    // Off heap memstore size has not relevance when MSLAB is turned OFF. We will go with making
    // this entire size split into Chunks and pooling them in MemstoreLABPoool. We dont want to
    // create so many on demand off heap chunks. In fact when this off heap size is configured, we
    // will go with 100% of this size as the pool size
    if (MemStoreLAB.isEnabled(conf)) {
      // We are in offheap Memstore use
      long globalMemStoreLimit = (long) (offheapMSGlobal * 1024 * 1024); // Size in bytes
      return new Pair<>(globalMemStoreLimit, MemoryType.NON_HEAP);
    } else {
      // Off heap max memstore size is configured with turning off MSLAB. It makes no sense. Do a
      // warn log and go with on heap memstore percentage. By default it will be 40% of Xmx
      LOG.warn("There is no relevance of configuring '" + OFFHEAP_MEMSTORE_SIZE_KEY + "' when '"
          + MemStoreLAB.USEMSLAB_KEY + "' is turned off."
          + " Going with on heap global memstore size ('" + MEMSTORE_SIZE_KEY + "')");
    }
  }
  return new Pair<>(getOnheapGlobalMemStoreSize(conf), MemoryType.HEAP);
}
 
Example 4
Source File: MemoryLogger.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the memory pool statistics from the JVM.
 *
 * @param poolBeans The collection of memory pool beans.
 * @return A string denoting the names and sizes of the memory pools.
 */
public static String getMemoryPoolStatsAsString(List<MemoryPoolMXBean> poolBeans) {
	StringBuilder bld = new StringBuilder("Off-heap pool stats: ");
	int count = 0;
	
	for (MemoryPoolMXBean bean : poolBeans) {
		if (bean.getType() == MemoryType.NON_HEAP) {
			if (count > 0) {
				bld.append(", ");
			}
			count++;

			MemoryUsage usage = bean.getUsage();
			long used = usage.getUsed() >> 20;
			long committed = usage.getCommitted() >> 20;
			long max = usage.getMax() >> 20;
			
			bld.append('[').append(bean.getName()).append(": ");
			bld.append(used).append('/').append(committed).append('/').append(max);
			bld.append(" MB (used/committed/max)]");
		}
	}

	return bld.toString();
}
 
Example 5
Source File: MemoryLogger.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the memory pool statistics from the JVM.
 *
 * @param poolBeans The collection of memory pool beans.
 * @return A string denoting the names and sizes of the memory pools.
 */
public static String getMemoryPoolStatsAsString(List<MemoryPoolMXBean> poolBeans) {
	StringBuilder bld = new StringBuilder("Off-heap pool stats: ");
	int count = 0;
	
	for (MemoryPoolMXBean bean : poolBeans) {
		if (bean.getType() == MemoryType.NON_HEAP) {
			if (count > 0) {
				bld.append(", ");
			}
			count++;

			MemoryUsage usage = bean.getUsage();
			long used = usage.getUsed() >> 20;
			long committed = usage.getCommitted() >> 20;
			long max = usage.getMax() >> 20;
			
			bld.append('[').append(bean.getName()).append(": ");
			bld.append(used).append('/').append(committed).append('/').append(max);
			bld.append(" MB (used/committed/max)]");
		}
	}

	return bld.toString();
}
 
Example 6
Source File: MemoryPoolImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 7
Source File: MemoryPoolImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 8
Source File: MemoryPoolImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 9
Source File: MemoryPoolImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 10
Source File: MemoryPoolImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 11
Source File: MemoryPoolImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 12
Source File: MemoryPoolImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 13
Source File: MemoryPoolImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 14
Source File: MemoryPoolImpl.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 15
Source File: MemoryPoolImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 16
Source File: MemoryPoolImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 17
Source File: MemoryPoolImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 18
Source File: MemoryPoolImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public MemoryType getType() {
    if (isHeap) {
        return MemoryType.HEAP;
    } else {
        return MemoryType.NON_HEAP;
    }
}
 
Example 19
Source File: RegionServerAccounting.java    From hbase with Apache License 2.0 4 votes vote down vote up
boolean isOffheap() {
  return this.memType == MemoryType.NON_HEAP;
}