Mercurial > hg > blitz_condensed
annotate src/org/dancres/blitz/config/Persistent.java @ 34:6f68e94c1fb8 default tip
Add CondensedStats monitoring utility, equivalent to vmstat
author | Dominic Cleal <dominic-cleal@cdo2.com> |
---|---|
date | Thu, 05 Aug 2010 11:07:25 +0100 |
parents | a77f0a9ed93c |
children |
rev | line source |
---|---|
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
1 package org.dancres.blitz.config; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
2 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
3 /** |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
4 Configures Blitz to be maximally durable with all operations being recorded |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
5 on disk immediately they are commited. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
6 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
7 @todo Add MAX_LOGS_BEFORE_SYNC disable |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
8 */ |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
9 public class Persistent extends PersistentBase { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
10 |
32
a77f0a9ed93c
Add support for optimistic log batching.
Dan Creswell <dan.creswell@gmail.com>
parents:
15
diff
changeset
|
11 private boolean dontUseExpLog; |
15
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
12 private long theBatchWriteWindowSizeMs; |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
13 private int theBatchWriteWindowSizeNs; |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
14 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
15 /** |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
16 @param shouldReset specifies whether to reset the ObjectOutputStream |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
17 used for logging. This is a performance vs memory tradeoff |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
18 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
19 @param shouldClean specifies whether old log files and snapshots should |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
20 be cleaned up or left for archiving. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
21 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
22 @param aBatchWriteWindowSize specifies a batch-write window for logging. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
23 Set this to zero to disable batching. Batch-writing can reduce the |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
24 number of forced flushes to disk whilst increasing the amount of data |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
25 written with each flush. This has a positive effect on throughput |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
26 under concurrent load. Time is specified in ms, first thread into |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
27 barrier waits this amount of time for other writers. Other writers |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
28 entering the barrier are now blocked until the first entrant commits all |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
29 writes to log. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
30 |
32
a77f0a9ed93c
Add support for optimistic log batching.
Dan Creswell <dan.creswell@gmail.com>
parents:
15
diff
changeset
|
31 @param noUseExpLog avoid using optimistic logger which should increase log throughput |
a77f0a9ed93c
Add support for optimistic log batching.
Dan Creswell <dan.creswell@gmail.com>
parents:
15
diff
changeset
|
32 by allowing an optimistic flushing strategy but may still contain bugs |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
33 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
34 @param aMaxLogsBeforeSync is the maximum number of log entries before |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
35 a checkpoint is forced. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
36 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
37 @param aLogBufferSize especially useful when doing batching. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
38 All commands are rendered to the buffer before going to disk in one |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
39 large block. Without the buffer, each command will trickle to disk as a |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
40 small update which isn't good for throughput! |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
41 */ |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
42 public Persistent(boolean shouldReset, boolean shouldClean, |
32
a77f0a9ed93c
Add support for optimistic log batching.
Dan Creswell <dan.creswell@gmail.com>
parents:
15
diff
changeset
|
43 int aBatchWriteWindowSize, boolean noUseExpLog, |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
44 int aMaxLogsBeforeSync, int aLogBufferSize) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
45 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
46 super(shouldReset, shouldClean, aLogBufferSize, aMaxLogsBeforeSync); |
32
a77f0a9ed93c
Add support for optimistic log batching.
Dan Creswell <dan.creswell@gmail.com>
parents:
15
diff
changeset
|
47 dontUseExpLog = noUseExpLog; |
15
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
48 theBatchWriteWindowSizeMs = aBatchWriteWindowSize; |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
49 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
50 |
32
a77f0a9ed93c
Add support for optimistic log batching.
Dan Creswell <dan.creswell@gmail.com>
parents:
15
diff
changeset
|
51 public boolean dontUseExperimentalBatcher() { |
a77f0a9ed93c
Add support for optimistic log batching.
Dan Creswell <dan.creswell@gmail.com>
parents:
15
diff
changeset
|
52 return dontUseExpLog; |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
53 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
54 |
15
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
55 public long getBatchWriteWindowSizeMs() { |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
56 return theBatchWriteWindowSizeMs; |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
57 } |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
58 |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
59 public int getBatchWriteWindowSizeNs() { |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
60 return theBatchWriteWindowSizeNs; |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
61 } |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
62 |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
63 public Persistent(boolean shouldReset, boolean shouldClean, |
32
a77f0a9ed93c
Add support for optimistic log batching.
Dan Creswell <dan.creswell@gmail.com>
parents:
15
diff
changeset
|
64 long aBatchWindowSizeMs, int aBatchWindowSizeNs, boolean noUseExpLog, |
15
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
65 int aMaxLogsBeforeSync, int aLogBufferSize) { |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
66 |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
67 super(shouldReset, shouldClean, aLogBufferSize, aMaxLogsBeforeSync); |
32
a77f0a9ed93c
Add support for optimistic log batching.
Dan Creswell <dan.creswell@gmail.com>
parents:
15
diff
changeset
|
68 dontUseExpLog = noUseExpLog; |
15
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
69 theBatchWriteWindowSizeMs = aBatchWindowSizeMs; |
cd96fcac1487
Add support for nano-second batch windows.
Dan Creswell <dan.creswell@gmail.com>
parents:
0
diff
changeset
|
70 theBatchWriteWindowSizeNs = aBatchWindowSizeNs; |
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
71 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
72 } |