<a id="flink-sql-delivery-guarantees-latency"></a>

# Delivery Guarantees and Latency in Confluent Cloud for Apache Flink

Confluent Cloud for Apache Flink® provides exactly-once semantics end-to-end by default, which means
that the output of a [statement](statements.md#flink-sql-statements) reflects every
input message exactly-once and that every output message is delivered exactly
once.

To achieve this, Confluent Cloud for Apache Flink relies on Apache Flink®’s checkpointing mechanism and Kafka
transactions. While checkpointing and fault tolerance fall into Confluent’s
responsibility, you should understand the implications of how Flink
reads from and writes to Kafka:

* Flink statements write to Kafka by using transactions. Flink commits
  transactions periodically, approximately every minute.
* Flink by default only reads committed messages from Kafka. For more
  information, see
  [isolation.level](/platform/current/installation/configuration/consumer-configs.html#isolation-level).

This implies that depending on the delivery guarantees required by your use
case, you can currently achieve different end-to-end latencies with Flink.

* **Exactly-Once**: If you require exactly-once, the latency is roughly one
  minute and depends on the interval at which Kafka commits transactions.
  In this case, ensure that all consumers of the output topics of
  Flink statements use `isolation.level: read_committed` or set the
  [Flink table option](../reference/statements/create-table.md#flink-sql-create-table-with-kafka-consumer-isolation-level) `'kafka.consumer.isolation-level' = 'read-committed'`.
* **At-Least-Once**: If at-least-once is sufficient for your use case, you can
  read from the output topics with `isolation-level: read_uncommitted`, which
  is the default in Kafka, or set the
  [Flink table option](../reference/statements/create-table.md#flink-sql-create-table-with-kafka-consumer-isolation-level) `'kafka.consumer.isolation-level' = 'read-uncommitted'`.
  With this configuration, depending on the logic of your query, you can
  achieve an end-to-end latency below 100 ms, but you can
  see some output messages twice. This happens when Flink needs to abort a
  transaction that your consumer has already read. You don’t see incorrect
  results, but you can see the same correct result multiple times.

#### NOTE
Confluent is actively working on reducing the latency under exactly-once
semantics. If your use case requires a lower latency, reach out to Support
or your account manager.

## Related content

- [Statements](statements.md#flink-sql-statements)
- [Determinism](determinism.md#flink-sql-determinism)
- [Flink SQL Queries](../reference/queries/overview.md#flink-sql-queries)

#### NOTE
This website includes content developed at the [Apache Software Foundation](https://www.apache.org/)
under the terms of the [Apache License v2](https://www.apache.org/licenses/LICENSE-2.0.html).
