On Nov 7, 2025, at 10:55 am, Ronald Klop <[email protected]> wrote:

> Hi,
> 
> A bit off topic, but as maintainer of mongodb70 I can tell you that I do my 
> test building on a RPI4 with 8GB of memory. It has 16 GB of swap, but that 
> isn't used that much during my build tests.
> 
> I do add LDFLAGS+= -Wl,--threads=1 to the build. In my experience the linker 
> is using a lot of memory when multi threaded and at the end of the mongo 
> build you end up with 2 or 3 binaries being linked in parallel if you are 
> unlucky.
> You can also play with MAKE_JOBS_NUMBER=3 to keep it from running to much in 
> parallel.
> Of course limiting parallelism makes the duration longer, unless it is 
> swapping so much that sequential compiling without swapping is faster than 
> parallel building with trashing the swap space. Find the sweet spot.
> 
> And yes, MongoDB is a monster to compile.


Many thanks for the MongoDB compilation tips.  An extra complicating factor in 
my case is I'm building via Poudriere and so the poudriere.conf settings can 
confound things when it comes to controlling resource usage.  The mongodb70 
port has caused me to change my poudriere.conf settings.

Before I started building mongodb70, I had PARALLEL_JOBS=1; 
ALLOW_MAKE_JOBS=yes; TMPFS_LIMIT=8; MAX_MEMORY=5; and USE_TMPFS=all.  Now, I 
have commented out PARALLEL_JOBS=1; ALLOW_MAKE_JOBS=yes; TMPFS_LIMIT=8; and 
MAX_MEMORY=5, and have USE_TMPFS="wrkdir data".  I also added mongodb70 to 
TMPFS_BLACKLIST: TMPFS_BLACKLIST="rust mongodb*".

So, I went from 1 builder with multiple make jobs to multiple builders with 
just 1 make job.  (Before needing to build ports like rust and mongodb70, I 
used to have multiple builders with multiple make jobs per builder.)  I've also 
dialled back a little in what TMPFS can be used for.  Usually, the system runs 
with 16 GB RAM and 8 GB swap on a 6-core system.  Right now, I have to add 
extra swap to let mongodb70 build successfully.  I suspect prior TMPFS usage is 
not helping matters.  Also, I don't know whether MongoDB is using a 
reproducible build, because ccache doesn't seem to speed things up much for me 
after a failed build.  That's just a gut feeling, though.

I can echo your observation that the swap doesn't appear to be used much for 
most of the build.  It's just when it comes to a certain point where everything 
explodes and LLVM dies from OOM.  Adding extra swap has got me past that point.

Cheers,

Paul.

Reply via email to