Are you utilizing batch for your daily business operations? I've been thinking about blogging about batch in AX for a long time, and a few weeks ago I attended one of the Microsoft webinars sessions where the topic was batch in AX. The support engineer had a brilliant flowchart and I was allowed to publish it. I've reworked it a bit, hoping it will fit the blog space better, but the credit goes to Microsoft's support engineers. :-)
Batch is just yet another great feature of Dynamics AX where you can have operations scheduled to run, sort of like Task Scheduler in Windows. You can have the task be repeated automatically and perhaps have it run during night time when your users are sleeping or partying.
Each Batch Task exists inside what is called a Batch Job, and a Batch Job can have one or more tasks, and the tasks may even be dependent on each other. You may want one task to wait until another one has completed before it starts, and both of them are part of the same Batch Job.
Another important feature of batch is that it runs the operations on the server only. In AX2012 and above, this means it will run the operations in CIL (.Net), which improves performance. That's nice!
I find it interesting to know that the AOS kernel looks for new tasks to fire up every 60 seconds, and it will spawn two threads per CPU core. Also, any AOS can run batch tasks, so you can define dedicated AOSes for batch and perhaps cluster multiple AOSes together. If your AOSes are spread over multiple timezones you can have the same AOS handle users on daytime and batch on nighttime, and visa versa for your other AOSes. Pretty neat!
Back in 2011 Tariq Bell wrote this nice post on how Batch works under the hood. It explains the steps and parts of the code that is involved in the processing of batch tasks. Having a flowchart while reading the textual outline is always helpful.
Understanding how batch works in AX is especially helpful when investigating why tasks remain in Executing Status. In my upgrade projects, batch is heavily involved for running the upgrade scripts, and understanding batch is essential.
From the flowchart above, you see there are tables holding the tasks (Batch) and the "header" of the tasks (BatchJob). There is also a table, BatchGlobal, to help the framework keep track of any tasks running across multiple AOSes. The potential constraints and dependencies between tasks in a job is persisted in the BatchConstraints-table. These are just a few of the elements involved in this framework, as there are quite a few elements involved.
The Premier Field Engineers blogged about tweaking the batch threads settings for improved performance for AX2009, but I expect the post to be just as interesting for those who want to learn for AX2012.
Feel free to reuse the flowchart. Thanks for reading!
No comments:
Post a Comment