Advanced Fastly Interview Questions (2027)
40 advanced Fastly interview questions: VCL clustering, shielding side effects, cache key and Vary, restarts, stale content, purging and Compute.
Advanced Fastly interview questions test how the platform behaves inside a POP and between POPs: which VCL subroutines run on the delivery node and which on the fetch node, why code runs twice when shielding is on, how the cache key and Vary interact, how restarts and stale content are limited, and when Compute is the better tool than VCL. This page has 40 senior-level questions with direct answers.
It is written for engineers who already run Fastly in production. For CDN interviews in general, the main guide in this group is our 80+ Akamai and CDN interview questions, and Fastly basics are covered on the Fastly FAQs page. Answers were checked against the Fastly documentation in November 2026.
Key takeaways
- Inside a POP,
vcl_recv,vcl_hash,vcl_deliverandvcl_logrun on the delivery node;vcl_miss,vcl_pass,vcl_hitandvcl_fetchrun on the fetch node. Changes toreq.http.*on the fetch node do not travel back. - With shielding, your edge code usually runs at both the edge POP and the shield POP, so it has to be idempotent.
- The default cache key is the URL plus the Host header plus a generation value used by purge all. Vary adds variations under that key.
- VCL allows three restarts per request. The fourth returns a 503 that you can catch in
vcl_error, and the count is shared across the cluster. - Stale-while-revalidate applies before stale-if-error when their windows overlap, and Fastly sets the stale request limits to zero on shields.
- Compute runs WebAssembly, with official SDKs for Rust, JavaScript and Go among others listed on Fastly's SDK page.
How this page differs from the other Fastly guides
| Page | Angle |
|---|---|
| Fastly engineer questions for freshers | Services, versions, backends, basic VCL |
| Fastly FAQs | Short answers across caching, purging and security |
| Real-time Fastly questions | Production operations, purge API, headers |
| Scenario-based Fastly questions | Incident walk-throughs |
| This page | Request lifecycle internals, clustering, shielding side effects, cache key design, VCL limits, Compute architecture |
Request lifecycle and clustering
1. Walk through the VCL subroutines for a cache miss.
vcl_recv decides whether to look up or pass, vcl_hash builds the cache key, vcl_miss runs before the backend request, vcl_fetch runs when the response arrives and decides whether and how long to cache, then vcl_deliver runs before the response goes to the client and vcl_log runs after.
2. What return states does Fastly's boilerplate use in each subroutine?
vcl_recv returns lookup or pass, vcl_hash returns hash, vcl_hit and vcl_deliver return deliver, vcl_miss returns fetch, vcl_pass returns pass, and vcl_fetch returns deliver or pass.
3. What is clustering inside a POP?
Fastly spreads each object to a specific cache node in the POP. The node the client connects to (the delivery node) runs vcl_recv, vcl_hash, vcl_deliver and vcl_log; the node that owns the object (the fetch node) runs vcl_miss, vcl_hit, vcl_pass and vcl_fetch. This keeps one copy of each object per POP instead of one per server.
4. Why does a header you set in vcl_miss not appear in vcl_deliver?
Because vcl_miss ran on the fetch node and vcl_deliver runs on the delivery node. Changes to req.http.* made on the fetch node do not come back. Put the value on the response object (beresp) in vcl_fetch if you need it at delivery.
5. When is clustering skipped automatically?
On a hit on the delivery node, after a restart, and when vcl_recv returns pass or an error. You can also disable it by setting the Fastly-No-Shield header to 1 in vcl_recv.
6. How do you see from a response whether clustering happened?
fastly_info.state gets a -CLUSTER suffix when the request was handed to a second cache node. Logging it is a quick way to explain unexpected behaviour between nodes.
Shielding side effects
7. What changes in the request path when shielding is enabled?
Requests that need the origin go edge POP to shield POP to origin. If the client's nearest POP is the shield, it goes straight to origin. Only requests forwarded to a backend are affected.
8. Why does shielding make you write idempotent VCL?
The same service code typically runs at the edge and again at the shield. Code that appends headers or rewrites URLs without checking whether it already did will apply twice.
9. How do you limit a change to the origin-bound request only?
Check req.backend.is_origin (or req.backend.is_shield) before changing the request. Use fastly.ff.visits_this_service to tell whether you are at the client-facing edge (0) or the shield (greater than 0) when changing responses.
10. Why can modifying the response at the shield poison the edge cache?
The edge caches what the shield sends it. A client-specific change made at the shield, such as a cookie or a personalised header, ends up cached at the edge for everyone. Apply client-facing changes only at the edge.
11. What breaks if you change the Host header at the edge?
The shield drops the request with a 500 because it can no longer match the service. Use the backend's override_host setting instead.
12. Which value gives you the real client IP at the shield?
Fastly-Client-IP. At the shield, client.ip is the edge POP's address.
13. Why does cache hit ratio look lower after enabling shielding?
An origin fetch through a shield counts as two misses (MISS, MISS), one at each POP. Compare origin request volume rather than the raw ratio to judge whether shielding helped.
14. What happens to backend assignment and shielding in VCL?
Assigning req.backend after the #FASTLY RECV macro disables shielding for that request; assigning it before the macro gets overridden. Use Fastly's documented patterns for custom routing with shields.
15. Do shielding hops cost anything?
Yes. Traffic between POPs counts toward requests and bandwidth on the bill, which is worth stating when you justify a shield choice.
Cache key, Vary and object design
16. What is in Fastly's default cache key?
req.url, req.http.host and a generation value. The HTTP method and whether the request used TLS are not part of it.
17. Is the URL normalised before hashing?
The Host header is lowercased, but req.url keeps its case and query string order. Normalise the URL in vcl_recv (sort or strip query parameters) if variants are fragmenting the cache.
18. What is the generation value used for?
Purge all. Changing the generation makes every existing object unreachable at once, which is why purge all is always a hard purge.
19. When would you add to req.hash instead of using Vary?
Rarely. Fastly recommends Vary for things like language or device class because it keeps one primary object with variations. Change the hash only when the variants must be purged or managed as separate objects, and keep req.url in the key.
20. Why is Vary: User-Agent a bad idea?
User-Agent strings have huge cardinality, so the object splits into many variations and hit ratio falls. Map it to a small header in vcl_recv (for example a device class) and vary on that.
21. How does Surrogate-Control interact with Cache-Control?
When both are present, Fastly uses Surrogate-Control for its own cache and strips it before delivery, so browsers still follow Cache-Control. It supports max-age but not s-maxage.
22. How would you design surrogate keys for an e-commerce catalogue?
Tag each response with keys for the entities it shows, such as the product ID, the category and a template version. A price change then purges one product key; a template deploy purges the template key; nothing requires purge all.
Restarts, stale content and error handling
23. How many restarts does VCL allow?
Three. The fourth restart triggers a 503 that you can handle in vcl_error, and the counter travels with the request across both cluster nodes.
24. Why must restarts be conditional?
Restarting on every 502 restarts again when the retry also returns 502, until the limit is hit. Gate it, for example with req.restarts == 0 or a flag header.
sub vcl_fetch {
if (beresp.status == 502 && req.restarts == 0) {
restart;
}
}
25. How do stale-while-revalidate and stale-if-error differ?
SWR serves the stale object immediately after expiry while Fastly fetches a new copy in the background. SIE serves stale content when the origin is unhealthy or unreachable. When both windows overlap, SWR applies first.
26. How do you serve stale content when the origin returns a 5xx?
In a VCL service, return deliver_stale when a stale object exists (check stale.exists). In Compute, return an error from the after-send hook so the stale object is used.
27. Why might stale content not be served from a shield?
Fastly sets req.max_stale_while_revalidate and req.max_stale_if_error to 0s on shields, so stale serving happens at the edge. Keep this in mind when you test stale behaviour from a POP that is also the shield.
28. What is the difference between soft and hard purge, and where is soft purge available?
A soft purge marks objects stale, so they can still be served under SWR or SIE while revalidating. A hard purge removes them. Soft purge works for URL and surrogate key purges; purge all is always hard.
29. Why is purge all risky right before a traffic peak?
Every request becomes a miss at the same moment, and origin load jumps. Prefer soft surrogate-key purges, and keep shielding on so the shield absorbs the refill.
Compute and architecture
30. What does Compute run?
Programs compiled to WebAssembly. Fastly provides official SDKs for Rust, JavaScript and Go, and lists others on its SDK reference page; any Wasm program can run but only SDK languages are supported.
31. What toolchain versions does Fastly list for Compute?
Fastly's guides list Rust 1.78.0 or later (and name 1.91.0 and 1.93.0 as incompatible), Go 1.21 or later or TinyGo 0.28.1 or later, and Node.js 16.6 or later for JavaScript. Check the current page before an interview because these move.
32. When would you choose Compute over VCL?
When the logic needs real code: parsing request bodies, calling several backends and combining results, signing tokens, or reusing a library. VCL is fine for header logic, routing and cache rules and is quicker to change.
33. How does shielding look different in Compute?
Fastly's shielding guide notes that Compute services do not expose the internal Fastly-FF header, so VCL-style checks on it do not carry over; follow the Compute section of that guide for your SDK. The double-execution rule still applies.
34. How do you keep VCL changes reviewable in a team?
Store VCL or snippets and service settings in Terraform or another IaC tool, run plans in pull requests, and activate new service versions only from the pipeline. Fastly service versions give you a rollback point for every change.
35. How would you design a multi-region origin with Fastly?
Define one backend per region with health checks, choose the backend in vcl_recv with a geo or header rule (following Fastly's guidance on backend assignment with shielding from question 14), fall back to the healthy region when req.backend.healthy is false, and place a shield near each origin.
Scenario questions
36. After enabling shielding, a custom header appears twice in responses. What do you change?
The code that adds it runs at both POPs. Wrap it so it runs only where fastly.ff.visits_this_service == 0 (the client-facing edge) or make it set rather than append.
37. Logs show "Max restarts limit reached".
A restart is unconditional, often on a status that the retried request also gets. Add a req.restarts guard, handle the 503 in vcl_error, and look at why the origin keeps failing.
38. A header set in vcl_miss for analytics is missing from logs written in vcl_log.
Clustering: vcl_miss ran on the fetch node. Copy the value to beresp in vcl_fetch or compute it on the delivery node in vcl_recv.
39. Hit ratio is low and cached objects vary by query string order.
The URL is part of the key as received. Sort or strip query parameters in vcl_recv so equivalent URLs map to one key, then watch the hit ratio and origin requests.
40. A deploy changed the Host header in VCL and the site now returns 500 from the shield.
Revert to the previous service version, then set override_host on the backend instead of rewriting Host in vcl_recv.
How to prepare
- Use Fiddle or a test service to log
fastly_info.state,req.restartsandfastly.ff.visits_this_serviceand watch them change with and without a shield. - Write a small Compute app in one SDK language and deploy it with the Fastly CLI.
- Follow the Fastly preparation plan for a week-by-week order, and read about CDN integration in DevOps pipelines.
Fastly roles usually sit inside platform or SRE teams. Our DevOps training in Pune (Kharadi classroom or live online) covers the HTTP, Linux, Terraform and CI/CD skills these rounds assume.
FAQ
Which VCL subroutines run on the fetch node?
vcl_miss, vcl_hit, vcl_pass and vcl_fetch typically run on the fetch node when clustering applies. vcl_recv, vcl_hash, vcl_deliver and vcl_log run on the delivery node.
Why does my VCL run twice with shielding?
The service code runs at the edge POP and again at the shield POP. Use req.backend.is_origin and fastly.ff.visits_this_service to limit changes to one location.
How many times can a Fastly VCL request restart?
Three times. The fourth restart produces a 503 that you can intercept in vcl_error.
What is in the default Fastly cache key?
The request URL, the Host header and a generation value. Method and TLS status are not included.
Can purge all be a soft purge?
No. Soft purge works for single URLs and surrogate keys; purge all is always a hard purge.
Which languages does Fastly Compute support?
Compute runs WebAssembly. Fastly provides official SDKs including Rust, JavaScript and Go; check the SDK reference page for the current list.
Should I learn VCL or Compute first for a senior role?
Learn VCL request flow first, because most existing services and many interview questions use it, then build one Compute service so you can compare them.
Official references
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0