nats-io / nats-server

High-Performance server for NATS.io, the cloud and edge native messaging system.
https://nats.io
Apache License 2.0
16k stars 1.41k forks source link

Introduce a NumPendingMulti that uses a sublist for efficient selection. #6089

Closed derekcollison closed 1 week ago

derekcollison commented 2 weeks ago

Consumers with many filtered subjects and large streams could suffer from slow creation times due to NumPending() being called for all filtered subjects.

This improvement is similar to the LoadNextMsgMulti for consumers with large number of filtered subjects.

Also fixed a bug in normal NumPending for memstore.

Signed-off-by: Derek Collison derek@nats.io