Krish DEV

Krish DEV

AZ-400 Exam Preparation: Well-Architected Framework - Performance efficiency

Published a month ago

7 minutes read

The content is summarised from AZ-400 official document

  • Scaling your system
  • Identifying network bottlenecks
  • Optimizing network performance
  • Optimizing storage and database performance

Use scaling up and scaling out in your architecture

It is hard to predict the load of your system. The load is usually dynamic.

Scaling two key concepts

  • Scaling: the goal is to meet performance requirements with minimum cost.
  • Resources: anything we need to manage and run the applications:
    • Memory
    • CPU
    • VMs
    • Request Units for CosmosDB

Azure let you easily add or remove resources on demand.

Autoscaling based on a performance metric (e.g., CPU utilization)

Scale up/down

Increase/decrease processing capacity.

  • CPU
  • Memory
  • DTUs (Database transaction units)

Scale out/in

Increase/decrease the number of instances.

  • Virtual machine scale sets
  • Sharding for Azure SQL Database

    Sharding is a technique to distribute large amounts of identically structured data across a number of independent databases.

Consider startup time of your instances to determine how fast you can scale.

Externalize your state to another service. (Azure Cache, Redis, SQL DB) - Make your web server stateless.

Throttling

Rate limit

Serverless

  • No worries about infrastructure
  • Your focus is on writing code
  • Event-driven

Containers

  • Lightweight and is a good use for scale in/out
  • Azure Kubernetes Service (AKS)
  • Azure Container Instances: you can create and execute containers on demand.

Optimize network performance

  • Importance of network latency - how to reduce it?

Each request round trip comes with a latency tax, and each round trip adds to the overall latency.

request-round-trip

Reduce latency between Azure resources

  • Create a read-replica of DB in another region. (Write still has latency)
  • Sync data between regions with Azure SQL Data Sync
  • Use CosmosDB (Globally Distributed DB) - it allows both reads and writes to occur in any region.
  • Use caching techniques. (Azure Cahce for Redis)

Reduce latency between users and Azure resources

  • DNS load balancer for endpoint path optimization
    • Azure Traffic Manager Service - it can route the users based on:
      • Priority: 1, 2, 3
      • Weighted: %
      • Performance: based on network latency
      • Geograpic: localization of content

The criteria can be nested

Traffic Manager simply returns the DNS name of the instance based on criteria.

  • CDN to cache content close to users
    • Cache static content - they will be copied to edge servers.
    • Cache Dynamic Content- need TTL or to be purged

Azure CDN

Dynamic site acceleration for API endpoint

Reduce latency between on-promises to Azure

  • ExpressRoute
    • Private, dedicated connection.
    • ExpressRoute Circuit is sit between Partner Edge and Microsoft Edge

The best way to save cost is to use CDN. Azure Traffic Manager is more expensive as it is just a load balancer, meaning you need more instances of your app.

Optimize storage performance

VM storage performance

  • Local SSD storage
    • high performance
    • temporary data
    • great for VM's page or swap file or in-memory db
    • The cost is included with VM
  • Standard storage HDD
    • For dev/test
  • Standard storage SSD
    • low latency
    • but low levels of throughput
    • non-production web server
  • Premium storage SSD
    • for production
    • low latency
    • high throughput and IOPS
    • can attach only to specific VM sizes

Striping increases the throughput and IOPS by spreading disk activity across multiple disks.

Optimize storage performance for your application

  • Caching
    • sit between your app and data store
    • Azure Case for Redis (in memory)

Polyglot persistence

  • is the use of different data storage technologies
  • example
    • using blob store for assets
    • NoSQL for product reviews and recommendation
    • SQL for user profile or account data

Eventual consistency means that replica data stores eventually converge if there are no further writes. If a write is made to one of the data stores, reads from another data store might provide slightly out-of-date data. Eventual consistency enables higher scale because there's a low latency for reads and writes, instead of waiting to check if information is consistent across all stores.

Identify performance bottlenecks in your application

Don't over engineer(More cost, more complex): find nonfunctional requirements

  • How fast a transaction must return under a given load.
  • How many simultaneous connections your application needs to support before it begins to return errors
  • If there's server failure, what's the maximum amount of time your application is allowed to be down before a backup is online..

Performance monitoring options in Azure

  • Azure Monitor
    • Infrastructure-level logs and monitoring for your Azure services.
    • Near real time. Good use for alert and to check resource metrics.
    • Azure Monitor collects data from each of the following tiers
      • Application monitoring data
      • Guest OS monitoring data
      • Azure resource monitoring data
      • Azure subscription monitoring data
      • Azure tenant monitoring data

Diagram that depicts a high-level view of Azure Monitor.

  • Log Analytics for Centralized logging
    • log aggregation
    • track custom logs and metrics
    • custom query language
    • can see logs in 5 to 15 minutes

An illustration showing the role of Log Analytics in resource monitoring.

Application performance management (Application Insights)

  • sdk required
  • helps you to track down low-level application performance and behavior.
  • to gain a deep understanding of your application
  • to see activity across your application

Application Insights stores its data in a common repository, and metrics are shared with Azure Monitor. Application Insights can also take advantage of shared functionality such as alerts, dashboards, and deep analysis with the Log Analytics query language.

Note: health endpoint monitoring pattern


Recommended Posts

AZ-400 Exam Preparation: Introduction to App Center

AZ-400 Exam Preparation: Introduction to App Center

Exam preparation for AZ-400, in the topic of Azure App Center

Read more →

Published a month ago

AZ-400 Exam Preparation: Control and organize Azure resources with Azure Resource Manager

AZ-400 Exam Preparation: Control and organize Azure resources with Azure Resource Manager

Exam preparation for AZ-400, in the topic of Control and organize Azure resources with Azure Resource Manager

Read more →

Published a month ago

AZ-400 Exam Preparation: Azure Application Insights (Metrics)

AZ-400 Exam Preparation: Azure Application Insights (Metrics)

Exam preparation for AZ-400, in the topic of Azure Application Insights (Metrics)

Read more →

Published a month ago

เตรียมตัวสอบ AZ-400: App Service Diagnostics Logging

เตรียมตัวสอบ AZ-400: App Service Diagnostics Logging

บันทึกการเตรียมตัวสอบ AZ-400 ในหัวข้อ App Service Diagnostics Logging

Read more →

Published a month ago