Category Archives: Gaming

Optimising TF2: RealTime Virus Protection interference.

Are you experiencing lag in TF2? Random slowdowns, particularly with larger servers? Does it seem like whatever you change in the settings, it’s still slow?

If, so, it’s probably worth you following this guide. I will be detailing what the issue is, why it happens, and how to remedy it (at least in come cases).

WTF causes it?

In short, it is caused by your antivirus. There is a certain folder on your PC, which is constantly being written to and read from by the game whilst playing. The faster the data gets in and out, the less laggy issues you have with your game. Which leads us onto…

Why does it happen?

It’s not actually that crazily complicated.

Thousands of times per second, the TF2 engine writes to I:\Steam\appcache\stats\. This is normal behaviour for the game, and normally does not cause any issues.

The problem comes when your antivirus gets involved, and tries to apply “Active Protection” to the folder. Normally AP is great; whenever a folder is modified, your AV swoops in and does a quick ocular-pat-down, and gives you the thumbs up if everything is cool.

However, when a folder is having thousands of writes per second, this can have a very detrimental effect on performance. Instead of every file just getting written down or quickly read by TF2 and getting left alone, the AV wants to know what the hell it is doing there. Thousands of times per second.
Even with a good SSD, you’re still going to see a performance drop as the system struggles to check itself quickly enough. Essentially, it triples the I/O on the disk.
The problem is exacerbated when using busy servers: Instead of the usage doubling, it sextuples, sometimes grinding to a nasty halt.

How do I fix it?

Quite simply, just add an exception for the folder. This tells the AV that you trust what is going in and out of the folder, that it’s safe, and that it can stop fretting.

Step 1: Find the folder:

(Windows centric)

The folder lives inside the Steam Appcache folder.
On devices with everything on the OS drive, the path should be:
C:\Steam\appcache\stats
And for people using seperate drives for their TF2 game:
${DriveLetter}:\Steam\appcache\stats

 

Step 2: Tell the AV to leave it alone:

(This details Avast Antivirus, although the procedure is similar in most other providers)

Open the AV interface:avast1

Navigate to settings, select Active Protection, and click Customise on File System Shield:avast2

Select Exclusions, then add your file path, followed by * to indicate the entire folder:

avast3

So in my case, I’d be adding I:\Steam\appcache\stats\*

Somebody using thir OS drive would add IC:\Steam\appcache\stats\*

Step 3: See if it makes a difference:

I’m not going to lie, it’s a case by case basis for success. If I have a few minutes at some point, I’ll try to benchmark the difference. It is 100% worth trying though, especially if you are still using a platter-based HDD (like my long-suffering laptop). I had a very happy person the other day though, so I decided to write this 🙂

Potential Risks:

Just to cover this, you are disabling a section of your antivirus protection. As low as the risks are, there could come a nasty piece of malware that exploits this. The chances are pretty low, but hey, it’s good to know. In fairness, if stuff’s getting modified like that, you’ve probably got bigger problems on your PC.

As you can see in my first image, you will get notifications from the AV saying that you’re a bad person; Just bear in mind what you’re doing, stay safe, and don’t meddle any more than necessary!