Hyper-threading reduces the single-core power of my CPU

hammereditor

Honorable
Nov 27, 2012
121
0
10,710
I just got a new dedicated server with an Intel Xeon E3-1230 v2 CPU which has hyper-threading by default, and Windows server 2012 R2 64-bit. I run 4-6 game servers, so my workload is essentially multiple single-threaded processes. This particular game needs to have access to an entire core out of the four, in order for the game to run smoothly. It needs access to 25% of the total CPU power.

However, no single-threaded process on the dedicated server can use more than 12.5% of the whole CPU. This means the 4 cores are being split into eight threads. I have tried running other applications like Prime 95 and benchmarking tools, and none of them can use more than a 12.5%, either. To me, it appears as if the 4 cores were forcibly split into eight, and the threads are set in stone; no single-threaded process can use 2 of the 8 threads.

I use Task manager to look at the CPU usage. Is Windows task manager reporting the usages inaccurately (because it doesn't know about hyper-threading), or is hyper-threading supposed to make single-threaded programs run half as fast? If it's supposed to make single-threaded programs half as fast, I guess I'll have to disable HT from the BIOS. But why does everybody say HT makes games (which are mostly single-threaded) run the same, if not faster?
 
As you may, or may not know, 4 core hyperthreading CPUs show up to the system as 8 cores. The advantage of HT is supposed to be that the system can use the additional "cores" created by hyperthreading, or other physical cores, for background tasks, other applications, etc., which then frees the core being utilized for the application to complete it's task rather than having to share it's resources with another task.

As to why your cores won't utilize more than 12.5% of the CPU, that's basic math. 8 cores times 12.5% obviously equals 100%. The more important question is whether or not each core is using it's full share of resources, which, by default, it should be. Disabling HT probably isn't going to gain you much if anything, but it really depends on how the application or game, in question, is written. There are buggy ass games like Farcry 4 for example that most people find won't run at all on dual core cpus (So forget about using the G3258 with it) and requires a 4 core CPU, but then refuses to utilize more than a single core for gameplay.

If the game you're trying to serve is not written to utilize hyperthreading or multiple cores, then you might be better off disabling hyperthreading, at least to see if the additional 12.5% of resource allocation is enough to resolve your issue. In reality, this is a problem with the game or application, not the CPU, but that may work as a work around.

I'd also make sure that the Turbo boost feature is enabled in the BIOS to allow for the natural boosting of the cores under demand.
 
I don't believe HT is hurting you. The 1230v2's max turbo for 1 core is 3.7ghz whether it's HT'd or not. If that was the case, i5 would actually outperform i7s a lot of the time, and we all know they pretty much never do within their own generation. HT doesn't make a huge difference in gaming most of the time, but it does help, and it helps by managing the background tasks and processes. An i5 will bog down much faster when there are a lot of things running in the background because it pulls resources from your main task. Of course, all software and programs aren't created equally so there are always exceptions. Some software can't even "see" HTing and some make great use of it.

I say run some examples with HT on, and then run some examples with HT disable and see what the results are. We could be wrong.

I agree with what darkbreeze said and I tried not to repeat his info.
 
Are you trying to actually game on this server, or serve games to workstations or terminals using it? I'm assuming from what you posted above that you're running a game server that serves the application up to dedicated stations. Is this configured to run the core game process server or client side? I think maybe a bit further explanation of you intentions and needs is required as I believe that myself and CTurbo are not seeing your intentions in the same light.
 
There is the POSSIBILITY HTT could reduce performance; the hyperthreaded core shares resources with a physical core, so there is the potential for some minor performance loss. This is typically both unlikely to occur and minimal if it does occur. HTT should almost certainly be left enabled these days.
 

When I say "dedicated server", I refer to the server computer, and when I say "game servers", I refer to the game servers running on the server computer. The dedicated server is headless and it's in a data center, so the dedicated server is not being used like a workstation at all. I'm serving the game to remote players around the world.
I'm trying to run 4 game servers (specifically Unturned 3.3.6.0) on 4 physical cores, with the intent that each game server will use up one of those cores. The game servers are console applications with no GUI, and I don't think the developer deliberately added optimization for HT. The problem is that the CPU appears to the OS as 8 threads, so only 4 of the 8 threads are being utilized. None of these game servers ever went above a CPU usage of 12.5%, and when they hit 12.5%, they start to lag. I'm essentially losing half of my CPU because of HT.


So you're saying that if a game is not designed to use multiple threads, it's expected to run half as fast on HT?


That is certainly enabled and I have seen it boost before.


For example, let's say that each physical core is numbered 0-3, and each thread is numbered A or B. Each physical core has a capacity of 25% of the whole CPU.
I am running a web browser, which uses 3% of the whole CPU, on thread 2A. I'm running a game server on thread 2B. You're saying that thread 2B has 22% of the whole CPU available to it, right? Now let's say I close the web browser and thread 2A is unoccupied. The game server now has 25% of the whole CPU available to it, right? From what you're saying, I'm imagining a pair of threads belonging to each core, and each thread in the pair shares the 25% of the whole CPU. This flexibility does seem more efficient than just having 4 threads.

However, on my dedicated server, it appears as if the physical cores are not shared among pairs of threads. Each thread seems to have a fixed 12.5% of the whole CPU available to it. I've run many heavy, single-threaded applications other than the 4 game servers, and it's the same story: no more than 12.5% of the whole CPU is ever used. It's as if my Xeon has been replaced with an 8-core Opteron 3365 (which has half the per-core power).
 
This is strange, because it absolutely isn't how the whole thing works. One process/thread will not be dedicated to one core, be it virtual or physical.
The scheduler does tell cpu core's what to do and it certainly doesn't give a shit what thread has to be processed, it simply assigns a currently free one.
 
Seems like you've got a good understanding of the issue hammereditor. Go ahead and disable HT so that the cores are not "split into two parts". Since you say that you wish to run 4 single threaded processes, HT is not needed.
 
For example, let's say that each physical core is numbered 0-3, and each thread is numbered A or B. Each physical core has a capacity of 25% of the whole CPU.
I am running a web browser, which uses 3% of the whole CPU, on thread 2A. I'm running a game server on thread 2B. You're saying that thread 2B has 22% of the whole CPU available to it, right? Now let's say I close the web browser and thread 2A is unoccupied. The game server now has 25% of the whole CPU available to it, right? From what you're saying, I'm imagining a pair of threads belonging to each core, and each thread in the pair shares the 25% of the whole CPU. This flexibility does seem more efficient than just having 4 threads.

It's a bit more complicated then that.

For Intel Quad-Core CPUs with HTT (i7's): Cores 0, 2, 4, and 6 are physical cores, and cores 1, 3, 5, and 7 are the HTT cores. Cores 0 and 1 are shared, as are 2/3, 4/5, and 6/7.

Say you have a light workload task running on core 1. Now a heavy task such as a game starts and runs on core 0. Because core's 0 and 1 share HW resources, such as CPU cache and the ALU, it's possible the light thread running on core 1 could block the heavy thread on core 0 from running. This is obviously a BAD thing, and the main reason why the Pentium 4 version of HTT often REDUCED performance.

These days, the OS is a lot smarter then it was back in XP. The OS scheduler tries to avoid using HTT cores whenever possible. In this case, that light thread would likely get moved to another core so core 0 is running the heavy thread, and core 1 is doing nothing, so there's no conflict for resources. That being said, the more threads that are running, the more likely there ends up being a collision somewhere that blocks a heavy thread, and reduces application performance.