Skip to content

Instantly share code, notes, and snippets.

@davidalger
Last active December 6, 2023 03:06
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save davidalger/a3afa2410a40ce6ae59d4e6a3b18e5c7 to your computer and use it in GitHub Desktop.
Save davidalger/a3afa2410a40ce6ae59d4e6a3b18e5c7 to your computer and use it in GitHub Desktop.

Enable macOS Server Performance Mode

Performance mode changes the system parameters of your Mac. These changes take better advantage of your hardware for demanding server applications.

A Mac with macOS Server that needs to run high-performance services can turn on performance mode to dedicate additional system resources for server applications. Note, however, that performance mode can be enabled even without macOS Server being installed to achieve similar benifits for other high-performance services.

sudo nvram boot-args="serverperfmode=1 $(nvram boot-args 2>/dev/null | cut -f 2-)"
sudo reboot

Reference: https://support.apple.com/en-us/HT202528.

Changes to sysctl -a output before/after enabling

Changes shown in parameter: before -> after format. The full diff output of sysctl has been cleaned up a quite a bit to exclude things that are obviously not tuning params (like uptime and counters or stats, for example)

kern.maxvnodes: 263168 -> 300000
kern.maxproc: 2128 -> 5000
kern.maxprocperuid: 1418 -> 3750
kern.ipc.somaxconn: 128 -> 1024
kern.ipc.nmbclusters: 65536 -> 98304
kern.ipc.njcl: 21840 -> 32768
kern.bootargs:  -> serverperfmode=1 
kern.timer.longterm.threshold: 1000 -> 0
kern.timer.longterm.qlen: 155 -> 0
kern.timer.longterm.scan_pauses: 282 -> 0
kern.progressmeter: 685 -> 674
net.inet.ip.rtexpire: 10 -> 3600
net.inet.ip.maxfragpackets: 2048 -> 3072
net.inet.tcp.fastopen_backlog: 10 -> 200
net.inet.tcp.tcbhashsize: 4096 -> 8192
net.inet6.ip6.maxfragpackets: 2048 -> 3072
net.inet6.ip6.maxfrags: 4096 -> 6144
ktrace.background_pid: 80154 -> 0
ktrace.configured_by: tailspind -> 
@kovacs-andras
Copy link

Thanks!
For some reason the boot-args change command did not work for me but I could turn it on with 4 reboots like:

  1. rebooted in recovery mode with command (windows) + r, then Utillities / Terminal
    csrutil disable
  2. rebooted in normal mode, brought up the terminal and enabled perfmode like:
    sudo serverinfo --setperfmode 1
  3. rebooted in recovery mode and turned back on system integrity protection from the terminal:
    csrutil enable
  4. rebooted into normal mode and tested with these commands (both should be enabled):
    serverinfo --perfmode; csrutil status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment