Azure App Service Monitoring & Performance Optimization
Home » Ashfarq Kariapper  »  Azure App Service Monitoring & Performance Optimization
Azure App Service Monitoring & Performance Optimization

Introduction

When I started this Azure App Service series, my goal wasn't just to explain what Azure App Service is that I wanted to share the things I've learned while working with it in real production environments.

Introduction

One thing I've learned over the years is that deploying an application is actually the easy part. Keeping it healthy, available, and performing well is where the real work begins.

I've been involved in several Azure projects where the application itself wasn't the issue. Instead, it was a slow database query, a third-party API taking too long to respond, an unexpected spike in traffic, or simply an application that had been running for weeks and slowly consuming more memory than expected.

Without proper monitoring, these issues can go unnoticed until users start calling the support team.

That's why I always tell customers that monitoring shouldn't be something you add later. It should be part of the deployment from day one.

overview

Azure Gives You Most of What You Need

One of the things I like about Azure is that Microsoft has already built a solid monitoring ecosystem. You don't have to purchase several third-party tools just to understand what's happening inside your application.

For most Azure App Service deployments, I usually rely on four key services:

  • Azure Monitor
  • Application Insights
  • Log Analytics
  • Azure Alerts

These services work really well together and provide almost everything you need to understand your application's health.

Application Insights Is Probably My Favorite

If there's one service I almost always enable, it's Application Insights.

Many people think it only tracks application errors, but it's much more than that.

