Package com.illumon.iris.db.v2.utils
Class RuntimeMemory
java.lang.Object
com.illumon.iris.db.v2.utils.RuntimeMemory
Cache memory utilization.
Calling Runtime.getRuntime().getFreeMemory() is expensive; and we may do it a lot when we have automatically computed tables, such as in a byExternal. Instead of calling the runtime directly from the performance instrumentation framework, we call this class's methods; which cache the result for a configurable number of milliseconds to avoid repeated calls that are not likely any different.
Additionally, we log our JVM heap usage on a regular basis; to enable users to quickly examine their worker logs and understand memory issues.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlong
SeeRuntime.freeMemory()
.static RuntimeMemory
Return a singleton RuntimeMemory object.long
SeeRuntime.maxMemory()
.long
-
Field Details
-
RUNTIME_MEMORY_LOG_INTERVAL_PROPERTY
- See Also:
-
RUNTIME_MEMORY_LOG_INTERVAL_DEFAULT
public static final int RUNTIME_MEMORY_LOG_INTERVAL_DEFAULT- See Also:
-
-
Method Details
-
getInstance
Return a singleton RuntimeMemory object.- Returns:
- the RuntimeMemory singleton
-
freeMemory
public long freeMemory()SeeRuntime.freeMemory()
. -
totalMemory
public long totalMemory() -
getMaxMemory
public long getMaxMemory()SeeRuntime.maxMemory()
.
-