MMO-Champion - News

Tuesday, January 18, 2011

Multi-Core Cpu Architecture and WoW / Lag and Graphical tweaks...Guide

Multi-Core Cpu Architecture and WoW / Lag and Graphical tweaks...Guide

The TLDR version of this guide

Also, as a little side note. If you decide to edit your config file you obviously need to open it. Right click on it, click open with, and open it in notepad, word, or any other text editor.



Updated for 4.0:
They changed wow in 3.1 to run on more processor threads. Originally it was running on 2 main threads with several smaller threads handling simpler tasks. As of 3.1 there are now 3 main threads, and many more smaller threads. This means that forcing wow to run over all 3 cores may prove more beneficial then having it run over only 2 cores, as now you can"force" it to use all of the available cores.


If you want more information on what exactly setting the masks values does, and how it works, look in the CPU stuff section of the article.

These are the new recommended affinity mask values taking into account three available cores:

i7 Qudcore with Ht- 84
Any Quadcore chips with no HT - 15 or 84 (try both see whats better)
i5 Quadcore which does not have HT as far as I know - 15
i5 Dualcore with HT- 5
Dualcore with HT- 5
Dualcore without HT - 5
AMD tricore - 7





TCPAckFrequency portion of the latency fixes have to be done manually. Look at the bottom of this post for the steps or download Leatrix's Latency fix from WoWInterface. Its verified to work, and does exactly what the manual steps illustrated below will do. I have examined his code myself, it's visual basic, and it emulates the exact functionality that I go over in this thread. If you're lazy and like using apps, try his. If you prefer to learn and do things yourself, take a look at the lag stuff portion of the article.


CPU STUFF



I recently have been toying around with assigning certain running processes on my computer to certain cores on my PC via Affinity I/O controls. I have an Intel i7 quad core. I know a few of us here use this processor, and a few of us use AMD phenom cores. In any event whether you use dual core or quad core the following information pertains to you.

Config.wtf is located in the WoW/WTF game folder. Contained in this file is CVAR's a.k.a console variables or in some cases referred to as configurable variables. These variables allow you to manipulate program settings often found in games and other applications. I used to edit this config file a lot in the past to manipulate camera settings but never really paid much attention to the CVAR's. There is a shit ton of variables that can be changed and manipulated within this file, but for the purpose of this write up we will only talk about AffinityMask CVAR.


I have been working on this for a while. I virtualize several different operating systems server 03 being one of them, while also running SQL server on my PC. SQL server allows affinity cvars to be set within its own settings. I wasn't aware WoW had this capability until I was talking to someone in game about this the other day. Which then made me wonder if this was possible in WoW.

WoW is a threaded application meaning it can take advantage of more than 1 single core. However, no matter how many cores you have, WoW cannot take advantage of more than 2. After monitoring process activity on each core I saw that when I started WoW core 1's activity spikes while my other cores remain pretty low. The majority of applications that run on my computer are not threaded meaning that for the most part they either default to core 1 or windows will dictate which core the application is processed through. Having WoW run on core 1 as well as all my other programs run on it seems counter productive. I wish all applications were capable of doing this, sadly most common ones aren't.

The whole point of this, and the bottom line of it all is that we can force WoW to run on whatever cores we want, up to 3 cores in total. We can change the Affinity CVAR value from the default which is 3. The default value of 3 has wow running over cores 1 and 2. You have to think though that this isn't really running over physical cores 1 and 2. Instead it is running over 1 physical core but is threaded and broken down across that 1 core.See below chart I put it in quotes:

A Dual Core processor :[CORE1][CORE1Virtual][CORE2][CORE2Virtual]
Core numbers: 1 2 3 4
A Quad Core: [CORE1][CORE1Virtual][CORE2][CORE2Virtual][CORE3]
Core numbers: 1 2 3 4 5
[CORE3Virtual][CORE4][CORE4Virtual]
6 7 8


This is what is called hyper threading which basically splits each core into 2. 1 physical core and 1 virtual core. Which means that on quad cores we have a total of 8 cores. It isn't really a virtual core, but for the sake of argument we can call it that. Each core on the chip has circuitry on it that splits that core into two separate entities in software. Look up hyper threading if you want more of an explanation its to long to write out and really off topic for this.

