Version 1.6.5
Statistics

WiredTiger can be configured to maintain a variety of run-time statistics.

The statistics configuration boolean must be set for statistics to be maintained; see Statistics Data for information about accessing the statistics. The following example configures WiredTiger to maintain statistics:

ret = wiredtiger_open(home, NULL, "create,statistics=true", &conn);

Note that maintaining statistics involves updating shared-memory data structures and may decrease application performance.

Statistics logging

WiredTiger will optionally log database statistics into a file when the the wiredtiger_open statistics_log configuration is set. The following example logs statistics every 30 seconds:

home, NULL, "create,statistics_log=(wait=30)", &conn);

Each record is formatted as a space-separated timestamp, unsigned 64-bit value and a variable length string which describes the statistic.

The timestamp format may be changed with the statistics_log.timestamp configuration string. The timestamp value may contain ISO C90 standard strftime conversion specifications.

By default, only the database statistics are logged.

Statistics for specific underlying data sources may be included by adding a list of data source URIs to the statistics_log configuration string:

ret = wiredtiger_open(home, NULL,
"create,"
"statistics_log=(sources=(\"table:table1\",\"table:table2\"))",
&conn);

Statistics for all underlying data sources of a particular type may be included by adding a partial data source URI to the statistics_log configuration string:

ret = wiredtiger_open(home, NULL,
"create,statistics_log=(sources=(\"table:\"))",
&conn);

When database statistics are logged, the database home will be the first space-separated entry for each record in the log file. For example:

Mar 08 11:38:23 463 /database/home pthread mutex condition wait calls
Mar 08 11:38:23 0 /database/home files currently open
Mar 08 11:38:23 1855437 /database/home total heap memory allocations
Mar 08 11:38:23 1856622 /database/home total heap memory frees
Mar 08 11:38:23 1 /database/home total heap memory re-allocations
Mar 08 11:38:23 472 /database/home total read I/Os

When data source statistics are logged, the data source's URI will be the first space-separated entry for each record in the log file. For example:

Mar 20 10:42:36 21 table:mytable compressed pages written
Mar 20 10:42:36 0 table:mytable page written failed to compress
Mar 20 10:42:36 5 table:mytable page written was too small to compress
Mar 20 10:42:36 586 table:mytable cursor insert calls
Mar 20 10:42:36 0 table:mytable bulk-loaded cursor-insert calls

No statistics are logged for any data source for which a handle is not currently open in the database, nor will any statistics requiring the traversal of a tree (as if the statistics_fast configuration string were set).

The location of the log files may be changed with the statistics_log.path configuration string. The path value value may contain ISO C90 standard strftime conversion specifications. WiredTiger will not create non-existent directories in the path, they must exist before wiredtiger_open is called.

The following example logs statistics into files named with the month, day and year:

ret = wiredtiger_open(home, NULL,
"create,"
"statistics_log=(wait=120,path=/log/log.%m.%d.%y)", &conn);

A Python script that parses the default logging output and uses the gnuplot, utility to generate Portable Network Graphics (PNG) format graphs is included in the WiredTiger distribution in the file tools/statlog.py.