Restrict JVM to run on specific cores undocumented?

I would like to limit CrateDB to use only 4 specific cores out or the 16 my host has.
I find https://crate.io/docs/crate/reference/en/latest/config/node.html?highlight=cores#cpu , which hints at reducing the max number of threads per thread pool, but can those threads only be assigned to specific cores?

AWS allows you to have 4x and 8x core machines, I would like to get one of the big machines and run CrateDB in only 4 of its 8 cores.

CrateDB is a process and as such its CPU affinity can be stated up front or at runtime. The procedure will differ depending on your OS, and you could in principle assign specific threads to specific cores (jps to obtain jid, then jstack -l jid to obtain the thread’s nid, then task set the nid to the appropriate core).

Note that CrateDB is a multi-threaded application designed to make full use of the core’s available, thus we do not actively maintain documentation on how to limit your specific environment.

CPU affinity is a scheduler property that “bonds” a process to a given set of CPUs on the system. The Linux scheduler will honor the given CPU affinity and the process will not run on any other CPUs.
Commands taskset and cgroups/csets can help with this.

Documentation on CPUSETS.

If you run CrateDB as a docker container, notice there are parameters that will have the same effect:

docker run --cpuset-cpus=0,1  -p 5432:5432

Docker run reference (under Runtime constraints on resources):

--cpus=0.000	Number of CPUs. Number is a fractional number. 0.000 means no limit.
--cpu-period=0	Limit the CPU CFS (Completely Fair Scheduler) period
--cpuset-cpus=""	CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems=""	Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
--cpu-quota=0	Limit the CPU CFS (Completely Fair Scheduler) quota
--cpu-rt-period=0	Limit the CPU real-time period. In microseconds. Requires parent cgroups be set and cannot be higher than parent. Also check rtprio ulimits.
--cpu-rt-runtime=0	Limit the CPU real-time runtime. In microseconds. Requires parent cgroups be set and cannot be higher than parent. Also check rtprio ulimits.