# Stream repartition with continuously increasing memory usage

**URL:** <https://forum.confluent.io/t/stream-repartition-with-continuously-increasing-memory-usage/10176>\
**Category:** Kafka Streams\
**Created:** [14 February 2024 08:25 UTC](https://forum.confluent.io/t/stream-repartition-with-continuously-increasing-memory-usage/10176 "2024-02-14T08:25:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Espen](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@Espen](https://forum.confluent.io/u/Espen)\
**Post date:** [14 February 2024 08:25 UTC](https://forum.confluent.io/t/stream-repartition-with-continuously-increasing-memory-usage/10176/1 "2024-02-14T08:25:59Z")

</div>

I have a problem with an application using a repartitioning step.

`.repartition(Repartitioned.numberOfPartitions<String?, Anl1sHist?>(1).withName("kStream-repartition"))`

This has not been a problem before. The repartition step seems to continuously increase in the number of messages and size.

 ![Skjermbilde 2024-02-14 091601](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/2X/a/afa27c910f01920cf4e6e4e50d8e4714569f8b84.png)

Any idea what may cause this?

---

<div class="post-metadata">

**Author:** ![mjsax](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mjsax/32/3113_2.png) [@mjsax](https://forum.confluent.io/u/mjsax)\
**Post date:** [15 February 2024 01:28 UTC](https://forum.confluent.io/t/stream-repartition-with-continuously-increasing-memory-usage/10176/2 "2024-02-15T01:28:10Z")

</div>

In general, KS creates repartition topics with infinite retention and issues explicit “delete record” request to cut off data no longer needed.

By default, after a commit of offset X on partition P, KS would issue a corresponding “delete request” for this partition and offset. (In newer version, you there is a new config that allows you do configure how often “delete record” request are sent.)

Hence, you should first check if KS does make progress on the repartition topic, and if it does commit offsets – if not, you need to find out why.

If KS does make progress, the question is why data is no deleted. Are the request sent to begin with? Do you have the right permissions configured (KS required “delete” permissions for this operation to work: [Secure Deployment for Kafka Streams in Confluent Platform | Confluent Documentation](https://docs.confluent.io/platform/current/streams/developer-guide/security.html)) – If the request reaches the broker and you have permissions but purging does not happen, the question goes into the broker: why is it not executed (for example, the current active segment can never be delete, and only after a segment roll data can be purged – thus, a “delete record” request might still be successful, but not up to the request offset not might lag)

HTH.
