limit sort(1) memory usage to 20% of available main memory

By default BSD sort(1) uses 90% (or at least 50%?) of the available
main memory. That is good for performance for a single job, but not
for a shared OS. For a long running script the performance is less
important than the stability of the server.  Also, if a server
with 64GB RAM starts swapping, the performance goes south and
hurts other running applications.

Note: this change does not affect the weekly cron job to
rebuild the locate database. The FreeBSD locate.updatedb
use the -presort option (find -s)
This commit is contained in:
Wolfram Schneider 2022-01-26 19:30:11 +00:00
parent 4731124cac
commit 5cf0049653

View File

@ -52,7 +52,7 @@ fi
: ${sort:=sort}
sortopt="-u -T $TMPDIR"
sortopt="-u -T $TMPDIR -S 20%"
sortcmd=$sort