How are people replacing origins with Workers?


#1

In this Twitter post, Justin (@xxdesmus) from Cloudflare Trust and Safety uses Workers to offload and speed up his origin server:

This is at least the second time someone talks about speeding up their site with Workers. What magic are they using to deliver content more quickly from their origin server? His cache hit ratio is impressive.


#2

I believe they are mainly, but depends on the server and website type:

  1. Replying directly to errors from the worker.
  2. Splitting eventual aggregate request.
  3. Serving some of the content directly from there.

Have you read this?

https://scotthelme.co.uk/cloudflare-workers-report-uri/


#3

I did read Helme’s post about that (and was impressed).

I don’t think it’s #1 because the tweet implies they’re legitimate requests.
I don’t understand what #2 is.
#3 is what I think it is, but a 98% cache hit rate is a lot of content to be served from Workers.


#4

#2 is that you can combine multiple request, imagine you are requesting obj1 and obj2, if they are both in cache, but your request wants them both. It would be a cache miss, instead you could get two cache hits.

In my analytics dashboard every worker request is counted at least twice if it makes a remote request, that would be on my example half cached (inbound to the edge -> workers) and half not (edge -> origin, basically all are specific so, no caching).

He could also have Argo -> Tiered Caching.


#5

Thanks, @Matteo. I’d sure like to hear more from those making such optimizations. It’d be nice if Cloudflare published some case studies.


#6

Ignore the bad rendering (would be great to have the mobile version fixed @ryan since this is not the only issue + shouldn’t the Dashboard be available on dash.cloudflare.com?), but as you can see I’m 50% cache hit, but the worker’s request count is almost exactly the number of cached requests in here.


#7

We’re working on some case studies even as we speak. :slight_smile:


#8

Am also interested. Have the case studies published yet? :slight_smile: