My website loads mp4 videos via cloudflare workers, which grab the file from R2.
It uses range requests to control the exact amount of data downloaded. It starts by downloading only the first megabyte of the video file. After that if the video is playing it continues to download chunks of data 2 megabytes at a time.
I have noticed that most of the time responses from Cloudflare are quick. Sometimes however the response times slow down drastically, often taking 2 minutes to download for the first 1 megabyte chunk.
I cannot make sense of what is going on.
I’ve made a rather long video of me trying to nail down what is happening.
In the video, I show the problem occurring in Firefox and also Chrome, and I also send the same request via curl from a U.S. based server and from my local machine here in Australia.
Here is the YouTube video showing my efforts to make sense of things:
I’d like to request help in resolving this as it’s a showstopper for my application if requests for video data randomly takes 2 minutes instead of 2 seconds.