Skip to content

test: benchmark memory optimizations - #324

Draft
l0wl3vel wants to merge 23 commits into
masterfrom
feat/memory-consumption-test
Draft

test: benchmark memory optimizations#324
l0wl3vel wants to merge 23 commits into
masterfrom
feat/memory-consumption-test

Conversation

@l0wl3vel

Copy link
Copy Markdown
Contributor

Description

TODO

Used AI-Tools ✨

  • TOOL used for generation

l0wl3vel added 22 commits July 28, 2026 12:25
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
includes
sonic-net/sonic-platform-vpp#212
and sonic-net/sonic-platform-vpp#220
for troubleshooting reasons

Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Removed hacks, that just about worked in sonic-vs but broke in sonic-vpp
- sonic-vpp requires first time init to generate
  VPP config files from hwsku lanemap and port
  config. If skipped the syncd container, in which
  vpp runs, will crash immediately
- /etc/sonic/sonic-environment is generated on first boot from
  /usr/share/sonic/device/x86_64-kvm_x86_64-r0/default_sku,
  so writing it serves no purpose as we reenabled firstboot
- switch to telnetlib3, due to telnetlib being deprecated

Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
- Split pipelines to build sonic_vs and sonic_vpp images
- Rename sonic flavor to sonic_vs
- Add sonic-vpp as sonic_vpp flavor
- Run integration tests for sonic_vpp

Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
fixes sonic_vs with older (202505) image

Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
does nothing anymore

Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
it is configured using the sonic startup config, we run lldp.service, so
we do not need it anymore

Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
Signed-off-by: Benjamin Ritter <benjamin.ritter@x-cellent.com>
This reverts commit c9e1837.

Management VRF requires some more work around bootstrapping the switch
Every leaf and machine is a QEMU VM, and QEMU RSS behaves as a high-water
mark: the guest touches all of its RAM through the page cache eventually,
so a guest started with -m 4096 stays resident at ~4 GiB no matter how
little it actually needs. virtio-balloon with free page reporting barely
helps because the page cache keeps almost nothing on the free lists.

Add three opt-in knobs, all defaulting to the previous behaviour:

  MINI_LAB_LEAF_MEMORY / MINI_LAB_MACHINE_MEMORY  guest RAM, substituted
    into the topologies. All three launchers read QEMU_MEMORY (SONiC
    launch.py, machine launch.py and vrnetlab for the dell flavors).
  MINI_LAB_KSM      host kernel samepage merging, dedupes the identical
    guest RAM of leaf01/leaf02 and of the machine VMs
  MINI_LAB_THP      transparent hugepage policy

KSM and THP are host global and are applied/reverted by
scripts/memory-tuning.sh, which records the pristine values so the host
is left as it was found.

scripts/memory-profile.sh bundles the knobs into one-factor-at-a-time
profiles (baseline, low-memory, ksm, thp-madvise, all) so each knob can
be measured on its own. baseline pins KSM and THP explicitly instead of
leaving them untouched, so a comparison is not skewed by the host state.

scripts/memory-trace.py samples host and per-container memory plus QEMU
RSS into a CSV; scripts/memory-report.py renders per-run summaries and a
cross-run comparison. The integration test starts the tracer and stops it
in an EXIT trap, so a profile that is too tight for a flavor still
produces data instead of nothing.

The integration workflow builds its matrix from flavors x profiles. Pull
requests and pushes run baseline only so regular CI cost is unchanged;
workflow_dispatch defaults to the full matrix. Runs are serialised
because the host level numbers would otherwise be contaminated by
concurrent labs. Each run uploads its trace, and a final job merges them
into a per-flavor comparison table.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant