Skip to content

Commit

Permalink
Merge pull request #5289 from robhoes/add-docs
Browse files Browse the repository at this point in the history
More docs on the new site
  • Loading branch information
robhoes authored Dec 11, 2023
2 parents cea1088 + a48432b commit e582ce8
Show file tree
Hide file tree
Showing 40 changed files with 6,325 additions and 321 deletions.
17 changes: 17 additions & 0 deletions doc/content/squeezed/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
+++
title = "Squeezed"
weight = 50
+++

Squeezed is the XAPI Toolstack's host memory manager (aka balloon driver).
Squeezed uses ballooning to move memory between running VMs, to avoid wasting
host memory.

Principles
----------

1. Avoid wasting host memory: unused memory should be put to use by returning
it to VMs.
2. Memory should be shared in proportion to the configured policy.
3. Operate entirely at the level of domains (not VMs), and be independent of
Xen toolstack.
42 changes: 42 additions & 0 deletions doc/content/squeezed/architecture/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
+++
title = "Architecture"
+++

Squeezed is responsible for managing the memory on a single host. Squeezed
"balances" memory between VMs according to a policy written to Xenstore.

The following diagram shows the internals of Squeezed:

![Internals of squeezed](squeezed.png)

At the center of squeezed is an abstract model of a Xen host. The model
includes:

- The amount of already-used host memory (used by fixed overheads such as Xen
and the crash kernel).
- Per-domain memory policy specifically `dynamic-min` and `dynamic-max` which
together describe a range, within which the domain's actual used memory
should remain.
- Per-domain calibration data which allows us to compute the necessary balloon
target value to achive a particular memory usage value.

Squeezed is a single-threaded program which receives commands from xenopsd over
a Unix domain socket. When Xenopsd wishes to start a new VM, squeezed will be
asked to create a "reservation". Note this is different to the Xen notion of a
reservation. A squeezed reservation consists of an amount of memory squeezed
will guarantee to keep free labelled with an id. When Xenopsd later creates the
domain to notionally use the reservation, the reservation is "transferred" to
the domain before the domain is built.

Squeezed will also wake up every 30s and attempt to rebalance the memory on a
host. This is useful to correct imbalances caused by balloon drivers
temporarily failing to reach their targets. Note that ballooning is
fundamentally a co-operative process, so squeezed must handle cases where the
domains refuse to obey commands.

The "output" of squeezed is a list of "actions" which include:

- Set domain x's `memory/target` to a new value.
- Set the `maxmem` of a domain to a new value (as a hard limit beyond which the
domain cannot allocate).

Binary file added doc/content/squeezed/architecture/squeezed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e582ce8

Please sign in to comment.