-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Environment Information
- OS: Windows 11
- Node Version: 22.7.0
- NPM Version: 10.8.2
- C++ Toolchain: Visual Studio Code
- confluent-kafka-javascript version: 1.4.1
Steps to Reproduce
- Take a snapshot of the heap usage
- Initialize a new Kafka Consumer
- Call the Consumer.connect() method
- Call the Consumer.disconnect() method
- Take a snapshot of the updated heap usage
for(let i = 0; i < 10; i++) {
const consumer = kafka.consumer({ kafkaJS: { groupId: `Group-${i}`, fromBeginning: false} });
await consumer.connect();
await consumer.disconnect();
}
Running the above snippet and taking heap snapshots between each consumer creation shows that around 1 MB of memory is retained for each disconnected consumer. This can add up over time if an application needs to spin up a large number of consumers.
Comparing the latest heap snapshot to the initial the largest size delta is in the Array constructor which added 7.2MB.
Comparing each snapshot to the previous one shows the same. The Array constructor has the largest size delta and increases at a consistent rate between snapshots.

Metadata
Metadata
Assignees
Labels
No labels