1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002, 2014 Oracle and/or its affiliates.  All rights reserved.
5  *
6  */
7 
8 package com.sleepycat.je.evictor;
9 
10 import com.sleepycat.je.utilint.StatDefinition;
11 import com.sleepycat.je.utilint.StatDefinition.StatType;
12 
13 /**
14  * Per-stat Metadata for JE evictor statistics.
15  */
16 public class EvictorStatDefinition {
17     public static final String GROUP_NAME = "Cache";
18     public static final String GROUP_DESC =
19         "Current size, allocations, and eviction activity.";
20 
21     /*
22      * The StatDefinitions for the nBINsEvicted* stats are generated, but
23      * share a common description.
24      */
25     public static final String NUM_BYTES_EVICTED_DESC =
26         "Number of bytes evicted, per eviction source. It serves as an " +
27         "indicator of what part of the system is doing eviction work.";
28 
29     public static final StatDefinition EVICTOR_EVICTION_RUNS =
30         new StatDefinition(
31             "nEvictionRuns",
32             "Number of eviction runs, an indicator of the eviction " +
33             "activity level.");
34 
35     public static final StatDefinition EVICTOR_NODES_TARGETED =
36         new StatDefinition(
37             "nNodesTargeted",
38             "Number of nodes selected as eviction targets. An eviction " +
39             "target may actually be evicted, or skipped, or put back to " +
40             "the LRU, potentially after partial eviction or BIN-delta " +
41             "mutation is done on it.");
42 
43     public static final StatDefinition EVICTOR_NODES_EVICTED =
44         new StatDefinition(
45             "nNodesEvicted",
46             "Number of target nodes evicted from the cache.");
47 
48     public static final StatDefinition EVICTOR_ROOT_NODES_EVICTED =
49         new StatDefinition(
50             "nRootNodesEvicted",
51             "Number of database root nodes evicted.");
52 
53     public static final StatDefinition EVICTOR_LNS_EVICTED =
54         new StatDefinition(
55             "nLNsEvicted",
56             "Number of LNs evicted as a result of BIN stripping.");
57 
58     public static final StatDefinition EVICTOR_NODES_STRIPPED =
59         new StatDefinition(
60             "nNodesStripped",
61             "Number of target BINs whose child LNs were evicted (stripped). " +
62             "After a BIN is stripped, it is put back to the LRU.");
63 
64     public static final StatDefinition EVICTOR_NODES_MUTATED =
65         new StatDefinition(
66             "nNodesMutated",
67             "Number of target BINs mutated to BIN-deltas. After a BIN is " +
68             "mutated, it is put back to the LRU.");
69 
70     public static final StatDefinition EVICTOR_NODES_PUT_BACK =
71         new StatDefinition(
72             "nNodesPutBack",
73             "Number of nodes back into the LRU without any action taken on " +
74             "them. For example, a target BIN will immediatelly be put back " +
75             "if it has cursors on it, or is pinned, or is marked \"hot\", " +
76             "or none of it LNs are evictable");
77 
78     public static final StatDefinition EVICTOR_NODES_MOVED_TO_DIRTY_LRU =
79         new StatDefinition(
80             "nNodesMovedToDirtyLRU",
81             "Number of nodes moved from the \"mixed\" to the dirty LRU.");
82 
83     public static final StatDefinition EVICTOR_NODES_SKIPPED =
84         new StatDefinition(
85             "nNodesSkipped",
86             "Number of nodes removed from the LRU without any action taken " +
87             "on them. For example, a node will be skipped if it has already " +
88             "been evicted by another thread.");
89 
90     public static final StatDefinition EVICTOR_SHARED_CACHE_ENVS =
91         new StatDefinition(
92             "nSharedCacheEnvironments",
93             "Number of Environments sharing the cache.",
94             StatType.CUMULATIVE);
95 
96     public static final StatDefinition LN_FETCH =
97         new StatDefinition("nLNsFetch",
98                            "Number of LNs (data records) requested by " +
99                            "btree operations. Can be used to gauge cache " +
100                            "hit/miss ratios.");
101 
102     /*
103      * Number of times IN.fetchIN() or IN.fetchINWithNoLatch() was called
104      * to fetch a UIN.
105      */
106     public static final StatDefinition UPPER_IN_FETCH =
107         new StatDefinition("nUpperINsFetch",
108                            "Number of Upper INs (non-bottom internal nodes) " +
109                            "requested by btree operations. Can be used to " +
110                            "gauge cache hit/miss ratios.");
111 
112     /*
113      * Number of times IN.fetchIN() or IN.fetchINWithNoLatch() was called
114      * to fetch a BIN.
115      */
116     public static final StatDefinition BIN_FETCH =
117         new StatDefinition("nBINsFetch",
118                            "Number of BINs (bottom internal nodes) " +
119                            "requested by btree operations. Can be used " +
120                            "to gauge cache hit/miss ratios.");
121 
122     public static final StatDefinition LN_FETCH_MISS =
123         new StatDefinition("nLNsFetchMiss",
124                            "Number of LNs (data records) requested by " +
125                            "btree operations that were not in cache. Can be " +
126                            "used to gauge cache hit/miss ratios.");
127 
128     /*
129      * Number of times IN.fetchIN() or IN.fetchINWithNoLatch() was called
130      * to fetch a UIN and that UIN was not already cached.
131      */
132     public static final StatDefinition UPPER_IN_FETCH_MISS =
133         new StatDefinition("nUpperINsFetchMiss",
134                            "Number of Upper INs (non-bottom internal nodes) " +
135                            "requested by btree operations that were not in " +
136                            "cache. Can be used to gauge cache hit/miss " +
137                            "ratios.");
138 
139     /*
140      * Number of times IN.fetchIN() or IN.fetchINWithNoLatch() was called
141      * to fetch a BIN and that BIN was not already cached.
142      */
143     public static final StatDefinition BIN_FETCH_MISS =
144         new StatDefinition("nBINsFetchMiss",
145                            "Number of full BINs (bottom internal nodes) and " +
146                            "BIN-deltas fetched to satisfy btree operations. " +
147                            "Can be used to gauge cache hit/miss ratios.");
148 
149     /*
150      * BIN_FETCH_MISS / BIN_FETCH
151      */
152     public static final StatDefinition BIN_FETCH_MISS_RATIO =
153         new StatDefinition("nBINsFetchMissRatio",
154                            "The BIN fetch miss ratio " +
155                            "(nBINsFetchMiss / nBINsFetch)",
156                            StatType.CUMULATIVE);
157 
158     /*
159      * Number of times IN.fetchIN() or IN.fetchINWithNoLatch() was called
160      * to fetch a BIN, that BIN was not already cached, and a BIN-delta was
161      * fetched from disk.
162      */
163     public static final StatDefinition BIN_DELTA_FETCH_MISS =
164         new StatDefinition("nBINDeltasFetchMiss",
165                            "Number of BIN-deltas (partial BINs) " +
166                            "fetched to satisfy btree operations. Can " +
167                            "be used to gauge cache hit/miss ratios.");
168 
169     /*
170      * The number of operations performed blindly in BIN deltas
171      */
172     public static final StatDefinition BIN_DELTA_BLIND_OPS =
173         new StatDefinition("nBinDeltaBlindOps",
174                            "The number of operations performed blindly " +
175                            "in BIN deltas");
176 
177     /*
178      * Number of calls to BIN.mutateToFullBIN()
179      */
180     public static final StatDefinition FULL_BIN_MISS =
181         new StatDefinition("nFullBINsMiss",
182                            "Number of times a BIN-delta had to be mutated " +
183                            "to a full BIN (and as a result a full BIN had " +
184                            "to be read in from the log).");
185 
186 
187     /*
188      * The number of UINs in the memory-resident tree at the time the
189      * stats were collected. This is an INSTANT stat.
190      */
191     public static final StatDefinition CACHED_UPPER_INS =
192         new StatDefinition("nCachedUpperINs",
193                            "Number of upper INs (non-bottom internal nodes) " +
194                            "in cache. The cache holds INs and BINS, so this " +
195                            "indicates the proportion used by each type of " +
196                            "node. When used on shared environment caches, " +
197                            "will only be visible via " +
198                            "StatConfig.setFast(false)",
199                            StatType.CUMULATIVE);
200 
201     /*
202      * The number of BINs (full or deltas) in the memory-resident tree at the
203      * time the stats were collected. This is an INSTANT stat.
204      */
205     public static final StatDefinition CACHED_BINS =
206         new StatDefinition("nCachedBINs",
207                            "Number of BINs (bottom internal nodes) in cache. " +
208                            "The cache holds INs and BINS, so this indicates " +
209                            "the proportion used by each type of node. When " +
210                            "used on shared environment caches, will only be " +
211                            "visible via StatConfig.setFast(false)",
212                            StatType.CUMULATIVE);
213 
214     /*
215      * The number of delta-BINs in the memory-resident tree at the time the
216      * stats were collected. This is an INSTANT stat.
217      */
218     public static final StatDefinition CACHED_BIN_DELTAS =
219         new StatDefinition("nCachedBINDeltas",
220                            "Number of BIN-deltas (partial BINs) in cache. " +
221                            "This is a subset of the nCachedBINs value.",
222             StatType.CUMULATIVE);
223 
224     /*
225      * Number of eviction tasks that were submitted to the background evictor
226      * pool, but were refused because all eviction threads were busy.
227      */
228     public static final StatDefinition THREAD_UNAVAILABLE =
229         new StatDefinition("nThreadUnavailable",
230                            "Number of eviction tasks that were submitted " +
231                            "to the background evictor pool, " +
232                            "but were refused because all eviction threads " +
233                            "were busy. The user may want to change the size " +
234                            "of the evictor pool through the " +
235                            "je.evictor.*threads properties.");
236 
237     public static final StatDefinition CACHED_IN_SPARSE_TARGET =
238         new StatDefinition("nINSparseTarget",
239                            "Number of INs that use a compact sparse array " +
240                            "representation to point to child nodes " +
241                            "in the cache.",
242                            StatType.CUMULATIVE);
243 
244     public static final StatDefinition CACHED_IN_NO_TARGET =
245         new StatDefinition("nINNoTarget",
246                            "Number of INs that use a compact " +
247                            "representation when none of its child nodes are" +
248                            "in the cache.",
249                            StatType.CUMULATIVE);
250 
251     public static final StatDefinition CACHED_IN_COMPACT_KEY =
252         new StatDefinition("nINCompactKey",
253                            "Number of INs that use a compact key " +
254                            "representation to minimize the key object " +
255                            "representation overhead.",
256                            StatType.CUMULATIVE);
257 }
258