# Multiple Postgres Database Source Connectors OOM Issue

**URL:** <https://forum.confluent.io/t/multiple-postgres-database-source-connectors-oom-issue/37241>\
**Category:** Kafka Connect\
**Created:** [14 February 2025 03:07 UTC](https://forum.confluent.io/t/multiple-postgres-database-source-connectors-oom-issue/37241 "2025-02-14T03:07:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sansun2111](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@sansun2111](https://forum.confluent.io/u/sansun2111)\
**Post date:** [14 February 2025 03:07 UTC](https://forum.confluent.io/t/multiple-postgres-database-source-connectors-oom-issue/37241/1 "2025-02-14T03:07:56Z")

</div>

**Out of Memory Issue**  
Hi All,  
I’m new to Kafka Connect and need some guidance regarding an issue we’re encountering.  
We are managing 500+instances of source Postgres (9.3)(one database per tenant) in our legacy system, each with 14 tables that we need to listen for updates.  
Currently, we’ve created one connector per table. However, we plan to consolidate this into one connector per database moving forward.  
We are using the official Confluent Docker image: `confluentinc/cp-kafka-connect-jdbc`, with the following heap settings:  
`-e KAFKA_HEAP_OPTS="-Xms4g -Xmx6g"`  
The setup includes a minimum of 10 instances and a maximum of 15 instances, with a batch size of 100 and a polling interval of 1 minute.  
Despite these settings, the application runs out of memory over time, and we are facing memory issues.  
**Business Context** : We do not receive more than 1000 records per connector per minute. Our approach is to start with batch mode and then update the connector to use the `timestamp+incrementing` mode.  
After analyzing the memory dump, I observed that:

- A `byte[]` object is taking up **~550MB** of memory.
- A `HashMap` is consuming more than **2GB** , and it is holding many connector objects.

I’ve attached the heap dump screenshot showing these details.

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread “kafka-producer-network-thread | connector-producer-C149429\_AOMD\_po\_invoice\_detail\_Reconcile\_19\_11\_2024\_PO-0”

 ![image](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/2X/2/2c675d97b2fdb3c3a19b0bfe718b966f79b7a56f.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [16 March 2025 03:08 UTC](https://forum.confluent.io/t/multiple-postgres-database-source-connectors-oom-issue/37241/2 "2025-03-16T03:08:03Z")

</div>

Closed on 16 March 2025 03:08 UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
