bwmap

package
v1.16.0-pre.3 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 13 Imported by: 5

Documentation

Overview

Package bwmap represents the BPF map used to enforce Pod bandwidth limitations via EDT (Earliest Departure Time) + BPF. +groupName=maps

Index

Constants

View Source
const (
	MapName = "cilium_throttle"
	// Flow aggregate is per Pod, so same size as Endpoint map.
	MapSize = lxcmap.MaxEntries

	// DefaultDropHorizon represents maximum allowed departure
	// time delta in future. Given applications can set SO_TXTIME
	// from user space this is a limit to prevent buggy applications
	// to fill the FQ qdisc.
	DefaultDropHorizon = 2 * time.Second
)
View Source
const EdtTableName = "bandwidth-edts"

Variables

View Source
var Cell = cell.Module(
	"bwmap",
	"Manages the endpoint bandwidth limit BPF map",

	cell.Provide(
		NewEdtTable,
		statedb.RWTable[Edt].ToTable,
		newThrottleMap,
	),
	cell.ProvidePrivate(
		edtReconcilerConfig,
	),
	cell.Invoke(
		statedb.RegisterTable[Edt],
		registerReconciler,
		bpf.RegisterTablePressureMetricsJob[Edt, throttleMap],
	),
)

Cell manages the cilium_throttle BPF map for implementing per-endpoint bandwidth management. The cell provides RWTable[Edt] to which per endpoint bandwidth limits can be inserted. Use NewEdt to create the object. The table can be inspected with "cilium-dbg statedb bandwidth-edts". A reconciler is registered that reconciles the table with the cilium_throttle map.

View Source
var EdtIDIndex = statedb.Index[Edt, uint16]{
	Name: "endpoint-id",
	FromObject: func(t Edt) index.KeySet {
		return index.NewKeySet(index.Uint16(t.EndpointID))
	},
	FromKey: index.Uint16,
	Unique:  true,
}

Functions

func NewEdtTable

func NewEdtTable() (statedb.RWTable[Edt], error)

func ThrottleMap

func ThrottleMap() *bpf.Map

ThrottleMap constructs the cilium_throttle map. Direct use of this outside of this package is solely for cilium-dbg.

Types

type Edt

type Edt struct {
	// EndpointID is the identity of the endpoint being throttled.
	EndpointID uint16

	// BytesPerSecond is the bandwidth limit for the endpoint.
	BytesPerSecond uint64

	// TimeHorizonDrop is the maximum allowed departure time nanoseconds
	// delta in future.
	TimeHorizonDrop uint64

	// Status is the BPF map reconciliation status of this throttle entry.
	Status reconciler.Status
}

Edt is defines the "earliest departure time" pacing for a specific Cilium endpoint. This structure is stored in Table[Edt] and reconciled to the cilium_throttle BPF map.

Edt is stored by value as it's relatively tiny.

func NewEdt

func NewEdt(endpointID uint16, bytesPerSecond uint64) Edt

func (Edt) BinaryKey

func (e Edt) BinaryKey() encoding.BinaryMarshaler

func (Edt) BinaryValue

func (e Edt) BinaryValue() encoding.BinaryMarshaler

func (Edt) TableHeader

func (e Edt) TableHeader() []string

func (Edt) TableRow

func (e Edt) TableRow() []string

type EdtId

type EdtId struct {
	Id uint64 `align:"id"`
}

func (*EdtId) New

func (k *EdtId) New() bpf.MapKey

func (*EdtId) String

func (k *EdtId) String() string

type EdtInfo

type EdtInfo struct {
	Bps             uint64    `align:"bps"`
	TimeLast        uint64    `align:"t_last"`
	TimeHorizonDrop uint64    `align:"t_horizon_drop"`
	Pad             [4]uint64 `align:"pad"`
}

func (*EdtInfo) New

func (v *EdtInfo) New() bpf.MapValue

func (*EdtInfo) String

func (v *EdtInfo) String() string

Jump to

Keyboard shortcuts

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