Azure Compute Services Summary
Compute Services Overview
Set of cloud services for hosting and running applications.
Allows uploading code and running it on Azure.
Offers various levels of control and flexibility.
Four main types: Virtual Machines, App Services, AKS, Azure Functions.
Virtual Machines
Virtual server running on a physical server.
Allows quick creation of new servers using existing physical server resources.
User experience is similar to a regular server.
Unmanaged service (user manages the guest OS).
Virtual Machines in Azure
Azure manages the host OS and hypervisor.
Users manage the guest OS, including bins, libs, and code.
Steps for creating a VM: select location, image (OS + pre-installed software), and size.
Key cost factors: VM, Disk, IP, Storage.
Reducing VM Costs
Auto Shutdown: Automatically shuts down the machine when not needed (especially for dev/test).
Reserved Instances: Upfront payment for 1 or 3 years offers substantial discounts (for production machines).
Spot Instances: Runs on unused Azure capacity, offering up to 90% discount, but can be evicted anytime (for non-critical tasks).
Disk Optimization: Select the right disk type; Standard SSD can be sufficient for non-IO-intensive machines.
VM Availability
Fault Domain: Logical group sharing a common power source and network switch.
Update Domain: Logical group that can undergo maintenance and reboot simultaneously.
Availability Set: Spreads VMs across multiple Fault and Update Domains within the same zone.
Availability Zone: Physically separate zones within an Azure region, each functioning as a fault and update domain.
Virtual Machine Scale Set
Group of VMs sharing the same image, managed as a group.
Can be scaled out or in manually or based on conditions.
VMs should not be modified after setup; changes should be made to the original image.
A load balancer is typically used in front of the scale set for web apps.
Azure Instance Metadata Services
REST API accessible from the VM providing information about the machine (SKU, storage, networking, scheduled events).
Accessible only from the VM.
App Services
Fully managed web hosting for websites.
Code is published and runs without access to the underlying servers.
Supports various platforms: .NET, .NET Core, Node.JS, Java, Python, PHP, and containers.
App Types: Web Apps, Web API, Web Jobs.
App Services Tiers
Different tiers offer varying levels of CPU and RAM at different prices.
App Service Auto Scaling
Can be auto-scaled based on various metrics.
Deployment Slots
Allows uploading and testing code separately from the main site before promoting to production.
Traffic Splitting: Route a percentage of users to the new slot for testing.
AKS (Azure Kubernetes Services)
Managed Kubernetes service on Azure.
Allows deploying and managing containers using Kubernetes.
Users pay only for the instances (VMs) used.
Azure Functions
Small, focused functions running as a result of an event.
Suitable for event-driven systems.
Automatically managed by Azure (start, stop, autoscale).
Serverless.
Serverless
Cloud resources completely managed by the cloud provider.
Users don't need to manage VMs, CPU, memory, etc.
Triggers and Bindings
Triggers: Events that cause the function to run (e.g., HTTP request, timer).
Bindings: Declarative connections to other resources (input, output, or both).
Cold Start
Delay when a function is activated after a period of inactivity.
Can be mitigated by selecting the right hosting plan.
Azure Functions Hosting Plans
Consumption: Pay only for actual usage.
Premium: Pay for pre-warmed instances, eliminating cold starts.
Dedicated: Runs on an existing App Service.
Durable Functions
Stateful Functions that interact with external resources and track the workflow.
Compute Services Overview
Set of cloud services for hosting and running applications with varying levels of control and flexibility.
Enables uploading code and execution on Azure infrastructure.
Four main types: Virtual Machines, App Services, AKS (Azure Kubernetes Service), Azure Functions.
Virtual Machines
Virtual server hosted on a physical server, allowing for rapid provisioning using existing hardware resources.
Provides a user experience akin to a traditional server environment.
Considered an unmanaged service, requiring users to oversee the guest OS.
Virtual Machines in Azure
Azure oversees the host OS and Hyper-V.
Users are responsible for managing the guest OS, including bins, libs, and application code.
Creation involves selecting a location, an image (OS + pre-installed software), and instance size.
Cost is determined by VM size, disk usage, public IP addresses, and storage consumption.
Reducing VM Costs
Auto Shutdown: Configures VMs to automatically shut down during periods of inactivity, particularly useful in development and testing environments.
Reserved Instances: Involves upfront payments for 1-year or 3-year terms, providing substantial discounts for steady-state production workloads.
Spot Instances: Leverages unused Azure compute capacity, offering up to 90% discounts, suitable for non-critical, fault-tolerant tasks that can tolerate interruptions.
Disk Optimization: Matching the disk type to the workload: Standard SSDs may suffice for machines with less stringent I/O requirements.
VM Availability
Fault Domain: A logical grouping of hardware that shares a common power source and network switch, mitigating risks from hardware failures.
Update Domain: A logical grouping of underlying hardware that can undergo maintenance and reboots simultaneously, minimizing downtime during updates.
Availability Set: A configuration that distributes VMs across multiple Fault and Update Domains within the same zone to enhance application availability.
Availability Zone: Physically isolated zones within an Azure region, each serving as an independent fault and update domain to protect against datacenter-level failures.
Virtual Machine Scale Set
Manages a group of VMs from a single image, facilitating uniform configuration.
Supports scaling operations, either manually or automatically based on predefined conditions.
Emphasizes image-based deployments, discouraging post-deployment VM modifications.
Integrates with load balancers for efficient web application traffic distribution.
Azure Instance Metadata Services
A REST API accessible solely from within the VM, delivering critical information about the VM's SKU, storage, networking, and scheduled events.
App Services
Provides a fully managed web hosting platform to deploy and run websites easily.
Abstraction from the underlying server infrastructure.
Supports .NET, .NET Core, Node.JS, Java, Python, PHP, and containers.
App Types: Web Apps, Web API, Web Jobs, and Mobile Apps.
App Services Tiers
Varied tiers provide different allocations of CPU and RAM at varying cost levels to match performance and budget needs.
App Service Auto Scaling
Automatically scales resources in response to load, ensuring optimal performance.
Deployment Slots
Staging environments that enable code deployment and testing independently from the primary production site.
Traffic Splitting: A/B testing by directing a percentage of user traffic to the new slot.
AKS (Azure Kubernetes Services)
Enables deploying, managing, and scaling containerized applications using Kubernetes.
Users are billed only for consumed instances (VMs).
Azure Functions
Designed for small, event-triggered functions.
Ideal for event-driven architectures.
Fully managed by Azure, including startup, shutdown, and autoscaling.
Serverless computing.
Serverless
Abstracts the underlying infrastructure, eliminating the need for server management.
Triggers and Bindings
Triggers: Events that initiate function execution, such as HTTP requests or timers.
Bindings: Declarative connections to other Azure resources, streamlining data flow.
Cold Start
The delay experienced upon initial function invocation following inactivity.
Resolved by pre-warming instances in appropriate hosting plans.
Azure Functions Hosting Plans
Consumption: Pay-per-use model based on actual consumption.
Premium: Offers pre-warmed instances for consistently fast execution.
Dedicated: Runs functions within a dedicated App Service environment.