But I noticed that one of my worker sites is running from LAX or sometimes from DFW data centers which are quite far away from me.
cf-ray: 58c625c60897c802-DFW
I live in Mexico an I know there is a CF data center in my city. In fact if I load cloudflare.com I can see I hit that server:
cf-ray: 58c628425bcc7f40-QRO
So I asked on Twitter and Cloudflare’s CEO kindly pointed out that if the domain I’m using for the worker route is on the free plan, then it won’t be deployed to all data centers.
Not all sites will be in all cities. Generally you’re correct that Free sites may not be in some smaller PoPs depending on capacity and what peering relationships we have.
Which makes sense… so if upgrade the domain to a paid plan workers and kv should deploy to “all 200 data centers”, right?
But what if the same worker has routes from domains that are on free plans? Would that worker still run from all data centers too? Are workers tied to the routes’ domains?
Yes, since workers run on whatever datacenter receives the request (which is determined by the DNS zone/hostname a client connects to), the datacenters that run your Worker code are whatever datacenter the client hits. This applies to your whole zone and not just Workers/KV.
The reasoning behind this behavior is due to two things - peering and network prioritization. Network prioritization means that, depending on how loaded/overloaded certain datacenters are, websites on lower-tier plans will be routed to different datacenters that have more capacity. For more on this, read this explanation.
To add a little more insight, KV is different from workers in that your data isn’t really pushed and stored to all Datacenters, rather it’s centrally stored and only cached at a datacenter if it’s frequently read:
Workers KV read performance is determined by the amount of read-volume a given key receives. Maximum performance for a key is not reached unless that key is being read at least a couple times per minute in any given data center.
Right. So, if a domain is on the free plan the DNS will not point to all CF data centers and even if the worker is running on all PoPs it will not execute there.
Interestingly, I’m getting very varied results on my Cloudflare Workers account (Paid). Out of 4 domains, 2 of them are going to the colo that would equal Business Plan according to your test-page. But two of them are going to free plan. This is consistent when testing from multiple locations. Very odd.
The only thing I can think of is the amount of traffic, 2 domains have a lot of traffic and 2 has very little.
That said though, the ping-time to the colo on free plan is actually faster than that colo which is closer.