#150

Aug 1, 2021

Work

This week I started looking into Fastly’s Compute@Edge service, as a possible means of handling some bits of dynamic content on GOV.UK (for example, showing the appropriate sign in / sign out link in the header, without every request needing to hit our origin servers).

Currently we do our CDN configuration with lots of VCL, which has a big downside: Fastly use their own fork of Varnish, so we can’t run or test this VCL locally. You just have to make your change, deploy it to staging, and manually check.

But Compute@Edge would let us use Rust or AssemblyScript, which in principle can be run locally, though the situation there isn’t so great either:

The downside of using Compute@Edge for some accounts-related functionality is that we’d have another layer in our CDN stack. This could be pretty confusing, as all the network hops inside Fastly’s network go through cache nodes.

We’d likely stick the Compute@Edge logic between our current VCL and our origin servers, so we’d end up with something like:

user User fedge Fastly Edge Node user->fedge vcl GOV.UK VCL fedge->vcl fcacheVCL1 Fastly Cache Node vcl->fcacheVCL1 fcacheVCL2 Fastly Cache Node vcl->fcacheVCL2 fcacheVCL3 Fastly Cache Node vcl->fcacheVCL3 fcacheVCL4 Fastly Cache Node vcl->fcacheVCL4 cate GOV.UK Compute@Edge fcacheVCL1->cate mirror1 GOV.UK Mirror #1 fcacheVCL2->mirror1 mirror2 GOV.UK Mirror #2 fcacheVCL3->mirror2 mirror3 GOV.UK Mirror #3 fcacheVCL4->mirror3 fcacheCATE Fastly Cache Node cate->fcacheCATE origin GOV.UK Origin fcacheCATE->origin

…or maybe…

user User fedge Fastly Edge Node user->fedge vcl GOV.UK VCL fedge->vcl fcacheVCL Fastly Cache Node vcl->fcacheVCL cate GOV.UK Compute@Edge fcacheVCL->cate fcacheCATE1 Fastly Cache Node cate->fcacheCATE1 fcacheCATE2 Fastly Cache Node cate->fcacheCATE2 fcacheCATE3 Fastly Cache Node cate->fcacheCATE3 fcacheCATE4 Fastly Cache Node cate->fcacheCATE4 origin GOV.UK Origin fcacheCATE1->origin mirror1 GOV.UK Mirror #1 fcacheCATE2->mirror1 mirror2 GOV.UK Mirror #2 fcacheCATE3->mirror2 mirror3 GOV.UK Mirror #3 fcacheCATE4->mirror3

In either case, it’s kind of confusing having two layers of custom CDN logic. Now, Rust is a much nicer language than VCL, so perhaps we’d end up merging the VCL into the Compute@Edge code and doing it all there, and then we could have fully tested CDN logic, which would be very nice.

user User fedge Fastly Edge Node user->fedge cate GOV.UK Compute@Edge fedge->cate fcacheCATE1 Fastly Cache Node cate->fcacheCATE1 fcacheCATE2 Fastly Cache Node cate->fcacheCATE2 fcacheCATE3 Fastly Cache Node cate->fcacheCATE3 fcacheCATE4 Fastly Cache Node cate->fcacheCATE4 origin GOV.UK Origin fcacheCATE1->origin mirror1 GOV.UK Mirror #1 fcacheCATE2->mirror1 mirror2 GOV.UK Mirror #2 fcacheCATE3->mirror2 mirror3 GOV.UK Mirror #3 fcacheCATE4->mirror3

But deciding to rewrite how our CDN works is a little outside the scope of the accounts team, so I’d need to build up some support first.

Books

This week I read: