Real-Time Fastly Interview Questions (2027)

32 real-time Fastly interview questions on VCL, surrogate-key purges, soft purge, shielding, stale content and Compute, with production scenarios.

Sep 30, 2025 - 17:49
Nov 7, 2026 - 05:37
 0  66
Real-Time Fastly Interview Questions (2027)

Real-time Fastly interview questions test how you run a Fastly service under live traffic: where logic sits in the VCL lifecycle, how you purge by surrogate key without hammering the origin, how shielding and stale content protect a backend, and what you check first when cache hit ratio drops. The 32 questions below cover all of that.

This page is about Fastly only and leans on production situations. For Akamai property and CDN questions, use our Akamai engineer interview questions, which is the main CDN interview guide on this blog. If you need a quick refresher on how CDNs fit into delivery pipelines, read where CDN integrations help cloud-native deployments first. Every VCL subroutine, API endpoint and header named here was checked against Fastly's documentation in November 2026.

Key takeaways

  • Know the VCL subroutine order (vcl_recv, vcl_hash, vcl_hit, vcl_miss, vcl_pass, vcl_fetch, vcl_error, vcl_deliver, vcl_log) and what each one returns by default.
  • Surrogate keys let you purge one product or article across thousands of URLs. A soft purge marks content stale instead of removing it.
  • Shielding funnels cache misses through one POP, which cuts origin requests and raises hit ratio.
  • stale-while-revalidate and stale-if-error keep pages up during slow or failed origin fetches.
  • Fastly Compute runs your code as WebAssembly, with official SDKs for Rust, JavaScript, Go and C++.

Fastly concepts at a glance

ConceptWhat it doesInterview angle
VCL servicesRequest handling written in Fastly's Varnish-based configuration languageWhich subroutine to change for a given goal
ComputeYour code compiled to WebAssembly and run at the edgeWhen you need logic VCL cannot express
Surrogate-KeyResponse header that tags cached objects with keysTargeted invalidation after a content change
Soft purgeMarks objects stale rather than deleting themAvoiding an origin stampede after a purge
ShieldingRoutes misses through a designated shield POPProtecting a small origin
Surrogate-ControlCache directives for Fastly only, stripped before the browserDifferent TTLs at edge and browser

Questions for freshers

1. What is Fastly?

Fastly is an edge cloud platform that provides CDN caching, edge compute and security services from points of presence (POPs) around the world. Customers configure a service with one or more domains and backends. Requests hit the nearest POP, which serves from cache or fetches from the origin.

2. What is VCL in Fastly?

VCL (Varnish Configuration Language) is the language Fastly uses to define how a service handles requests and responses. Fastly generates boilerplate VCL for every service, and you can add custom VCL or snippets into specific subroutines. It is compiled and deployed when you activate a new service version.

3. List the VCL subroutines in the order they usually run.

vcl_recv runs first when a request arrives, then vcl_hash builds the cache key. On a cache hit vcl_hit runs; on a miss vcl_miss runs; for uncacheable requests vcl_pass runs. vcl_fetch runs when the backend response arrives, vcl_error handles synthetic or error responses, vcl_deliver runs before the response goes to the client, and vcl_log runs at the end for logging.

4. What does vcl_recv return by default?

In Fastly's boilerplate, vcl_recv returns lookup for cacheable requests and pass for methods other than GET, HEAD and FASTLYPURGE. Returning pass skips the cache for that request, which is what you want for most POST requests and authenticated API calls.

5. What is a cache hit ratio and why does it matter?

It is the share of requests answered from Fastly's cache instead of the origin. A higher ratio means lower origin load, lower latency and fewer origin egress costs. A sudden drop usually means a cache key change, a new uncacheable header such as Set-Cookie, or a purge.

6. What is a backend in a Fastly service?

A backend is the origin server Fastly fetches from on a miss or pass. You define its address, port, TLS settings and health check. A service can have several backends and pick one in vcl_recv based on path, host or other request data.

7. What is a service version, and why can you not edit an active one?

Fastly configuration is versioned. You clone the active version, edit the clone, validate it and then activate it. The active version is locked so you always have a known good version to roll back to. Rollback is activating the previous version.

8. What is the difference between Cache-Control and Surrogate-Control?

Cache-Control applies to every cache, including browsers. Surrogate-Control applies only to Fastly, overrides Cache-Control at the edge and is removed before the response reaches the client. Fastly's documentation notes that s-maxage is not supported in Surrogate-Control, so use max-age there.

9. What is a purge?

A purge removes or invalidates cached content so the next request goes to the origin. Fastly supports purging a single URL, purging by surrogate key and purging everything in a service.

10. What is Fastly Compute?

Compute is Fastly's platform for running your own code at the edge. Code is compiled to WebAssembly and run with Wasmtime. Fastly ships official SDKs for Rust, JavaScript, Go and C++, and the CLI scaffolds projects with fastly compute init and deploys with fastly compute publish.

Questions for 2-5 years of experience

11. How do surrogate keys work?

Your origin adds a Surrogate-Key response header listing one or more space-separated keys, for example a product ID and a category. Fastly indexes cached objects by those keys. When the product changes, one purge by key invalidates every URL tagged with it. Keys are case sensitive.

12. Show the API call to purge by surrogate key.

Send a POST to the purge endpoint for your service with your API token. Add the soft purge header if you want objects marked stale rather than removed.

curl -X POST \
  -H "Fastly-Key: $FASTLY_API_TOKEN" \
  -H "Fastly-Soft-Purge: 1" \
  "https://api.fastly.com/service/$SERVICE_ID/purge/product-123"

13. What is a soft purge and when do you use it?

A soft purge marks objects as stale instead of deleting them. With stale-while-revalidate or stale-if-error configured, Fastly can keep serving the old copy while it fetches a new one. Fastly's API reference says soft purge works for single URLs, surrogate keys and bulk key purges, but not for purge all.

14. Why is purge all risky on a busy site?

Purge all empties the cache for the whole service, so the next wave of requests all go to the origin at once. Fastly's purging guide warns it can raise load times while the cache rebuilds and recommends surrogate keys if you find yourself purging everything more than weekly.

15. What is shielding?

Shielding designates one POP as a shield. Edge POPs send their misses to the shield instead of straight to the origin, so many regional misses collapse into one origin request. It raises the hit ratio and reduces connection setup to the origin, since POPs keep connections open to each other.

16. How do stale-while-revalidate and stale-if-error differ?

stale-while-revalidate serves a stale object right away while Fastly refreshes it in the background. stale-if-error blocks on the origin fetch and falls back to the stale object only when the fetch fails. When both apply, Fastly uses stale-while-revalidate first and stale-if-error after that window ends.

Surrogate-Control: max-age=300, stale-while-revalidate=60, stale-if-error=86400

17. How would you serve stale content from VCL when the origin returns a 5xx?

In vcl_fetch or vcl_error, check stale.exists. If a stale object within its stale-if-error window exists, return(deliver_stale) sends it instead of the error. Pair this with a backend health check so Fastly stops sending traffic to a failing origin quickly.

18. How do you change the cache key in VCL?

Edit vcl_hash or normalize the request in vcl_recv before hashing. A common pattern is stripping tracking query parameters or sorting query strings in vcl_recv so that the same page with different parameter order hits one cache object instead of many.

19. Why might adding a Vary header hurt your hit ratio?

Vary tells caches to store a separate copy for each value of the named request header. Varying on User-Agent, for example, creates a huge number of variants. Normalize the header in vcl_recv to a few buckets, such as mobile and desktop, before the response varies on it.

20. How do you deploy Fastly changes safely from CI/CD?

Keep VCL or Compute code in Git, clone a new service version through the API or CLI in the pipeline, upload changes, validate, and activate only after tests pass on a staging service. Rollback is activating the previous version. Our pipeline-as-code guide covers the Git side of this.

21. How does a request reach vcl_pass, and what happens to the response?

vcl_recv or vcl_hit can return pass. The request goes to the backend and the response is not stored in cache. This is the right path for personalized pages, carts and admin URLs.

22. What does vcl_log run for?

vcl_log runs after the response has been delivered and is the usual place for logging statements that send request and response data to your log endpoints. Because it runs last, it can record the final status, cache state and timing.

Senior and architect questions

23. When would you choose Compute over VCL?

Choose Compute when you need general-purpose logic: parsing JSON bodies, calling several backends and composing responses, running tests in a normal language toolchain, or sharing code with other services. VCL is enough for routing, header manipulation, cache policy and redirects, and many teams keep those in VCL.

24. How do you design a purge strategy for an e-commerce catalogue?

