On a Windows 10 machine, I seem to be running into substantially increased write times on our cache files.
Below I have included timing operations for our writes with/without Defender's intervention. For this test, we are writing 32KB blocks to a 1GB, pre-allocated cache file, 36000 times.
Here are file write times with Windows Defender enabled (default behavior on machines):
@@@ Manager: [CacheFile] --> 123.524 secs
@@@ Count: 36784. Time: 123524(ms). Average: 3(ms). Max Finished: 218(ms).
@@@ Unfinished: 0. Max Unfinished: 0(ms). Min Unfinished: 0(ms).
@@@ Max Finished Item: [Name: [DirectFileWrite:4294967293]. Pid: 0x00000000000002E8. Tid: 0x00000000000010A0. Data: 0x0000000000000000.].
@@@ Max Unfinished Item: [].
@@@ Min Unfinished Item: [].
@@@ Reporting Time: 0(ms).
And here's the same operations performed when our cache file is added to Windows Defender's exclusion list:
@@@ Manager: [CacheFile] --> 9.194 secs
@@@ Count: 36784. Time: 9194(ms). Average: 0(ms). Max Finished: 126(ms).
@@@ Unfinished: 0. Max Unfinished: 0(ms). Min Unfinished: 0(ms).
@@@ Max Finished Item: [Name: [DirectFileWrite:4294967293]. Pid: 0x00000000000006F4. Tid: 0x000000000000130C. Data: 0x0000000000000000.].
@@@ Max Unfinished Item: [].
@@@ Min Unfinished Item: [].
@@@ Reporting Time: 0(ms).
@@@@@@@@@
I'm thinking that Windows Defender is running some sort of check on the entire file (opening and checking the entire data of the 1GB file), every time we write to the file.
Adding the cache files to the exclusion list would be the last option, so I'm wondering if anyone run in to any issues of similar nature?
I'm using Windows C++ API for all I/O operations.