- Set the underscore parameter _enable_NUMA_support=TRUE and restart the database. Doc ID 760705.1
- Setting the HP BIOS "Setting NUMA Group Size Optimization" to Flat. https://techlibrary.hpe.com/docs/iss/proliant_uefi/UEFI_TM_030617/s_set_NUMA_group.html
To check the affinity of the process
Open Task Manager -> Tab “Details” -> Right click the process -> Set affinity
Before Change – Only 16 processors are checked (in one processor group)
- After Change – All 64 processors are checked
How to set processor affinity on Linux using taskset
Today’s computers typically adopt multiple CPU cores. A process/thread can be executed on any of those CPU cores (determined by OS scheduling). Hence, performance optimization in such multi-core architecture is crucial.
Processor affinity, or CPU pinning is an important technique for above purpose. It enables the binding and unbinding of a process or a thread to a CPU or a range of CPUs, so that the process or thread will execute only on the designated CPU or CPUs rather than any CPU.
Processor affinity takes advantage of the fact that remnants of a process that was run on a given processor may remain in that processor’s state (for example, data in the cache memory) after another process was run on that processor. Therefore, it can effectively reduce cache miss problems. Also, when two processes communicate via shared memory intensively, scheduling both processes on the cores in the same NUMA domain would speed up their performance.
Now, let’s see how to set processor affinity on Linux. To this end, there are several approaches. To set the CPU affinity of a process, you can use taskset program and sched_setaffinity system call. To set the CPU affinity of a thread, you can use pthread_setaffinity_np and pthread_attr_setaffinity_np. In this article, I want to introduce the usage of taskset.
taskset is used to set or retrieve the CPU affinity of a running process given its PID or to launch a new COMMAND with a given CPU affinity.
Read the CPU Affinity of a Running Process
To retrieve the CPU affinity of a process, you can use the following command.
For example, to check the CPU affinity of a process with PID 1141.
The return value ffffffff is essentially a hexadecimal bitmask, corresponding to 1111 1111 1111 1111 1111 1111 1111 1111. Each bit in the bitmask corresponds to a CPU core. The bit value 1 means that the process can be executed on the corresponding CPU core. Therefore, in above example, pid 1141 can be executed on CPU core 0-31.
You may think that bitmask is a little hard to understand. Don’t worry. taskset can also show CPU affinity as a list of processors instead of a bitmask using “-c” option. An example is given as follows.
Pin a Running Process to Particular CPU Core(s)
You can also use taskset to pin a running process to particular CPU core(s). The command formats are given as follows.
For example, to assign process 1141 to CPU core 0 and 4:
Launch a Program on Specific CPU Cores
tasklet also allows us to launch a program running on specific CPU cores. The command is given as follows.
For example, to launch a ping program (destination 126.96.36.199) on a CPU core 0, use the following command.