git: 5cf00496537a - main - limit sort(1) memory usage to 20% of available main memory

From: Wolfram Schneider <wosch_at_FreeBSD.org>
Date: Wed, 26 Jan 2022 19:33:10 UTC
The branch main has been updated by wosch:

URL: https://cgit.FreeBSD.org/src/commit/?id=5cf00496537a27d0f4bece7f5783327b59c2146b

commit 5cf00496537a27d0f4bece7f5783327b59c2146b
Author:     Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2022-01-26 19:30:11 +0000
Commit:     Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2022-01-26 19:30:11 +0000

    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)
---
 usr.bin/locate/locate/mklocatedb.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.bin/locate/locate/mklocatedb.sh b/usr.bin/locate/locate/mklocatedb.sh
index 284ea6416493..e838c9795820 100644
--- a/usr.bin/locate/locate/mklocatedb.sh
+++ b/usr.bin/locate/locate/mklocatedb.sh
@@ -52,7 +52,7 @@ fi
 : ${sort:=sort}
 
 
-sortopt="-u -T $TMPDIR"
+sortopt="-u -T $TMPDIR -S 20%"
 sortcmd=$sort