|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<BufferMode>
com.bigdata.journal.BufferMode
public enum BufferMode
The buffer mode in which the journal is opened.
The Direct and Mapped options may not be used for files
exceeding Integer.MAX_VALUE bytes in length since a
ByteBuffer is indexed with an int (the pragmatic limit
is typically much lower and depends on the size of the JVM heap for the
Direct mode).
| Enum Constant Summary | |
|---|---|
BufferedDisk
Deprecated. This has not been implemented yet. It may not be necessary with the use of global buffers for B+Tree nodes and leaves. |
|
Direct
A direct buffer is allocated for the file image. |
|
Disk
The journal is managed on disk. |
|
Mapped
A memory-mapped buffer is allocated for the file image. |
|
Temporary
A variant on the Disk mode that is not restart-safe. |
|
Transient
A variant on the Direct mode that is not restart-safe. |
|
| Method Summary | |
|---|---|
boolean |
isFullyBuffered()
true iff this BufferMode is fully buffered
in memory - this implies that there is an absolute upper bound
of Integer.MAX_VALUE bytes in the store since that is
the limit on a byte[] in Java. |
boolean |
isStable()
true iff this BufferMode uses a stable media
(disk). |
static BufferMode |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static BufferMode[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final BufferMode Transient
A variant on the Direct mode that is not restart-safe. This mode
is useful for temporary stores which can reside entirely in memory and do
not require disk. It can be used in environments, such as an applet,
where you can not access the disk (however, you can also use a transient
BTree with much the same effect). The Temporary mode
is much more scalable.
TransientBufferStrategypublic static final BufferMode Direct
A direct buffer is allocated for the file image. Writes are applied to the buffer. The buffer tracks dirty slots regardless of the transaction that wrote them and periodically writes dirty slots through to disk. On commit, any dirty index or allocation nodes are written onto the buffer and all dirty slots on the buffer. Dirty slots in the buffer are then synchronously written to disk, the appropriate root block is updated, and the file is (optionally) flushed to disk.
This option offers wires an image of the journal file into memory and allows the journal to optimize IO operations.
DirectBufferStrategypublic static final BufferMode Mapped
A memory-mapped buffer is allocated for the file image. Writes are applied to the buffer. Reads read from the buffer. On commit, the map is forced disk disk.
This option yields control over IO and memory resources to the OS. However, there is currently no way to force release of the mapped memory per the bug described below. This means (a) you might not be able to delete the mapped file; and (b) that native memory can be exhausted. While performance is good on at least some benchmarks, it is difficult to recommend this solution given its downsides.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038,
MappedBufferStrategypublic static final BufferMode Disk
The journal is managed on disk. This option may be used with files of
more than Integer.MAX_VALUE bytes in extent. Journal performance
for large files should be fair on write, but performance will degrade as
the journal is NOT optimized for random reads (poor locality).
DiskOnlyStrategypublic static final BufferMode Temporary
A variant on the Disk mode that is not restart-safe. This mode
is useful for all manners of temporary data with full concurrency control
and scales-up to very large temporary files. The backing file (if any) is
always destroyed when the store is closed. This is much more scalable
than the Transient mode.
DiskOnlyStrategypublic static final BufferMode BufferedDisk
The journal is managed on disk, but with a direct ByteBuffer
equal in size to the Options.INITIAL_EXTENT. This option is
designed for use with periodic overflow of the live journal for a
DataService. You pay a modest premium for the fully buffered
journal (~200M of RAM per journal, and the data service maintains both
the live journal and the historical journal). However, this mode offers
higher read concurrency than Disk and faster asynchronous
overflow processing (since it is not reading through to the disk).
Note: The implementation in fact limits the capacity of the buffer to a maximum extent. Beyond that, this solution degrades into a partly buffered approach.
BufferedDiskStrategy| Method Detail |
|---|
public static BufferMode[] values()
for (BufferMode c : BufferMode.values()) System.out.println(c);
public static BufferMode valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified name
NullPointerException - if the argument is nullpublic boolean isStable()
true iff this BufferMode uses a stable media
(disk).
public boolean isFullyBuffered()
true iff this BufferMode is fully buffered
in memory - this implies that there is an absolute upper bound
of Integer.MAX_VALUE bytes in the store since that is
the limit on a byte[] in Java.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||