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:
- Request Units for CosmosDB
Azure let you easily add or remove resources on demand.
Autoscaling based on a performance metric (e.g., CPU utilization)
Increase/decrease processing capacity.
- DTUs (Database transaction units)
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.
- No worries about infrastructure
- Your focus is on writing code
- 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.
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
Dynamic site acceleration for API endpoint
Reduce latency between on-promises to Azure
- 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
- 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
- sit between your app and data store
- Azure Case for Redis (in memory)
- is the use of different data storage technologies
- 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
- Log Analytics for Centralized logging
- log aggregation
- track custom logs and metrics
- custom query language
- can see logs in 5 to 15 minutes
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