What does serverperfmode=1 actually do on macOS?

Published on Author Code Father
What does serverperfmode=1 actually do on macOS?

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”.

Comments

comments