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:

  • Fastly’s Rust crate depends on some hidden code which their runtime injects. So you can run integration tests locally where you use their local runtime to run your WASM binary and fire requests at it, but unit tests are a bit trickier.
  • Their “hello world” AssemblyScript project crashes, which is very unpromising and makes me wonder what more subtle bugs are lurking, if something this blatant slipped through.

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:

%3 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…

%3 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.

%3 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:

  • The Stars My Destination by Alfred Bester

    It’s the future, humanity has colonised the solar system, and a great breakthrough has been made: the ability to “jaunte”, or teleport up to about 1000 miles merely by thinking. The book starts with Gully Foyle, the narrator, running low on air in a derelict spaceship, who watches another craft approach, notice his distress signal, and leave him behind.

    Most of the book is a Count of Monte Cristo-esque revenge tale, with a subplot of some very rich men trying to recover a secret treasure which Foyle’s ship had been transporting. It’s a good read, and I enjoyed it a lot.

    I’m glad that the original title of “Tiger! Tiger!” got dropped, as “The Stars My Destination” is much better.

Roleplaying Games

History

Software Engineering