web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Customer aging snapshot batch job speed

(0) ShareShare
ReportReport
Posted on by

Hi

We are running the customer aging snapshot (sales ledger>Periodic>Collections>Customer ageing snapshot). I have already split so it is running for batches of 50,000 customers but is still taking over an hour to run, does anyone have any experience with this, or any ideas for it to run faster?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brian Kinser Profile Picture
    815 on at

    Only an hour.....it actually is doing a lot behind the scenes...you can add batch servers to your batch group, the more muscle you throw at it, etc,...many clients have separate batch AOS that only run these type of ong running tasks, many have multiple batch servers...I usually run the snapshot at night and only about once a week....otherwise i would create a BI cube for this type of activity (AP/AR aging are just as bad) and use MR or SSRS.

  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at

    I had never run it before, so I tried it a few times after reading this thread, and watched its performance with several tools.

    It basically runs a customer account statement for every customer, which is not the most efficient process, but it does a lot under the hood as Brian mentioned.

    When run in batch, it creates a batch task for every customer "bundle", which is defined in class CustAgingSnapshot method classDeclaration as [tag:define].CustomerBundleSize(120).  Basically more customers means more batch tasks, so the easiest way to process them faster is to run more batch threads, provided that you have the infrastructure to support it (multiple AOS, with plenty of processors, etc.).  You could also play a little with that CustomerBundleSize, but I doubt much can be gained from it.  

    Outside of potential blocking in SQL Server, it should scale in parallel pretty well.  It just runs a huge number of single record select statements, for the most part.  I didn't see much in the way of index opportunities or join optimizations.  The whole thing is probably as CPU intensive in the AOS as it is in SQL Server, which means your options are limited without doing some heavy re-writing.

  • Suggested answer
    bnorma01 Profile Picture
    119 on at

    If you look at the batch tasks/threads that get created do all the batches take that long ?  Reason I ask is in our company we have a few customers that take all the time.  I changed the code to be a little smarter on how it assembles the groups/bundles of customers for each thread which took our run time from 1-2 hours down to 20 minutes.  Further if your run creates a bunch of threads but the batch server does not have that many threads then this could explain some of the time.  I am attempting to create a blog post to demonstrate my change but have not been approved yet to post a blog.

  • Community Member Profile Picture
    on at

    you can try use the tracing tool, to run the statement in SQL, and see which index you need to create in the query or tables, this will increase the performance almost 90 % if you use the correct index.

  • bnorma01 Profile Picture
    119 on at
  • guk1964 Profile Picture
    10,888 on at

    Thank you, the blog article is clear. A little more information on this would be welcome.

  • cowboyott Profile Picture
    204 on at

    The problem with the aging snapshot is that it wants to run for ALL customers.  We have 2 million customers and this was not realistic. It would have taken weeks of continuous processing to run.  My solution was to modify the custAgingSnapshot class and only run the snapshot for customers with Open Unsettled balances.  

    1. On CustAgingSnapshot (form) - Add some new Dialog Field parameters so you can choose to Query customers by open balance.  Pass this parameter into the custAgingSnapshot class

            pastedimage1642690321028v1.png

    2. On CustAgingSnapshot (class) - Add logic to query customers with open balances only based on the parameter you passed in.  This is on the getCustomerPoolQuery (method)

            pastedimage1642690054482v3.png

    3. Then we need some logic on the process (method) to skip the customer bundle creation, because it has a flaw that bundles customers that aren't in your query, at least in 2012 R3 CU9.  

    4. Lastly we need to Delete all records from the custAging table.  Since we are only processing open customer balances, if a balance is paid it will not get removed from the next snapshot run, so we just delete them all out before the next run.

            pastedimage1642689758396v2.png

    Now it only takes 30 minutes to run!  Hope this helps someone. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans