Documentation
¶
Overview ¶
The idle window advice. Ports manager packages/fleet/src/idle.ts (idleWindowAdvice, intersect).
The idle window replay: a workload's requests per minute replayed against idle windows with the router's rules. Ports manager packages/fleet/src/idle.ts (IDLE_WINDOWS, windowsFor, checkMinutesOf, replayIdle, recommendWindow).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var IdleWindows = []int{5, 10, 15, 20, 30, 45, 60, 90, 120}
IdleWindows are the nine windows tried, in minutes.
Functions ¶
func CheckMinutes ¶
CheckMinutes returns a router's check period from its schedule: rate(n minutes) or rate(n hours), 5 minutes otherwise (nil schedule included).
Types ¶
type Actual ¶
type Actual struct {
Wakes int `json:"wakes"`
ReplayedWakes int `json:"replayedWakes"`
Noisy bool `json:"noisy"`
}
Actual compares the real wakes with the replay's.
type Input ¶
type Input struct {
Ctx context.Context
Requests RequestMinutes
Current int
CheckMinutes int
WakeMs *float64
StartAsleep bool
ActualWakes int
ActualFrom *string
Stopped []stopped.Item
Hourly func(context.Context, stopped.Item) (*float64, error)
Baseline prices.Baseline
WakerTargetGroup bool
Now time.Time
Running []Period
}
Input is idleWindowAdvice's argument. WakeMs, ActualFrom and Stopped are nil when Node's are null; Running nil is a backend running all the time. Ctx defaults to context.Background().
type ReplayInput ¶
type ReplayInput struct {
Requests RequestMinutes `json:"requests"`
Windows []int `json:"windows"`
CheckMinutes int `json:"checkMinutes"`
WakeSeconds float64 `json:"wakeSeconds"`
StartAsleep bool `json:"startAsleep"`
}
ReplayInput is replayIdle's argument.
type ReplayedWindow ¶
type ReplayedWindow struct {
Minutes int `json:"minutes"`
Asleep []Period `json:"asleep"`
Wakes int `json:"wakes"`
WokeAt []string `json:"wokeAt"`
}
ReplayedWindow is one window's replay.
func Replay ¶
func Replay(in ReplayInput) ([]ReplayedWindow, error)
Replay replays each window over the requests.
type RequestMinutes ¶
type RequestMinutes struct {
From string `json:"from"`
To string `json:"to"`
Minutes [][2]int `json:"minutes"`
}
RequestMinutes are the minutes with requests, as offsets from From with their counts.
type Result ¶
type Result struct {
ComputedAt string `json:"computedAt"`
From string `json:"from"`
To string `json:"to"`
Current int `json:"current"`
Recommended int `json:"recommended"`
CheckMinutes int `json:"checkMinutes"`
WakeSeconds *float64 `json:"wakeSeconds"`
Priced bool `json:"priced"`
Windows []Row `json:"windows"`
Actual Actual `json:"actual"`
WakerTargetGroup bool `json:"wakerTargetGroup"`
}
Result is the Node IdleWindowAdvice.