Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I will be maxing out a few boxes running some heavy CPU intensive processing.

Each process only uses 1 thread, so I will run them in parallel. I'm using machines with 4 cores, so that's 8 with hyperthreading enabled.

Each process also uses 1GB of RAM, so I will need 8GB of RAM per machine if hyper-threading is enabled, or 4GB if it is disabled.

My question is: should I enable or disable hyperthreading?

The cost of the RAM is not the concern, but the speed at which the processing can be done. Would it be more efficient with hyperthreading enabled or disabled?

share|improve this question
1  
What type of CPU are you running on? Old P4's hyperthreading was rather bad, but the new stuff on i7 and newer is actually pretty good. –  Marcin Dec 16 '11 at 13:46
    
It's Intel Sandy Bridge. –  Alasdair Dec 16 '11 at 13:54
    
Can I ask a dumb question? Can you try a run one way and then a run the other and see what the difference you are looking at is? –  OG Chuck Low Dec 16 '11 at 17:07
add comment

3 Answers

up vote 7 down vote accepted

The only way to know for sure is to benchmark.

That said, there's very few scenarios where HT slows things down on a modern CPU, but moving from 4 to 8 processes might add enough I/O that other areas of the system turn into a bottleneck (Disk, Network, RAM bandwidth, etc.)

I think that no matter what, HT should be left enabled, but you'll need to benchmark your system to see how many jobs can be run at once for maximum throughput.

If nothing else, the OS might be able to make use of some extra execution resources.

share|improve this answer
    
It's not so easy to benchmark as I don't have physical access to the servers. But I/O should not be a problem as the hard drive is not used too much. –  Alasdair Dec 16 '11 at 13:44
4  
@Alasdair if you don't have access to the servers how are you planning to disable HT? –  Scott Chamberlain Dec 16 '11 at 19:49
2  
+1: If you can't benchmark it, don't bother changing it. –  surfasb Dec 16 '11 at 19:58
    
I can make a special request to disable the HP if I have to. –  Alasdair Dec 17 '11 at 0:25
add comment

Test running one process with HT disabled.

If the process does not max out the single core when HT is disabled it would be more effecient to run with HT enabled, since you would be "wasting" less CPU cycles.

If it does max the core out, then in theory either situation should take the same amount of time to execute. Having read afrazier's answer and your response, this seems like the only valid benchmark you might need to perform.

share|improve this answer
add comment

A short script to disable hyperthreaded CPUs is below. This could be useful for benchmarking. Works on Centos 6.2 (2.6.32 kernel).

#!/bin/sh
cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list |
sort -u |
while read sibs
do
    case "$sibs" in
            *,*)
                    oldIFS="$IFS"
                    IFS=",$IFS"
                    set $sibs
                    IFS="$oldIFS"

                    shift
                    while [ "$1" ]
                    do
                            echo Disabling CPU $1 ..
                            echo 0 > /sys/devices/system/cpu/cpu$1/online
                            shift
                    done
                    ;;
            *)
                    ;;
    esac
done
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.