You are right. Too much swapping influences performance bad.
In poudriere i configured,
# Use tmpfs(5)
# This can be a space-separated list of options:
# wrkdir - Use tmpfs(5) for port building WRKDIRPREFIX
# data - Use tmpfs(5) for poudriere cache/temp build data
# localbase - Use tmpfs(5) for LOCALBASE (installing ports for packaging/testing)
# all - Run the entire build in memory, including builder jails.
# yes - Enables tmpfs(5) for wrkdir and data
# no - Disable use of tmpfs(5)
# EXAMPLE: USE_TMPFS="wrkdir data"
USE_TMPFS="yes"
PARALLEL_JOBS=13
PREPARE_PARALLEL_JOBS=17
In make.conf,
MAKE_JOBS_NUMBER=12
Number of cores on my CPU is 12.
A good measurement of frequency of pages swapped-in would be interesting. Because pages swapped in is expensive on load.
I'll try now with,
MAKE_JOBS_NUMBER=6
This number seem to have hardly an influence on swap usage ...
Trying now,
USE_TMPFS="wrkdir"
Not better swap usage, 16G
====================================================================================
Trying something new,
PARALLEL_JOBS=1
PREPARE_PARALLEL_JOBS=11
Meaning i build packages not in parallel but one after another. When done in memory it gives good performance...
With these settings swap usage dropped from 19G to 8G.