Solved Running out of Swap Space

Greetings,

I'm running FreeBSD 13.5-RELEASE (AMD64) on a remote VPS (Virtual Private Server). I have a couple of ports that I'm trying to upgrade that use Rust as a dependency.
As Rust is being compiled, it eventually errors out. Looking at /var/log/messages, it appears that swap space is running out...
Code:
Jun  3 04:12:31 ssh kernel: swap_pager: out of swap space
Jun  3 04:12:31 ssh kernel: swp_pager_getswapspace(27): failed
Jun  3 04:12:37 ssh kernel: swp_pager_getswapspace(14): failed
Jun  3 04:12:41 ssh kernel: swp_pager_getswapspace(15): failed
Jun  3 04:12:43 ssh kernel: swp_pager_getswapspace(24): failed
Jun  3 04:12:48 ssh kernel: swp_pager_getswapspace(11): failed
Jun  3 04:12:58 ssh kernel: pid 80552 (llvm-tblgen), jid 0, uid 0, was killed: failed to reclaim memory
Jun  3 04:12:59 ssh kernel: pid 80566 (llvm-tblgen), jid 0, uid 0, was killed: failed to reclaim memory
Jun  3 04:13:00 ssh kernel: pid 80400 (llvm-tblgen), jid 0, uid 0, was killed: failed to reclaim memory
Code:
[carltonfsck@ssh /usr/ports]$ swapinfo -kh
Device              Size     Used    Avail Capacity
/dev/gpt/swapfs     1.0G     320M     704M    31%
[carltonfsck@ssh /usr/ports]$
Code:
[carltonfsck@ssh /usr/ports]$ sysctl -a|grep swap
swap_pager: out of swap space
swp_pager_getswapspace(27): failed
swp_pager_getswapspace(14): failed
swp_pager_getswapspace(15): failed
swp_pager_getswapspace(24): failed
swp_pager_getswapspace(11): failed
kern.shutdown.dumpdevname: gpt/swapfs
1 PART da0p3 1073741824 512 i 3 o 34157568 ty freebsd-swap xs GPT xt 516e7cb5-6ecf-11d6-8ff8-00022d09712b
2 LABEL gpt/swapfs 1073741824 512 i 0 o 0
z0xfffff8000a539800 [shape=hexagon,label="gpt/swapfs\nr1w1e0\nerr#0\nsector=512\nstripe=4096"];
z0xfffff8000a539a00 [shape=box,label="DEV\ngpt/swapfs\nr#4"];
z0xfffff8000377a000 [shape=box,label="SWAP\nswap\nr#4"];
            <type>freebsd-swap</type>
            <label>swapfs</label>
          <name>gpt/swapfs</name>
      <name>gpt/swapfs</name>
      <name>swap</name>
vm.swap_enabled: 1
vm.domain.0.stats.unswappable: 37
vm.swap_idle_threshold2: 10
vm.swap_idle_threshold1: 2
vm.swap_idle_enabled: 0
vm.disable_swapspace_pageouts: 0
vm.stats.vm.v_swappgsout: 15789551
vm.stats.vm.v_swappgsin: 11198395
vm.stats.vm.v_swapout: 2618261
vm.stats.vm.v_swapin: 2880404
vm.stats.swap.free_completed: 1666491
vm.stats.swap.free_deferred: 2206002
vm.nswapdev: 1
vm.swap_fragmentation:
Free space on device gpt/swapfs:
vm.swap_async_max: 4
vm.swap_maxpages: 4010352
vm.swap_total: 1073741824
vm.swap_reserved: 2641272832
[carltonfsck@ssh /usr/ports]$

There are 2GBs of RAM on this Virtual Machine. A known rule of thumb is that FreeBSD SWAP should be 2.5 times the amount of physical RAM, which would be
around 5GBs.

Would it be advised to increase the swap space to this amount to resolve this issue, or is there something else I can do?


Thanks in advance!

--CF
 
Back
Top