If you have a dual core processor you can stop reading here and set your CVAR value for affinity mask to 5. What this does is force wow to run over the actual hardware cores of your computer instead of having it run over 1 physical and 1 virtual. Make sense?

Dual core set your value to 5 and your done. This will force WoW to run on cores 1 and 3 which in actuality represent the 2 physical cores in a single processor w/ dual cores.

____________________________

For single processor/ quad core it becomes somewhat more complex because instead of being

[CORE1][CORE1Virtual][CORE2][CORE2Virtual]

it turns into

[CORE1][CORE1Virtual][CORE2][CORE2Virtual]
[CORE3][CORE3Virtual][CORE4][CORE4Virtual]

4 phyiscal cores / 4 threaded cores = 8 logical cores (the chart above also shows this)



The mask/CVAR values also become more complex. See my chart below.

Logical Cores: |C1|C(v)1| |C2|C(v)2| |C3|C(v)3| |C4|C(v)4|

Core Number: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Mask Values: 1 2 4 8 16 32 64 128




Binary translation: We have to reverse the processor cores around since binary is read right to left, like Hebrew.


|C(v)4|C4| |C(v)3|C3| |C(v)2|C2| |C(v)1|C1|



In dual core systems setting the value to 5 would allow you to make wow run on physical core 1 and core 2, which we already went over. The default value of 3 has wow running on 1 physical core and 1 virtual core which are both parts of the same core in reality, which we also went over. In quad core systems you can set it to 5 as well like we do for dual cores, but you can also set different numbers. You want to stay away from running the game on virtual cores and run it only on 2 out of the 4 physical cores. The beauty of quad core is that we do not have to run anything on core 1, like you do with dual core processors. Core 1 is the most used core of all the 4 physical cores since it is the default core most applications run on. In my case I wanted wow to run over physical cores 3 / 4. I have SQL running on cores 1 and 2 but nothing running on cores 3 and 4.

I typed in 80 which would be cores 3 and 4 as per the above chart, you have to add the decimal values that I listed in the chart above that correspond to the core numbers that you want to enable. Now if you convert 80 to its binary equivalent 1010000 *Remember binary is read from right to left* Now if you match up that number to the binary translation chart.

for cores 3/4 - CVAR value 80

|C(v)4|C4| |C(v)3|C3| |C(v)2|C2| |C(v)1|C1|
0 1 0 1 0 0 0 0

for cores 2/4 - CVAR value 68

|C(v)4|C4| |C(v)3|C3| |C(v)2|C2| |C(v)1|C1|
0 1 0 0 0 1 0 0

you could even have it run on cores 1/4 if you wanted with the value 65

|C(v)4|C4| |C(v)3|C3| |C(v)2|C2| |C(v)1|C1|
0 1 0 0 0 0 0 1

For most people I would recommend a value of 80. Cores 3 and 4 are used virtually never.


Hopefully this was all clear enough. Even someone who is computer illiterate, you should still be able to make sense of this.

People who have done this tweak report, in some cases, double their fps.



LAG STUFF

I have been using this for a while, and I noticed substantial results with it. If you have random lag spikes, lag all the time, or internet problems this may help you out a bit.

Its kind of old school now, but a lot of people don't seem to know about it though so figured I would include it here. Depending on your system settings it can drastically improve ping times due to TCP/ACK response times.

Basically at the root of this tweak is changing the frequency at which TCP ACKS's or acknowledgments are sent out, it also disables NAGLE. Most know that TCP/IP works with data packets, the header of the packet contains destination port information as well as source port, followed by sequence and acknowledgment numbers, data offset, and some other crap, and then lastly the data itself.

By default the TCP ackfrequency is set to 2 in windows. Other programs that you might have installed can manipulate this number though, some network drivers for certain cards also can edit it as well. A value of 2 means that for every 2 tcp packets you computer receives an acknowledgment packet is sent. It basically tells the sending end, in the case of wow the server, that I received the data you sent me. The below reg tweak changes this value from whatever it is set to on your PC to a value of 1. I could make a reg key file that you could run on your computer that would do all this work for you, but I cant at this moment. So it takes about a total of 2 minutes to make this change anyway.


TcpAckFrequency defaults to 2. At this setting, copying a
250 MB file from the server takes 45 seconds. That's not a terrible
result, but I'm just establishing a baseline.

Microsoft Windows 2003 performance guidelines recommends a setting for TCP
ACK of 13 for gigabit Ethernet. Setting TcpAckFrequency to 13 on the
client yields copy time of 20+ minutes!!

