micrometer icon indicating copy to clipboard operation
micrometer copied to clipboard

Poor performance of DefaultLongTaskTimer#takeSnapshot

Open Hartigan opened this issue 1 year ago • 8 comments

Poor performance of MicrometerCollector.collect() which uses DefaultLongTaskTimer. DefaultLongTaskTimer contains a lot of calls of ConcurrentLinkedDeque.size() with O(n) complexity during histogram creation.

Micrometer version: 1.10.3

Might be worth saving the size of deque or full snapshot at the beginning of the method DefaultLongTaskTimer.takeSnapshot() execution. Also method may contain data races between histogram creation and updates of activeTasks.

Hartigan avatar Jul 24 '23 10:07 Hartigan