13/03/2024
Without shielding
To understand shielding, let’s look at this diagram. My main server is in Roubaix, France. My aim is to lighten the load on this server as much as possible.
Requests come from all over the world, handled by the nearest Fastly POPs. However, these POPs still need to reach my server to refresh the cache, creating inefficiency as every POP accesses my origin.
To improve this, we can place a cache server between the POPs and my origin. This server, acting as a shield, absorbs requests and delivers cached content, reducing the direct load on my origin server and improving efficiency.
With Shielding
The Paris POP acts as an additional caching layer. Since it’s closest to our origin, it will handle all the load from other POPs when they need to access my origin server.
Multiple shields
You can set up multiple shields if you have multiple origins. Just like before, keep your shields close to your origins for better efficiency.
Skipping the shield with PASS on the request
If « PASS » is called on the request, it skips the shields and goes directly to the origin.
Shielding adds another caching layer
Since the shield is essentially an extra POP, you gain benefits from POP features like clustering, which adds another layer of caching.
How to visualize your shield?
Run the following command
curl -I -H "Fastly-Debug: 1" https://www.antoinebrossault.com
Then observe the fastly-debug-path
:
For that example I ran the command from a german IP
fastly-debug-path:
(D cache-fra-etou8220158-FRA 1740688295) (F cache-fra-etou8220129-FRA 1740688295)
(D cache-par-lfpb1150066-PAR 1740688295) (F cache-par-lfpb1150066-PAR 1740637340)
Here the edge pop ( the first one to process our request ) is cache-fra-etou8220158
and the shield is cache-par-lfpb1150066-PAR
Note: fra
stands for Frankfurt and par
stands for Paris.
We can also see the details of the machines used for the delivery (D) node and the fetching (F) node.
Edge pop (Frankfurt):
(D cache-fra-etou8220158-FRA 1740688295) (F cache-fra-etou8220129-FRA 1740688295)
And our shield (Paris) :
(D cache-par-lfpb1150066-PAR 1740688295) (F cache-par-lfpb1150066-PAR 1740637340)
Takeaways
• The free Shielding feature allows a single POP to act as an additional caching layer
between the user and the origin.
• Each backend configuration can have a different POP selected as it’s Shield POP.
• This allows different Shields to be configured, one per
