-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(2.11) Add ability for IP queues to track total size (#5775)
You can optionally pass in an `ipQueue_SizeCalculation` function to an IP queue that fires each time an item is pushed or popped so that the total size can be tracked. There is a slight performance impact but mostly it will depend on the complexity of the calculation function: ``` go test -v ./server -run=XXX -bench=IPQueueSizeCalculation -benchtime=10s goos: darwin goarch: arm64 pkg: github.com/nats-io/nats-server/v2/server BenchmarkIPQueueSizeCalculation BenchmarkIPQueueSizeCalculation/WithoutCalc BenchmarkIPQueueSizeCalculation/WithoutCalc-24 396342910 30.75 ns/op 520.35 MB/s BenchmarkIPQueueSizeCalculation/WithEmptyCalc BenchmarkIPQueueSizeCalculation/WithEmptyCalc-24 377004524 33.91 ns/op 471.80 MB/s BenchmarkIPQueueSizeCalculation/WithLenCalc BenchmarkIPQueueSizeCalculation/WithLenCalc-24 375148896 33.76 ns/op 473.99 MB/s PASS ok github.com/nats-io/nats-server/v2/server 48.150s ``` Signed-off-by: Neil Twigg <[email protected]>
- Loading branch information
Showing
3 changed files
with
189 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters