Wednesday, March 13, 2013

AX 2012 R2 compilation takes a long time

I was asked by a co-worker why the AX 2012 R2 compilations seems to be so much longer than previous versions. The AOS also seems to take longer to restart. He was also inquiring on the overall compiling process like X++ compilation, Full (partial) CIL generation, and finally the database synch and how they all fit together. The CPU seems to get highly utilized (but not fully) on a compilation for R2.

The funny thing with AX is that I've seen a trend with every new release taking longer and longer to compile and AOS restart. When bringing this up with other people in casual conversation they point to the fact that there is more code now and it's more complex yada yada yada. I see that but shouldn't the compilation process be a little more expedient? Hardware prices have come down while software efficiency has gone up. Why does it seem that later releases (or heavily customized systems) take so much longer to run?

Here is an excellent discussion around this topic. Its still a hot topic at the moment so posts are still going on here. I'll summarize some of the content below.
http://community.dynamics.com/ax/f/33/p/102527/195927.aspx#.UUDl1lemgYF
The answer to this is that the compiler won't scale as it is today. There haven't been many updates with the compiler instructions for quite a while and was originally built in 1983. As more code is added, the compilation time will go up. Features like Retail, new table structures like the EcoRes and Global address book, etc will all add significant code. The old architecture was created on memory management techniques when Intel's 8086/iAPX86 were popular (16-bit). The metadata provider the compiler interfaces to is also pretty weak.

Some of the highlights:
  • X++ Compiler doesn't scale well. More code = more time
    • limited to a 32-bit architecture even if running on a 64-bit architecture because AX client is 32-bit (restricts memory that can be used)
  • Adding multiple CPUs will not really help the situation from what people have seen (MAXDOP should be 1 anyways. See DAX Dude - AX MAXDOP settings for SQL performance)
    • The AOS is single threaded and this single thread can only use one processor hence the bottleneck
  • Current Metadata provider the compiler interfaces to doesn't perform well
Possible ways to improve the compilation speed:
  • Build a single tier 'build server' that contains AX client, AOS, and DB. Move completed code via a model store move.
  • Remove best practice checks <- Confirmed that it can cut a table sync from 20 minutes to 10...
  • Compile the code on the AOS server to reduce metadata fetching time
  • Use a CPU with high clock speeds with a high on-chip cache
  • Adequate RAM

No comments:

Post a Comment