<style>
  input.search-bar {
    box-sizing: border-box;
    margin-bottom: 30px;
    font-size: 22px;
    padding: 20px;
    padding-left: 60px;
    border: 0;
    border-radius: 4px;
    box-shadow: none;
    flex: 1;
    width: 100%;
    color: #3B454F;
    line-height: 27.5px;
    background: #F1FAFF 20px 24px no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGqSURBVHgBrZRBTsJQEIZnHi6AkNiVeYRNDZC4xBMIN9AT0BuIJxBPwBHEExhPQDmB7NFYFiRNcNEFCZu2z5n2EUnpKwSd5KXT8vN15vWfh5AJy7KtSuXMiWNlI8I5AC7osev7Hy4cEbh7I2XrUQgYKAXWvlR5SkU93/c8OAYoZfsZUTn6dkpQNxEg2nS5ISBfgzDE3mo1nxUCuTJqb0griGO4y7Yn5ZUtRDiil9wydLMJL4PAC3KJLK7XW4qXlE0HCoI0k1TXGpo0AiDq6nzq+5/jAh5QhU9JWwj3RiBi3NFiFw7EzlZY7IZcoFLCghOiXIZ8INsBkgrVQTDv9zY32YeAaatCYN/Uxm+EfZ1MTQqh94WXVa2WRiZho9HusLU4p27GRqCu7oE9qBQ69Xrzi2zR3Qq4avYpjeK7fkT+i1wTEHcrIFO/6onIFycv5Y9hHkOxTZbL+UypUo/+9kIrK+RR7MXx2XX6G9LBUZpIadvGCrPBrbI1slXwl0aMJmkn+5UagUVRBD0JWAQ9GWiCluAPsV5/B7XaxRudo3ys2TTGC/iP0EfggPMf4IXM0qeAeMAAAAAASUVORK5CYII=);
    background-clip: padding-box;
    }
 </style>

 <script>
 function filterList() {
     // Get input value and convert to lowercase
     var input = document.getElementById("search-bar").value.toLowerCase();

     // Get all of the sections.
     var sections = document.getElementsByTagName("section")

     // Loop through the sections and check for h3s, which is the section type that contains the config values.
     for (var i = 0; i < sections.length; i++) {
     var section = sections[i];
     var h3Entries = section.getElementsByTagName("h3")
     // There is only 1 h3 in a section that contains a config value.
     if (h3Entries.length == 1) {
             // Now, check if the term matches the search input, and if so display the section. Otherwise, hide it.
         var h3text = h3Entries[0].textContent.toLowerCase();
         if (h3text.indexOf(input) > -1)
         section.style.display ="";
         else
         section.style.display = "none";
     }
     }
     }
   window.addEventListener('load', filterList);
 </script>

<a id="producer-metrics"></a>

# Producer Metrics

<form>

  <input type="text" id="search-bar"
    class="search-bar"
    aria-label="Search"
    placeholder="Enter search text..."
    onkeyup="filterList()"
    autocomplete="off"></input>
 </form>
<!-- WARNING: THIS IS A SHARED FILE AND THE SOURCE IS LOCATED IN DOCS-COMMON. DO NOT ADD TO ANY OTHER REPO. -->

This topic describes JMX metrics available on Kafka producer instances.
These metrics are useful for monitoring the health and performance of your producer applications.

