public class TotalHeapUsageEmulatorPlugin extends Object implements ResourceUsageEmulatorPlugin
A ResourceUsageEmulatorPlugin that emulates the total heap
usage by loading the JVM heap memory. Adding smaller chunks of data to the
heap will essentially use up some heap space thus forcing the JVM to expand
its heap and thus resulting into increase in the heap usage.
TotalHeapUsageEmulatorPlugin emulates the heap usage in steps.
The frequency of emulation can be configured via
HEAP_EMULATION_PROGRESS_INTERVAL.
Heap usage values are matched via emulation only at specific interval
boundaries.
TotalHeapUsageEmulatorPlugin is a wrapper program for managing
the heap usage emulation feature. It internally uses an emulation algorithm
(called as core and described using TotalHeapUsageEmulatorPlugin.HeapUsageEmulatorCore) for
performing the actual emulation. Multiple calls to this core engine should
use up some amount of heap.| Modifier and Type | Class and Description |
|---|---|
static class |
TotalHeapUsageEmulatorPlugin.DefaultHeapUsageEmulator
This is the core engine to emulate the heap usage.
|
static interface |
TotalHeapUsageEmulatorPlugin.HeapUsageEmulatorCore
Defines the core heap usage emulation algorithm.
|
| Modifier and Type | Field and Description |
|---|---|
protected TotalHeapUsageEmulatorPlugin.HeapUsageEmulatorCore |
emulatorCore |
static String |
HEAP_EMULATION_PROGRESS_INTERVAL
The frequency (based on task progress) with which memory-emulation code is
run.
|
static String |
HEAP_LOAD_RATIO
Determines the unit increase per call to the core engine's load API.
|
static String |
MIN_HEAP_FREE_RATIO
The minimum buffer reserved for other non-emulation activities.
|
static int |
ONE_MB |
| Constructor and Description |
|---|
TotalHeapUsageEmulatorPlugin() |
TotalHeapUsageEmulatorPlugin(TotalHeapUsageEmulatorPlugin.HeapUsageEmulatorCore core)
For testing.
|
| Modifier and Type | Method and Description |
|---|---|
void |
emulate()
Emulate the resource usage to match the usage target.
|
protected long |
getMaxHeapUsageInMB() |
float |
getProgress() |
protected long |
getTotalHeapUsageInMB() |
void |
initialize(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.tools.rumen.ResourceUsageMetrics metrics,
org.apache.hadoop.yarn.util.ResourceCalculatorPlugin monitor,
Progressive progress)
Initialize the plugin.
|
protected TotalHeapUsageEmulatorPlugin.HeapUsageEmulatorCore emulatorCore
public static final String HEAP_EMULATION_PROGRESS_INTERVAL
DEFAULT_EMULATION_PROGRESS_INTERVAL.public static final String MIN_HEAP_FREE_RATIO
public static final String HEAP_LOAD_RATIO
public static final int ONE_MB
public TotalHeapUsageEmulatorPlugin()
public TotalHeapUsageEmulatorPlugin(TotalHeapUsageEmulatorPlugin.HeapUsageEmulatorCore core)
protected long getTotalHeapUsageInMB()
protected long getMaxHeapUsageInMB()
public float getProgress()
getProgress in interface Progressivepublic void emulate()
throws IOException,
InterruptedException
ResourceUsageEmulatorPluginResourceCalculatorPlugin to query for the current
resource usage.emulate in interface ResourceUsageEmulatorPluginIOExceptionInterruptedExceptionpublic void initialize(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.tools.rumen.ResourceUsageMetrics metrics,
org.apache.hadoop.yarn.util.ResourceCalculatorPlugin monitor,
Progressive progress)
ResourceUsageEmulatorPlugininitialize in interface ResourceUsageEmulatorPluginCopyright © 2008–2023 Apache Software Foundation. All rights reserved.