Infinispan Cache Number of Entries: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Internal=


=Overview=


A read-only int represents the current number of raw entries maintained in the cache node being interrogated. May return null if the cache is not started.  
The ''number of entries'' is a read-only Infinispan cache metric representing the current number of cache entries (key/value pairs) maintained by the cache node being interrogated. Note that for distributed or replicated caches, the node may maintain "original" entries and duplicated entries. The value of "number of entries" accounts for ''all'' entries, either original or duplicates, physically present on the node that is being interrogated. The value has no bearing on the total number of distinct entries in the logical cache, which is exposed as "[[#Clusterwide_Number_of_Entries|clusterwide number of entries]]". Unlike the "clusterwide number of entries", the "number of entries" seems to be synchronized across the cluster on each write.


The exact semantics of the "number-of-entries" for a distributed cache is: the raw number of entries (key/value pairs), either original or duplicates, physically present on that specific node that is being interrogated via the CLI command. The value has not bearing on the total number of distinct entries in the logical cache. For that, see <tt>[[#clusterwide-number-of-entries|clusterwide-number-of-entries]]</tt>. Unlike <tt>clusterwide-number-of-entries</tt>, <tt>number-of-entries</tt> seems to be synchronized across the cluster on each write.
The number of entries is maintain as an Integer. May return null if the cache is not started.  


For configuration details see "[[Infinispan_Cache_Container_Configuration#owners|owners]]".
For configuration details see:


The metric is also available as the "numberOfEntries" JMX Attribute of the MBean
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
:[[Infinispan_Cache_Container_Configuration#owners|owners]]
</blockquote>


<pre>
The metric is available as JMX and CLI attributes:
jboss.infinispan:type=Cache,name="<cache-name>(dist_sync)",manager="clustered",component=Statistics
 
</pre>
{|
| JDG 6 JMX [[JDG_6_JMX#numberOfEntries|container level]] and [[JDG_6_JMX#numberOfEntries_individual_cache|individual]] || JDG 6 CLI [[JDG 6 CLI#number-of-entries|container level]] and [[JDG 6 CLI#number-of-entries_individual_cache|individual]]
|-
| JDG 7 JMX [[JDG 7 JMX#numberOfEntries|container level]] and [[JDG 7 JMX#numberOfEntries_individual_cache|individual]] || JDG 7 CLI [[JDG 7 CLI#number-of-entries|container level]] and [[JDG 7 CLI#number-of-entries_individual_cache|individual]]
|-
|}
 
=Clusterwide Number of Entries=
 
The ''clusterwide number of entries'' is a read-only Infinispan cache metric representing the cluster-wide number of distinct entries in the logical cache maintained by the cluster being interrogated. May return null if the cache is not started. The metrics is different than the "[[#Overview|number of entires]]" metric.
 
<blockquote style="background-color: Gold; border: solid thin Goldenrod;">
:<br>There are cases cases where clusterwide-number-of-entries is 0 for a non-zero number of keys, and owners=2. In general, it seems it is not continuously updated under load. The metric seems to "catch up" as more keys are added, so it does not seem to be very reliable. The following factors may result such inconsistency:
* By default, values collected from other nodes are cached for 3,000 milliseconds. Any changes happening during that time are not detected. This value can be changed by <tt>ClusterCacheStats.setStaleStatsTreshold()</tt> operation.
* The division of (numberOfEntries / numOwners) is calculated on each node first, then these are summed up. Any fraction of the division is truncated. numOwners is constant regardless of the current number of nodes; if there is only one node and numOwners=2, it reports the half of the true value.
<br>
</blockquote>
 
For configuration details see:


<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
:[[Infinispan_Cache_Container_Configuration#owners|owners]]
</blockquote>


====Relationship Between clusterwide-number-of-entries and number-of-entries====
=Relationship Between the Number of Entries and Clusterwide Number of Entries=


For a distributed cache, this relationship holds true (provided that clusterwide-number-of-entries is correctly syncrhonized across the cluster and it has an updated value):
For a distributed cache, this relationship holds true (provided that clusterwide number of entries is correctly syncrhonized across the cluster and it has an updated value):
   
   
<pre>
<pre>
Line 25: Line 50:


where the cluster consists in 1 ... n nodes.
where the cluster consists in 1 ... n nodes.
==clusterwide number of entries==
A read-only int representing the cluster-wide number of distinct entries in the logical cache maintained by the cluster being interrogated. May return null if the cache is not started. The metrics is different than <tt>[[#number-of-entries|number-of-entries]]</tt> metric.
<font color=red>There are cases cases where clusterwide-number-of-entries is 0 for a non-zero number of keys, and owners=2. In general, it seems it is not continuously updated under load. The metric seems to "catch up" as more keys are added.</font>.
For configuration details see "[[Infinispan_Cache_Container_Configuration#owners|owners]]".

Latest revision as of 16:54, 15 November 2016

Internal

Overview

The number of entries is a read-only Infinispan cache metric representing the current number of cache entries (key/value pairs) maintained by the cache node being interrogated. Note that for distributed or replicated caches, the node may maintain "original" entries and duplicated entries. The value of "number of entries" accounts for all entries, either original or duplicates, physically present on the node that is being interrogated. The value has no bearing on the total number of distinct entries in the logical cache, which is exposed as "clusterwide number of entries". Unlike the "clusterwide number of entries", the "number of entries" seems to be synchronized across the cluster on each write.

The number of entries is maintain as an Integer. May return null if the cache is not started.

For configuration details see:

owners

The metric is available as JMX and CLI attributes:

JDG 6 JMX container level and individual JDG 6 CLI container level and individual
JDG 7 JMX container level and individual JDG 7 CLI container level and individual

Clusterwide Number of Entries

The clusterwide number of entries is a read-only Infinispan cache metric representing the cluster-wide number of distinct entries in the logical cache maintained by the cluster being interrogated. May return null if the cache is not started. The metrics is different than the "number of entires" metric.


There are cases cases where clusterwide-number-of-entries is 0 for a non-zero number of keys, and owners=2. In general, it seems it is not continuously updated under load. The metric seems to "catch up" as more keys are added, so it does not seem to be very reliable. The following factors may result such inconsistency:
  • By default, values collected from other nodes are cached for 3,000 milliseconds. Any changes happening during that time are not detected. This value can be changed by ClusterCacheStats.setStaleStatsTreshold() operation.
  • The division of (numberOfEntries / numOwners) is calculated on each node first, then these are summed up. Any fraction of the division is truncated. numOwners is constant regardless of the current number of nodes; if there is only one node and numOwners=2, it reports the half of the true value.


For configuration details see:

owners

Relationship Between the Number of Entries and Clusterwide Number of Entries

For a distributed cache, this relationship holds true (provided that clusterwide number of entries is correctly syncrhonized across the cluster and it has an updated value):


number-of-entries[1] + number-of-entries[2] + .. number-of-entries[n] = clusterwide-number-of-entries * owners
                            

where the cluster consists in 1 ... n nodes.