derivation

package
v0.0.0-...-0701c2b Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BilledTime

func BilledTime(timeStart time.Time, timeEnd time.Time, unit string) float64

Calculate detlta time for a time window

func ComputePolicyCost

func ComputePolicyCost(policy types.Policy, billingUnit string, mapVMProfiles map[string]types.VmProfile) float64

Compute the total cost for a given policy It takes into account the billing unit according to the pricing model

func ComputePolicyMetrics

func ComputePolicyMetrics(scalingActions *[]types.ScalingAction, forecast []types.ForecastedValue,
	sysConfiguration util.SystemConfiguration, mapVMProfiles map[string]types.VmProfile) (types.PolicyMetrics, map[string]bool)

Compute the metrics related to the policy and its scaling actions

func DeltaVMSet

func DeltaVMSet(current types.VMScale, candidate types.VMScale) (types.VMScale, types.VMScale)
 compare the changes (vms added, vms removed) from one VM set to a candidate VM set
	in:
		@current	- Map with current VM cluster
		@candidate	- Map with candidate VM cluster
	out:
		@VMScale	- Map with VM cluster of the VMs that were added into the candidate VM set
		@VMScale	- Map with VM cluster of the VMs that were removed from the candidate VM set

func Drucken

func Drucken(n *Node, level int)

func MapKeysToString

func MapKeysToString(keys map[string]bool) string

func Policies

func Policies(sortedVMProfiles []types.VmProfile, sysConfiguration util.SystemConfiguration, forecast types.Forecast) ([]types.Policy, error)
 Derive scaling policies
	in:
		@poiList []types.PoI
		@values []float64
		@times [] time.Time
		@sortedVMProfiles []VmProfile
		@sysConfiguration SystemConfiguration
	out:
		@[]types.Policy

func SelectPolicy

func SelectPolicy(policies *[]types.Policy, sysConfig util.SystemConfiguration, vmProfiles []types.VmProfile, forecast types.Forecast) (types.Policy, error)

Evaluates and select the most suitable policy for the given system configurations and forecast

 in:
	@policies *[]types.Policy
				- List of derived policies
	@sysConfig config.SystemConfiguration
				- Configuration specified by the user in the config file
	@vmProfiles []types.VmProfile
				- List of virtual machines profiles
	@forecast types.Forecast
				- Forecast of the expected load
 out:
	@types.Policy
			- Selected policy
	@error
			- Error in case of any

func VMListToMap

func VMListToMap(listVMProfiles []types.VmProfile) map[string]types.VmProfile
 Build a map taking as input a list
	in:
		@listVMProfiles
	out:
		@map[string]types.VmProfile

Types

type AlwaysResizePolicy

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

func (AlwaysResizePolicy) CreatePolicies

func (p AlwaysResizePolicy) CreatePolicies(processedForecast types.ProcessedForecast) []types.Policy
 Derive a list of policies using the best homogeneous cluster, change of type is possible
	in:
		@processedForecast
		@serviceProfile
	out:
		[] Policy. List of type Policy

func (AlwaysResizePolicy) FindSuitableVMs

func (p AlwaysResizePolicy) FindSuitableVMs(numberReplicas int, limits types.Limit) (types.VMScale, error)

Calculate VM set able to host the required number of replicas

 in:
	@numberReplicas = Amount of replicas that should be hosted
	@limits = Resources (CPU, Memory) constraints to configure the containers.
 out:
	@VMScale with the suggested number of VMs for that type

type BestResourcePairPolicy

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

After each change in the workload it calculates the number of VMs of a predefined size needed Repeat the process for all the vm types available

func (BestResourcePairPolicy) CreatePolicies

func (p BestResourcePairPolicy) CreatePolicies(processedForecast types.ProcessedForecast) []types.Policy
 Derive a list of policies using the Best Instance Approach approach
	in:
		@processedForecast
		@serviceProfile
	out:
		[] Policy. List of type Policy

