Dynamic Resource Control

Crafting shares underlying compute resources across multiple workloads from different sandboxes. Because development workloads have highly variable and unpredictable resource usage, the actual resources allocated to each workload are adjusted continuously rather than fixed at a static amount.

Enabling swap on the underlying machines is essential. Without swap, workloads are killed as soon as physical memory reaches pressure.

Memory and Swap

A soft cap on memory and swap is placed on each workload by allocating available node resources weighted by current usage. This soft cap is continuously adjusted as usage changes.

Specifying a Memory Request

A workload can specify a minimum memory reservation via schedule_spec:

workspaces:
- name: dev
  schedule_spec:
    resource_requests:
    - resource_type: memory
      request: 4Gi

The request value is the minimum amount of memory allocated when the workload starts. A higher request gives the workload more memory from the start, but may reduce overall memory utilization on the node if the workload typically uses much less.

Why Lower Memory Requests Often Perform Better

Consider a node with:

In this case:

This is suboptimal because there is 54 GB of unused physical memory sitting reserved.

If the memory requests are reduced to 4 GB each:

Lower memory requests lead to better overall performance when the actual usage is well below the requested amount, because more physical memory becomes available for workloads that actually need it.

See Also