Operating system kernels typically enforce configurable limits on System V Shared Memory usage. On macOS, these limits can be seen by running the following command:
ipcs -M IPC status from <running system> as of Sun Apr 29 05:38:52 PDT 2018 shminfo: shmmax: 1073741824 (max shared memory segment size) shmmin: 1 (min shared memory segment size) shmmni: 32 (max number of shared memory identifiers) shmseg: 8 (max shared memory segments per process) shmall: 2097152 (max amount of shared memory in pages)
The tunable variables that affect shared memory are:
kern.sysv.shmmax
- This variable defines
the maximum size, in bytes, of a single shared memory segment. It
should be set to at least the largest desired memory size for
nodes using System V Shared Memory.
kern.sysv.shmall
- This variable sets the
total number of shared memory pages that can be used system wide.
It should be set to at least
kern.sysv.shmmax/pagesize
. The current page
size can be seen using the pagesize
command:
pagesize 4096
kern.sysv.shmmni
- This variable sets the
system wide maximum number of shared memory segments. It should be
set to at least the number of nodes that are to be run on the
system using System V Shared Memory.
These variables can be changed at runtime using
sysctl
, or at system boot time using
/etc/sysctl.conf
.
These sysctl
commands change the kernel to
support two million System V shared memory pages with a maximum shared
memory segment size of eight gigabytes. These changes take affect
immediately, but are not maintained across system
reboots.
sudo sysctl kern.sysv.shmall=2097152 sudo sysctl kern.sysv.shmmax=8589934592
The /etc/sysctl.conf
must be updated to have
the changed variables be maintained across system reboots. Changes to
/etc/sysctl.conf
require a system reboot to take
affect.
# # Maximum shared memory segment size of 10 GB # Maximum of 2 million shared memory pages # kern.sysv.shmmax=1073741824 kern.sysv.shmall=2097152
A system imposed user limit on the maximum number of processes and threads may impact the ability to deploy multiple JVMs concurrently to the same machine, or even a single JVM if it uses a large number of threads. The current process limit is displayed using:
ulimit -u 2837
There are two tunable variables that control this value:
These variables can be changed at runtime using
sysctl
, or at system boot time using
/etc/sysctl.conf.
These sysctl
commands change the kernel to
support a total of 4K processes system wide and 2K processes per user.
These changes take affect immediately, but are not maintained across
system reboots.
sudo sysctl kern.maxproc=4096
sudo sysctl kern.maxprocperuid
=2048
The /etc/sysctl.conf
must be updated to have
the changed variables be maintained across system reboots. Changes to
/etc/sysctl.conf
require a system reboot to take
affect.
#
# Support 4096 total process and 2048 per user
#
kern.maxproc=4096
kern.maxprocperuid
=2048