What does serverperfmode=1 actually do on macOS?

by Keir Thomas   Last Updated October 20, 2019 00:12 AM - source

Turning it on is described here but there are no details.

There is a vague description:

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

What is actually changing inside the system/kernel?



Answers 2


Turning on Server Performance Mode essentially increases some kernel/net parameters related to the max number of possible/allowed processes and connections and modifies some memory/timer settings:

...
kern.maxvnodes: 66560 > 300000
kern.maxproc: 1064 > 5000
...
kern.maxfilesperproc: 10240 > 150000
kern.maxprocperuid: 709 > 3750
kern.ipc.maxsockbuf: 4194304 > 8388608
...
kern.ipc.somaxconn: 128 > 1024
...
kern.ipc.nmbclusters: 32768 > 65536
...
kern.ipc.sbmb_cnt_peak: 1120 > 1170
...
kern.ipc.njcl: 10920 > 21840
...
kern.timer.longterm.qlen: 100 > 0
kern.timer.longterm.threshold: 1000 > 0
...
net.inet.ip.maxfragpackets: 1024 > 2048
...
net.inet.tcp.tcbhashsize: 4096 > 8192
...
net.inet.tcp.fastopen_backlog: 10 > 200
...
net.inet6.ip6.maxfragpackets: 1024 > 2048
...
net.inet6.ip6.maxfrags: 2048 > 4096
#and some very special vm page-outs/compressor and and memory/cache settings

The goal is to allow more open files (especially needed for web servers) and connections to serve more clients at the same time and discarding single server threads faster from memory/virtual memory (if I interpret certain modifications correctly).


In the past, Apple released a different OS and now that server loads on top of the consumer OS some basic tuning can help the operating system run processes for 25 users that connect to a server instead of being tuned for one person using the OS. These tunings are just a starting point - anyone that wants their server to perform under high load needs to customize and monitor things at a far more detailed level than having performance mode on or off.

Also, these limits are mostly for preventing bad software from bringing down a server by exhausting limited resources like inter process communications signaling channels (ipc). On a system where one user is running, you want to halt a runaway process sooner than if there are dozens of processes running for dozens of users. The "performance" can be seen as raising some hard limits as opposed to "serve one file or one web page faster".

klanomath
klanomath
December 15, 2016 13:48 PM

Under OS X El Capitan 10.11.6 I got different numbers than @klanomath for performance mode. In almost all cases I got bigger numbers, probably because I have a beefier computer. According to this old support document from Apple about Server 10.6, some of these numbers scale with the amount of memory installed. My numbers correspond with 48 GB of memory according to the details given:

  • For each 8GB of installed memory, 2500 processes and 150,000 vnodes are available.
  • The maximum number of threads is set to five times (5x) the number of maximum processes.
  • A single user ID (uid) can use up to 75% of the maximum number of processes.
  • A single process can allocate up to 20% of the maximum threads value.

Specifically, under performance mode, I see:

kern.maxvnodes: 900000
kern.maxproc: 15000
kern.maxfilesperproc: 450000
kern.maxprocperuid: 11250

kern.ipc.maxsockbuf:8388608
kern.ipc.somaxconn: 256
kern.ipc.nmbclusters: 131072
kern.ipc.sbmb_cnt_peak: # This parameter is not in my kernel
kern.ipc.njcl: 43688
...
kern.timer.longterm.qlen: 0 # same
kern.timer.longterm.threshold: 0 # same
...
net.inet.ip.maxfragpackets: 4096
...
net.inet.tcp.tcbhashsize: 32768
net.inet.tcp.fastopen_backlog: 600
...
net.inet6.ip6.maxfragpackets: 4096
net.inet6.ip6.maxfrags: 8192
Old Pro
Old Pro
October 19, 2019 23:54 PM

Related Questions


Using Software Update Server

Updated October 25, 2016 09:05 AM



How to setup Mac mini server for remote access?

Updated November 04, 2016 09:05 AM

Using Apple Remote Desktop to view External HD files

Updated August 09, 2018 01:12 AM