spd

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 30 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PerformanceLevelUnknown PerformanceLevel = -1
	PerformanceLevelPerfect PerformanceLevel = 0
	PerformanceLevelGood    PerformanceLevel = 1
	PerformanceLevelPoor    PerformanceLevel = 2

	MaxPerformanceScore float64 = 100
	MinPerformanceScore float64 = 0
)

Variables

This section is empty.

Functions

func GetContainerMemoryBandwidthRequest added in v0.4.1

func GetContainerMemoryBandwidthRequest(profilingManager ServiceProfilingManager, podMeta metav1.ObjectMeta, cpuRequest int) (int, error)

GetContainerMemoryBandwidthRequest gets the memory bandwidth request for pod with given cpu request

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Cache is spd cache stores current

func NewSPDCache

func NewSPDCache(manager checkpointmanager.CheckpointManager, skipCorruptionError bool,
	cacheTTL, expiredTime time.Duration, maxRetryCount int64, jitterFactor float64) (*Cache, error)

func (*Cache) DeleteSPD

func (s *Cache) DeleteSPD(key string) error

DeleteSPD delete target spd by namespace/name key

func (*Cache) GetNextFetchRemoteTime added in v0.4.0

func (s *Cache) GetNextFetchRemoteTime(key string, now time.Time, skipBackoff bool) time.Time

GetNextFetchRemoteTime get next fetch remote spd timestamp

func (*Cache) GetSPD

func (s *Cache) GetSPD(key string, updateLastGetTime bool) *workloadapis.ServiceProfileDescriptor

GetSPD gets target spd by namespace/name key

func (*Cache) ListAllSPDKeys added in v0.4.0

func (s *Cache) ListAllSPDKeys() []string

ListAllSPDKeys list all spd key

func (*Cache) Run

func (s *Cache) Run(ctx context.Context)

Run to clear local unused spd

func (*Cache) SetLastFetchRemoteTime

func (s *Cache) SetLastFetchRemoteTime(key string, t time.Time)

SetLastFetchRemoteTime set last fetch remote spd timestamp

func (*Cache) SetSPD

SetSPD set target spd to cache and checkpoint

type DummyPodServiceProfile added in v0.3.0

type DummyPodServiceProfile struct {
	PerformanceLevel PerformanceLevel
	Score            float64
	AggregatedMetric *resource.Quantity
}

type DummySPDFetcher added in v0.4.1

type DummySPDFetcher struct {
	SPD *workloadapis.ServiceProfileDescriptor
}

func (DummySPDFetcher) GetSPD added in v0.4.1

func (DummySPDFetcher) Run added in v0.4.1

func (d DummySPDFetcher) Run(_ context.Context)

type DummyServiceProfilingManager

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

func NewDummyServiceProfilingManager added in v0.3.0

func NewDummyServiceProfilingManager(podProfiles map[types.UID]DummyPodServiceProfile) *DummyServiceProfilingManager

func (*DummyServiceProfilingManager) Run

func (*DummyServiceProfilingManager) ServiceAggregateMetrics added in v0.4.1

func (*DummyServiceProfilingManager) ServiceBaseline added in v0.4.0

func (*DummyServiceProfilingManager) ServiceBusinessPerformanceLevel

func (d *DummyServiceProfilingManager) ServiceBusinessPerformanceLevel(_ context.Context, podMeta metav1.ObjectMeta) (PerformanceLevel, error)

func (*DummyServiceProfilingManager) ServiceBusinessPerformanceScore

func (d *DummyServiceProfilingManager) ServiceBusinessPerformanceScore(_ context.Context, podMeta metav1.ObjectMeta) (float64, error)

func (*DummyServiceProfilingManager) ServiceExtendedIndicator added in v0.4.1

func (d *DummyServiceProfilingManager) ServiceExtendedIndicator(_ context.Context, _ metav1.ObjectMeta, _ interface{}) (bool, error)

func (*DummyServiceProfilingManager) ServiceSystemPerformanceTarget added in v0.3.0

func (d *DummyServiceProfilingManager) ServiceSystemPerformanceTarget(_ context.Context, _ metav1.ObjectMeta) (IndicatorTarget, error)

type GetPodSPDNameFunc

type GetPodSPDNameFunc func(_ metav1.ObjectMeta) (string, error)

type IndicatorTarget added in v0.3.0

type IndicatorTarget map[string]util.IndicatorTarget

type PerformanceLevel

type PerformanceLevel int

PerformanceLevel is an enumeration type, the smaller the positive value, the better the performance

type SPDFetcher

type SPDFetcher interface {
	// GetSPD get spd for given pod
	GetSPD(ctx context.Context, podMeta metav1.ObjectMeta) (*workloadapis.ServiceProfileDescriptor, error)

	// Run async loop to clear unused spd
	Run(ctx context.Context)
}

func NewSPDFetcher

func NewSPDFetcher(clientSet *client.GenericClientSet, emitter metrics.MetricEmitter,
	cncFetcher cnc.CNCFetcher, conf *pkgconfig.Configuration) (SPDFetcher, error)

NewSPDFetcher creates a spd manager to implement SPDFetcher

type ServiceProfilingManager

type ServiceProfilingManager interface {
	// ServiceBusinessPerformanceLevel returns the service business performance level for the given pod
	ServiceBusinessPerformanceLevel(ctx context.Context, podMeta metav1.ObjectMeta) (PerformanceLevel, error)

	// ServiceBusinessPerformanceScore returns the service business performance score for the given pod
	// The score is in range [MinPerformanceScore, MaxPerformanceScore]
	ServiceBusinessPerformanceScore(ctx context.Context, podMeta metav1.ObjectMeta) (float64, error)

	// ServiceSystemPerformanceTarget returns the system performance target for the given pod
	ServiceSystemPerformanceTarget(ctx context.Context, podMeta metav1.ObjectMeta) (IndicatorTarget, error)

	// ServiceBaseline returns whether this pod is baseline
	ServiceBaseline(ctx context.Context, podMeta metav1.ObjectMeta) (bool, error)

	// ServiceExtendedIndicator load the extended indicators and return whether the pod is baseline for the extended indicators
	ServiceExtendedIndicator(ctx context.Context, podMeta metav1.ObjectMeta, indicators interface{}) (bool, error)

	// ServiceAggregateMetrics retrieves aggregated metrics from profiling data using different aggregators,
	// each designed for a specific level of aggregation:
	// - podAggregator: Aggregates metrics across different pods.
	// - containerAggregator: Aggregates metrics across different containers.
	// - metricsAggregator: Aggregates metrics across different time windows.
	ServiceAggregateMetrics(ctx context.Context, podMeta metav1.ObjectMeta, name v1.ResourceName, milliValue bool,
		podAggregator, containerAggregator, metricsAggregator workloadapis.Aggregator) (*resource.Quantity, error)

	// Run starts the service profiling manager
	Run(ctx context.Context)
}

func NewServiceProfilingManager

func NewServiceProfilingManager(fetcher SPDFetcher) ServiceProfilingManager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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