Application Gateway (Layer 7) in Azure - Time & Space Complexity
Start learning this pattern below
Jump into concepts and practice - no test required
We want to understand how the work done by an Application Gateway grows as more requests come in.
Specifically, how does the number of requests affect the processing time and resource use?
Analyze the time complexity of processing incoming HTTP requests through an Application Gateway.
// Pseudocode for request processing
foreach (request in incomingRequests) {
authenticate(request);
applyWebApplicationFirewall(request);
routeToBackend(request);
logRequest(request);
}
This sequence shows how each request is handled one by one by the Application Gateway at Layer 7.
Look at what happens repeatedly for each request:
- Primary operation: Processing each HTTP request through authentication, firewall checks, routing, and logging.
- How many times: Once per incoming request.
As the number of requests increases, the Application Gateway processes each one individually.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 10 request processings |
| 100 | 100 request processings |
| 1000 | 1000 request processings |
Pattern observation: The work grows directly with the number of requests; double the requests, double the work.
Time Complexity: O(n)
This means the processing time grows linearly with the number of incoming requests.
[X] Wrong: "The Application Gateway processes all requests at once, so time stays the same no matter how many requests arrive."
[OK] Correct: Each request requires separate processing steps, so more requests mean more total work.
Understanding how request load affects processing helps you design and explain scalable cloud solutions confidently.
"What if the Application Gateway used caching to skip some processing steps for repeated requests? How would the time complexity change?"
Practice
Solution
Step 1: Understand Layer 7 role
Layer 7 means the application layer, which handles web traffic content like URLs.Step 2: Identify Application Gateway function
Application Gateway routes traffic based on URL paths and content, unlike DNS or VM management.Final Answer:
It routes web traffic based on URL paths and content. -> Option CQuick Check:
Layer 7 routing = URL-based traffic routing [OK]
- Confusing Application Gateway with DNS or VM services
- Thinking it works at network layer instead of application layer
- Assuming it stores data like a database
Solution
Step 1: Review ARM template frontend IP syntax
The frontend IP config requires a name and properties including a reference to a public IP resource by its ID.Step 2: Match correct JSON structure
{\"name\": \"appGatewayFrontendIP\", \"properties\": {\"publicIPAddress\": {\"id\": \"/subscriptions/.../publicIPAddresses/myPublicIP\"}}} correctly uses "name" and "properties" with "publicIPAddress" and its "id" field, matching ARM schema.Final Answer:
{"name": "appGatewayFrontendIP", "properties": {"publicIPAddress": {"id": "/subscriptions/.../publicIPAddresses/myPublicIP"}}} -> Option AQuick Check:
Frontend IP config needs name + publicIPAddress id [OK]
- Missing 'properties' wrapper around publicIPAddress
- Using 'location' inside frontend IP config incorrectly
- Incorrect field names like 'frontendIP' or 'ipConfig'
"pickHostNameFromBackendAddress" to true?{
"name": "appGatewayBackendHttpSettings",
"properties": {
"port": 80,
"protocol": "Http",
"pickHostNameFromBackendAddress": true
}
}Solution
Step 1: Understand 'pickHostNameFromBackendAddress'
This setting tells the gateway to use the hostname from the backend pool's address (IP or FQDN) for HTTP requests.Step 2: Analyze effect on backend requests
When true, the hostname in HTTP headers matches backend pool address, not the HTTP settings hostname.Final Answer:
The backend hostname is taken from the backend pool IP or FQDN instead of the HTTP settings. -> Option AQuick Check:
pickHostNameFromBackendAddress true = use backend pool hostname [OK]
- Thinking it changes port or protocol
- Confusing frontend hostname with backend hostname
- Assuming it disables SSL termination
Solution
Step 1: Understand health probe failure with IP backend pool
If 'pickHostNameFromBackendAddress' is true, the gateway uses backend hostname from IP, which fails if no DNS name exists.Step 2: Identify mismatch causing probe failure
Backend IPs lack DNS names, so probes fail when hostname is required but missing.Final Answer:
The backend HTTP settings have 'pickHostNameFromBackendAddress' set to true but backend IPs lack proper DNS names. -> Option BQuick Check:
IP backend + pickHostNameFromBackendAddress true = probe fails [OK]
- Blaming subnet size for routing issues
- Assuming frontend IP config missing public IP causes backend probe failure
- Confusing backend pool IPs with FQDNs
/images/* to an image server pool and /api/* to an API server pool. Which configuration step is essential to achieve this?Solution
Step 1: Understand URL-based routing requirement
Routing based on URL paths requires path-based routing rules with URL path maps.Step 2: Configure path-based rules
Define URL path maps that link specific URL patterns like '/images/*' and '/api/*' to their respective backend pools.Final Answer:
Create path-based routing rules with URL path maps specifying backend pools for each path. -> Option DQuick Check:
URL path routing = path-based rules with URL maps [OK]
- Thinking multiple public IPs are needed for URL routing
- Using multiple frontend ports without path rules
- Assuming backend HTTP settings control URL routing
