[
https://issues.apache.org/jira/browse/IGNITE-29082?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nikita Amelchev updated IGNITE-29082:
-------------------------------------
Attachment: JmhCacheMetricsBenchmark.java
> Fix repeated iterations over local partitions in cache metrics
> --------------------------------------------------------------
>
> Key: IGNITE-29082
> URL: https://issues.apache.org/jira/browse/IGNITE-29082
> Project: Ignite
> Issue Type: Improvement
> Reporter: Nikita Amelchev
> Assignee: Nikita Amelchev
> Priority: Minor
> Fix For: 2.19
>
> Attachments: JmhCacheMetricsBenchmark.java
>
>
> {{CacheMetricsMessage(CacheMetrics)}} reads the 10 entries and partitions
> counters of {{CacheMetricsImpl}} through separate getters, and each getter
> calls {{getEntriesStat()}}, which iterates over all local partitions 4 times
> ({{offHeapEntriesCount()}}, {{localSize(null)}}, {{localSizeLong(null)}} and
> its own loop): 40 passes per snapshot instead of one. The snapshots are taken
> on each metrics update for every cache with statistics enabled, in the
> {{tcp-disco-msg-worker}} thread. The {{CacheSize}}, {{HeapEntriesCount}} and
> {{OffHeap*EntriesCount}} gauges also make 4 passes each on every read by
> metric exporters.
> JMH, 50 caches with 1024 partitions: snapshots of all caches 39.8 ms -> 2.45
> ms, reading of the cache metric registries 22.4 ms -> 3.9 ms.
> Also fix the {{CacheMetrics}} javadoc: {{getSize()}} and {{getKeySize()}}
> don't always return 0, {{getCacheSize()}} counts only primary copies.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)