Mercurial > hg > blitz_condensed
comparison src/org/dancres/blitz/config/Persistent.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children | cd96fcac1487 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 package org.dancres.blitz.config; | |
2 | |
3 /** | |
4 Configures Blitz to be maximally durable with all operations being recorded | |
5 on disk immediately they are commited. | |
6 | |
7 @todo Add MAX_LOGS_BEFORE_SYNC disable | |
8 */ | |
9 public class Persistent extends PersistentBase { | |
10 | |
11 private boolean useConcurrentBatcher; | |
12 private int theBatchWriteWindowSize; | |
13 | |
14 /** | |
15 @param shouldReset specifies whether to reset the ObjectOutputStream | |
16 used for logging. This is a performance vs memory tradeoff | |
17 | |
18 @param shouldClean specifies whether old log files and snapshots should | |
19 be cleaned up or left for archiving. | |
20 | |
21 @param aBatchWriteWindowSize specifies a batch-write window for logging. | |
22 Set this to zero to disable batching. Batch-writing can reduce the | |
23 number of forced flushes to disk whilst increasing the amount of data | |
24 written with each flush. This has a positive effect on throughput | |
25 under concurrent load. Time is specified in ms, first thread into | |
26 barrier waits this amount of time for other writers. Other writers | |
27 entering the barrier are now blocked until the first entrant commits all | |
28 writes to log. | |
29 | |
30 @param useConcurrent should increase log throughput by allowing the | |
31 next batch to form whilst the current batch is being written to log. | |
32 | |
33 @param aMaxLogsBeforeSync is the maximum number of log entries before | |
34 a checkpoint is forced. | |
35 | |
36 @param aLogBufferSize especially useful when doing batching. | |
37 All commands are rendered to the buffer before going to disk in one | |
38 large block. Without the buffer, each command will trickle to disk as a | |
39 small update which isn't good for throughput! | |
40 */ | |
41 public Persistent(boolean shouldReset, boolean shouldClean, | |
42 int aBatchWriteWindowSize, boolean useConcurrent, | |
43 int aMaxLogsBeforeSync, int aLogBufferSize) { | |
44 | |
45 super(shouldReset, shouldClean, aLogBufferSize, aMaxLogsBeforeSync); | |
46 useConcurrentBatcher = useConcurrent; | |
47 theBatchWriteWindowSize = aBatchWriteWindowSize; | |
48 } | |
49 | |
50 public boolean useConcurrentWriteBatcher() { | |
51 return useConcurrentBatcher; | |
52 } | |
53 | |
54 public int getBatchWriteWindowSize() { | |
55 return theBatchWriteWindowSize; | |
56 } | |
57 } |