Description
Environment Information
- OS : node-alpine image running in ECS fargate
- Node Version: 20
- NPM Version: 20
- C++ Toolchain [e.g. Visual Studio, llvm, g++]: Visual Studio Code
- confluent-kafka-javascript version [e.g. 2.3.3]: latest
Steps to Reproduce
We are currently using the confluent-kafka-js library to consume messages from an AWS MSK (Provisioned) cluster. Our implementation relies on the eachMessage handler, with the expectation that messages are consumed and processed one at a time, in order. While the behavior aligns with our expectations in terms of message ordering and processing, we are observing significant CPU spikes when consumption begins, especially when the topic contains a large number of messages.
We are trying to determine whether the library is pre-fetching or consuming messages in the background, which might be contributing to the spike. If that’s the case, is there a way to control or throttle message consumption to mitigate the CPU usage?
I have attached the sample code.
confluent-kafka-javascript Configuration Settings
Basic settings. No additional setting provided.