You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a specific use case that we're struggling to configure properly in Pulsar:
Message Pattern: Small bursts of messages (10-100) arrive at unpredictable times, queue is empty most of the day
Processing Time: Each message requires 15-80 minutes of processing (CPU-intensive tasks)
Scaling Requirement: We have a controller that monitors the backlog and automatically scales consumers up/down based on demand
Problem: When messages arrive before consumers are scaled up, the first consumer gets ALL messages, and later-added consumers remain idle
Our Setup:
consumer, err := c.client.Subscribe(pulsar.ConsumerOptions{
Topic: c.topic,
SubscriptionName: c.subscription,
Type: pulsar.Shared,
Name: consumerID,
ReceiverQueueSize: 1,
}
each msg is being sent with different key
The Core Problem We Discovered:
Through extensive testing, we found that when messages exist in the backlog before consumers join:
First consumer to connect gets ALL messages assigned by the broker
When additional consumers are added by our auto-scaler, they get 0 messages
New consumers only receive newly-arriving messages, not the existing backlog
This leads to extremely uneven load distribution where 1 consumer processes for hours while 9 sit idle
The Configuration We're Looking For:
Is there a broker-side configuration that would:
Limit the maximum number of messages assigned to each consumer at the broker level (not just client-side)
Allow messages to be redistributed when new consumers join
Something like maxMessagesPerConsumerBrokerSide or maxPendingMessagesPerConsumer
Essentially, we need the broker to only assign 1 messages to each consumer each time, keeping the rest in the backlog for other consumers to claim.
Environment
Pulsar Version: 3.0.3
Deployment: k8s jobs as consumers, each job is a consumer
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Use Case Overview:
We have a specific use case that we're struggling to configure properly in Pulsar:
Our Setup:
consumer, err := c.client.Subscribe(pulsar.ConsumerOptions{
Topic: c.topic,
SubscriptionName: c.subscription,
Type: pulsar.Shared,
Name: consumerID,
ReceiverQueueSize: 1,
}
each msg is being sent with different key
The Core Problem We Discovered:
Through extensive testing, we found that when messages exist in the backlog before consumers join:
The Configuration We're Looking For:
Is there a broker-side configuration that would:
maxMessagesPerConsumerBrokerSideormaxPendingMessagesPerConsumerEssentially, we need the broker to only assign 1 messages to each consumer each time, keeping the rest in the backlog for other consumers to claim.
Environment
Any guidance would be greatly appreciated. We really like Pulsar for our other use cases but struggling with this specific scenario.
thanks ahead!
Beta Was this translation helpful? Give feedback.
All reactions