It can tell you:

  • Which pages are slow
  • Which API is taking the longest
  • Which database query is causing delays
  • How many users are currently connected
  • Which exceptions occur most often
    • Which external service is slowing down your application

    A while ago, I was troubleshooting an application where users kept saying,

    "The system feels slow."

    Nothing looked unusual from the infrastructure side. CPU usage was normal. Memory usage was normal. The App Service Plan wasn't under pressure.

    After opening Application Insights, it became obvious that almost every request was waiting on a single SQL query.

    Once that query was optimized, the application's response time dropped significantly.

    Without Application Insights, we probably would have spent much longer looking in the wrong place.

    Live Metrics Is Great During Deployments

    Whenever I deploy a new application or release a new version, I usually keep the Live Metrics blade open.

    It's one of those features you don't realize you need until you're watching traffic in real time. Instead of waiting for logs to be processed, you can immediately see:

  • Incoming requests
  • Failed requests
  • Response times
  • CPU utilization
  • Memory usage
  • If something breaks right after deployment, you'll notice almost instantly. I've found this especially useful during after-hours deployments when everyone is watching the release closely.

    failures (1)

    Azure Monitor Helps You See the Bigger Picture

    Application Insights focuses on your application. Azure Monitor gives you the bigger operational picture. I often use Azure Monitor dashboards to keep track of things like:

  • CPU utilization
  • Memory usage
  • HTTP requests
  • Response times
  • Availability
  • Network activity
  • Over time, these metrics also help identify trends.

    Maybe your application performs well today, but traffic has been increasing every month. Those trends can help you decide whether it's time to scale your App Service Plan before users start experiencing performance issues.

    dashboard

    Don't Ignore Alerts

    One mistake I see quite often is organizations collecting lots of monitoring data but never configuring alerts.

    Monitoring without alerts is like having CCTV cameras but never looking at the footage.

    For production workloads, I usually configure alerts for things such as:

    1. CPU staying above 80% 
    2. High memory consumption 
    3. HTTP 500 errors 
    4. Slow response times 
    5. Application becoming unavailable 
    6. SSL certificates nearing expiration

    The goal isn't to receive hundreds of emails every day. The goal is to receive the right notifications before your customers notice something is wrong.

    health-check-diagram

    Log Analytics Makes Troubleshooting Easier

    When investigating production issues, Log Analytics becomes incredibly useful. Using Kusto Query Language (KQL), you can quickly answer questions like:

  • Which requests failed today?
  • Which API is generating the most errors?
  • Which exception occurred most frequently?
  • How many users experienced failures?
  • Instead of manually digging through log files, you can query millions of records within seconds.

    If you're managing multiple Azure resources, having everything centralized in Log Analytics makes life much easier.

    app-insights-overview

    Performance Optimization isn't Always About Scaling

    When people hear the word "performance," the first thought is often to increase the App Service Plan size. Sometimes that's the right answer.

    But in many cases, it's not.

    Over the years, I've seen performance improve simply by:

  • Optimizing SQL queries
  • Reducing unnecessary API calls
  • Enabling response caching
  • Compressing HTTP responses
  • Cleaning up unused code
  • Moving secrets into Azure Key Vault
  • Enabling Always On
  • Using Deployment Slots properly
  • Throwing more CPU at a poorly optimized application only delays the real problem.

    Autoscaling Is Worth Configuring

    One feature I always recommend for production environments is Autoscale. Instead of running large instances all day, Azure can automatically add or remove instances based on demand.

    For example:

  • Scale out when CPU exceeds 70%
  • Scale in during off-peak hours
  • Increase instances during business hours
  • Reduce instances overnight
  • It improves both performance and cost efficiency.

    My Go-To Checklist Before Production

    Whenever I'm preparing an App Service for production, I usually run through a simple checklist:

    ✔ Application Insights enabled

    ✔ Azure Monitor configured

    ✔ Diagnostic logs turned on

    ✔ Alerts configured

    ✔ Availability tests enabled

    ✔ Autoscale configured

    ✔ Deployment Slots ready

    ✔ SSL certificate monitoring enabled

    ✔ Backup configured

    ✔ Log retention reviewed

    It doesn't take long to configure these, but they can save hours of troubleshooting later.

    quotas

    Conclusion

    One thing I've learned throughout my Azure journey is that monitoring isn't just for operations teams.

    Developers benefit from it.

    Cloud engineers benefit from it.

    Architects benefit from it.

    Even business stakeholders benefit from having visibility into how their applications are performing.

    Azure App Service already provides an excellent set of monitoring tools. The challenge isn't whether the tools exist, it's whether we're using them effectively.

    If you're deploying applications to Azure and haven't spent much time with Application Insights or Azure Monitor yet, I'd encourage you to explore them. You'll be surprised how much they can tell you about your application, and more importantly, how many problems they can help you prevent before your users ever notice.

    There are also other tools in the market for more visualisation as

    • Datadog, 
    • Grafana + Promethesus, 
    • Dynatrace,
    • Elastic (ELK Stack)

    Based on my experience as an Azure Solutions Architect, my recommendations are:

    If you're primarily on Azure: Stick with Azure Monitor + Application Insights + Log Analytics. They're deeply integrated, easy to deploy, and cost-effective.

    If you're a large enterprise with multiple cloud providers: Consider Datadog or Dynatrace for unified observability across environments.

    And If you're running Kubernetes or prefer open source: Grafana + Prometheus is an excellent combination. If centralized logging or security analytics is the priority: Elastic or Splunk are strong options.

    In the next article, I'll be covering Deployment Slots, CI/CD pipelines, and Zero-Downtime Deployments as it is one of my favourite topics when it comes to delivering applications safely into production.

    Share the Post on:
    WhatsApp Image 2025-03-17 at 13.01.27_45cefa7f

    I, M Ashfarq Kariapper, currently working as a Cloud Solution Architect / Tech Lead - Infrastructure. My expertise lies in designing and implementing on-prem and cloud solutions, particularly on Microsoft Azure and traditional environment. Possess extensive experience in cloud infrastructure, Data Engineering, and integrating various enterprise systems like SAP and Oracle. Moreover,  I'm passionate about education and community development initiatives supporting local socio-economic projects in Sri Lanka. Also the Co-Founder of International Council for Virtual & Research Education (Pvt) Ltd.