> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tsr/latest/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/tsr/latest/performance.md).

# Performance

Basic performance indications for a TSR setup running in Kubernetes.

## Type 

In this setup, TSR Collector is not needed. Sink is configured with the following resources:

```yaml
resources:
    requests:
        cpu: 2
        memory: 2Gi
    limits:
        cpu: 2
        memory: 2Gi
```
For FlowUsage IPFIX messages, the bytes can be summed up and aggregated before persisting. Therefore, Sink can handle more FlowUsage IPFIX messages than NatEvent messages.
This impact of the aggregation depends on the number of external IP addresses, VRF, and interfaces.
If every FlowUsage message is for a different external IP address, nothing can be aggregated and the performance is the same as for NatEvents.
To achieve high performance, you have to adjust a few settings:

- **buffer.socket.size** - value of 25 MB has been proven a good fit for high load (`26214400`)
- **buffer.persist.size** - value between 1,000 and 2,000 has been proven a good fit. This depends on the network and on the used database.

FlowUsage messages can be aggregated to have at most 10,000 variations of (ip, vrf, interface).
`db.storageEngine=InnoDB` is very performant as data can be effectively updated with an `UPSERT`. Otherwise, `ARCHIVE` should be used.

Sink is able to handle 100,000 IPFIX messages per second.
The load on the database for NatEvent messages is one message in one value added to the insert statement towards the database.
With a standard MySQL database deployment and `db.storageEngine=ARCHIVE`, it is possible to achieve inserts around 12,000 per second.
