qos

package
v0.0.0-...-303e327 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxIops      = 1000 * 1000 // 1000k
	MaxBandwidth = 2 << 30     // 1GB/s
)

Variables

View Source
var ErrWrongConfig = errors.New("qos: wrong config item")

Functions

func NewLevelQos

func NewLevelQos(threshold *Threshold, diskStat iostat.IOViewer) *levelQos

Types

type Config

type Config struct {
	DiskBandwidthMBPS int64           `json:"disk_bandwidth_MBPS"`
	DiskIOPS          int64           `json:"disk_iops"`
	LevelConfigs      LevelConfig     `json:"flow_conf"`
	DiskViewer        iostat.IOViewer `json:"-"`
	StatGetter        flow.StatGetter `json:"-"`
}

type IOQos

type IOQos struct {
	LevelMgr LevelGetter     // Identify: a level qos controller
	StatMgr  flow.StatGetter // Identify: a io flow
}

func (*IOQos) GetLevelMgr

func (qos *IOQos) GetLevelMgr() LevelGetter

func (*IOQos) Reader

func (qos *IOQos) Reader(ctx context.Context, ioType bnapi.IOType, reader io.Reader) (r io.Reader)

func (*IOQos) ReaderAt

func (qos *IOQos) ReaderAt(ctx context.Context, ioType bnapi.IOType, reader io.ReaderAt) (r io.ReaderAt)

func (*IOQos) Writer

func (qos *IOQos) Writer(ctx context.Context, ioType bnapi.IOType, writer io.Writer) (w io.Writer)

func (*IOQos) WriterAt

func (qos *IOQos) WriterAt(ctx context.Context, ioType bnapi.IOType, writer io.WriterAt) (w io.WriterAt)

type LevelConfig

type LevelConfig map[string]ParaConfig

type LevelGetter

type LevelGetter interface {
	GetLevel(priority.Priority) LevelQos
}

type LevelManager

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

Manage multiple level qos controllers Note: controllers that are not configured, nil

func NewLevelQosMgr

func NewLevelQosMgr(conf Config, diskStat iostat.IOViewer) (*LevelManager, error)

func (*LevelManager) GetLevel

func (mgr *LevelManager) GetLevel(pri priority.Priority) LevelQos

get the controller of the specified priority

type LevelQos

type LevelQos interface {
	Writer(ctx context.Context, underlying io.Writer) io.Writer
	WriterAt(ctx context.Context, underlying io.WriterAt) io.WriterAt
	Reader(ctx context.Context, underlying io.Reader) io.Reader
	ReaderAt(ctx context.Context, underlying io.ReaderAt) io.ReaderAt
	ChangeLevelQos(level string, conf Config)
}

qos controller. controlling two dimensions: - iopsLimiter - bpsLimiter

type ParaConfig

type ParaConfig struct {
	Iops      int64   `json:"iops"`
	Bandwidth int64   `json:"bandwidth_MBPS"`
	Factor    float64 `json:"factor"`
}

func InitAndFixParaConfig

func InitAndFixParaConfig(raw ParaConfig) (para ParaConfig, err error)

type Qos

func NewQosManager

func NewQosManager(conf Config) (Qos, error)

type Threshold

type Threshold struct {
	sync.RWMutex
	ParaConfig
	DiskBandwidth int64
	DiskIOPS      int64
}

Jump to

Keyboard shortcuts

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