question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Negative cache miss metric

See original GitHub issue

Hi,

I’m registering sme Hazelcast cache metrics using

HazelcastCacheMetrics.monitor(meterRegistry, hazelcastInstance.getMap(Constants.METADATA_DEFINITION_CACHE));

And then using then like this:

    @CachePut(value = Constants.METADATA_DEFINITION_CACHE, key = "#metadataDefinitionId", unless = "#result == null")
    public MetadataDefinition putMetadataDefinition(long metadataDefinitionId) {
        return getMetadataDefinitionMetadataInternal(metadataDefinitionId);
    }

    @Cacheable(value = Constants.METADATA_DEFINITION_CACHE, key = "#metadataDefinitionId", unless = "#result == null")
    public MetadataDefinition getMetadataDefinition(long metadataDefinitionId) {
        return getMetadataDefinitionMetadataInternal(metadataDefinitionId);
    }

    @CacheEvict(value = Constants.METADATA_DEFINITION_CACHE, key = "#metadataDefinitionId")
    public void removeFromCache(long metadataDefinitionId) {
    }

but somehow I’m getting negative miss values.

# HELP cache_gets_total the number of times cache lookup methods have returned an uncached (newly loaded) value, or null
# TYPE cache_gets_total counter
cache_gets_total{cache="metadataDefinitionCache",result="miss",} -156909.0
cache_gets_total{cache="metadataDefinitionCache",result="hit",} 314086.0

Any ideas why?

Thanks

Nick

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mweirauchcommented, May 8, 2018

Just as a hint, when somebody touches the file, the class Javadoc mentions “EhCache”. Likely a C&P leftover.

0reactions
jkschneidercommented, May 8, 2018

@nickcodefresh Without your screenshots, this would have been very hard to track down. In the end, I concluded that it is impossible to calculate miss count against Hazelcast caches 😦

I’ve removed the metric from the Hazelcast implementation, and added another FunctionCounter, cache.partition.gets.

See this for the detail on why miss count is incalculable on Hazelcast.

If it is really important for you to know miss count, you can create a wrapper IMap type that adds to a counter every time get is about to return null.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Review and monitoring - Streaming Media Lens
A Cache Hit Ratio (CHR) is the ratio of requests served from cache (matches) to the total requests (misses and matches) over a...
Read more >
Cache performance measurement and metric - Wikipedia
Another useful metric to test the performance is Power law of cache misses. It gives you the number of misses when you change...
Read more >
Metrics and Statistics — PowerDNS Recursor documentation
There are 1773 items in the negative cache, items of which it is known that don't exist and won't do so for the...
Read more >
Linux perf reporting cache misses for unexpected instruction
For your Nehalem (Intel Core i5 750 with L3 cache of 8MB and without ... and reset PMU counter back to some negative...
Read more >
What is a Cache Hit Ratio and How do you Calculate it?
Answer this question by using cache hit and miss ratios that can help you determine whether your cache is working successfully. These metrics...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found