Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Enabled bool
// MinSessionAge is how long a session must have been observed before it is
// eligible to graduate. It gives the pager time to do its job as a restore
// accelerator and avoids churning a freshly restored VM.
MinSessionAge time.Duration
// MaxConcurrent bounds simultaneous graduations. Each one reads the whole
// memory image, so this is the IO/RAM blast-radius lever.
MaxConcurrent int
// ScanInterval is how often the controller evaluates sessions.
ScanInterval time.Duration
// CompletionTimeout bounds a single graduation. Completion reads the whole
// remaining image, so this is generous.
CompletionTimeout time.Duration
}
Config controls how aggressively the controller graduates VMs off the pager. The zero value is disabled, so the feature is a no-op until explicitly turned on.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller periodically detaches running VMs that have soaked past MinSessionAge from their snapshot memory pager, so long-lived VMs stop depending on a pager and old pager versions drain to zero and exit.
func NewController ¶
func NewController(store InstanceStore, cfg Config, opts ControllerOptions) *Controller
NewController builds a controller. cfg is normalized here.
type ControllerOptions ¶
ControllerOptions configures logging, metrics, and time.
type Instance ¶
Instance is a running VM that currently depends on a detachable snapshot memory pager. PagerVersion is the version it is bound to.
type InstanceStore ¶
type InstanceStore interface {
// ListPagerInstances returns running instances that still depend on a
// detachable snapshot memory pager, each tagged with its bound version.
ListPagerInstances(ctx context.Context) ([]Instance, error)
// GraduateInstance detaches the instance from its pager. The call blocks
// until the pager has populated remaining pages and released the session.
GraduateInstance(ctx context.Context, id string) error
// TargetVersion is the pager version new restores bind to. Sessions on a
// different version are prioritised so old pager versions can retire.
TargetVersion() string
}
InstanceStore is the controller's view of the instance manager. It is kept narrow and free of hypervisor/UFFD types so the controller stays agnostic to how graduation is actually performed.