MetricRegistryImpl metricRegistry = null; int numberProcessors = Hardware.getNumberCPUCores();
return getSizeOfPhysicalMemoryForLinux(); return getSizeOfPhysicalMemoryForWindows(); return getSizeOfPhysicalMemoryForMac(); return getSizeOfPhysicalMemoryForFreeBSD();
public static HardwareDescription extractFromSystem(long managedMemory) { final int numberOfCPUCores = Hardware.getNumberCPUCores(); final long sizeOfJvmHeap = Runtime.getRuntime().maxMemory(); final long sizeOfPhysicalMemory = Hardware.getSizeOfPhysicalMemory(); return new HardwareDescription(numberOfCPUCores, sizeOfPhysicalMemory, sizeOfJvmHeap, managedMemory); } }
/** * The maximum JVM heap size, in bytes. * * <p>This method uses the <i>-Xmx</i> value of the JVM, if set. If not set, it returns (as * a heuristic) 1/4th of the physical memory size. * * @return The maximum JVM heap size, in bytes. */ public static long getMaxJvmHeapMemory() { final long maxMemory = Runtime.getRuntime().maxMemory(); if (maxMemory != Long.MAX_VALUE) { // we have the proper max memory return maxMemory; } else { // max JVM heap size is not set - use the heuristic to use 1/4th of the physical memory final long physicalMemory = Hardware.getSizeOfPhysicalMemory(); if (physicalMemory != -1) { // got proper value for physical memory return physicalMemory / 4; } else { throw new RuntimeException("Could not determine the amount of free memory.\n" + "Please set the maximum memory for the JVM, e.g. -Xmx512M for 512 megabytes."); } } }
return getSizeOfPhysicalMemoryForLinux(); return getSizeOfPhysicalMemoryForWindows(); return getSizeOfPhysicalMemoryForMac(); return getSizeOfPhysicalMemoryForFreeBSD();
public static HardwareDescription extractFromSystem(long managedMemory) { final int numberOfCPUCores = Hardware.getNumberCPUCores(); final long sizeOfJvmHeap = Runtime.getRuntime().maxMemory(); final long sizeOfPhysicalMemory = Hardware.getSizeOfPhysicalMemory(); return new HardwareDescription(numberOfCPUCores, sizeOfPhysicalMemory, sizeOfJvmHeap, managedMemory); } }
/** * The maximum JVM heap size, in bytes. * * <p>This method uses the <i>-Xmx</i> value of the JVM, if set. If not set, it returns (as * a heuristic) 1/4th of the physical memory size. * * @return The maximum JVM heap size, in bytes. */ public static long getMaxJvmHeapMemory() { final long maxMemory = Runtime.getRuntime().maxMemory(); if (maxMemory != Long.MAX_VALUE) { // we have the proper max memory return maxMemory; } else { // max JVM heap size is not set - use the heuristic to use 1/4th of the physical memory final long physicalMemory = Hardware.getSizeOfPhysicalMemory(); if (physicalMemory != -1) { // got proper value for physical memory return physicalMemory / 4; } else { throw new RuntimeException("Could not determine the amount of free memory.\n" + "Please set the maximum memory for the JVM, e.g. -Xmx512M for 512 megabytes."); } } }
return getSizeOfPhysicalMemoryForLinux(); return getSizeOfPhysicalMemoryForWindows(); return getSizeOfPhysicalMemoryForMac(); return getSizeOfPhysicalMemoryForFreeBSD();
public static HardwareDescription extractFromSystem(long managedMemory) { final int numberOfCPUCores = Hardware.getNumberCPUCores(); final long sizeOfJvmHeap = Runtime.getRuntime().maxMemory(); final long sizeOfPhysicalMemory = Hardware.getSizeOfPhysicalMemory(); return new HardwareDescription(numberOfCPUCores, sizeOfPhysicalMemory, sizeOfJvmHeap, managedMemory); } }
MetricRegistryImpl metricRegistry = null; int numberProcessors = Hardware.getNumberCPUCores();
/** * The maximum JVM heap size, in bytes. * * <p>This method uses the <i>-Xmx</i> value of the JVM, if set. If not set, it returns (as * a heuristic) 1/4th of the physical memory size. * * @return The maximum JVM heap size, in bytes. */ public static long getMaxJvmHeapMemory() { final long maxMemory = Runtime.getRuntime().maxMemory(); if (maxMemory != Long.MAX_VALUE) { // we have the proper max memory return maxMemory; } else { // max JVM heap size is not set - use the heuristic to use 1/4th of the physical memory final long physicalMemory = Hardware.getSizeOfPhysicalMemory(); if (physicalMemory != -1) { // got proper value for physical memory return physicalMemory / 4; } else { throw new RuntimeException("Could not determine the amount of free memory.\n" + "Please set the maximum memory for the JVM, e.g. -Xmx512M for 512 megabytes."); } } }
return getSizeOfPhysicalMemoryForLinux(); return getSizeOfPhysicalMemoryForWindows(); return getSizeOfPhysicalMemoryForMac(); return getSizeOfPhysicalMemoryForFreeBSD();
public static HardwareDescription extractFromSystem(long managedMemory) { final int numberOfCPUCores = Hardware.getNumberCPUCores(); final long sizeOfJvmHeap = Runtime.getRuntime().maxMemory(); final long sizeOfPhysicalMemory = Hardware.getSizeOfPhysicalMemory(); return new HardwareDescription(numberOfCPUCores, sizeOfPhysicalMemory, sizeOfJvmHeap, managedMemory); } }
MetricRegistryImpl metricRegistry = null; int numberProcessors = Hardware.getNumberCPUCores();
/** * The maximum JVM heap size, in bytes. * * <p>This method uses the <i>-Xmx</i> value of the JVM, if set. If not set, it returns (as * a heuristic) 1/4th of the physical memory size. * * @return The maximum JVM heap size, in bytes. */ public static long getMaxJvmHeapMemory() { final long maxMemory = Runtime.getRuntime().maxMemory(); if (maxMemory != Long.MAX_VALUE) { // we have the proper max memory return maxMemory; } else { // max JVM heap size is not set - use the heuristic to use 1/4th of the physical memory final long physicalMemory = Hardware.getSizeOfPhysicalMemory(); if (physicalMemory != -1) { // got proper value for physical memory return physicalMemory / 4; } else { throw new RuntimeException("Could not determine the amount of free memory.\n" + "Please set the maximum memory for the JVM, e.g. -Xmx512M for 512 megabytes."); } } }
Hardware.getNumberCPUCores(), new ExecutorThreadFactory("taskmanager-future"));
public static JobManagerServices fromConfiguration( Configuration config, HighAvailabilityServices haServices) throws Exception { final BlobServer blobServer = new BlobServer(config, haServices.createBlobStore()); final long cleanupInterval = config.getLong( ConfigConstants.LIBRARY_CACHE_MANAGER_CLEANUP_INTERVAL, ConfigConstants.DEFAULT_LIBRARY_CACHE_MANAGER_CLEANUP_INTERVAL) * 1000; final BlobLibraryCacheManager libraryCacheManager = new BlobLibraryCacheManager(blobServer, cleanupInterval); final FiniteDuration timeout; try { timeout = AkkaUtils.getTimeout(config); } catch (NumberFormatException e) { throw new IllegalConfigurationException(AkkaUtils.formatDurationParingErrorMessage()); } final ScheduledExecutorService futureExecutor = Executors.newScheduledThreadPool( Hardware.getNumberCPUCores(), new ExecutorThreadFactory("jobmanager-future")); return new JobManagerServices( futureExecutor, libraryCacheManager, RestartStrategyFactory.createRestartStrategyFactory(config), Time.of(timeout.length(), timeout.unit())); } }
Hardware.getNumberCPUCores(), new ExecutorThreadFactory("taskmanager-future"));
Hardware.getNumberCPUCores(), new ExecutorThreadFactory("taskmanager-future"));
Hardware.getNumberCPUCores(), new ExecutorThreadFactory("jobmanager-future"));