diff options
author | Etienne Dechamps <[email protected]> | 2012-06-15 16:22:14 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-06-29 09:56:51 -0700 |
commit | b6ad9671acdd245385744bcc1fe6c0f21f252570 (patch) | |
tree | 80363b645fdf980ba2dfb6bbeba3b03c50cae76d /include/sys | |
parent | 7164d092210f122a4564ab37fb4fce476ec4485f (diff) |
Add ZIL statistics.
The performance of the ZIL is usually the main bottleneck when dealing with
synchronous, write-heavy workloads (e.g. databases). Understanding the
behavior of the ZIL is required to diagnose performance issues for these
workloads, and to tune ZIL parameters (like zil_slog_limit) accordingly.
This commit adds a new kstat page dedicated to the ZIL with some counters
which, hopefully, scheds some light into what the ZIL is doing, and how it is
doing it.
Currently, these statistics are available in /proc/spl/kstat/zfs/zil.
A description of the fields can be found in zil.h.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #786
Diffstat (limited to 'include/sys')
-rw-r--r-- | include/sys/zil.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/include/sys/zil.h b/include/sys/zil.h index 45900c981..c583887cd 100644 --- a/include/sys/zil.h +++ b/include/sys/zil.h @@ -372,6 +372,65 @@ typedef struct itx { /* followed by type-specific part of lr_xx_t and its immediate data */ } itx_t; +/* + * Used for zil kstat. + */ +typedef struct zil_stats { + /* + * Number of times a ZIL commit (e.g. fsync) has been requested. + */ + kstat_named_t zil_commit_count; + + /* + * Number of times the ZIL has been flushed to stable storage. + * This is less than zil_commit_count when commits are "merged" + * (see the documentation above zil_commit()). + */ + kstat_named_t zil_commit_writer_count; + + /* + * Number of transactions (reads, writes, renames, etc.) + * that have been commited. + */ + kstat_named_t zil_itx_count; + + /* + * See the documentation for itx_wr_state_t above. + * Note that "bytes" accumulates the length of the transactions + * (i.e. data), not the actual log record sizes. + */ + kstat_named_t zil_itx_indirect_count; + kstat_named_t zil_itx_indirect_bytes; + kstat_named_t zil_itx_copied_count; + kstat_named_t zil_itx_copied_bytes; + kstat_named_t zil_itx_needcopy_count; + kstat_named_t zil_itx_needcopy_bytes; + + /* + * Transactions which have been allocated to the "normal" + * (i.e. not slog) storage pool. Note that "bytes" accumulate + * the actual log record sizes - which do not include the actual + * data in case of indirect writes. + */ + kstat_named_t zil_itx_metaslab_normal_count; + kstat_named_t zil_itx_metaslab_normal_bytes; + + /* + * Transactions which have been allocated to the "slog" storage pool. + * If there are no separate log devices, this is the same as the + * "normal" pool. + */ + kstat_named_t zil_itx_metaslab_slog_count; + kstat_named_t zil_itx_metaslab_slog_bytes; +} zil_stats_t; + +extern zil_stats_t zil_stats; + +#define ZIL_STAT_INCR(stat, val) \ + atomic_add_64(&zil_stats.stat.value.ui64, (val)); +#define ZIL_STAT_BUMP(stat) \ + ZIL_STAT_INCR(stat, 1); + typedef int zil_parse_blk_func_t(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t txg); typedef int zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, |