Dynamics 365 Business Central: AppSource and PTE apps under the hood.

I think that everyone of you know the difference between a Dynamics 365 Business Central AppSource extension and a per-tenant extension (PTE):

  • AppSource apps are apps that are published in the Microsoft AppSource marketplace (after passing a validation) and that are installed in the global scope.
  • Per-tenant extensions apps (PTEs) are apps created by the partner as a customization for a particular environment. They are deployed in the environment with the PTE scope and they are unique per environment.

In this post I want to answer to a question received after our Directions EMEA session in Viennna related to best practices for handling large customers. We talked a lot about the importance to write efficient code (expecially in an high-transaction environment) and one of the attendees asked an interesting question:

Is there a difference under the hood in the Business Central server when using an AppSource or a PTE app?

The answer is yes, but maybe this is not too much visible…

When you publish an app in a Business Central environment, from the .app file the AL compiler generates C# code and metadata. The generated C# code defines the behavior of the objects in the app, while the metadata defines all the object’s properties. Code and metadata are stored in the Azure SQL database and they are loaded at runtime (during app execution).

At the installation phase, the app is recompiled with the latest dependencies and the server also updates the runtime cache with the app C# code and metadata. The runtime cache is updated every time you execute an object for faster object’s startup.

But what happens under the hood for code and metadata objects?

Here is the hidden part where there’s a big difference between AppSource and PTE apps.

AppSource apps share assemblies (C# code) and metadata across environments. This is possible because those apps have an unique identity across tenants (global identity granted by AppSource). Here is a diagram representing the architecture:

Metadata are not duplicated, memory usage is under control and the load time is faster.

What happens for PTEs?

With Per-tenant extensions (PTEs) assemblies (C# code) and metadata are NOT shared across environments, but they are specific per environment. If you have 2 Business Central environments in a tenant and you install the same PTE into the 2 environments, this is the situation:

Metadata and assemblies are duplicated inside the tenant. And this means that you can have an higher memory usage in the NST and also an increased startup overhead when running the specific object for the first time.

Should I be worried about that?

No, you should not be worried about that. This is handled by Microsoft and the NST is able to handle this behavior accordingly. But as a general rule, if you have the same extension and you plan to distribute it across different environments and/or tenants to multiple customers, distributing it via AppSource can be probably a better choice.

Original Post https://demiliani.com/2024/11/20/dynamics-365-business-central-appsource-and-pte-apps-under-the-hood/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...