<a id="flink-sql-billing"></a>

# Billing on Confluent Cloud for Apache Flink

Confluent Cloud for Apache Flink® is a serverless stream-processing platform with usage-based
pricing. Confluent charges you only for the duration that your queries run.

You configure Flink by creating a Flink [compute pool](compute-pools.md#flink-sql-compute-pools).

Confluent charges you for the [CFUs](#flink-sql-cfus) you consume when
you run statements within a compute pool. The compute pool itself scales
elastically to provide the necessary resources; your cost depends on the
actual CFUs you use per minute, not on the provisioned size of the pool.

You can configure the maximum size of a compute pool to limit your spending.

<a id="flink-sql-cfus"></a>

## CFUs

A CFU is a logical unit of processing power that Confluent Cloud for Apache Flink uses to measure
the resources it consumes. Each Flink statement consumes a minimum of
1 CFU-minute but can consume more depending on the needs of the workload.

#### NOTE
If you’re a Flink Advantage Package customer, you can run up to four
statements per CFU.

<a id="flink-sql-billing-cfu"></a>

## CFU billing

Confluent bills you for the total number of CFUs you consume inside a
compute pool per minute. Usage appears in hours to apply hourly pricing to
minute-by-minute use. For example, 30 CFU-minutes is 0.5 CFU-hours.

CFU pricing
: $0.21/CFU-hour, calculated by the minute ($0.0035/CFU-minute)

Prices vary by [cloud region](../../billing/billing-dimensions.md#cloud-billing-regional-multiplier).

## Networking fees

Using Flink to read and write data from Apache Kafka® doesn’t add any new
Flink-specific networking fees, but you’re still responsible for the Confluent Cloud
networking rates for data that you read from and write to your Kafka clusters.
These are existing Kafka costs, not new charges that Flink creates.

## Cost management

You can’t define the number of CFUs an individual statement requires.
Confluent Cloud for Apache Flink counts CFUs for you. You can configure the maximum size of a
compute pool to limit your spending by setting a parameter named MAX_CFU,
which sets an upper limit on the hourly spend on the compute pool. If the
size of the workload in a pool exceeds MAX_CFU, Confluent Cloud for Apache Flink rejects new
statements. Existing workloads continue running but can experience increased
latency.

#### NOTE
You can increase the MAX_CFU value after you create a compute pool, but
you can’t decrease the initial MAX_CFU value. For more information,
see [Update a compute pool](../operate-and-deploy/create-compute-pool.md#flink-sql-manage-compute-pool-update).

You can set a minimum CFU floor for an individual statement with a
[Baseline CFU](autopilot.md#flink-sql-baseline-cfu). A statement with a Baseline CFU
is billed for at least that many CFUs even when it’s idle. Usage above the
floor is billed on top, so setting a Baseline CFU can increase your CFU usage.
For more information, see [Set a Baseline CFU for a Flink SQL Statement](../how-to-guides/manage-baseline-cfu.md#flink-sql-manage-baseline-cfu).

For more information on CFU prices, see
[Confluent Cloud Pricing](https://www.confluent.io/confluent-cloud/pricing/).

## Pricing examples

Data streaming is a real-time business, and data streams oscillate on a
minute-by-minute basis, creating peaks and troughs of utilization. You don’t
want to allocate and overpay for processing capacity that you aren’t using.
With Confluent Cloud for Apache Flink, you pay only for the processing power that you actually
use.

The following examples provide additional detail on how pricing works when
processing streams using Confluent Cloud for Apache Flink.

### Data exploration and discovery

Most SQL queries are short-running, interactive queries that help software and
data engineers understand the streams they have access to. Querying the
streams directly is an important and necessary step in the iterative
development of applications and pipelines.

In the following example, one user executes five different queries. Unlike
other Flink offerings, Confluent Cloud for Apache Flink’s serverless architecture charges you
only for the five minutes when these queries run, with all users able to
share the resources of a single compute pool. It doesn’t matter whether the
same person executes these queries, whether five different people execute
them at the same time, or whether (as shown in the following diagram) the
queries run at different points in the hour.

![Diagram showing five SQL queries and corresponding CFUs in Confluent Cloud for Apache Flink®️.](flink/images/flink-sql-five-queries-over-time.png)

Example pricing calculation
: - Number of queries executed = 5
  - Total CFU-minutes consumed = 5
  - Total charge: 5 CFU-minutes x $0.0035/CFU-minute = **$0.0175**
  <br/>
  **Note:** The charge appears on the invoice as “0.083 CFU-hours x $0.21/CFU-hour”.

### Many data streaming applications and statements

A data streaming architecture comprises many applications, each with its
own workload requirements. An architecture can be a mix of interactive,
terminating statements and continuous, streaming statements. Confluent Cloud for Apache Flink
automatically scales the processing power of the Flink compute pool up and
down in real time so that your applications have the processing power they
need, while charging only for the minutes you use.

In the following example, five streaming statements run in a single compute
pool. The data streams oscillate, and you can see spikes of utilization for
short periods within the hour. Each statement attracts a minimum price of
1 CFU-minute ($0.0035 in this example), and Confluent Cloud for Apache Flink automatically scales
the statement up and down on a per-minute basis as needed.

![Diagram showing five SQL queries with changing workloads and corresponding CFUs in Confluent Cloud for Apache Flink®️.](flink/images/flink-sql-five-queries-changing-workloads.png)

| Statement   |   CFU-minutes | Statement Type   |
|-------------|---------------|------------------|
| Q1          |             5 | Interactive      |
| Q2          |            60 | Streaming        |
| Q3          |           110 | Streaming        |
| Q4          |            10 | Interactive      |
| Q5          |           124 | Streaming        |
| Total       |           309 |                  |

Example pricing calculation
: - Number of statements executing = 5
  - Total CFU-minutes consumed = 309
  - Total charge: 309 CFU-minutes x $0.0035/CFU-minute = **$1.0815**
  <br/>
  **Note:** The charge appears on the invoice as “5.15 CFU-hours x $0.21/CFU-hour”.

## Related content

- [Compute Pools](compute-pools.md#flink-sql-compute-pools)
- [Confluent Cloud Pricing](https://www.confluent.io/confluent-cloud/pricing/)
