sizing

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sizing right-sizes a sandbox to the actor's declared resource limits. The actor's limits arrive over the worker RPCs (RunWorkload / RestoreWorkload) as a SandboxSize. ateworker-gvisor calls ApplyToOCISpec to write them into the sandbox container's OCI spec, which runsc then applies to the host cgroup leaf. ateworker-microvm does not call ApplyToOCISpec: it uses SandboxSize only to size the VM itself (VCPUs, and MemoryBytes via resolveGuestMemMiB). A micro-VM container's own cgroup limit comes instead from that container's declared `spec.containers[].resources`, written into its OCI spec by atelet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SandboxSize

type SandboxSize struct {
	// MilliCPU is the CPU limit in millicores (1000 = one core), or 0 if unset.
	MilliCPU int64
	// MemoryBytes is the memory limit in bytes, or 0 if unset.
	MemoryBytes int64
}

SandboxSize is the sandbox's target size, derived from the actor's declared resource limits. A zero field means "unset".

func FromLimits

func FromLimits(l *ateworkerpb.Resources) SandboxSize

FromLimits builds a SandboxSize from an actor's declared limits as carried on the worker RPCs. It is runtime-agnostic; both ateworker-gvisor and ateworker-microvm call it. Negative values are clamped to zero ("unset").

func (SandboxSize) ApplyToOCISpec

func (s SandboxSize) ApplyToOCISpec(spec *specs.Spec)

ApplyToOCISpec writes the pod's CPU/memory limits into the container OCI spec's linux.resources so the sandbox cgroup is created with the right values. This is the gVisor sandbox-cgroup path: only ateworker-gvisor calls it, so runsc applies the result to the host cgroup leaf. Fields that are unset in SandboxSize are left untouched, preserving any existing values on the spec.

func (SandboxSize) VCPUs

func (s SandboxSize) VCPUs() int

VCPUs converts the CPU limit to a whole vCPU count for the micro-VM, rounding up so a fractional limit still yields a usable core (minimum 1 when a limit is set). Returns 0 when the CPU limit is unset, letting the caller keep its default.

Jump to

Keyboard shortcuts

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