nats-server icon indicating copy to clipboard operation
nats-server copied to clipboard

Double the number of message count and bytes sent for aggrgated streams

Open vividvilla opened this issue 2 years ago • 3 comments

We have a simple NATS hub-leafnode cluster setup.

  • Hub has a aggregated stream called orders which aggregates stream called orders from multiple leaf nodes.
  • Leaf node stream called orders created on subjects silo_x.orders.> where x is replaced with silo id.

Now the issue I have noticed is that, messages pushed to topic orders.> on leaf nodes are received twice in hub. I curled stats url to check received messages count and bytes. I don't have any standard NATS subscription for orders.> in hub cluster though.

Is this a expected behavior? we are trying to avoid multiple GBs of data being sent from leaf nodes to hub on our production.

vividvilla avatar Jun 01 '22 04:06 vividvilla

You will need to give them unique subjects to avoid nats publishing the messages into all streams that listen on any one subject.

ripienaar avatar Jun 01 '22 05:06 ripienaar

@ripienaar forgot to mention that as well. I am actually prefixing all silo orders with silo_x.orders.>. Will fix this in the issue.

vividvilla avatar Jun 01 '22 05:06 vividvilla

@vividvilla Is this still an issue you observe? If so, one bit of missing info, is the orders stream bound to the orders.> subject? You noted the leaf node stream is bound to silo_x.orders.>, but the leaf node is publishing on orders.> rather than the local leaf subject? If multiple leaf nodes are publishing to a subject that the hub stream would ultimately received, then indeed, it would be ingested by the stream unless you clamp down permissions or have some other strategy.

bruth avatar Mar 17 '24 11:03 bruth