common

package
v0.0.0-...-29de4e1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FunctionNamePrefix      = "trace-func"
	OneSecondInMicroseconds = 1_000_000.0
)
View Source
const (
	// MinExecTimeMilli 1ms (min. billing unit of AWS)
	MinExecTimeMilli = 1

	// MaxExecTimeMilli 60s (avg. p96 from Wild)
	MaxExecTimeMilli = 60e3
)
View Source
const (
	// MaxMemQuotaMib Number taken from AWS Lambda settings
	// https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html#configuration-memory-console
	MaxMemQuotaMib = 10_240
	MinMemQuotaMib = 1

	// OvercommitmentRatio Machine overcommitment ratio to provide to CPU requests in YAML specification.
	// Value taken from the Firecracker NSDI'20 paper.
	OvercommitmentRatio = 10
)
View Source
const (
	// RequestedVsIssuedWarnThreshold Print warning on stdout if the relative difference between requested
	// and issued number of invocations is higher than this threshold
	RequestedVsIssuedWarnThreshold = 0.1
	// RequestedVsIssuedTerminateThreshold Terminate experiment if the relative difference between
	// requested and issued number of invocations is higher than this threshold
	RequestedVsIssuedTerminateThreshold = 0.2

	// FailedWarnThreshold Print warning on stdout if the percentage of failed invocations (e.g., connection timeouts,
	// function timeouts) is greater than this threshold
	FailedWarnThreshold = 0.3
	// FailedTerminateThreshold Terminate experiment if the percentage of failed invocations (e.g., connection timeouts,
	// function timeouts) is greater than this threshold
	FailedTerminateThreshold = 0.5
)
View Source
const (
	AwsRegion                  = "us-east-1"
	AwsTraceFuncRepositoryName = "invitro_trace_function_aws"
)
View Source
const (
	CPULimit1vCPU string = "1vCPU"
	CPULimitGCP   string = "GCP"
)

CPULimits

View Source
const (
	// ContainerImageSizeMB was chosen as a median of the container physical memory usage.
	// Allocate this much less memory inside the actual function.
	ContainerImageSizeMB = 15

	ExecUnit int = 1e2
)

Variables

View Source
var ValidCPULimits = []string{CPULimit1vCPU, CPULimitGCP}

Functions

func B2Kib

func B2Kib(numB uint32) uint32

func Check

func Check(e error)

func CheckCPULimit

func CheckCPULimit(cpuLimit string)

func CheckNode

func CheckNode(node string)

func CheckPath

func CheckPath(path string)

func DeepCopy

func DeepCopy[T any](a T) (T, error)

func GetName

func GetName(function *Function) int

func Hash

func Hash(s string) uint64

func Hex2Int

func Hex2Int(hexStr string) int64

func IsValidIP

func IsValidIP(ip string) bool

func Kib2Mib

func Kib2Mib(numB uint32) uint32

func MaxOf

func MaxOf(vars ...int) int

func Mib2Kib

func Mib2Kib(numMb uint32) uint32

func Mib2b

func Mib2b(numMb uint32) uint32

func MinOf

func MinOf(vars ...int) int

func ParseLogMessage

func ParseLogMessage(logString string) string

func ParseLogType

func ParseLogType(logString string) string

func RandBool

func RandBool() bool

func RandIntBetween

func RandIntBetween(min, max int) int

func RunScript

func RunScript(command string)

func SumNumberOfInvocations

func SumNumberOfInvocations(withWarmup bool, totalDuration int, functions []*Function) int

func TraceFunctionExecution

func TraceFunctionExecution(start time.Time, IterationsMultiplier uint32, timeLeftMilliseconds uint32) (msg string)

Types

type DirigentMetadata

type DirigentMetadata struct {
	HashFunction        string   `json:"HashFunction"`
	Image               string   `json:"Image"`
	Port                int      `json:"Port"`
	Protocol            string   `json:"Protocol"`
	ScalingUpperBound   int      `json:"ScalingUpperBound"`
	ScalingLowerBound   int      `json:"ScalingLowerBound"`
	IterationMultiplier int      `json:"IterationMultiplier"`
	IOPercentage        int      `json:"IOPercentage"`
	EnvVars             []string `json:"EnvVars"`
	ProgramArgs         []string `json:"ProgramArgs"`
}

type ExperimentPhase

type ExperimentPhase int
const (
	WarmupPhase    ExperimentPhase = 1
	ExecutionPhase ExperimentPhase = 2
)

type Function

type Function struct {
	Name     string
	Endpoint string

	// From the static trace profiler
	InitialScale int
	// From the trace
	InvocationStats  *FunctionInvocationStats
	RuntimeStats     *FunctionRuntimeStats
	MemoryStats      *FunctionMemoryStats
	DirigentMetadata *DirigentMetadata

	ColdStartBusyLoopMs int

	CPURequestsMilli  int
	MemoryRequestsMiB int
	CPULimitsMilli    int

	Specification *FunctionSpecification
}

