1 | How And Why To Use TDB Tracing
|
---|
2 | ==============================
|
---|
3 |
|
---|
4 | You can trace all TDB operations, using TDB_TRACE. It is not complete
|
---|
5 | (error conditions which expect to the logged will not always be traced
|
---|
6 | correctly, so you should set up a logging function too), but is designed
|
---|
7 | to collect benchmark-style traces to allow us to optimize TDB.
|
---|
8 |
|
---|
9 | Note: tracing is not efficient, and the trace files are huge: a
|
---|
10 | traverse of the database is particularly large! But they compress very
|
---|
11 | well with rzip (http://rzip.samba.org)
|
---|
12 |
|
---|
13 | How to gather trace files:
|
---|
14 | --------------------------
|
---|
15 | 1) Uncomment /* #define TDB_TRACE 1 */ in tdb_private.h.
|
---|
16 | 2) Rebuild TDB, and everything that uses it.
|
---|
17 | 3) Run something.
|
---|
18 |
|
---|
19 | Your trace files will be called <tdbname>.trace.<pid>. These files
|
---|
20 | will not be overwritten: if the same process reopens the same TDB, an
|
---|
21 | error will be logged and tracing will be disabled.
|
---|
22 |
|
---|
23 | How to replay trace files:
|
---|
24 | --------------------------
|
---|
25 | 1) For benchmarking, remember to rebuild tdb with #define TDB_TRACE commented
|
---|
26 | out again!
|
---|
27 | 2) Grab the latest "replace_trace.c" from CCAN's tdb module (tools/ dir):
|
---|
28 | http://ccan.ozlabs.org/tarballs/tdb.tar.bz2
|
---|
29 | 3) Compile up replay_trace, munging as necessary.
|
---|
30 | 4) Run replay_trace <scratch-tdb-name> <tracefiles>...
|
---|
31 |
|
---|
32 | If given more than one trace file (presumably from the same tdb)
|
---|
33 | replay_trace will try to figure out the dependencies between the operations
|
---|
34 | and fire off a child to run each trace. Occasionally it gets stuck, in
|
---|
35 | which case it will add another dependency and retry. Eventually it will
|
---|
36 | give a speed value.
|
---|
37 |
|
---|
38 | replay_trace can intuit the existence of previous data in the tdb (ie.
|
---|
39 | activity prior to the trace(s) supplied) and will prepopulate as
|
---|
40 | neccessary.
|
---|
41 |
|
---|
42 | You can run --quiet for straight benchmark results, and -n to run multiple
|
---|
43 | times (this saves time, since it need only calculate dependencies once).
|
---|
44 |
|
---|
45 | Good luck!
|
---|
46 | Rusty Russell <rusty@rustcorp.com.au>
|
---|