Skip to content

Does Stream Per Subject have any performance benifits over multiple subjects within same stream #6100

Answered by Jarema
YashasAnand asked this question in Q&A
Discussion options

You must be logged in to vote

Many Consumers per single Stream is usually the simple and good pattern as a starting point.
It's rarely a good idea to have stream per subject.

Each Stream, if replicated (3 or more replicas) will have some overhead for maintaing its own RAFT group.
NATS with it's unique subject wildcards and filters allows for efficient filtering messages from the stream.
I would stick to one stream, unless you need different retention policies for some subjects for example.

Consumers can also scale on Stream - as each consumer leader (if replicated) can live on different Stream replica, balancing the load.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by YashasAnand
Comment options

You must be logged in to vote
1 reply
@Jarema
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants