> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/cdf/4.2/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/cdf/4.2/configuration/ext_sender.md).

# CDF Sender configuration

This document provides a sample configuration for a CDF Sender and describes all the parameters you can adjust to configure throughput.

Use this configuration to deploy a CDF Sender:

```yaml
sender:
  # -- Must be enabled to deploy CDF Sender. Mandatory.
  enabled: true
  rateLimit: 2000
  cdr_limit_per_cgf: 1000
  CGFs:
  -
    IP: 192.0.2.1
  -
    IP: 192.0.2.2
  echo: 60000
  responseTimeout: 1000
  retries: 1

nats_services:
  work_queue:
    # -- NATS URL. Example: nats://192.168.0.1:4222. Mandatory.
    url: nats://example.com
    # -- NATS subject for work queue. Example: `CDR.arrived`. Mandatory.
    subject: CDR.arrived
    # -- Existing NATS stream name. Example: CDR. Mandatory.
    streamName: CDR
    # -- Existing NATS consumer name. Example: CDF. Mandatory.
    consumerName: CDF
    poolSize: 16
  kv_store:
    # -- NATS URL. Example: nats://192.168.0.1:4222. Mandatory.
    url: nats://example.com
    # -- NATS bucket name. Example: cdrbucket. Mandatory.
    bucket: CDFbucket
    poolSize: 2

resources:
  cdf:
    limits:
      cpu: 2000m
      memory: 1Gi
```

## Configure `rateLimit`

CDRs are stored in a NATS stream called a Work Queue. The **rateLimit** parameter controls how quickly CDRs are consumed from the Work Queue and distributed across the available CGFs. Configure the CDF Sender rate limit according to the desired performance level.

## Configure `cdr_limit_per_cgf`

The **cdr_limit_per_cgf** parameter defines the maximum number of processes that can send CDRs to a CGF simultaneously. For each allowed process, CDF Sender opens a socket and keeps one CDR in memory.

The default value is `1000`. If your system cannot support 1,000 open sockets or has limited RAM, you can reduce this value to better fit your resource constraints.
The ratio between **cdr_limit_per_cgf** and the rate at which CDF Sender consumes CDRs from the Work Queue is calculated as:

```
(1 second / RTT in seconds) * cdr_limit_per_cgf
```

This means that the longer it takes to receive a response back from a CGF, the higher the `cdr_limit_per_cgf` value should be. A higher limit allows more outstanding requests, helping maintain throughput despite network latency.

## Configure `CGFs`

Each CGF receives an equal share of the load. Adding more CGFs increases overall throughput, as long as CDF Sender does not reach its performance limit.

## Configure `responseTimeout` and `retries`

The `responseTimeout` parameter defines how long, in milliseconds, CDF Sender waits for a GTP Data Response. The default value is `1000`.

If there is no response to a CDR within this time, it is retried based on the **retries** setting. If there’s still no response, the CGF is considered unavailable and won’t be used again until it replies to a GTP Echo.

To avoid triggering a retransmission for still-in-flight responses from the CGF, pick a `responseTimeout` value larger than 2 * RTT(cdf -> cgf) + processing-duration(cgf).

However, setting the timeout too high can cause issues with GTP Prime sequence numbers, as the protocol is limited to 65,536 sequence numbers. For example, at 1000 CDRs per second, this limit is reached in about 65 seconds. A longer timeout increases the risk of sequence numbers wrapping and being reused, which makes it impossible to reliably match responses to their original CDRs.
For more information, see the [GTP Prime sequence number](https://docs.cennso.com/components/cdf/4.2/troubleshooting.md#gtp-prime-sequence-number) troubleshooting section.

## Configure `echo`

The **echo** parameter defines the interval, in milliseconds, between sending GTP Prime Echo requests. According to the standard, this value cannot be shorter than 60 seconds.
Setting a high value for  `echo` increases the time CDF Sender takes to establish communication with a CGF.

If communication with a CGF is lost, CDF Sender continues to send Echo requests. When a response is received, CDF Sender considers the connection re-established. While one or more CGFs are unresponsive, CDF Sender automatically reduces its throughput to match the capacity of the remaining active CGFs, and restores it once all CGFs respond to the echo request.

## Configure `poolSize`

One way to scale CDF Sender performance is to increase the number of Work Queue connections (`poolSize`).
The default pool size is 8.
Each connection starts a new pull consumer — a client that requests messages on demand from a NATS stream. Adding more connections can increase overall throughput, but it won't help if the actual bottlenecks are high RTT per CGF or a low `cdr_limit_per_cgf`. Each additional connection increases CPU usage.
The maximum load on CGF is maintained, even when using multiple connections.

The table below shows the relation between CDF Sender pool size, CPU usage, and NATS ingress and egress throughput. The data was collected by running CDF Sender and CDF Receiver in a Kubernetes cluster.

| Pool size | CPU % | ingress CDR/s | egress CDR/s |
| --- | --- | --- | --- |
| 8 | 50 | 1500 | 935 |
| 16 | 117 | 1500 | 1500 |
| 16 | 98 | 3000 | 2425 |
| 24 | 216 | 3000 | 3000 |
| 24 | 164 | 4500 | 4250 |
| 32 | 260 | 4500 | 4500 |
| 32 | 226 | 6000 | 6000 |

After 6k ingress, the four load generators were restarted with 2000 rate per generator and not changed anymore.

| Pool size | CPU % | ingress CDR/s | egress CDR/s |
| --- | --- | --- | --- |
| 32 | 220 | 8000 | 6200 |
| 40 | 275 | 8000 | 7700 |
| 48 | 295 | 8000 | 9470 |

CDF Receiver was always using pool size 8.

## Configure resource consumption

For more information on how to configure resources for CDF Sender, read [Recommended resource requirements](https://docs.cennso.com/components/cdf/4.2/recommendation.md).
