session: "5102-foundations-of-comp-sys/2026-09-05 0000 FCS 05 Sep"
title: "FCS 05 Sep"
date: "2026-09-05 00:00"
duration: "2h 11m"
language: "en"
model: "deepseek-ai/DeepSeek-V3.2"
parts: 3
transcript_chars: 73090
generated: "2026-11-23T15:17:18+05:30"
FCS 05 Sep
Overview
This class introduced cloud-based autoscaling using Azure Virtual Machine Scale Sets (VMSS) as a practical case study for the course's theme of the hardware/software contract. It covered the configuration of a VMSS, including instance counts, scaling rules, load balancers, and health probes. The session demonstrated how a web request flows from a user through the load balancer to a VM's OS and CPU, connecting high-level service availability to low-level system resources. Students observed live scaling triggered by simulated CPU load, monitored metrics, and discussed the orchestration of virtualized hardware resources.
Learning outcomes
- Configure a Virtual Machine Scale Set with autoscaling rules based on a metric like CPU utilization.
- Explain the flow of a web request from a browser through a load balancer to a VM's CPU and back.
- Monitor VM and VMSS performance metrics (CPU, memory) using cloud portal tools and basic Linux commands.
- Diagnose why a scaled-out VM instance might be marked "unhealthy" by a load balancer health probe.
- Describe the relationship between application deployment (e.g., NGINX installation) and the automatic scaling infrastructure.
Core concepts
Virtual Machine Scale Set (VMSS)
A group of load-balanced, identical virtual machines that can automatically increase or decrease the number of running instances based on defined rules (e.g., CPU utilization). It matters because it embodies the cloud principle of elastic, on-demand resource allocation, abstracting the management of individual servers.
Load Balancer and Health Probe
A network component that distributes incoming traffic across available VM instances. It uses a health probe (e.g., checking port 80) to determine which VMs are ready to serve requests. Unhealthy VMs are removed from the pool. This is crucial for maintaining service availability and is a software-managed replacement for hardware load-balancing appliances.
Autoscaling Rule
A policy that defines when to add or remove VM instances. It is triggered by a metric threshold (e.g., average CPU utilization > 60%). Scaling actions are not instantaneous and include configurable wait periods. This concept connects the observed system state (CPU load) to an automated management action, implementing a feedback loop.
Orchestration Mode (Flexible vs. Fixed)
Determines how VMs are managed within or across scale sets. 'Flexible' allows mixing VM types and scaling across multiple scale sets under one load balancer, while 'Fixed' is restricted to a single, uniform set. This relates to the trade-off between management complexity and deployment flexibility.
Virtualization and Metrics Abstraction
The cloud platform virtualizes physical hardware (vCPUs, RAM) and provides aggregated metrics (e.g., average CPU across a VMSS). The lecturer noted that "depending on the vm and the virtualization environment some fields may be virtualized or not represented physical most exactly." This highlights the course's central theme: the contract between the software's view of resources and the underlying physical implementation.
Formulas and maths
No formulas were presented in this session.
Worked examples
Example 1: Initial VMSS Configuration and IPs
- Setup: A VMSS was created with Ubuntu 24.04, VM size Standard B2s (2 vCPUs, 4 GB RAM), minimum 2 instances, maximum 5 instances, deployed across three availability zones.
- Observed IPs:
- Load Balancer Public IP:
20.235.212.114 - VM Instance 1 Public IP:
4.240.91.58 - VM Instance 2 Public IP:
4.240.107.194 - Test: Accessing the load balancer IP returned "response from VMSS instance 2". Accessing a VM's IP directly returned a customized page (e.g., "response from VMSS instance 1").
Example 2: Triggering Autoscaling with CPU Load
- Initial State: 2 VM instances, average CPU utilization ~0.2%.
- Action: A
for loop command was run on one VM to generate load. Later, external load was applied using siege (20 concurrent users for 1 minute). - Observation: The VMSS average CPU utilization rose to 44-50.04%.
- Result: Because the scaling rule was set to "scale out when CPU > 60%" (in one demo) or "> 40%" (in another), the VMSS automatically increased the instance count from 2 to 5. The new VMs were created but were marked "unhealthy" because NGINX was not automatically installed on them.
Example 3: Manual Web Server Setup on a VM
A sequence of shell commands was run via Azure's "Run command" feature to prepare a VM:
1. apt-get update && apt-get install -y nginx
2. echo "response from VMSS instance X" > /var/www/html/index.html
3. systemctl enable nginx && systemctl restart nginx
This demonstrated the manual steps required to make a VM serve web traffic, which was missing from automatically scaled-out instances.
Questions asked in class
- Q (Shobhit Kumar): Why use NGINX and what problem does it solve?
- A: NGINX is a sample web server used to demonstrate a service running on port 80. Any web server (Apache, Tomcat, IIS) could be used. It allows the load balancer's health probe to check if the VM is healthy.
- Q (Rohit): What is the relation between NGINX and VM health?
- A: The load balancer monitors port 80. If the web server (NGINX) is not running, the VM is marked unhealthy and the load balancer stops sending traffic to it.
- Q (Varun): Is a load balancer created by default with a VMSS?
- A: No, it is configured separately. Without a load balancer, the VMSS is not accessible from the external internet.
- Q (Varun): Is the CPU percentage on the VMSS overview the load balancer's CPU or an average?
- A: It is the average CPU utilization of all VMs in the scale set. Individual VM metrics show per-instance CPU.
- Q: Why use a 40% CPU threshold in the lab?
- A: Because generating enough load to reach a higher threshold (like 70%) in a demo environment is difficult; a lower threshold ensures the scaling action can be triggered.
- Q: What is CPU throttling?
- A: Explained via analogy: Increasing load (requests) is like cars on a highway. If lanes (CPU cores) are full, additional lanes (additional VM instances) are added by autoscaling to prevent the system from hanging.
Key takeaways
- A Virtual Machine Scale Set (VMSS) manages a group of identical VMs, enabling horizontal scaling based on metrics like CPU utilization.
- A load balancer distributes traffic and uses health probes (e.g., on port 80) to route requests only to healthy VMs.
- Autoscaling rules define thresholds (e.g., scale out at >60% CPU, scale in at <40% CPU) and include wait periods to prevent rapid oscillation.
- The CPU utilization metric shown for a VMSS in the Azure portal is an average of all VMs in the set.
- Scaling out creates new VM instances, but any required application software (e.g., NGINX) must be installed via a custom script or image; it is not deployed automatically by default.
- The flow of a web request is: Browser → Load Balancer (Public IP) → VM Network Interface → OS → CPU execution → Memory → Response.
- Basic Linux commands (
systemctl, curl, lscpu, top) can be run on cloud VMs via portal tools to inspect service status and resource usage. - Cloud providers offer free-tier accounts (e.g., $200 credit on Azure with an IIT ID) for learning, requiring card verification for a small, refundable temporary charge.
- Orchestration mode ("flexible" vs. "fixed") controls whether scaling can occur across multiple scale sets or is confined to one.
- Availability zones are used for high availability; the platform decides zone placement when multiple zones are selected.
- The hardware/software contract is visible in virtualization: the VM sees virtualized resources (vCPUs), and the platform's metrics may not represent the physical hardware exactly.
Exam-style questions
1. Question: You configure an Azure VMSS with a load balancer health probe on port 80. After a scale-out event, new VMs are created but receive no traffic. Using curl from the load balancer's IP returns a 503 error. What is the most likely cause and how would you fix it?
- Answer Outline: The new VMs are marked "unhealthy" because the service on port 80 (e.g., NGINX) is not running. Fix by ensuring a startup script or custom VM image installs and starts the web server automatically upon instance creation.
2. Question: A VMSS is configured to scale out when average CPU > 70% and scale in when average CPU < 30%. The current average CPU is 75%, but no new VMs are being created. List two possible reasons.
- Answer Outline: (1) The scale set has already reached its configured maximum instance limit. (2) The scaling action has a "cool down" or wait period that has not yet elapsed since the last scaling action.
3. Question: Describe the journey of a single HTTP GET request from a user's browser to a web page hosted on a VM within a VMSS, mentioning the load balancer and the health probe.
- Answer Outline: Request goes to load balancer's public IP. Load balancer checks its pool of VMs, selecting one that is "healthy" (health probe on port 80 succeeded). Request is forwarded to that VM's internal IP. The VM's OS receives the packet, the web server process generates a response, which is sent back through the load balancer to the user.
Glossary
- Virtual Machine Scale Set (VMSS) - An Azure service for creating and managing a group of load-balanced, auto-scaling VMs.
- Load Balancer - A network device that distributes incoming traffic across multiple servers to ensure no single server is overwhelmed.
- Health Probe - A check performed by a load balancer to determine if a backend server is available to handle requests.
- Autoscaling Rule - A policy that automatically adjusts the number of compute resources based on specified performance metrics.
- Orchestration Mode - Defines how VMs are managed and scaled within a VMSS, either flexibly across sets or fixed within one set.
- Availability Zone - Physically separate locations within an Azure region, each with independent power, cooling, and networking.
- vCPU - A virtual central processing unit, representing a portion of a physical CPU core allocated to a virtual machine.
Follow-ups
- A step-by-step document for creating free-tier accounts on Azure, AWS, and GCP will be uploaded.
- The assignment for the week, covering both theory and lab sessions, will be uploaded before Monday.
- The process for automatically installing required software (like NGINX) on newly scaled-out VM instances was not resolved and may be revisited.
- The next theory session is scheduled for Saturday at 7:30 PM (clarified later as possibly 2 PM).