For information about how to configure JMX, see [Configure JMX for Monitoring](configure-jmx.md#configure-jmx).

<a id="kafka-monitoring-metrics-producer"></a>

## Producer instance metrics

The following metrics are available on a producer instance.
These metrics are attributes on the associated MBean.

### batch-size-avg

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `batch-size-avg`
: The average number of bytes sent per partition per request.
  Global request metric.

### batch-size-max

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `batch-size-max`
: The maximum number of bytes sent per partition per request.
  Global request metric.

### batch-split-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `batch-split-rate`
: The average number of batch splits per second. Global request metric.

### batch-split-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `batch-split-total`
: The total number of batch splits. Global request metric.

### buffer-available-bytes

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `buffer-available-bytes`
: The total amount of buffer memory that is not being used, either unallocated or in the free list. Kafka 3.1.1 and later.

### buffer-total-bytes

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `buffer-total-bytes`
: The maximum amount of buffer memory the client can use whether or not it is available. Kafka 3.1.1 and later.

### bufferpool-wait-ratio

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `bufferpool-wait-ratio`
: The fraction of time an appender waits for space allocation. This metric is available in Kafka version 3.1.1 and later.

### bufferpool-wait-time

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `bufferpool-wait-time`
: The fraction of time an appender waits for space allocation. Kafka 3.1.1 and later.

### bufferpool-wait-time-ns-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `bufferpool-wait-time-ns-total`
: The total time in nanoseconds an appender waits for space allocation. Kafka 3.1.1 and later.

### compression-rate-avg

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `compression-rate-avg`
: The average compression rate of record batches, defined as the average
  ratio of the compressed batch size over the uncompressed size. Global request metric.

### connection-close-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `connection-close-rate`
: The connections closed per second in the window. Global connection metric.

### connection-count

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `connection-count`
: The current number of active connections. Global connection metric.

### connection-creation-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `connection-creation-rate`
: The number of new connections established per second in the window. Global connection metric.

### flush-time-ns-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `flush-time-ns-total`
: The total time in nanoseconds the producer spent in `Producer.flush`. Kafka 3.1.1 and later.

### txn-abort-time-ns-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `txn-abort-time-ns-total`
: The total time in nanoseconds the producer spent aborting transactions for exactly-once semantics. Kafka 3.1.1 and later.

### txn-begin-time-ns-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `txn-begin-time-ns-total`
: The total time in nanoseconds the producer spent in `beginTransaction` for exactly-once semantics. Kafka 3.1.1 and later.

### txn-commit-time-ns-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `txn-commit-time-ns-total`
: The total time in nanoseconds the producer spent committing transactions for exactly-once semantics.

### txn-init-time-ns-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `txn-init-time-ns-total`
: The total time in nanoseconds that the producer spent initializing transactions for exactly-once semantics. Kafka 3.1.1 and later.

### txn-send-offsets-time-ns-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `txn-send-offsets-time-ns-total`
: The total time the producer spent sending offsets to transactions in nanoseconds for exactly-once semantics. Kafka 3.1.1 and later.

### waiting-threads

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `waiting-threads`
: The number of user threads blocked waiting for buffer memory to enqueue their records. Kafka 3.1.1 and later.

### incoming-byte-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `incoming-byte-rate`
: The average number of incoming bytes received per second from all servers. Global request metric.

### io-ratio

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `io-ratio`
: The fraction of time the I/O thread spent doing I/O. Global connection metric.

### io-time-ns-avg

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `io-time-ns-avg`
: The average length of time for I/O per select call in nanoseconds. Global connection metric.

### io-time-ns-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `io-time-ns-total`
: The total time the I/O thread spent doing I/O in nanoseconds. Global connection metric.

### io-wait-ratio

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `io-wait-ratio`
: The fraction of time the I/O thread spent waiting. Global connection metric.

### io-wait-time-ns-avg

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `io-wait-time-ns-avg`
: The average length of time the I/O thread spent waiting for a socket ready for reads or writes
  in nanoseconds. Global connection metric.

### io-wait-time-ns-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `io-wait-time-ns-total`
: The total length of time the I/O thread spent waiting for a socket ready for reads or writes
  in nanoseconds. Global connection metric.

### metadata-age

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `metadata-age`
: The age, in seconds, of the current producer metadata being used. Global request metric.

### outgoing-byte-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `outgoing-byte-rate`
: The average number of bytes sent per second to all servers. Global request metric.

### produce-throttle-time-avg

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `produce-throttle-time-avg`
: The average time in milliseconds a request was throttled by a broker. Global request metric.

### produce-throttle-time-max

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `produce-throttle-time-max`
: The maximum time in milliseconds a request was throttled by a broker. Global request metric.

### record-error-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-error-rate`
: The average per-second number of record sends that resulted in errors. Global request metric.

### record-error-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-error-total`
: The total number of record sends that resulted in errors. Global request metric.

### record-queue-time-avg

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-queue-time-avg`
: The average time in milliseconds record batches spent in the send buffer. Global request metric.

### record-queue-time-max

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-queue-time-max`
: The maximum time in milliseconds record batches spent in the send buffer. Global request metric.

### record-retry-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-retry-rate`
: The average per-second number of retried record sends. Global request metric.

### record-retry-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-retry-total`
: The total number of retried record sends. Global request metric.

### record-send-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-send-rate`
: The average number of records sent per second. Global request metric.

### record-send-total

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-send-total`
: The total number of records sent. Global request metric.

### record-size-avg

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-size-avg`
: The average record size. Global request metric.

### record-size-max

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `record-size-max`
: The maximum record size. Global request metric.

### records-per-request-avg

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `records-per-request-avg`
: The average number of records per request. Global request metric.

### request-latency-avg

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `request-latency-avg`
: The average request latency in milliseconds for producer requests. This metric measures the time
  from when a request is sent until the response is received, providing insight into the overall
  request-response performance of the producer.

### request-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `request-rate`
: The average number of requests sent per second. Global request metric.

### requests-in-flight

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `requests-in-flight`
: The current number of in-flight requests awaiting a response. Global request metric.

### select-rate

MBean: `kafka.producer:type=producer-metrics,client-id={clientId}` Attribute: `select-rate`
: The number of times the I/O layer checked for new I/O to perform per second. Global connection metric.

## Producer per-broker metrics

Besides the producer global request metrics, the following metrics are also available per broker:

### incoming-byte-rate

MBean: `kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)` Attribute: `incoming-byte-rate`
: The average number of bytes received per second from the broker.

### outgoing-byte-rate

MBean: `kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)` Attribute: `outgoing-byte-rate`
: The average number of bytes sent per second to the broker.

### request-rate

MBean: `kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)` Attribute: `request-rate`
: The average number of requests sent per second to the broker.

### request-size-avg

MBean: `kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)` Attribute: `request-size-avg`
: The average size of all requests in the window for a broker.

### request-size-max

MBean: `kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)` Attribute: `request-size-max`
: The maximum size of any request sent in the window for a broker.

### response-rate

MBean: `kafka.producer:type=producer-node-metrics,client-id={clientId},node-id=([0-9]+)` Attribute: `response-rate`
: The average number of responses received per second from the broker.

## Producer per-topic metrics

In addition to the producer global request metrics, the following metric attributes are available per topic:

### byte-rate

MBean: `kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}` Attribute: `byte-rate`
: The average number of bytes sent per second for a topic.

### byte-total

MBean: `kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}` Attribute: `byte-total`
: The total number of bytes sent for a topic.

### compression-rate

MBean: `kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}` Attribute: `compression-rate`
: The average compression rate of record batches for a topic.
  This is computed by averaging the compression ratios of the record batches. The compression ratio is computed by
  dividing the compressed batch size by the uncompressed size.

### record-error-rate

MBean: `kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}` Attribute: `record-error-rate`
: The average per-second number of record sends that resulted in errors for a topic.

### record-error-total

MBean: `kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}` Attribute: `record-error-total`
: The total number of record sends that resulted in errors for a topic.

### record-retry-rate

MBean: `kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}` Attribute: `record-retry-rate`
: The average per-second number of retried record sends for a topic.

### record-retry-total

MBean: `kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}` Attribute: `record-retry-total`
: The total number of retried record sends for a topic.

### record-send-rate

MBean: `kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}` Attribute: `record-send-rate`
: The average number of records sent per second for a topic.

### record-send-total

MBean: `kafka.producer:type=producer-topic-metrics,client-id="{clientId}",topic="{topic}` Attribute: `record-send-total`
: The total number of records sent for a topic.

## Related content

- [Configure JMX for Monitoring](configure-jmx.md#configure-jmx)
- [Consumer Metrics](consumer-metrics.md#consumer-metrics)
