CPU Affinity

#1
my server has 4 cores, what should i set the CPU Affinity too based on best performance? my site has quite heavy content.

cheers
 

lucasrolff

New Member
Staff member
#2
Hi @adzkii

I suggest that you se tthe CPU Affinity to 1, this makes each worker stick to it's own core, so all traffic that worker will receive will always be served from the same CPU core, this increases the overall performance because the web server will be able to utilize the local CPU cache.

By setting it to 1, you'll see your 4 worker processes being assigned to 4 different cores.

You can verify this by running:

Code:
ps -eF | grep litespeed
The 4th column will be the core it's assigned to, like as following:

Code:
$ ps -eF | grep litespeed
root     16116     1  0 39337 109780  0 11:54 ?        00:00:22 litespeed (lshttpd - main)
nobody   16162 16116  4 376097 700492 0 11:54 ?        00:13:46 litespeed (lshttpd - #01)
In this case the lshttpd - main is assigned to core 0, and #01 being assigned to core 4.
 
#3
Hi @adzkii

I suggest that you se tthe CPU Affinity to 1, this makes each worker stick to it's own core, so all traffic that worker will receive will always be served from the same CPU core, this increases the overall performance because the web server will be able to utilize the local CPU cache.

By setting it to 1, you'll see your 4 worker processes being assigned to 4 different cores.

You can verify this by running:

Code:
ps -eF | grep litespeed
The 4th column will be the core it's assigned to, like as following:

Code:
$ ps -eF | grep litespeed
root     16116     1  0 39337 109780  0 11:54 ?        00:00:22 litespeed (lshttpd - main)
nobody   16162 16116  4 376097 700492 0 11:54 ?        00:13:46 litespeed (lshttpd - #01)
In this case the lshttpd - main is assigned to core 0, and #01 being assigned to core 4.
i'll set it too 1, what about leaving it empty? what happens?

cheers
 

lucasrolff

New Member
Staff member
#4
If it's left empty it will use the default value (0), this will disable pinning a given process to a core.

What this means is that whenever a process idle (which it does a lot), the OS can then assign the process to another core at any given time.
 
Top