How to prevent starvation? #3632
-
Hi, I encountered an issue today, one of my clients pushed more than 100 messages to be processed which made the stream busy for so long as each message is waiting for its turn. Example: Result: User 2 message will be processed after all of user 1's messages. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Several ways to approach the problem. You could limit the number of messages each user can queue up. Allow them to only publish to certain subjects and have a max msgs per subject. On the consumption side. Meaning the applications that are processing these messages. You could just horizontally scale, meaning run lots of applications to consume the next message available. If order is important per user, create multiple consumers that filter via user, e.g. |
Beta Was this translation helpful? Give feedback.
Several ways to approach the problem.
You could limit the number of messages each user can queue up. Allow them to only publish to certain subjects and have a max msgs per subject.
On the consumption side. Meaning the applications that are processing these messages. You could just horizontally scale, meaning run lots of applications to consume the next message available.
If order is important per user, create multiple consumers that filter via user, e.g.
FilterSubject: "users.derek.>"