func (BestResourcePairPolicy) FindSuitableVMs

func (p BestResourcePairPolicy) FindSuitableVMs(numberReplicas int, resourcesLimit types.Limit, vmType string) (types.VMScale, error)

Calculate VM set able to host the required number of replicas

 in:
	@numberReplicas = Amount of replicas that should be hosted
	@resourcesLimit = Resources (CPU, Memory) constraints to configure the containers.
 out:
	@VMScale with the suggested number of VMs for that type

type DeltaLoadPolicy

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

Constructs different VM clusters to add resources every time the workload increases in a factor of deltaLoad.

func (DeltaLoadPolicy) CreatePolicies

func (p DeltaLoadPolicy) CreatePolicies(processedForecast types.ProcessedForecast) []types.Policy
 Derive a list of policies using this approach
	in:
		@processedForecast
	out:
		[] Policy. List of type Policy

func (DeltaLoadPolicy) FindSuitableVMs

func (p DeltaLoadPolicy) FindSuitableVMs(numberReplicas int, limits types.Limit) types.VMScale

Calculate VM set able to host the required number of replicas

 in:
	@numberReplicas = Amount of replicas that should be hosted
	@limits = Resources (CPU, Memory) constraints to configure the containers.
 out:
	@VMScale with the suggested number of VMs for that type

type MSCProfile

type MSCProfile struct {
	ResourceLimits types.Limit
	NumberReplicas int
	MSC            float64
}

type NaivePolicy

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

It assumes that the current VM set where the microservice is deployed is a homogeneous set Based on the unique VM type and its capacity to host a number of replicas it increases or decreases the number of VMs

func (NaivePolicy) CreatePolicies

func (p NaivePolicy) CreatePolicies(processedForecast types.ProcessedForecast) []types.Policy
 Derive a list of policies using the Naive approach
	in:
		@processedForecast
		@serviceProfile
	out:
		[] Policy. List of type Policy

func (NaivePolicy) FindSuitableVMs

func (p NaivePolicy) FindSuitableVMs(numberPods int, limits types.Limit) types.VMScale

Calculate VM set able to host the required number of replicas

 in:
	@numberPods = Amount of pods that should be hosted
	@limits = Resources (CPU, Memory) constraints to configure the containers.
 out:
	@VMScale with the suggested number of VMs for that type

type Node

type Node struct {
	NReplicas int
	// contains filtered or unexported fields
}

Node that represents a candidate option to scale

type PolicyDerivation

type PolicyDerivation interface {
	CreatePolicies(processedForecast types.ProcessedForecast) []types.Policy
	FindSuitableVMs(numberReplicas int, limits types.Limit) types.VMScale
}

Interface for strategies of how to scale

type ResizeWhenBeneficialPolicy

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

After each change in the workload it calculates the number of VMs of a predefined size needed Repeat the process for all the vm types available

func (ResizeWhenBeneficialPolicy) CreatePolicies

func (p ResizeWhenBeneficialPolicy) CreatePolicies(processedForecast types.ProcessedForecast) []types.Policy
 Derive a list of policies
   Add vmSet to handle delta load and compare the reconfiguration cost against the vmSet
   optimized for a total load.
	in:
		@processedForecast
		@serviceProfile
	out:
		[] Policy. List of type Policy

func (ResizeWhenBeneficialPolicy) FindSuitableVMs

func (p ResizeWhenBeneficialPolicy) FindSuitableVMs(numberReplicas int, resourceLimits types.Limit) types.VMScale

Calculate VM set able to host the required number of replicas

 in:
	@numberReplicas = Amount of replicas that should be hosted
	@resourceLimits = Resources (CPU, Memory) constraints to configure the containers.
 out:
	@VMScale with the suggested number of VMs

type Tree

type Tree struct {
	Root *Node
}

Tree structure used to create different combinations of VM types

Jump to

Keyboard shortcuts

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