Cloudflare proxy is extremely slow compared with non proxy

Hi, I’ve just enabled Cloudflare proxy for my website and notice that the cached file is loaded extremely slow compared with the no-cache version.

Here is the link of the non-proxy version: https://shopdunk.com/gsap.min.js
Here is the link of the cached version: https://beta.shopdunk.com/gsap.min.js

These following images is the load time of non proxy version and cached version.

non-proxy load time:

CF cached load time:

As we can see, the load time of CF cached version is extremely slow and unstable. It’s 6x to 10x slower than the non proxy version.

I am using CF free plan. Is there anything I can do to improve the load time such as upgrading plan or changing some config?

Addition information:

  • My origin server is Google Cloud Platform and the region is asia-southeast1 (Singapore)
  • My request come from Viet Nam
  • Here is the response header of the cached file:
age: 21
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400
cache-control: public, max-age=14400
cf-cache-status: HIT
cf-ray: 67a6b55e0c8d2eb3-SIN
content-encoding: br
content-type: application/javascript
date: Fri, 06 Aug 2021 07:56:24 GMT
etag: W/"TO7qBw"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
expires: Fri, 06 Aug 2021 08:06:03 GMT
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=5Ymyc13ropMDJ5Tm6eqUTazx1Y3RjBeZAioq2BM13xoyZKezTT1pzu8HUXgJ6jqPNY4DiUK9qfi2vb%2FPQh8UGBA8J%2BMSg7FJ4bqVHU8lREMN7Eg6sUPKOkwNzPWaPJg%3D"}],"group":"cf-nel","max_age":604800}
server: cloudflare
vary: Accept-Encoding
via: 1.1 google
x-cloud-trace-context: c754913d257e0477cbae842858af0dcb

I think the clue is in the line

So it looks like the cache is re-fetching the files from your origin server.
I would try adding a page rule which does sets Cache Everything, and a sufficiently long Edge Cache TTL:

The CF free plan should be extremely fast (if it serves cached data and does not attempt to revalidate).

1 Like

Thank you for your reply.

I’ve re-checked the header of those requests and found that only the first one has cf-cache-status: REVALIDATED. All other requests has cf-cache-status: HIT. And the response time still is the same.
So I think it is not the reason for my problem. I will update my question to change the cf-cache-status to match the major number of requests.

Looking at your numbers, something very strange is happening.
Hits should be super-fast.

Have a look at https://speed.cloudflare.com/
This will show you which cloudflare cache you are hitting,
and the latency number in the top right will show you the round trip time from your browser to the cache. The response time for cached http requests should be roughly this number, + payload serialisation time (payload size/your bandwidth) + a small overhead.

My Latency is 42.7 ms and the server location is HKG. But when I check on https://shopdunk.com/cdn-cgi/trace the actual server is SIN. I don’t know what to do next with this information.

The strange here is both my CF data center and my origin server is located in Singapore but their response time is deeply different.

I have checked my request with cURL and found that CloudFlare is simply slow. Maybe it helps. Here is the result:

Non-proxy request:

Time Handshake: 0.132179
Time Connect: 0.038150
Name Lookup Time: 0.001735
Time Pretransfer: 0.132716
Time Redirect: 0.000000
Time Start Transfer: 0.176743
Time Total: 0.246519

Cached request with cf-cache-status: HIT:

Time Handshake: 0.843496
Time Connect: 0.111792
Name Lookup Time: 0.001541
Time Pretransfer: 0.843791
Time Redirect: 0.000000
Time Start Transfer: 0.964540
Time Total: 1.305000

I’ve opened a ticket and waiting for Cloudflare to support me. This comment is just for preventing the automatic closing of the topic.

After 2 weeks of exchanging email support, the Cloudflare staff admit that the problem may come from CPU overload from HKG datacenters. They are working on it to make things better.

I can see the load time is better but still slower than the uncached request timing. The only thing we can do now is waiting for them to completely fix the problem.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.