19
With the new computer trend of adding more processing core rather than speeding each of them, CPU affinity is becoming quite important. It allow intelligent GNU/Linux system administrators to bind specific process or hardware interrupt to a list of CPU or core. This binding capacity is very useful in database server and high throughput environment by removing a lot of context-switching request on high load cpu. It can even be used to offload workstation CPU of the dreaded ‘firefox’/'flash’ combo.
Here is a quite interesting article from Intel, Improved Linux* SMP Scaling: User-directed Processor Affinity, on the subject. It shows how to distribute hardware-based interrupts to specifics CPU to lower context switching. It is way more technical that this very article, but I don’t see the need to copy/paste everything. Read it, it worth it.
So, checking out a process cpu affinity is done with following syntax:
# taskset -pc ‘pid’
The processor IDs start at 0. The CPU-ID list is available with ‘cat /proc/cpuinfo‘.
Binding a process ID (pID) to a specific processor is done with the following command. The only difference between the list/bind command is the processor id list added before the pID. It can be inserted as a single digit (1) or a list (1,2,3) or a suite (1-3).
# taskset -pc 1 ‘pid’
There you go: your now able to bind this CPU intensive oracle process on specific core on this 16-ways system.
Links : old ‘for coder’ IBM article – another one for VMWare.
tagged with : , affinity, consultant, cpu, database, GNU/Linux, jobs, mysql, oracle, sysadmin, Technique | permalink
