Speeding up freebsd-update

When using freebsd-update it can take a long time to complete. I’ve been looking at ways of speeding it up.

During the update process, it’s not uncommon for it to download 50,000+ files one at a time! Lets fix that.

The update below will run 8 copies of phttpget in parallel. xargs takes care of making sure each instance of phttpget has it’s own unique list of files.

# man xargs
...
-P maxprocs
      Parallel mode: run at most maxprocs invocations of
      utility at once.  If maxprocs is set to 0, xargs will             
      run as many processes as possible.
...
# ee /usr/sbin/freebsd-update
...

fetch_setup_verboselevel () {
         case ${VERBOSELEVEL} in
         debug)
                 QUIETREDIR="/dev/stderr"
                 QUIETFLAG=" "
                 STATSREDIR="/dev/stderr"
                 DDSTATS=".."
                 XARGST="-t"
                 NDEBUG=" "
                 ;;
         nostats)
                 QUIETREDIR=""
                 QUIETFLAG=""
                 STATSREDIR="/dev/null"
                 DDSTATS=".."
                 XARGST="-P 8" # UPDATED <<
                 NDEBUG=""   
                 ;;
         stats)
                 QUIETREDIR="/dev/null"
                 QUIETFLAG="-q"
                 STATSREDIR="/dev/stdout"
                 DDSTATS=""
                 XARGST="-P 8" # UPDATED <<
                 NDEBUG="-n"
                 ;;
         esac
 }

...

Leave a Reply

Your email address will not be published. Required fields are marked *