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