type FunctionInvocationStats

type FunctionInvocationStats struct {
	HashOwner    string
	HashApp      string
	HashFunction string
	Trigger      string

	Invocations []int
}

type FunctionMemoryStats

type FunctionMemoryStats struct {
	HashOwner    string `csv:"HashOwner"`
	HashApp      string `csv:"HashApp"`
	HashFunction string `csv:"HashFunction"`

	Count   float64 `csv:"SampleCount"`
	Average float64 `csv:"AverageAllocatedMb"`

	Percentile1   float64 `csv:"AverageAllocatedMb_pct1"`
	Percentile5   float64 `csv:"AverageAllocatedMb_pct5"`
	Percentile25  float64 `csv:"AverageAllocatedMb_pct25"`
	Percentile50  float64 `csv:"AverageAllocatedMb_pct50"`
	Percentile75  float64 `csv:"AverageAllocatedMb_pct75"`
	Percentile95  float64 `csv:"AverageAllocatedMb_pct95"`
	Percentile99  float64 `csv:"AverageAllocatedMb_pct99"`
	Percentile100 float64 `csv:"AverageAllocatedMb_pct100"`
}

type FunctionRuntimeStats

type FunctionRuntimeStats struct {
	HashOwner    string `csv:"HashOwner"`
	HashApp      string `csv:"HashApp"`
	HashFunction string `csv:"HashFunction"`

	Average float64 `csv:"Average"`
	Count   float64 `csv:"Count"`
	Minimum float64 `csv:"Minimum"`
	Maximum float64 `csv:"Maximum"`

	Percentile0   float64 `csv:"percentile_Average_0"`
	Percentile1   float64 `csv:"percentile_Average_1"`
	Percentile25  float64 `csv:"percentile_Average_25"`
	Percentile50  float64 `csv:"percentile_Average_50"`
	Percentile75  float64 `csv:"percentile_Average_75"`
	Percentile99  float64 `csv:"percentile_Average_99"`
	Percentile100 float64 `csv:"percentile_Average_100"`
}

type FunctionSpecification

type FunctionSpecification struct {
	IAT                  IATArray                  `json:"IAT"`
	PerMinuteCount       []int                     `json:"PerMinuteCount"`
	RawDuration          ProbabilisticDuration     `json:"RawDuration"`
	RuntimeSpecification RuntimeSpecificationArray `json:"RuntimeSpecification"`
}

type IATArray

type IATArray []float64

IATArray Hold the IATs of invocations for a particular function. Values in this array tells individual function driver how much time to sleep before firing an invocation. First invocations should be fired right away after the start of experiment, i.e., should typically have a IAT of 0.

type IatDistribution

type IatDistribution int
const (
	Exponential IatDistribution = iota
	Uniform
	Equidistant
)

type Interval

type Interval[T comparable] struct {
	Start T
	End   T
	Value T
}

type IntervalSearch

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

func NewIntervalSearch

func NewIntervalSearch(data []int) *IntervalSearch

func (*IntervalSearch) SearchInterval

func (si *IntervalSearch) SearchInterval(val int) *Interval[int]

type LockFreeQueue

type LockFreeQueue[T any] struct {
	// contains filtered or unexported fields
}

LockFreeQueue reference implementation from The Art of Multiprocessor Programming pg. 236

func NewLockFreeQueue

func NewLockFreeQueue[T any]() *LockFreeQueue[T]

func (*LockFreeQueue[T]) Dequeue

func (lfq *LockFreeQueue[T]) Dequeue() T

func (*LockFreeQueue[T]) Enqueue

func (lfq *LockFreeQueue[T]) Enqueue(item T)

func (*LockFreeQueue[T]) Length

func (lfq *LockFreeQueue[T]) Length() int

type Node

type Node struct {
	Function *Function
	Branches []*list.List
	Depth    int
	DAG      string
}

type Pair

type Pair struct {
	Key   interface{}
	Value int
}

type PairList

type PairList []Pair

func (PairList) Len

func (p PairList) Len() int

func (PairList) Less

func (p PairList) Less(i, j int) bool

func (PairList) Swap

func (p PairList) Swap(i, j int)

type ProbabilisticDuration

type ProbabilisticDuration []float64

ProbabilisticDuration used for testing the exponential distribution

type RuntimeAssertType

type RuntimeAssertType int
const (
	RequestedVsIssued RuntimeAssertType = 0
	IssuedVsFailed    RuntimeAssertType = 1
)

type RuntimeSpecification

type RuntimeSpecification struct {
	Runtime int
	Memory  int
}

type RuntimeSpecificationArray

type RuntimeSpecificationArray []RuntimeSpecification

type TraceGranularity

type TraceGranularity int
const (
	MinuteGranularity TraceGranularity = iota
	SecondGranularity
)

Jump to

Keyboard shortcuts

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