Tag responses with keys at several levels: the product ID, its category, and a key for shared fragments such as the header. Price updates purge the product key with soft purge. Category reorganizations purge the category key. Reserve purge all for emergencies. Make the origin emit keys consistently so the purge job does not need to know URLs.

25. How do you stop stale-while-revalidate from running on both the edge and the shield?

Fastly documents req.max_stale_while_revalidate and req.max_stale_if_error, which you can set to 0s for a request, for example on the shield POP, so that only one layer serves stale content. This avoids stacking stale windows on top of each other.

26. How do you protect an origin that can only handle a small request rate?

Turn on shielding, give cacheable content sensible TTLs with stale-while-revalidate, use soft purges, and make sure error pages are cached briefly instead of passed. Restrict the origin firewall so it accepts traffic only from Fastly, which stops attackers bypassing the edge.

27. What metrics do you watch for a Fastly service?

Hit ratio, origin request rate, 5xx rate from origin versus edge, time to first byte at the edge, and bandwidth. Break them down by POP and by host. A change in one POP points to a regional network issue; a change everywhere after an activation points to your configuration.

Scenario-based questions

28. Hit ratio fell from 92% to 40% right after a deploy. What do you check?

Compare the new service version with the previous one. Look for a new Vary header, a Set-Cookie on cacheable responses, a cache-key change in vcl_hash or vcl_recv, or a TTL that dropped to zero. If the change is in the application rather than Fastly, check response headers from the origin with curl. Roll back to the previous version if the cause is not clear within minutes.

29. Editors say a fixed typo still shows on the live site.

Check whether the article response carries a surrogate key and whether the CMS purge job ran and succeeded. Fetch the URL and inspect the cache headers to see the object's age. If browsers are holding it, the issue is Cache-Control, not Fastly; shorten browser TTL with Cache-Control and keep a long edge TTL with Surrogate-Control.

30. The origin went down during a sale. How would you keep pages up?

If stale-if-error is set, Fastly serves the last good copy while the backend health check fails. Without it, add stale-if-error to cacheable responses and use stale.exists with return(deliver_stale) in vcl_error. For the next event, lengthen TTLs on product pages and pre-warm caches by requesting top URLs through the shield.

31. A purge-all during peak traffic overloaded the origin. How do you prevent it next time?

Remove purge-all rights from routine tooling, switch content updates to surrogate keys with soft purge, and add a runbook step requiring approval for purge all. Shielding also helps because a purge produces one origin miss per shield, not one per POP.

32. Users in one region report slow responses while others are fine.

Filter metrics and logs by POP. If one POP shows high time to first byte only on misses, the path to the origin is the problem; check the shield location and backend latency from that region. If hits are slow too, raise a support case with Fastly and share request IDs and timestamps.

How to prepare

Use a Fastly account, put a test service in front of a small origin, and practise these tasks: add a custom VCL snippet in vcl_recv, tag responses with surrogate keys, purge by key from curl, turn on shielding, and watch hit ratio in the dashboard. Then build a small Compute app with the CLI. Interviewers notice when you have run these steps yourself. If you want structured practice with CI/CD and cloud tooling around a CDN, our DevOps course (classroom in Kharadi, Pune, and live online) covers pipelines, Kubernetes and monitoring. For CDN-adjacent prep, also see the Cloudflare security and CDN interview questions and the guide on S3 with CloudFront.

FAQ

Is Fastly VCL the same as open-source Varnish VCL?

Fastly's VCL is based on Varnish but has its own subroutines, variables and functions, such as stale.exists and FASTLYPURGE handling. Use Fastly's VCL reference rather than Varnish docs.

What languages can I use with Fastly Compute?

Fastly provides official SDKs for Rust, JavaScript, Go and C++. Code compiles to WebAssembly, and the platform is language agnostic, so custom SDKs are possible.

What is the difference between purge and soft purge?

A purge removes the object so the next request goes to origin. A soft purge marks it stale so Fastly can keep serving it while revalidating, which protects the origin.

Does soft purge work with purge all?

No. Fastly's API reference lists soft purge for single URLs, surrogate keys and bulk key purges only.

What is shielding in Fastly?

Shielding sends cache misses from edge POPs through one designated shield POP before the origin, cutting origin requests and raising hit ratio.

How should I prepare for a Fastly interview?

Set up a test service, practise VCL snippets, surrogate-key purges and shielding, read the VCL lifecycle docs, and be ready to talk through a hit-ratio drop step by step.

References

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.