LeaderBoard

Batch processing in Microsoft Dynamics AX 2012

Batch processing is a non interactive task-processing technique where users create batch jobs to organize appropriate types of tasks to be processed as a unit. Batch processing has some important advantages: it lets users schedule batch tasks and define the conditions under which they execute, add the tasks to a queue, and set them to run automatically on a batch server.

After execution is complete, the batch server logs any errors and sends alerts.

A batch job might involve printing reports, closing inventory, or performing periodic maintenance. By scheduling a batch job to process these types of resource-intensive tasks in off-peak hours, users can avoid slowing down the system during working hours.
Table below describes how standard batch processing concepts are represented in Microsoft Dynamics AX.

Concept Description
Batch task

The smallest unit of work that can be executed using the batch framework. It is a
batch-executable class that contains business logic to perform a certain action.
The Microsoft Dynamics AX classes that are used for batch tasks are designated
to run on the server. These tasks can run automatically as part of a batch job on
the AOS. This version of the product has limited support for client batch jobs; it
is recommended that you use server-side batch jobs to take full advantage of
the new features in Microsoft Dynamics AX 2012.

Batch job

A complete process that achieves a goal, such as printing a report or performing
the inventory closing process. A batch job is made up of one or more batch tasks.

Batch group

A logical categorization for batch tasks that lets administrators specify which AOS
instance runs a particular task. Tasks that are not explicitly assigned to a batch
group are, by default, assigned to an empty (default) group.

Batch server

An AOS instance that processes batch jobs.

 

Common uses of the batch framework
Organizations can use the batch framework to perform asynchronous operations in a variety of scenarios. Typically, organizations create batch jobs to address the following kinds of needs:
■ Enable scheduling flexibility The batch framework can perform periodic tasks on a regular schedule, such as data cleanup or invoice processing. For example, to run invoice processing at the end of every month, you can set up a recurring batch job that runs at midnight on the last working day of each month. The batch framework automatically picks up the job and processes pending invoices according to the specified schedule.
■ Control the order in which tasks execute With the batch framework, you can develop a workflow or perform a complex data upgrade in a sequence that you specify. You can also set up dependencies between the tasks and create a dependency tree that ensures that certain tasks run in sequence while others run in parallel.
■ Enable conditional processing Decision trees can help you implement a reliable way of processing data. Developers or system administrators can set up dependencies between tasks in such a way that different tasks are executed, depending on whether a particular task succeeds or fails. System administrators can also set up alerts so that they are notified if a job fails.

■ Improve performance by using parallelization The batch framework lets you take advantage of multithreading, which ensures that your processor’s capabilities are used fully. This is particularly important for long-running processes, such as inventory closing. You can improve performance further by breaking a process into tasks and executing them against different AOS instances, thus increasing the throughput and reducing overall execution time.
■ Implement advanced logging and profiling The batch framework lets you see what errors or exceptions were thrown the last time the batch ran, and it also shows you how long a process takes to execute. Advanced logging and the new profiling capabilities are also useful for performance benchmarking and security auditing.

Performance
The new capability to run larger and more complex batch jobs has required performance enhancements to the batch framework. In Microsoft Dynamics AX 2012, the batch framework is designed to be a server-side component. This lets you design multithreaded server processes in a controlled manner. By configuring the number of parallel execution threads and servers, defining the set and order of tasks for processing, and setting the execution schedule, you can achieve greater scalability across your hardware.

As mentioned earlier, the batch framework is now designed to run X++ that has been compiled as .NET CIL code for batch jobs. This significantly improves performance compared to Microsoft Dynamics
AX 2009, which ran interpreted X++ code. Compared to the interpreted code, garbage collection is much better, and because of session pooling, scheduling new batch jobs is less resource intensive. You can also profile the performance of jobs by using Microsoft Visual Studio Performance Profiler.


Microsoft developers use the batch framework as a foundation for many performance-critical processes, such as maximizing hardware scalability during a data upgrade and maximizing throughput during journal posting. For more information about how Microsoft uses the batch framework for performance-critical processes, see the white paper “Journal Batch Posting,” available at http://www.microsoft.com/en-us/download/details.aspx?id=13379.

 

Imparted from Inside Dynamics AX 2012 book

No comments:

Post a Comment