ayeo-flex-org/pulsar-flex

Consumer can't keep up, leading to memory leak

Closed this issue · 0 comments

Describe the bug
Consume on high throughput sturggles to keep up and eventually leads to memory usage rising until crashing

Reproduce

  1. Run a consumer that subscribes to that topic and logs each topic offset
  2. Run a producer that continuously produces messages to a topic at 5MB/s (split between 70-100 messages per second)
  3. After a certain amount of time (for me around 10/15 minutes) memory usage starts rising rapidly and the subscription's backlog size also rises steadily.
    Expected behavior
    I expect the consumer to be able to handle these kinds of throughput and keep up with the consumer with memory usage staying steady.

Observed behavior
Every time the dequeue function is called, I logged the length of receiveQueue. At some point, it barely manages to empty the queue, reaching thousands of messages rapidly (even though I set receiveQueueSize to 1000).
This can be seen even within seconds if the consumer starts with a few thousand messages in its backlog.

Environment:

  • OS: CentOS 7.8
  • PulsarFlex version 1.0.1-beta.7
  • Pulsar version 2.8.1
  • NodeJS version 16.13.1