Status

Draft

Motivation

Apache Kafka has become the de facto standard for event streaming, with a growing ecosystem of Kafka-compliant services and implementations. While these services conform to the wire protocol, they differ drastically in their Quality of Service (QoS) characteristics—including latency, throughput, elasticity, storage architecture, and observability.

Today, users and applications operate with implicit assumptions or vendor-specific guarantees regarding performance and reliability. However, Kafka lacks a standard mechanism to declare, negotiate, and observe QoS characteristics. This results in a fragmented landscape with varying, often opaque, performance characteristics.

This KIP proposes the definition and implementation of a QoS framework to:

Two types of QoS grammars need to be developed: the first is a form of asks or offers — an ideal or desired QoS, such as to meet a certain latency SLA, or to prepare a Kafka cluster for an anticipated volume of traffic. A second would be to measure actual QoS, as would be conducted by observability tools, methods and systems. Comparisons could then be made between desired states and actual performance.

Any QoS implementation protocols and methods should be open standards, free of vendor bias as much as possible, while still allowing for customization and extensibility for advanced features that one vendor or implementation might support that others do not (or do not yet).

Proposed Changes

  1. QoS Declarations: Allow producers and consumers to declare desired QoS in their configurations.
  2. Cluster Capabilities Description: Brokers will expose supported QoS ranges, capabilities (e.g., self-balancing, storage tiering, autoscaling), and current limits.
  3. QoS Negotiation: A negotiation mechanism to reconcile producer/consumer expectations with broker capabilities.
  4. Observability Integration: Define standard metrics to report actual observed QoS (e.g., end-to-end latency, data freshness, throughput).
  5. QoS in Topic Configuration: Enable topic-level QoS annotations that can act as policy templates or governance guides.

Proposed Public Interfaces

This KIP introduces the concept of a QoS grammar that can be expressed in topic-level configurations, cluster-level capabilities, producer/consumer client metadata, and observability endpoints. 

QoS Metrics Measurements and Responses

The system measures and responds to Quality of Service (QoS) requirements in order to optimize cost, latency, and availability on a per-topic basis. Each topic has a requestedQoS policy attached, which may specify targets for characteristics such as:

There are also metadata associated with policies so they can be properly ascribed to topics and versioned:

This enumeration of characteristics should be considered illustrative but not exhaustive. Additional characteristics for topic-level QoS can be added over time, either through revision of this KIP or through the implementation of new related KIPs.

As well, which policy elements are REQUIRED, RECOMMENDED, or OPTIONAL will need to be defined in the final KIP proposal.

In practice, a producer should provide a requestedQoS policy when it first creates a topic. The Kafka cluster can interrogate the policy to see if it can meet the policy requirements. Some Kafka clusters may be fixed in capability and unable to meet the policy requirements. Other Kafka clusters may have more adaptive capabilities, and will be able to reconfigure or further provision resources to be able to meet the policy requirements.

If a cluster is unable to meet the requestedQoS the producer may be able to find a different Kafka-compatible cluster that can meet its topic-level requirements, or it may enter into a dynamic negotiation with the cluster to determine which, if any, of the desired policy requirements can be met.

Further downstream, consumers can also provide their own requestedQoS policies. The producer and the consumer may need to negotiate, through the cluster, how to establish the subscription. Fast producers and slow consumers are a common mismatch in Kafka connections; a consumer may only be able to ingest data at a certain fixed rate slower than a producer may be generating data. The QoS system could, in theory, help negotiate this, for example, via downsampling using Apache Flink.

To ensure compliance with these policies, each topic continuously reports both the requested QoS and the achieved QoS. The achieved QoS is calculated by the system based on runtime metrics collected by the control plane and brokers:

QoS Metadata Format (example schema)


{
  "desired-latency": {
    "p99": "50ms"
  },
  "desired-max-freshness": "00:01:00:00",
  "expected-throughput": "2M/s",
  "expected-payload-size": {
    "min": "500B",
    "max": "10MB",
    "mode": "<1KB"
  },

  "elasticity": {
    "min-partitions": 10,
    "max-partitions": 1000

  },
  "priority": "high",
  "retention": {
    "duration": "30d",
    "tier": "hot"

  },
  "schema-evolution-aware": true
}

Achieved QoS Measurements

Metrics collected per topic may include:

QoS metrics should be emitted via standardized topic-level metrics available through existing metrics systems (e.g., JMX, Prometheus exporters) or a new dedicated internal QoS topic (e.g., __qos-metrics). These should include:

Topics could self-report these metrics periodically or brokers could aggregate and emit them. Consumers and producers could subscribe to these metrics via an internal API or external metrics collection endpoint. These reports may include timestamps, moving average windows, and confidence levels.

QoS Metrics Format (example schema)


{
 "topic": "sensor-stream",
 "window": "5m",
 "desired-latency-p99": "100ms",
 "actual-latency-p99": "127ms",
 "desired-throughput": "500k msgs/sec",
 "actual-throughput": "491k msgs/sec",
 "max-payload-size-requested": "1MB",
 "max-payload-size-observed": "987KB"
}

QoS Evaluation and Reporting

Each topic periodically emits a QoS Status Report containing:

These reports are exposed via the system dashboard, APIs, and alerting tools. This allows users and the control plane to understand whether a topic's SLAs are being met.

System Response to QoS Drift or Violation

When a drift between requested and achieved QoS is detected, the control plane may take corrective action:

Kafka Cluster Characteristics

While individual Kafka topics will be the primary QoS policy level, clusters themselves can provide descriptions of their overall QoS based upon various factors: topology, capacity, performance, scalability, availability and even affordability. For example, a cluster may have an overall network bandwidth capacity, against which each individual topic that is supported deprecates a remaining availability metric.

Examples:


Clusters may also be able to describe different service levels for IO latency and throughput if they use different memory and storage media, such as in-memory (cached) topics, locally-attached NVMe Solid State Drives (SSD), network attached storage such as AWS Elastic Block Storage (EBS), distributed object storage such as Amazon S3 or Google Cloud Storage, or even rotating Hard Disk Drives (HDD).

In theory, a cluster with dynamic provisioning capabilities could deploy different types of servers and storage capacity to meet requestedQoS demands per topic as needed.

Even individual topics may be able to be deployed to a hybrid storage architecture, with some element of the topic (say, the past 24 hours of data) to fast NVMe, with the older data in the topic (from 24 hours to 72 hours) to object storage, after which the data in the topic is set with a TTL to be deleted.

Producers may or may not be able to specify the storage media their topics are deployed to in the cluster. For example, serverless deployments may entirely obscure such details. The producer should at least be able to request general requirements, such as throughput and latency, leaving the server to interpret how to fulfill them in a serverless manner, opaque to the producer.

Compatibility, Deprecation, and Migration Plan

Use Cases

Prior Art and References

Future Work

Conclusion

As Kafka evolves to serve more diverse workloads and industries, the need for transparent, standardized, and negotiable QoS has become essential. This KIP aims to establish the foundational work for a vendor-neutral, extensible QoS framework for Apache Kafka.

We invite the Kafka community to comment, contribute, and co-author this vision.