Introduction | Business Central Performance Tuning – Application Insights

Microsoft wants to make things simple, and for a good reason. If it’s simple then everyone can understand it and the bigger the group of believers the easier it is to generate volume.

So when I started to read on Business Central and Application Insigthts the first thing I looked at was a PowerPoint slide saying this…

And to be honest, it is extremely simple to setup Application Insights for Business Central. I’ve done the setup three times now and after making one simple mistake the first time I can now get this up and runing in 15 minutes given that I have the right access.

But what am I doing exactly, and why?

I am one of these anyoing people who cannot stop asking “why?”. I need to understand what I am doing and what I can use it for.

In my case the why was easy. I was handed over a case from my new job at QBS where the customer was having performance issues and the partner could not get the correct telemetry. I had read about this “Application Insights” and decided to give it a spin.

The good news is that we seem to have found the issue using the telemetry from Application Insights and the partner is now discussing a fix together with the customer.

The “what” is a little bit more difficult to explain and I won’t even start on the “how” when it really comes to understanding the details of what it is you are essentially doing.

What is Application Insights?

Application Insights is part of the Microsoft Azure family and falls under the umbrella of Azure Monitoring.

This means that as a partner or a customer you need an Azure Tenant up and running to move the telemetry data into. There are a few options to choose from here. Decisions are most likely to be made based on the size of your customers. Some larger customers will already have their own monitoring in place and will require control over their data while others are fine with the partner controling the data and being able to pick up the phone and submit a support ticket when performance is slower.

It does however mean that if you are a larger Business Central reseller you need some knowledge of Azure Monitoring or you need to outsource this to for example QBS to help you out here.

The real challenge here is that you need multiple disciplines to understand what you are looking at and which decisions to make. I’ll write more about that in future blogs in this series.

Metrics vs. Logs

Most Azure Resources have built in telemetry that is exposed automatically. I’ve used some of that in my blog about SQL Azure I/O issues.

This telemetry is exposed in Azure Metrics and you can find this throughout the whole Azure stack and it’s a core component for building dashboards.

Azure Metrics are stored in a database and the data is retained for a certain period.

Alternatively to Metrics, Azure also provides Log Analytics and in most cases these are not enabled out of the box. As an Azure Admin it is your own responsibility to enable them.

An example of using Log Analytics is to strore Windows Perfmon data or Windows Event log data.

Log Analytics uses its own database separately from the metrics database as shown in this diagram.

Since Azure Log Analytics are extremely powerful someone at Microsoft had a brilliant moment and thought why not make this available for anyone just as a logging tool.

This is essentially what Business Central is using.

If you search on what you can do with Application Insights you’ll find that 99% of the information is about how to configure it in Visual Studio for your C# Web App. That is what it is optimised for out of the box.

Later on in this series of blog posts I want to get back to Metrics because when troubleshooting your own Azure SQL and Service Tier VM it is critical to understand how to work with metrics. However for Business Central SAAS hosted by Microsoft you can forget about it.

Working with Application Insights

So Application Insights essentially is “nothing more” than an Azure Service with a database that stores events of my system.

How do I use this data?

There are several ways of doing that that vary from nerdy on the far left to fancy management KPI’s on the far right.

Being a nerd and wanting to deep dive into a problem this is where I spent most of my time thusfar trying to investigate this performance problem while learning this new tooling at the same time.

Kusto Query Language

The Azure Team have invented their own syntax to get data out of the Log Analytics database called Kusto Query Language or KQL for short.

I’ll write a whole post about this language since it’s important to learn, but I can tell you now it did not take me more than one hour to get comfortable with it.

Prerequisite for learning this fast is a deep understanding of Transact SQL and PowerShell since it seems to be a marriage between these languages.

Dashboards & PowerBI

On the other end of the spectrum we have fancy Dashboards and PowerBI.

The Dashboards are actually part of the KQL language. The Azure Log Analytics team essentially did what the NAV role tailored client tried a decade ago, each output can be rendered into a chart and the chart can be saved to a dashboard and shared externally.

Microsoft has published some demo dashboards but they are still very simple and I’m sure they will be enhanced as they are learning more and getting more telemetry.

Any KQL query can be converted to a PowerBI query and this will allow less technical administrators to work with the data if PowerBI is the tool they prefer to use.

The cool thing about PowerBI is that you can create a historical overview and send it as PDF to your customers.

Let’s get going now!

So this was the introduction. I quick wrap up what I learned in the last week while trying to wrap my head around this thing.

In the next episodes we will setup the tooling and drop the dashboards. I will also spend at least one blog on KQL.

If you are a partner of QBS you can also enroll for the workshop about Application Insights or attend the webinar that will be scheduled soon.

Mandatory for everyone

Understanding the basics of Application Insights is mandatory for everyone working with Business Central. It does not matter if you are a developer, consultant, support engineer or sale representative. Customers working with Business Central will eventually ask you questions that are related to telemetry and you should know what you have and how to use it in your advantage.

1 Comment

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.