Documentation ¶
Index ¶
- Constants
- Variables
- func DimToString(dim int) string
- func ForeachRegionStats(f func(RWType, int, RegionStatKind))
- func StringToDim(name string) int
- type ActionType
- type RWType
- func (rw RWType) DefaultAntiCount() int
- func (rw RWType) GetLoadRates(deltaLoads []float64, interval uint64) []float64
- func (rw RWType) Inverse() RWType
- func (rw RWType) RegionStats() []RegionStatKind
- func (rw RWType) ReportInterval() int
- func (rw RWType) SetFullLoadRates(full []float64, loads []float64)
- func (rw RWType) String() string
- type RegionStatKind
- type SourceKind
- type StoreStatKind
- type TopN
- func (tn *TopN) Get(id uint64) TopNItem
- func (tn *TopN) GetAll() []TopNItem
- func (tn *TopN) GetAllTopN(k int) []TopNItem
- func (tn *TopN) GetTopNMin(k int) TopNItem
- func (tn *TopN) Len() int
- func (tn *TopN) Put(item TopNItem) (isUpdate bool)
- func (tn *TopN) Remove(id uint64) (item TopNItem)
- func (tn *TopN) RemoveExpired() []uint64
- type TopNItem
Constants ¶
const ( // RegionHeartBeatReportInterval indicates the interval between write interval, the value is the heartbeat report interval of a region. RegionHeartBeatReportInterval = 60 // StoreHeartBeatReportInterval indicates the interval between read stats report, the value is the heartbeat report interval of a store. StoreHeartBeatReportInterval = 10 // HotRegionAntiCount is default value for antiCount HotRegionAntiCount = 2 // DefaultAotSize is default size of average over time. DefaultAotSize = 1 // DefaultWriteMfSize is default size of write median filter. DefaultWriteMfSize = 5 // DefaultReadMfSize is default size of read median filter. DefaultReadMfSize = 5 )
const ( // BytePriority indicates hot-region-scheduler prefer byte dim BytePriority = "byte" // KeyPriority indicates hot-region-scheduler prefer key dim KeyPriority = "key" // QueryPriority indicates hot-region-scheduler prefer query dim QueryPriority = "query" )
const ( ByteDim int = iota KeyDim QueryDim DimLen )
Indicator dims.
Variables ¶
var MinHotThresholds = [RegionStatCount]float64{
RegionReadBytes: 8 * units.KiB,
RegionReadKeys: 128,
RegionReadQueryNum: 128,
RegionWriteBytes: 1 * units.KiB,
RegionWriteKeys: 32,
RegionWriteQueryNum: 32,
}
MinHotThresholds is the threshold at which this dimension is recorded as a hot spot.
Functions ¶
func ForeachRegionStats ¶
func ForeachRegionStats(f func(RWType, int, RegionStatKind))
ForeachRegionStats foreach all region stats of read and write.
Types ¶
type ActionType ¶
type ActionType int
ActionType indicates the action type for the stat item.
const ( Add ActionType = iota Remove Update ActionTypeLen )
Flags for action type.
func (ActionType) String ¶
func (t ActionType) String() string
type RWType ¶
type RWType int
RWType is a identify hot region types.
func (RWType) DefaultAntiCount ¶
DefaultAntiCount returns the default anti count of read or write.
func (RWType) GetLoadRates ¶
GetLoadRates gets the load rates of the read or write type.
func (RWType) RegionStats ¶
func (rw RWType) RegionStats() []RegionStatKind
RegionStats returns hot items according to kind
func (RWType) ReportInterval ¶
ReportInterval returns the report interval of read or write.
func (RWType) SetFullLoadRates ¶
SetFullLoadRates set load rates to full as read or write type.
type RegionStatKind ¶
type RegionStatKind int
RegionStatKind represents the statistics type of region.
const ( RegionReadBytes RegionStatKind = iota RegionReadKeys RegionReadQueryNum RegionWriteBytes RegionWriteKeys RegionWriteQueryNum RegionStatCount )
Different region statistics kinds.
func (RegionStatKind) String ¶
func (k RegionStatKind) String() string
type SourceKind ¶
type SourceKind int
SourceKind represents the statistics item source.
const ( Direct SourceKind = iota // there is a corresponding peer in this store. Inherit // there is no corresponding peer in this store and we need to copy from other stores. )
Different statistics item sources.
func (SourceKind) String ¶
func (k SourceKind) String() string
type StoreStatKind ¶
type StoreStatKind int
StoreStatKind represents the statistics type of store.
const ( StoreReadBytes StoreStatKind = iota StoreReadKeys StoreWriteBytes StoreWriteKeys StoreReadQuery StoreWriteQuery StoreCPUUsage StoreDiskReadRate StoreDiskWriteRate StoreRegionsWriteBytes // Same as StoreWriteBytes, but it is counted by RegionHeartbeat. StoreRegionsWriteKeys // Same as StoreWriteKeys, but it is counted by RegionHeartbeat. StoreStatCount )
Different store statistics kinds.
func (StoreStatKind) String ¶
func (k StoreStatKind) String() string
type TopN ¶
type TopN struct {
// contains filtered or unexported fields
}
TopN maintains the N largest items of multiple dimensions.
func NewTopN ¶
NewTopN returns a k-dimensional TopN with given TTL. NOTE: panic if k <= 0 or n <= 0.
func (*TopN) GetAllTopN ¶
GetAllTopN returns the top N items of the `k`th dimension.
func (*TopN) GetTopNMin ¶
GetTopNMin returns the min item in top N of the `k`th dimension.
func (*TopN) RemoveExpired ¶
RemoveExpired deletes all expired items.