Skip to main content

Notifications

Hyper-V Host Power Plan and its affect on Dynamics AX Performance.

One often overlooked setting that affects AX performance in a Hyper-V hosted system is the Power Plan settings of the Hyper-V host.  On our system we noticed run times of batch jobs would vary from run to run.  This was not very interesting on the surface but what was interesting is that often the batch jobs were faster when the system was busier.  How could this be ?   Further when using AX as a user it occasionally seemed sluggish when there were fewer users on the system.  Again how could this be ?

To investigate I wrote a simple batch job that performs a math problem in a loop and ran it every so many minutes in batch.  I avoided any database calls to take any SQL issues out of the equation.  Looking at the run time of the batch job over time supported the fact that the busier the server the quicker the batch job completed.  Next I thought that if I could control how busy the server was that I could directly affected the run time of my batch job.  I created a VB script that performed roughly the same loop as well as a bat file that could run numerous instances of the VB script in parallel.  Sure enough the busier I made the server the quicker my AX Batch Job would run, up to a certain point.  During all these test I monitored CPU on the batch servers which again was very puzzling given I could not see any direct relationships between the CPU usage and the speed of the Batch Job.  Then I thought that maybe the issue was at a different level such as within our Hyper-V setup. 

The next test I performed was eye opening.  I again ran the AX batch job while my VB script was running to eat up CPU but this time the VB script was running on a different virtual machine that resided on the same Hyper-V host.  This test gave me the same results.  The busier I made the underlying Hyper-V host the quicker my AX batch job would run.  Next I loaded a tool on the Hyper-V host that would show the clock speed of the CPU.  I then had the answer.  The business I made the Hyper-V host the higher the clock speed would climb which went hand in hand with the run time of the AX batch job.

What seemed to be happening is that the batch job running on the virtual machine was not enough load on the Hyper-V host's CPU to take it out of a power saving low CPU clock speed state which I could directly see with the CPU clock speed monitor.  Next I changed the Power Plan on the host from "Balanced" to "High Performance" and wallah.  My batch job now ran twice as fast and had a much more consistent run time.  Note that the VM I was using had already been set to a "High Performance" power plan but that had little affect.  Once we made this change on our production AOS server's Hyper-V host EVERYTHING was faster.  Besides all the batch jobs being quicker the users also noticed a difference on the front end.

Below is a graph I created based on my test Batch Jobs run time.  It is simple to tell the runs prior to the Power Plan Change and the runs after the change.  My batch job was called "Eat CPU to Test Clock Speed".

secondsToRunEatCpuGraph.gif

Here is the Code for "Eat CPU to Test Clock Speed"

EatCPUclass.gif

Comments

*This post is locked for comments