The .NET Runtime Optimization Service can sometimes cause high CPU usage on Windows. In most cases, this happens while .NET Framework applications are being optimized. If the CPU usage remains high for a long time, you can manually process the pending optimization tasks. In this article, you will learn how to fix high CPU usage caused by the .NET Runtime Optimization Service.
.NET Runtime Optimization Service
The .NET Runtime Optimization Service is part of the .NET Framework and is responsible for optimizing .NET applications by compiling assemblies into native code. This can improve application startup and overall performance.
Normally, the service runs in the background and completes its work without noticeable impact. However, after installing .NET Framework updates, applications, or Windows updates, there can be a number of pending optimization tasks.
When this happens, you may notice .NET Runtime Optimization Service using a significant amount of CPU in Task Manager.


You can also identify the process by searching for mscorsvw.exe in Task Manager.


Instead of waiting for the optimization process to complete on its own, we can manually process the queued items using the Native Image Generator (ngen.exe).
.NET Framework uses separate 32-bit and 64-bit NGEN processes. Therefore, it’s important to run the command for both 32-bit and 64-bit .NET Framework applications.
Fix high CPU usage caused by .NET Runtime Optimization Service
1. Start Command Prompt
Open Command Prompt as Administrator.
2. Run NGEN for 32-bit and 64-bit applications
We will now manually process the pending .NET Framework optimization tasks.
Note: Ensure you run both commands to process the queued optimization tasks for both 32-bit and 64-bit .NET Framework applications.
32-bit .NET Framework
Change the directory to the 32-bit .NET Framework directory.
cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
Run the following command to process all queued .NET Framework native image compilation tasks.
ngen.exe executequeueditems
This is the folder.


64-bit .NET Framework
Change the directory to the 64-bit .NET Framework directory.
cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Run the following command to process all queued .NET Framework native image compilation tasks.
ngen.exe executequeueditems
This is the folder.


3. Check CPU Usage
Open Task Manager and check the CPU usage.
The .NET Runtime Optimization Service should have significantly less work to process and should disappear from the Processes list in Task Manager. CPU usage should also return to normal.


That’s it!
Read more: Check which .NET Framework versions are installed »
Conclusion
You learned how to fix high CPU usage caused by .NET Runtime Optimization Service. The .NET Runtime Optimization Service normally runs in the background to optimize .NET Framework applications. However, after updates or installations, it can sometimes consume a significant amount of CPU while processing pending optimization tasks.
By manually running ngen.exe executequeueditems for both 32-bit and 64-bit version of .NET Framework, you can process the queued tasks and help resolve persistent high CPU usage.
Did you enjoy this article? You may also like How to Bypass Microsoft Account Requirement on Windows 11 Installation. Don’t forget to follow us and share this article.

