Automatic Maintenance in Windows Server 2012 R2 causes high CPU load!

I recently stumbled across and issue when the updates house-cleaning in the automatic maintenance task in Windows Server 2012 R2 spiked the CPU pretty bad. Here is some background info, and workaround for this issue.

Update 2014-11-25: It appears that the http://support2.microsoft.com/kb/2975719 (http://support2.microsoft.com/kb/2771431 for Windows Server 2012) updates solves this issue.

Background

Shorthand, there is a scheduled task, enabled by default, that basically killed our servers about once a day. The first time I run into to this was the night before a presentation, and suddenly my demo machine was extremely sluggish. When investigating the issue I quickly found that the TiWorker.exe was spiking my CPU.

001
TiWorker.exe spiking the CPU.

After some additional research I found I was not alone on this issue. I found a post by Lars Jørgensen which nailed it:

Server 2012 Automatic Maintenance Killed Our SAN
http://larsjoergensen.net/windows/windows-server/windows-server-2012/server-2012-automatic-maintenance-killed-san

Action Center

The automatic maintenance job is visible in the Action Center, but the configuration are limited to say the least in that UI.  It’s way better to go straight to the source which in Windows Server 2012 R2 is scheduled tasks. Below is a screenshot of the Action Center / Automatic Maintenance, but to disable it, jump to the next section: Fixing the problem.

image
The Automatic Maintenance window in the Action Center.

Working Around the Problem

DISCLAIMER: I’m still trying to figure if disabling this task also stops the Windows update task, so please only do this on demo machines you use for presentations etc. NOT for production environments.

Anyway, since the Automatic Maintenance task is a built-in scheduled task, but if you think you can just open task scheduler as an administrator and disable it you’re wrong. As Lars pointed out in his post, you need to use the psexec utility (Sysinternals) together with schtasks.exe, and you need to run the command as SYSTEM. Use the following command:

psexec SERVERNAME -s schtasks /change /tn "Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE

In my scenario, I was testing this on my Hyper-V host, so I simply skipped the SERVERNAME switch.

psexec -s schtasks /change /tn "Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE

image

Disabling Automatic Maintenance on my server.

image

Maintenance disabled.

Happy Deployment / Johan

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
5 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Admin
Admin
8 years ago

Thanks, have updated the post with this info.

/ Johan

xaris_sm
xaris_sm
8 years ago

try this update

support2.microsoft.com/kb/2975719

works for our case, in our enviroment Automatic Maintenance consume all the ram 40 GB and then create a large page file while defrag all 8 drives on our file server cluster, this cause a time out on cluster health check and failover resources to other node.after install this update problem resolved.

hope this will help

Admin
Admin
9 years ago

Hey Josh,

Sorry, I haven't had any time to analyze the effects in any production environment.

/ Johan

monofurioso
monofurioso
9 years ago

Hi! Just wondering if you've left Automatic Maintenance disabled and what, if any, negative consequences you may have encountered?

I followed your directions last night on a 2012 Server in the DC role. It was hitting 100% utilization mid-day at least once a week and users couldn't even access shared files without massive slowdowns. Manually stopping maintenance always resolved the problem, so I went ahead and used psexec to disable the task. I'm just hoping it doesn't come back to bite me. 🙂

-Josh Marshall
NYC, NY

edanto
edanto
9 years ago

It seems like a reasonable idea, very poorly executed. How hard would it have been to limit that process to using a certain amount of CPU? They already know how, it's configurable setting for malware scans in Intune/SC Endpoint Protection….maybe the right heads will get bashed together.

Good catch!


>