I am doing some benchmarking tests and would like to disable hyper threading in an EC2 to see it's effect on my test application performance.
A single instance of my application uses only 1 thread during execution.
I understand that I can't access the BIOS of EC2 machines to disable hyper threading since they are all virtualised. But I have used the chcpu
command to disable half the vCPUs(threads) available so that I could simulate a hyper threading disabled environment.
For this benchmark, I am using a C4.xlarge with 4vCPUs numbered logically from 0 to 3.
I run this command sudo chcpu -d 1,3
which disables vCPUs 1 and 3.
In doing this, I assume that vCPUs 0 and 1 come from a single underlying bare metal core and vCPUs 2 and 3 come from another core.
This is where I know that my assumptions are wrong since vCPUs 0 and 4 could be coming from the same bare metal core or all of them could be coming from different bare metal cores.
Does anybody have a better way to disable hyper-threading in EC2 instances?
Also does Amazon rearrange vCPUs so that they come from different cores when it detects half the vCPUs being disabled?