Package com.tangosol.io.journal
Class FlashJournalRM.DefaultDependencies
- java.lang.Object
-
- com.tangosol.io.journal.AbstractJournalRM.DefaultDependencies
-
- com.tangosol.io.journal.FlashJournalRM.DefaultDependencies
-
- All Implemented Interfaces:
AbstractJournalRM.Dependencies
,FlashJournalRM.Dependencies
- Enclosing class:
- FlashJournalRM
public static class FlashJournalRM.DefaultDependencies extends AbstractJournalRM.DefaultDependencies implements FlashJournalRM.Dependencies
The DefaultDependencies class provides a default implementation of Dependencies.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DFT_BACKLOG_SIZE
Default maximum backlog (16MB).static int
DFT_BLOCK_SIZE
Default block size (256KB).static double
DFT_COLLECT_PCT
Default collection factor (collect files that are 25% or less utilized, unless in aggressive mode (high file count)).static long
DFT_FILE_SIZE
Default size of a file (2GB).static long
DFT_JOURNAL_SIZE
Default Journal Size (1TB).static int
DFT_POOL_SIZE
Default pool size (16MB).static int
DFT_PURGE_DELAY_MILLIS
Default delay until a tmp file is eligible for purging. 2 hours is the default.static long
DFT_WRITER_TIMEOUT
Default Writer Timeout (~8hrs).static int
MAX_BACKLOG_SIZE
Maximum backlog size (1GB).static int
MAX_BLOCK_SIZE
Maximum block size (1MB).static long
MAX_FILE_SIZE
Maximum size of a file (4GB).static long
MAX_JOURNAL_SIZE
Maximum Journal Size (2TB).static int
MAX_POOL_SIZE
Maximum pool size (1GB).static int
MAX_VALUE_SIZE
Maximum value size (64MB).static int
MIN_BACKLOG_SIZE
Minimum backlog size (4KB).static int
MIN_BLOCK_SIZE
Minimum block size (4KB).static long
MIN_FILE_SIZE
Minimum maximum size of a file (1MB).static long
MIN_WRITER_TIMEOUT
Minimum Writer Timeout (5mins).-
Fields inherited from class com.tangosol.io.journal.AbstractJournalRM.DefaultDependencies
m_cbMaxFile, m_cbMaxSize, m_cbMaxValue, m_cCollectorTimeout, m_dflLoadFactorGC, MAX_COLLECT_PCT, MAX_FILE_COUNT, MIN_COLLECT_PCT, MIN_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description DefaultDependencies()
Construct a DefaultDependencies object.DefaultDependencies(FlashJournalRM.Dependencies deps)
Construct a DefaultDependencies object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
calculateMaxFileSize(long cbJrnlSize)
Calculate the maximum size of each file based on the given the journal size.int
getBufferSize()
Return the size of the write buffers.protected double
getDefaultCollectorLoadFactor()
Get the default percentage at which a file is eligible for garbage collection.protected long
getDefaultMaxFileSize()
Get the default maximum file size for this Journal Resource Manager.protected long
getDefaultMaxSize()
Get the default maximum size (capacity) for this Journal Resource Manager.protected int
getDefaultMaxValueSize()
Get the default maximum value size for this Journal Resource Manager.String
getDirectory()
Return the directory used to store the underlying disk files for the journal.int
getHighFileCount()
Return the file count at which compulsory garbage collection (compaction) should start.float
getHighJournalFactor()
The high journal percentage is a soft limit on the journal size.long
getHighJournalSize()
The high journal size is a soft limit on the journal size.int
getMaxBacklogSize()
Return the size in bytes of the maximum backlog.long
getMaxPoolSize()
Return the maximum size of the write buffers pool.protected long
getPermittedMaxFileSize()
Return the highest memory size that can be allocated per journal file.protected long
getPermittedMaxJournalSize()
Return the highest memory size that can be allocated per journal.protected int
getPermittedMaxValueSize()
Return the highest memory size permitted for each value stored in the journal.protected long
getPermittedMinFileSize()
Return the lowest memory size that can be allocated per journal file.protected long
getPermittedMinJournalSize()
Return the lowest memory size that can be allocated per journal.long
getPurgeDelayMillis()
Return the delay since the last touch of a tmp file until it is eligible for purging.long
getWriterTimeout()
Return the number of milliseconds the Writer daemon can be unresponsive prior to considering it timed out.FlashJournalRM.DefaultDependencies
setBufferSize(int cb)
Configure the size of the write buffers.FlashJournalRM.DefaultDependencies
setDirectory(String dirTemp)
Configure the directory to use for journal files.FlashJournalRM.DefaultDependencies
setHighFileCount(int cHighFiles)
Set the high file count at which compulsory garbage collection (compaction) occurs.FlashJournalRM.DefaultDependencies
setHighJournalFactor(float flHighJournalPct)
Set the high journal percentage.FlashJournalRM.DefaultDependencies
setHighJournalSize(long cbHighJournalSize)
Set the high journal size.FlashJournalRM.DefaultDependencies
setMaxBacklogSize(int cb)
Specify the size, in bytes, of the maximum backlog.FlashJournalRM.DefaultDependencies
setMaxPoolSize(long cb)
Configure the size of the write buffers pool.FlashJournalRM.DefaultDependencies
setPurgeDelayMillis(long cPurgeDelayMillis)
Sets the delay from the last touch of a tmp file until it is eligible for purging.FlashJournalRM.DefaultDependencies
setWriterTimeout(long cWriterTimeout)
Set the number of milliseconds the Writer daemon can remain unresponsive prior to being considered timed out.String
toString()
Return the DefaultDependencies in String format.FlashJournalRM.DefaultDependencies
validate()
Validate the supplied dependencies.protected void
validateJournalSize()
Validate the journal and file size.-
Methods inherited from class com.tangosol.io.journal.AbstractJournalRM.DefaultDependencies
getCollectorLoadFactor, getCollectorTimeout, getDefaultCollectorTimeout, getMaxFileSize, getMaxJournalSize, getMaxValueSize, setCollectorLoadFactor, setCollectorTimeout, setMaxFileSize, setMaxJournalSize, setMaxValueSize, validateCollectorTimeout, validateLoadFactor, validateMaxValueSize
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tangosol.io.journal.AbstractJournalRM.Dependencies
getCollectorLoadFactor, getCollectorTimeout, getMaxFileSize, getMaxJournalSize, getMaxValueSize
-
-
-
-
Field Detail
-
MAX_VALUE_SIZE
public static final int MAX_VALUE_SIZE
Maximum value size (64MB).- See Also:
- Constant Field Values
-
MIN_BACKLOG_SIZE
public static final int MIN_BACKLOG_SIZE
Minimum backlog size (4KB).- See Also:
- Constant Field Values
-
MAX_BACKLOG_SIZE
public static final int MAX_BACKLOG_SIZE
Maximum backlog size (1GB).- See Also:
- Constant Field Values
-
DFT_BACKLOG_SIZE
public static final int DFT_BACKLOG_SIZE
Default maximum backlog (16MB).- See Also:
- Constant Field Values
-
MIN_FILE_SIZE
public static final long MIN_FILE_SIZE
Minimum maximum size of a file (1MB).- See Also:
- Constant Field Values
-
MAX_FILE_SIZE
public static final long MAX_FILE_SIZE
Maximum size of a file (4GB).- See Also:
- Constant Field Values
-
DFT_FILE_SIZE
public static final long DFT_FILE_SIZE
Default size of a file (2GB).- See Also:
- Constant Field Values
-
MIN_BLOCK_SIZE
public static final int MIN_BLOCK_SIZE
Minimum block size (4KB).- See Also:
- Constant Field Values
-
MAX_BLOCK_SIZE
public static final int MAX_BLOCK_SIZE
Maximum block size (1MB).- See Also:
- Constant Field Values
-
DFT_BLOCK_SIZE
public static final int DFT_BLOCK_SIZE
Default block size (256KB).- See Also:
- Constant Field Values
-
MAX_POOL_SIZE
public static final int MAX_POOL_SIZE
Maximum pool size (1GB).- See Also:
- Constant Field Values
-
DFT_POOL_SIZE
public static final int DFT_POOL_SIZE
Default pool size (16MB).- See Also:
- Constant Field Values
-
DFT_COLLECT_PCT
public static final double DFT_COLLECT_PCT
Default collection factor (collect files that are 25% or less utilized, unless in aggressive mode (high file count)).- See Also:
- Constant Field Values
-
DFT_PURGE_DELAY_MILLIS
public static final int DFT_PURGE_DELAY_MILLIS
Default delay until a tmp file is eligible for purging. 2 hours is the default.- See Also:
- Constant Field Values
-
MAX_JOURNAL_SIZE
public static final long MAX_JOURNAL_SIZE
Maximum Journal Size (2TB).- See Also:
- Constant Field Values
-
DFT_JOURNAL_SIZE
public static final long DFT_JOURNAL_SIZE
Default Journal Size (1TB).- See Also:
- Constant Field Values
-
MIN_WRITER_TIMEOUT
public static final long MIN_WRITER_TIMEOUT
Minimum Writer Timeout (5mins).- See Also:
- Constant Field Values
-
DFT_WRITER_TIMEOUT
public static final long DFT_WRITER_TIMEOUT
Default Writer Timeout (~8hrs).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultDependencies
public DefaultDependencies()
Construct a DefaultDependencies object.
-
DefaultDependencies
public DefaultDependencies(FlashJournalRM.Dependencies deps)
Construct a DefaultDependencies object. Copy the values from the specified Dependencies object.- Parameters:
deps
- the dependencies to copy, or null
-
-
Method Detail
-
getMaxPoolSize
public long getMaxPoolSize()
Return the maximum size of the write buffers pool.- Specified by:
getMaxPoolSize
in interfaceFlashJournalRM.Dependencies
- Returns:
- maximum size of write buffers pool
-
setMaxPoolSize
public FlashJournalRM.DefaultDependencies setMaxPoolSize(long cb)
Configure the size of the write buffers pool. The default is defined byDFT_POOL_SIZE
, with a maximum defined byMAX_POOL_SIZE
and a minimum enforced as the size of a single buffer.Note: This value can only be set before the ResourceManager is started.
- Parameters:
cb
- the size, in bytes, for the buffer pool- Returns:
- this object
-
getBufferSize
public int getBufferSize()
Return the size of the write buffers.- Specified by:
getBufferSize
in interfaceFlashJournalRM.Dependencies
- Returns:
- size of write buffers
-
setBufferSize
public FlashJournalRM.DefaultDependencies setBufferSize(int cb)
Configure the size of the write buffers. This is the size that writes to an underlying disk file will occur in, and the size should match or be a multiple of the physical device's optimal block size. The value must be a power of two. The default is 256KB, as specified byDFT_BLOCK_SIZE
, with a minimum defined byMIN_BLOCK_SIZE
and a maximum defined byMAX_BLOCK_SIZE
.Note: This value can only be set before the ResourceManager is started.
- Parameters:
cb
- the size, in bytes, for the buffers to write to the underlying journal files- Returns:
- this object
-
getMaxBacklogSize
public int getMaxBacklogSize()
Return the size in bytes of the maximum backlog.- Specified by:
getMaxBacklogSize
in interfaceFlashJournalRM.Dependencies
- Returns:
- the size in bytes of the maximum backlog
-
setMaxBacklogSize
public FlashJournalRM.DefaultDependencies setMaxBacklogSize(int cb)
Specify the size, in bytes, of the maximum backlog. The backlog defaults to 16MB as defined byDFT_BACKLOG_SIZE
, with a minimum defined byMIN_BACKLOG_SIZE
and a maximum defined byMAX_BACKLOG_SIZE
. The backlog is the amount of data that has been "dropped off" for the journal to write to disk, but which has not yet been written to disk; when the amount of backlog exceeds the maximum configured backlog, client threads attempting to "drop off" data are blocked until the backlog recedes below the maximum, thus helping to prevent out-of-memory conditions. Note that the maximum amount of memory used by the backlog is at least twice the configured amount, since the data dropped off is held in it Binary form and rendered to the write-behind buffers.Note: This value can be modified while the ResourceManager is running.
- Parameters:
cb
- the maximum allowable size of the backlog- Returns:
- this object
-
getDirectory
public String getDirectory()
Return the directory used to store the underlying disk files for the journal.- Specified by:
getDirectory
in interfaceFlashJournalRM.Dependencies
- Returns:
- the directory that is used to hold the journal files, or null if the default temporary directory is used
-
setDirectory
public FlashJournalRM.DefaultDependencies setDirectory(String dirTemp)
Configure the directory to use for journal files. This property is provided so that servers with multiple physical storage devices and/or file systems can select an ideal storage location for a journal; the ideal device is a flash (solid state disk, aka SSD) device, since the journal is designed as a block-writing, append-only implementation.Note: This value can only be set before the ResourceManager is started.
- Parameters:
dirTemp
- the directory to use for journal files- Returns:
- this object
-
getPurgeDelayMillis
public long getPurgeDelayMillis()
Return the delay since the last touch of a tmp file until it is eligible for purging. Tmp files are purged at startup of the FlashJournalRM to clean up tmp files from a previous instance of the FlashJournalRM.- Specified by:
getPurgeDelayMillis
in interfaceFlashJournalRM.Dependencies
- Returns:
- the delay in milliseconds
-
setPurgeDelayMillis
public FlashJournalRM.DefaultDependencies setPurgeDelayMillis(long cPurgeDelayMillis)
Sets the delay from the last touch of a tmp file until it is eligible for purging.- Parameters:
cPurgeDelayMillis
- the delay in milliseconds- Returns:
- this object
-
getHighFileCount
public int getHighFileCount()
Return the file count at which compulsory garbage collection (compaction) should start. During compulsory GC, the file with the least live data is considered for compaction irrespective of the CollectorLoadFactor.This allows the GC thread to tune itself to try to avoid growing the journal beyond the high file count. However, this is not a hard-limit and the journal could still grow beyond that up to the max file count.
- Specified by:
getHighFileCount
in interfaceFlashJournalRM.Dependencies
- Returns:
- the high file count
-
setHighFileCount
public FlashJournalRM.DefaultDependencies setHighFileCount(int cHighFiles)
Set the high file count at which compulsory garbage collection (compaction) occurs.- Parameters:
cHighFiles
- the high file count- Returns:
- this object
-
getHighJournalSize
public long getHighJournalSize()
The high journal size is a soft limit on the journal size. This allows the GC thread to tune itself to try to avoid growing the journal beyond the high journal size. This is not a hard-limit and the journal could still grow beyond that up to the max file count (511).- Specified by:
getHighJournalSize
in interfaceFlashJournalRM.Dependencies
- Returns:
- the high journal size
-
setHighJournalSize
public FlashJournalRM.DefaultDependencies setHighJournalSize(long cbHighJournalSize)
Set the high journal size. High file count is adjusted based on the high journal size.- Parameters:
cbHighJournalSize
- the high journal size- Returns:
- this object
-
getHighJournalFactor
public float getHighJournalFactor()
The high journal percentage is a soft limit on the journal size. This allows the GC thread to tune itself to try to avoid growing the journal beyond this percentage of the journal size. This is not a hard-limit and the journal could still grow beyond this percentage up to the max file count (511).- Specified by:
getHighJournalFactor
in interfaceFlashJournalRM.Dependencies
- Returns:
- the high journal percentage
-
setHighJournalFactor
public FlashJournalRM.DefaultDependencies setHighJournalFactor(float flHighJournalPct)
Set the high journal percentage. High file count is adjusted based on this high journal percentage; either this percentage or high journal size should be specified but not both.- Parameters:
flHighJournalPct
- the high journal percentage- Returns:
- this object
-
getWriterTimeout
public long getWriterTimeout()
Return the number of milliseconds the Writer daemon can be unresponsive prior to considering it timed out.- Specified by:
getWriterTimeout
in interfaceFlashJournalRM.Dependencies
- Returns:
- the number of milliseconds the Writer can be unresponsive
-
setWriterTimeout
public FlashJournalRM.DefaultDependencies setWriterTimeout(long cWriterTimeout)
Set the number of milliseconds the Writer daemon can remain unresponsive prior to being considered timed out.- Parameters:
cWriterTimeout
- number of millis the Writer daemon can remain unresponsive- Returns:
- this object
-
validate
public FlashJournalRM.DefaultDependencies validate()
Validate the supplied dependencies.- Overrides:
validate
in classAbstractJournalRM.DefaultDependencies
- Returns:
- this object
- Throws:
IllegalArgumentException
- if the dependencies are not valid
-
getDefaultMaxFileSize
protected long getDefaultMaxFileSize()
Get the default maximum file size for this Journal Resource Manager.- Specified by:
getDefaultMaxFileSize
in classAbstractJournalRM.DefaultDependencies
- Returns:
- the default maximum file size
-
getDefaultMaxValueSize
protected int getDefaultMaxValueSize()
Get the default maximum value size for this Journal Resource Manager.- Specified by:
getDefaultMaxValueSize
in classAbstractJournalRM.DefaultDependencies
- Returns:
- the default maximum value size
-
getDefaultMaxSize
protected long getDefaultMaxSize()
Get the default maximum size (capacity) for this Journal Resource Manager.- Specified by:
getDefaultMaxSize
in classAbstractJournalRM.DefaultDependencies
- Returns:
- the default maximum size
-
getDefaultCollectorLoadFactor
protected double getDefaultCollectorLoadFactor()
Get the default percentage at which a file is eligible for garbage collection.- Specified by:
getDefaultCollectorLoadFactor
in classAbstractJournalRM.DefaultDependencies
- Returns:
- the default garbage collection load factor
-
getPermittedMinJournalSize
protected long getPermittedMinJournalSize()
Return the lowest memory size that can be allocated per journal.- Specified by:
getPermittedMinJournalSize
in classAbstractJournalRM.DefaultDependencies
- Returns:
- the lowest memory size that can be allocated per journal
-
getPermittedMaxJournalSize
protected long getPermittedMaxJournalSize()
Return the highest memory size that can be allocated per journal.- Specified by:
getPermittedMaxJournalSize
in classAbstractJournalRM.DefaultDependencies
- Returns:
- the highest memory size that can be allocated per journal
-
getPermittedMinFileSize
protected long getPermittedMinFileSize()
Return the lowest memory size that can be allocated per journal file.- Specified by:
getPermittedMinFileSize
in classAbstractJournalRM.DefaultDependencies
- Returns:
- the lowest memory size that can be allocated per journal file
-
getPermittedMaxFileSize
protected long getPermittedMaxFileSize()
Return the highest memory size that can be allocated per journal file.- Specified by:
getPermittedMaxFileSize
in classAbstractJournalRM.DefaultDependencies
- Returns:
- the highest memory size that can be allocated per journal file
-
getPermittedMaxValueSize
protected int getPermittedMaxValueSize()
Return the highest memory size permitted for each value stored in the journal.- Specified by:
getPermittedMaxValueSize
in classAbstractJournalRM.DefaultDependencies
- Returns:
- the highest memory size permitted for each value stored in the journal
-
toString
public String toString()
Return the DefaultDependencies in String format.- Overrides:
toString
in classAbstractJournalRM.DefaultDependencies
- Returns:
- this object in String format
-
validateJournalSize
protected void validateJournalSize()
Validate the journal and file size.- Overrides:
validateJournalSize
in classAbstractJournalRM.DefaultDependencies
-
calculateMaxFileSize
protected long calculateMaxFileSize(long cbJrnlSize)
Calculate the maximum size of each file based on the given the journal size.- Overrides:
calculateMaxFileSize
in classAbstractJournalRM.DefaultDependencies
- Parameters:
cbJrnlSize
- the size, in bytes, of the journal- Returns:
- the maximum size permitted for each file
-
-