> For the complete documentation index, see [llms.txt](https://docs.rumi.systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rumi.systems/rumi-cli/commands/tools/txnstats.md).

# txnstats

The Transaction Stats Tools (`rumi tools txnstats`) provide utilities for analyzing per-transaction timing statistics captured in Rumi transaction stats logs (`.txnstats.log` files).

## Overview

When [per-transaction statistics logging](/rumi-core/guides/developing-applications/configuring-the-runtime/monitoring/per-transaction-statistics.md) is enabled, Rumi captures detailed timing information for each transaction.

### Transaction Structure

A Rumi transaction consists of:

1. **Inbound Messages** - One or more messages received from the messaging bus that are included in the transaction.
2. **Outbound Messages** - Zero or more messages sent by the application during message processing, held until commit
3. **Commit** - Store commit (persistence/replication) followed by send commit (releasing outbound messages)

### Timing Categories

The statistics capture timing at each stage of message and transaction processing:

**Inbound Message Timings:**

* **Wire Time** (`in.w2d`) - Time from receiving the message from the bus to pre-deserialization *(4.x only)*
* **Deserialize Time** (`in.d`) - Time to convert the binding's message to a Java object *(4.x only)*
* **Queue Offer Time** (`in.d2o`) - Time from deserialization to offering to the input queue *(4.x only)*
* **Queue Latency** (`in.o2p`) - Time the message waits in the disruptor-based input queue *(4.x only)*
* **Pre-Processing Time** (`in.pre`) - Time from queue poll to message handler dispatch
* **Processing Time** (`in.proc`) - Time spent in the application's message handler

**Transaction Commit Timings:**

* **Store Commit Start** (`txn.store.start`) - Time to initiate store commit
* **Store Commit** (`txn.store.commit`) - Time for store commit to complete
* **Send Commit Start** (`txn.send.start`) - Time to initiate send commit
* **Send Commit** (`txn.send.commit`) - Time for send commit to complete (releasing outbound messages)
* **Total Commit** (`txn.commit`) - Overall commit time

**Outbound Message Timings:**

* **Send Queue Time** (`out.sq`) - Time to enqueue an outbound message during processing
* **Commit to Serialize** (`out.o2s`) - Time from send commit start to pre-serialization *(4.x only)*
* **Serialize Time** (`out.s`) - Time to convert the Java object to the binding's message format *(4.x only)*
* **Serialize to Wire** (`out.s2w`) - Time from serialization to wire send *(4.x only)*
* **Wire Send Time** (`out.ws`) - Time spent in the binding provider's send operation
* **Total Send Time** (`out.snd`) - Overall time to send the outbound message

These statistics are invaluable for performance analysis, identifying latency bottlenecks, and understanding transaction flow timing.

## Commands

| Command                                             | Description                                |
| --------------------------------------------------- | ------------------------------------------ |
| [dump](/rumi-cli/commands/tools/txnstats/dump.md)   | Dump transaction stats to CSV format       |
| [query](/rumi-cli/commands/tools/txnstats/query.md) | Query transaction logs and join with stats |

## Compatibility

{% hint style="info" %}
**3.x Compatibility**: For logs created with Rumi 3.x, use the `--3x` flag before the command:

```bash
rumi --3x tools txnstats dump -l /path/to/myapp.txnstats.log
```

{% endhint %}

## Related Topics

* [Configuring Per-Transaction Statistics](/rumi-core/guides/developing-applications/configuring-the-runtime/monitoring/per-transaction-statistics.md) - How to enable per-transaction stats logging
* [Transaction Logs](/rumi-core/guides/operating-applications/analysis-and-troubleshooting/querying-transaction-logs.md) - Understanding transaction log structure
* [Container Heartbeats](/rumi-core/guides/operating-applications/monitoring/container-heartbeats.md) - Configuring statistics collection
* [Engine Stats](/rumi-core/guides/operating-applications/monitoring/engine-statistics.md) - Engine metrics and timing data

## See Also

* [admin](/rumi-cli/commands/tools/admin.md) - Administrative command-line tool
* [discovery](/rumi-cli/commands/tools/discovery.md) - Discovery troubleshooting tool
* [hbdump](/rumi-cli/commands/tools/hbdump.md) - Heartbeats dump tool
* [tlt](/rumi-cli/commands/tools/tlt.md) - Transaction log tool
