Files
ubicloud/prog/setup_hugepages.rb
Hadi Moshayedi 93c2b5585a Change the hugepages arithmetic.
Previously, at an arm64 host with 128g memory & 80 cores we tried to get
128 hugepages (2 + 128*79/80), which might put the host under pressure.

This PR enforces a static allocation of 5GB of memory for the host
across all configurations, enhancing the predictability of memory
available for services running on the host.

In current deployments we have allocated either 248 or 249 huepages per
256g host, so this doesn't reduce the capacity of current deployments.
2024-02-27 11:34:14 -08:00

19 lines
626 B
Ruby

# frozen_string_literal: true
class Prog::SetupHugepages < Prog::Base
subject_is :sshable, :vm_host
label def start
hugepage_size = "1G"
# Reserve 5G of overhead for the host. SPDK will use 2 of the hugepages +
# upto about 1G of the 5G as not all SPDK allocations are from hugepages.
hugepage_cnt = vm_host.total_mem_gib - 5
sshable.cmd("sudo sed -i '/^GRUB_CMDLINE_LINUX=\"/ s/\"$/ hugetlb_free_vmemmap=on default_hugepagesz=#{hugepage_size} hugepagesz=#{hugepage_size} hugepages=#{hugepage_cnt}&/' /etc/default/grub")
sshable.cmd("sudo update-grub")
pop "hugepages installed"
end
end