comparison src/org/dancres/blitz/config/Persistent.java @ 32:a77f0a9ed93c 2.1.1

Add support for optimistic log batching.
author Dan Creswell <dan.creswell@gmail.com>
date Sat, 12 Jun 2010 10:42:31 +0100
parents cd96fcac1487
children
comparison
equal deleted inserted replaced
31:243c74d599bf 32:a77f0a9ed93c
6 6
7 @todo Add MAX_LOGS_BEFORE_SYNC disable 7 @todo Add MAX_LOGS_BEFORE_SYNC disable
8 */ 8 */
9 public class Persistent extends PersistentBase { 9 public class Persistent extends PersistentBase {
10 10
11 private boolean useConcurrentBatcher; 11 private boolean dontUseExpLog;
12 private long theBatchWriteWindowSizeMs; 12 private long theBatchWriteWindowSizeMs;
13 private int theBatchWriteWindowSizeNs; 13 private int theBatchWriteWindowSizeNs;
14 14
15 /** 15 /**
16 @param shouldReset specifies whether to reset the ObjectOutputStream 16 @param shouldReset specifies whether to reset the ObjectOutputStream
26 under concurrent load. Time is specified in ms, first thread into 26 under concurrent load. Time is specified in ms, first thread into
27 barrier waits this amount of time for other writers. Other writers 27 barrier waits this amount of time for other writers. Other writers
28 entering the barrier are now blocked until the first entrant commits all 28 entering the barrier are now blocked until the first entrant commits all
29 writes to log. 29 writes to log.
30 30
31 @param useConcurrent should increase log throughput by allowing the 31 @param noUseExpLog avoid using optimistic logger which should increase log throughput
32 next batch to form whilst the current batch is being written to log. 32 by allowing an optimistic flushing strategy but may still contain bugs
33 33
34 @param aMaxLogsBeforeSync is the maximum number of log entries before 34 @param aMaxLogsBeforeSync is the maximum number of log entries before
35 a checkpoint is forced. 35 a checkpoint is forced.
36 36
37 @param aLogBufferSize especially useful when doing batching. 37 @param aLogBufferSize especially useful when doing batching.
38 All commands are rendered to the buffer before going to disk in one 38 All commands are rendered to the buffer before going to disk in one
39 large block. Without the buffer, each command will trickle to disk as a 39 large block. Without the buffer, each command will trickle to disk as a
40 small update which isn't good for throughput! 40 small update which isn't good for throughput!
41 */ 41 */
42 public Persistent(boolean shouldReset, boolean shouldClean, 42 public Persistent(boolean shouldReset, boolean shouldClean,
43 int aBatchWriteWindowSize, boolean useConcurrent, 43 int aBatchWriteWindowSize, boolean noUseExpLog,
44 int aMaxLogsBeforeSync, int aLogBufferSize) { 44 int aMaxLogsBeforeSync, int aLogBufferSize) {
45 45
46 super(shouldReset, shouldClean, aLogBufferSize, aMaxLogsBeforeSync); 46 super(shouldReset, shouldClean, aLogBufferSize, aMaxLogsBeforeSync);
47 useConcurrentBatcher = useConcurrent; 47 dontUseExpLog = noUseExpLog;
48 theBatchWriteWindowSizeMs = aBatchWriteWindowSize; 48 theBatchWriteWindowSizeMs = aBatchWriteWindowSize;
49 } 49 }
50 50
51 public boolean useConcurrentWriteBatcher() { 51 public boolean dontUseExperimentalBatcher() {
52 return useConcurrentBatcher; 52 return dontUseExpLog;
53 } 53 }
54 54
55 public long getBatchWriteWindowSizeMs() { 55 public long getBatchWriteWindowSizeMs() {
56 return theBatchWriteWindowSizeMs; 56 return theBatchWriteWindowSizeMs;
57 } 57 }
59 public int getBatchWriteWindowSizeNs() { 59 public int getBatchWriteWindowSizeNs() {
60 return theBatchWriteWindowSizeNs; 60 return theBatchWriteWindowSizeNs;
61 } 61 }
62 62
63 public Persistent(boolean shouldReset, boolean shouldClean, 63 public Persistent(boolean shouldReset, boolean shouldClean,
64 long aBatchWindowSizeMs, int aBatchWindowSizeNs, boolean useConcurrent, 64 long aBatchWindowSizeMs, int aBatchWindowSizeNs, boolean noUseExpLog,
65 int aMaxLogsBeforeSync, int aLogBufferSize) { 65 int aMaxLogsBeforeSync, int aLogBufferSize) {
66 66
67 super(shouldReset, shouldClean, aLogBufferSize, aMaxLogsBeforeSync); 67 super(shouldReset, shouldClean, aLogBufferSize, aMaxLogsBeforeSync);
68 useConcurrentBatcher = useConcurrent; 68 dontUseExpLog = noUseExpLog;
69 theBatchWriteWindowSizeMs = aBatchWindowSizeMs; 69 theBatchWriteWindowSizeMs = aBatchWindowSizeMs;
70 theBatchWriteWindowSizeNs = aBatchWindowSizeNs; 70 theBatchWriteWindowSizeNs = aBatchWindowSizeNs;
71 } 71 }
72 } 72 }