Performance of Cache Fetch - vs. Origin Fetch

cache

#1

I am not sure if this is more a worker question or performance question.

I have a worker that fetches small files (images and blobs) from a remote object storage (<100kb). My caching rule is: cacheTtlByStatus: { "200-299": 86400, 404:1, "500-599": 0 }, as described here.

Most origin fetches (cf cache: miss) from the remote object storage succeed in <100ms, I haven’t seen many origin fetches >200ms.

Fetches from the cache (cf cache: hit), seem to take longer. Only few fetches are <100ms, most are >150ms, many are >200ms.

I only use a simple fetch, not the Cache API. Not sure if this make a difference?

I have seen this for the colos: FRA, VIE, MUC. The object storage is hosted in FRA, so timings will certainly be different from colos that are farther away. Is this the expected cache fetch time? Is there any difference in cache fetch time for different plans (e.g. on the Business plan, the cache is stored on SSDs and therefore will be served faster or served with a higher priority)?


#2

You are talking purely about timings of the worker, right? Nothing client/browser related?!

So, do I understand correctly, your observation is fetching cached resources from the cache appears to take longer than fetching uncached resources from the origin?

Tagging @KentonVarda too


#3

Also, @matteo :slight_smile:


#4

I sincerely have no clue, it seems strange to me that it takes less time to go to the origin instead of the local cache, in particular for colos not in Frankfurt.

It would be interesting having a way to try with an actual Url @boldtrn


#5

Caching is done by per colos. And users are routed to a specific colo based on a lot of factors, but mainly network efficiency. FRA , VIE , MUC makes sense for FRA.
For some workers I use Cache API (beta), but still is beta.

In the last 12 hours we noticed some inconsistency on KV and Cache API. Possibly related to:

Network Issues in some EU locations

Resolved - Cloudflare has resolved the issue and our Paris location has resumed normal operation.
Jan 14, 20:24 UTC

Monitoring - Cloudflare has implemented a fix for this issue and is currently monitoring the results.

What is you measurement period?


#6

Thanks for your replies.

This bugged me all morning. I just figured out the issue. I had a bug in my measurement that completely skewed the results. I was able to identify and fix it. Fetching from the cache now requires <10 ms for most requests, some seem to take a little longer but still <50ms. So it’s a lot faster than the origin request. So this was not an issue with Cloudflare but with my measurement. Sorry if this caused any troubles :roll_eyes:.


closed #7

This topic was automatically closed after 30 days. New replies are no longer allowed.