accnt

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// metric cache.ops.metric.hit-full is how many metrics were hit fully (all needed chunks in cache)
	CacheMetricHitFull = stats.NewCounterRate32("cache.ops.metric.hit-full")

	// metric cache.ops.metric.hit-partial is how many metrics were hit partially (some of the needed chunks in cache, but not all)
	CacheMetricHitPartial = stats.NewCounterRate32("cache.ops.metric.hit-partial")

	// metric cache.ops.metric.miss is how many metrics were missed fully (no needed chunks in cache)
	CacheMetricMiss = stats.NewCounterRate32("cache.ops.metric.miss")

	// metric cache.ops.chunk.hit is how many chunks were hit
	CacheChunkHit = stats.NewCounter32("cache.ops.chunk.hit")

	// metric cache.ops.chunk.push-hot is how many chunks have been pushed into the cache because their metric is hot
	CacheChunkPushHot = stats.NewCounter32("cache.ops.chunk.push-hot")
)
View Source
var EventQSize = 100000

it's easily possible for many events to happen in one request, we never want this to fill up because otherwise events get dropped

Functions

This section is empty.

Types

type Accnt

type Accnt interface {
	GetEvictQ() chan *EvictTarget
	AddChunk(metric schema.AMKey, ts uint32, size uint64)
	AddChunks(metric schema.AMKey, chunks []chunk.IterGen)
	HitChunk(metric schema.AMKey, ts uint32)
	HitChunks(metric schema.AMKey, chunks []chunk.IterGen)
	DelMetric(metric schema.AMKey)
	Stop()
	Reset()
}

Accnt represents an instance of cache accounting. Currently there is only one implementation called `FlatAccnt`, but it could be replaced with alternative eviction algorithms in the future if they just implement this interface.

type AddPayload

type AddPayload struct {
	// contains filtered or unexported fields
}

payload to be sent with an add event

type AddsPayload

type AddsPayload struct {
	// contains filtered or unexported fields
}

payload to be sent with an add event

type DelMetPayload

type DelMetPayload struct {
	// contains filtered or unexported fields
}

payload to be sent with del metric event

type EvictTarget

type EvictTarget struct {
	Metric schema.AMKey
	Ts     uint32
}

EvictTarget is the definition of a chunk that should be evicted.

type FlatAccnt

type FlatAccnt struct {
	// contains filtered or unexported fields
}

FlatAccnt implements Flat accounting. Keeps track of the chunk cache size and in which order the contained chunks have been used to last time. If it detects that the total cache size is above the given limit, it feeds the least recently used cache chunks into the evict queue, which will get consumed by the evict loop.

func NewFlatAccnt

func NewFlatAccnt(maxSize uint64) *FlatAccnt

func (*FlatAccnt) AddChunk

func (a *FlatAccnt) AddChunk(metric schema.AMKey, ts uint32, size uint64)

func (*FlatAccnt) AddChunks

func (a *FlatAccnt) AddChunks(metric schema.AMKey, chunks []chunk.IterGen)

func (*FlatAccnt) DelMetric

func (a *FlatAccnt) DelMetric(metric schema.AMKey)

func (*FlatAccnt) GetEvictQ

func (a *FlatAccnt) GetEvictQ() chan *EvictTarget

func (*FlatAccnt) GetTotal

func (a *FlatAccnt) GetTotal() uint64

func (*FlatAccnt) HitChunk

func (a *FlatAccnt) HitChunk(metric schema.AMKey, ts uint32)

func (*FlatAccnt) HitChunks

func (a *FlatAccnt) HitChunks(metric schema.AMKey, chunks []chunk.IterGen)

func (*FlatAccnt) Reset

func (a *FlatAccnt) Reset()

func (*FlatAccnt) Stop

func (a *FlatAccnt) Stop()

type FlatAccntEvent

type FlatAccntEvent struct {
	// contains filtered or unexported fields
}

type FlatAccntMet

type FlatAccntMet struct {
	// contains filtered or unexported fields
}

type GetTotalPayload

type GetTotalPayload struct {
	// contains filtered or unexported fields
}

payload to be sent with a get total request event

type HitPayload

type HitPayload struct {
	// contains filtered or unexported fields
}

payload to be sent with a hit event

type HitsPayload

type HitsPayload struct {
	// contains filtered or unexported fields
}

payload to be sent with a hits event

type LRU

type LRU struct {
	// contains filtered or unexported fields
}

func NewLRU

func NewLRU() *LRU

type Uint32Asc

type Uint32Asc []uint32

func (Uint32Asc) Len

func (su Uint32Asc) Len() int

func (Uint32Asc) Less

func (su Uint32Asc) Less(i, j int) bool

func (Uint32Asc) Swap

func (su Uint32Asc) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL