1

Is there a recommended performant way to monitor the depth of a chronicle-queue (the number of messages yet to be read)

I am thinking I can compare index() at current location with the index after moving to end, but this may be too costly in terms of performance. Potentially I can perform this in a background "monitoring thread"

Rook
  • 25
  • 3

1 Answers1

1

You can use a "named tailer", which can be monitored in another thread/process. This can be compared to the end of the queue. If you do this periodically say every 1 ms or more, the overhead is low.

Alternatively, the reader could do this monitoring by holding a tailer at toEnd() and comparing this to the one it is reading.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130