Microsoft recommends a TCP ACK setting of 5 for 10/100 networks. Setting
to 5 yields copy time of 18 minutes!!


Finally, I tried setting to TcpAckFrequency of 3. This yields copy time of
13 minutes.

In the case of wow a much higher number will generate a retarded amount of lag while a lower number should remove it.

The second part of the hack is TCP no delay. Setting this value to 1, disables the Nagle algorithm in the TCP stack. The nagle algo. buffers up TCP packets and arranges them in a way that balances the size of the packets with the delay in sending it. It can rearrange different packets of different sizes coming from different programs on your computer and it sends out the bits and pieces that are easier to send first. It prioritizes and it also will wait for a packet to fill until sending it. Its kind of like QOS, but not at all really.

This is normally a good thing as it balances the load of a network if you have multiple PC's going at a time, and the delay is typically not noticeable with normal internet surfing etc. However, with WoW any bit of lag is noticeable, and bit of delay can mean the difference between living and dieing, wiping the raid or being the hero. On our level of internet usage, the TCP buffer/prioritization from nagle can effect performance. The second part of the tweak disables this. Instead of allowing Nagle to do its thing we are basically telling it, "choke and die, do not buffer the packets and wait to send them, just push them out NOW!!! NO u no u."

Here is the actual tweak itself:


-TcpAckFrequency -

Type "regedit" in windows "run.." dialog to bring up registry menu

Then find:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Tcpip\Parameters\Interfaces\

There will be multiple NIC interfaces listed in there, find the one you use to connect to the internet, there will be several interfaces listed (they have long names like{7DBA6DCA-FFE8-4002-A28F-4D2B57AE8383}. Click each one, the right one will have lots of settings in it and you will see your machines IP address listed there as one of the values.

-Right-click in the right hand pane and add a new DWORD value, name it TcpAckFrequency, then right click the entry and click Modify and assign a value of 1.

You can change it back to 2 (default) at a later stage if it affects your other TCP application performance. it tells windows how many TCP packets to wait before sending ACK. if the value is 1, windows will send ACK every time it receives a TCP package.

Again make sure you set it to 1.

- TCPNoDelay -
This one is pretty simple

Type "regedit" in windows "run.." dialog to bring up registry menu

Then find:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Paramet ers

Right-click in the right hand pane and add a new DWORD value, name it TCPNoDelay, then right click the entry and click Modify and assign a value of 1.

Click Ok and close the registry editor, then reboot your PC.




WINDOWS 7/VISTA STUFF


This section is dedicated to core parking. Core parking is a feature that will disable cores in real time that are not being used, as a power saving feature. The OS will then switch them back on as needed.

This poses a problem while gaming at times, because if you are out farming herbs/ore and their isn't very much graphical intensive activity going on some of the cores on your cpu may be disabled.

Lets say you then take a queue for Tol Barad, and you are shot right into the midst of angry battle. Fire is raining from the sky, green little lazers are flying at your face, and there are 25 angry alliance bum rushing your node. The OS will then flick the cores back on again.

The problem is that sometimes this process of turning the cores on and off causes noticeable video lag or screen tearing. Neither of which you want to deal with especially in pvp.

The following steps will disable this annoying feature.

Shut off Core parking:



- Go to Regedit

- Find this key:- " 0cc5b647-c1df-4637-891a-dec35c318583 "

- Within this key, there is a value called: " ValueMax "

- This value represents the % number of cores the system will park - the default 100% ie: all Cores are potentially park-able

- Change the value from 64 to 0 so the " ValueMin " and " ValueMax " are both zero

- You will have to find the key a few times and repeat the process for each time it is found - the number of instances will depend on the number of power profiles in your system

- Do a full shutdown and power-off and cold-re-start



GRAPHICAL/DX11 STUFF

If you have a graphics card that supports DX11, and are running on Vista/7, then you can potentially unlock a 20-30% gain in FPS while playing wow by doing the following:

-Open your config.wtf file (located in ...\World of Warcraft\WTF\) with notepad.
-add the line SET gxApi "d3d11"

This will unlock experimental dx11 support for wow(full support will probably be implemented in a future patch), it made me jump from 80fps to 100fps, not noticeable since the human eye only sees at around 32fps. For you it may be more noticeable.