001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.regionserver; 019 020import org.apache.hadoop.hbase.metrics.BaseSource; 021import org.apache.yetus.audience.InterfaceAudience; 022 023/** 024 * This interface will be implemented by a MetricsSource that will export metrics from 025 * HeapMemoryManager in RegionServer into the hadoop metrics system. 026 */ 027@InterfaceAudience.Private 028public interface MetricsHeapMemoryManagerSource extends BaseSource { 029 /** 030 * The name of the metrics 031 */ 032 String METRICS_NAME = "Memory"; 033 034 /** 035 * The name of the metrics context that metrics will be under. 036 */ 037 String METRICS_CONTEXT = "regionserver"; 038 039 /** 040 * Description 041 */ 042 String METRICS_DESCRIPTION = "Metrics about HBase RegionServer's memory"; 043 044 /** 045 * The name of the metrics context that metrics will be under in jmx 046 */ 047 String METRICS_JMX_CONTEXT = "RegionServer,sub=" + METRICS_NAME; 048 049 /** 050 * Update/Set the blocked flush count histogram/gauge 051 * @param blockedFlushCount the number of blocked flush since last tuning. 052 */ 053 void updateBlockedFlushCount(long blockedFlushCount); 054 055 /** 056 * Update/Set the unblocked flush count histogram/gauge 057 * @param unblockedFlushCount the number of unblocked flush since last tuning. 058 */ 059 void updateUnblockedFlushCount(long unblockedFlushCount); 060 061 /** 062 * Set the current blockcache size used gauge 063 * @param blockCacheSize the current memory usage in blockcache, in bytes. 064 */ 065 void setCurBlockCacheSizeGauge(long blockCacheSize); 066 067 /** 068 * Set the current global memstore size used gauge 069 * @param memStoreSize the current memory usage in memstore, in bytes. 070 */ 071 void setCurMemStoreSizeGauge(long memStoreSize); 072 073 /** 074 * Set the current global memstore on-heap size used gauge 075 * @param memStoreOnHeapSize the current memory usage in memstore on-heap, in bytes. 076 */ 077 void setCurMemStoreOnHeapSizeGauge(long memStoreOnHeapSize); 078 079 /** 080 * Set the current global memstore off-heap size used gauge 081 * @param memStoreOffHeapSize the current memory usage in memstore off-heap, in bytes. 082 */ 083 void setCurMemStoreOffHeapSizeGauge(long memStoreOffHeapSize); 084 085 /** 086 * Update the increase/decrease memstore size histogram 087 * @param memStoreDeltaSize the tuning result of memstore. 088 */ 089 void updateMemStoreDeltaSizeHistogram(int memStoreDeltaSize); 090 091 /** 092 * Update the increase/decrease blockcache size histogram 093 * @param blockCacheDeltaSize the tuning result of blockcache. 094 */ 095 void updateBlockCacheDeltaSizeHistogram(int blockCacheDeltaSize); 096 097 /** 098 * Increase the counter for tuner neither expanding memstore global size limit nor expanding 099 * blockcache max size. 100 */ 101 void increaseTunerDoNothingCounter(); 102 103 /** 104 * Increase the counter for heap occupancy percent above low watermark 105 */ 106 void increaseAboveHeapOccupancyLowWatermarkCounter(); 107 108 // Histograms 109 String BLOCKED_FLUSH_NAME = "blockedFlushes"; 110 String BLOCKED_FLUSH_DESC = "Histogram for the number of blocked flushes in the memstore"; 111 String UNBLOCKED_FLUSH_NAME = "unblockedFlushes"; 112 String UNBLOCKED_FLUSH_DESC = "Histogram for the number of unblocked flushes in the memstore"; 113 String INC_MEMSTORE_TUNING_NAME = "increaseMemStoreSize"; 114 String INC_MEMSTORE_TUNING_DESC = 115 "Histogram for the heap memory tuner expanding memstore global size limit in bytes"; 116 String DEC_MEMSTORE_TUNING_NAME = "decreaseMemStoreSize"; 117 String DEC_MEMSTORE_TUNING_DESC = 118 "Histogram for the heap memory tuner shrinking memstore global size limit in bytes"; 119 String INC_BLOCKCACHE_TUNING_NAME = "increaseBlockCacheSize"; 120 String INC_BLOCKCACHE_TUNING_DESC = 121 "Histogram for the heap memory tuner expanding blockcache max heap size in bytes"; 122 String DEC_BLOCKCACHE_TUNING_NAME = "decreaseBlockCacheSize"; 123 String DEC_BLOCKCACHE_TUNING_DESC = 124 "Histogram for the heap memory tuner shrinking blockcache max heap size in bytes"; 125 126 // Gauges 127 String BLOCKED_FLUSH_GAUGE_NAME = "blockedFlushGauge"; 128 String BLOCKED_FLUSH_GAUGE_DESC = "Gauge for the blocked flush count before tuning"; 129 String UNBLOCKED_FLUSH_GAUGE_NAME = "unblockedFlushGauge"; 130 String UNBLOCKED_FLUSH_GAUGE_DESC = "Gauge for the unblocked flush count before tuning"; 131 String MEMSTORE_SIZE_GAUGE_NAME = "memStoreSize"; 132 String MEMSTORE_SIZE_GAUGE_DESC = "Global MemStore used in bytes by the RegionServer"; 133 String MEMSTORE_ONHEAP_SIZE_GAUGE_NAME = "memStoreOnHeapSize"; 134 String MEMSTORE_ONHEAP_SIZE_GAUGE_DESC = 135 "Global MemStore On-heap size in bytes by the RegionServer"; 136 String MEMSTORE_OFFHEAP_SIZE_GAUGE_NAME = "memStoreOffHeapSize"; 137 String MEMSTORE_OFFHEAP_SIZE_GAUGE_DESC = 138 "Global MemStore Off-heap size in bytes by the RegionServer"; 139 140 String BLOCKCACHE_SIZE_GAUGE_NAME = "blockCacheSize"; 141 String BLOCKCACHE_SIZE_GAUGE_DESC = "BlockCache used in bytes by the RegionServer"; 142 143 // Counters 144 String DO_NOTHING_COUNTER_NAME = "tunerDoNothingCounter"; 145 String DO_NOTHING_COUNTER_DESC = 146 "The number of times that tuner neither expands memstore global size limit nor expands " 147 + "blockcache max size"; 148 String ABOVE_HEAP_LOW_WATERMARK_COUNTER_NAME = "aboveHeapOccupancyLowWaterMarkCounter"; 149 String ABOVE_HEAP_LOW_WATERMARK_COUNTER_DESC = 150 "The number of times that heap occupancy percent is above low watermark"; 151}