Workers - China - Baidu

Are CloudFlare Workers available in China ?

I saw that CloudFlare partners with Baidu.

Baidu proposes OpenEdge which seems to be a solution of Edge Computing.

I wondered if CloudFlare Workers were also deployed on Baidu’s infrastructure ?

1 Like
  1. When a static asset is pushed to CloudFlare, is it copied to Baidu Cloud ?
  2. When a worker is pushed to CloudFlare, is it copied to Baidu Cloud ?
  3. When a worker is called, but user is in China, does it call a Baidu Cloud worker ?
  4. When a CloudFlare worker writes data into KV, is it copied to a Baidu Cloud KV equivalent ?
  5. When a Baidu Cloud worker writes data into its KV equivalent, is it copied to CloudFlare KV ?

Picking a China provider on your own means:

  • Siloting urls : Administrate a dedicated url for China
  • Siloting codebases : Redevelop a “non-V8 isolates” Javascript code for China
  • Siloting databases: Writes on USA would not be reflected in China and vice-versa

I feel you, getting Cloudflare to work and be reliable in China would unlock a lot of conveniences. While you might get it to work from big cities in China, the larger part of the rural areas will cause issues. That’s why I suggest Ali Cloud, because their CDN and amount of datacenters reach a much larger part of China.

If you want to spend time and money on getting Cloudflare workers to work in China, then just you’d have to do tests from several China locations. Otherwise you’re just guessing as to what reach/performance you’ll have. (Unless Cloudflare can provide detailed answers, which I’ve been unable to find)

On Ali Cloud, there’s not much guessing, it’s their home turf and they know what they are doing.


Marketshares mean nothing.
Network means everything.

Population density map

CloudFlare + Baidu Cloud

In 2015, CloudFlare partnering with Baidu Cloud claimed to manage 62 data center locations, including 17 data centers in mainland China:

Today, we're proud to announce our partnership with Baidu as well as the launch of 17 data centers across mainland China (...) Globally, CloudFlare’s network now extends to 62 data center locations

In 2020, Baidu CDN claimed 1000+ nodes in Mainland China:

Baidu Smart Cloud CDN supports 1000+ domestic nodes

… Which seems quite good.

Alibaba Cloud

In 2020, Alibaba Cloud claimed in to manage 63 availability zones in 21 regions, including 9 regions in Mainland China, for a total of 2300+ China Nodes:

Alibaba Cloud operates 63 availability zones in 21 regions (...) 2300+ China Nodes

… So 1300 more nodes in Mainland China claimed by Alibaba Cloud, than Baidu Cloud. That said, Alibaba Cloud seems unable to show all these nodes on a map.

In 2017, Cloudbility published a quick comparison on Alibaba Cloud, Baidu Cloud and Tencent Cloud


Semantic difference between datacenter locations (CloudFlare), availability zones / regions (Alibaba Cloud), nodes (Baidu / Alibaba Cloud) are unclear. Not sure we can 100% compare (HDD/SSD, processor, software, speed connexion between nodes, …etc.), but at least it gives an idea.

Benchmarks would be interesting to compare real performance.
Then, real performance would have to be put in the perspective of siloting the Cloud between USA and China, which would be time consuming in terms of management, and unable to support global features.

In my use case, a global social network currently in development, I would grade higher a “Unified Cloud”, rather than a simple nodes count leading to a Cloud split. This is especially true since application in question is an offline-first PWA. It will be massively cached on client-side (browser). But there will still be bits of dynamic content downloaded through the network, for search engine results, messages, etc. It means CDN performance is the second more important factor.

I just see how the great firewall and censorship could be an issue, if the cloud reside in China and is not globally distributed, that will probably make things a lot easier. Take the Cloudflare Workers KV for example, does China has it’s own central KV store? What happens if it can’t be distributed to the rest of the world? How will users access the sites/data then? I’m not saying go with Ali Cloud, more saying, traditional servers rather than distributed might work better.

That is exactly what I would like to know.
How data can be exchanged / replicated in one direction or another.

Siloting China ?

I was unable to find information that Workers or KV where replicated in China, nor communication of { static assets or KV } was bi-directional.

It means for now I have to suppose that:

  • China has no Workers-equivalent feature
  • China static assets or KV-equivalent stay in China
  • China is an isolated region
  • China have to be processed separately
  • There is no need to keep a common url

And so on:

  • Siloted urls : Administrate a dedicated url for China
  • Siloted codebases : Redevelop a “non-V8 isolates” Javascript code for China
  • Siloted databases: Writes on USA will not be reflected in China and vice-versa

In addition, I saw that static sites are using Workers KV storage.

Problem is Workers KV storage is:

If we add benchmarks that show CloudFlare performs a little bit slower in average in comparison to GCP when it comes to CDN performance:,google-cloud-cdn

I come to these conclusions:

  • Separate urls:
    • 1 url outside China
    • 1 url inside China
  • CDN provider outside China : GCP
  • Functions provider outside China
    • if CloudFlare is able to perf R/W in Cloud Storage: CloudFlare Workers
    • if CloudFlare is unable to perf R/W in Cloud Storage: Cloud Run
  • CDN provider inside China : TBD
  • Functions provider inside China : TBD

It’s important to see that even if CloudFlare Workers are fast, communicating with Cloud Storage will be done over the Internet and not inside CloudFlare or GCP networks, so ms gains by using Edge computing might be nullified by such a communication over the Internet.

I think CloudFlare Workers, or CloudFlare enabling China traffic were really good ideas, but the whole picture seems, as of August 2020, incomplete.

Edit : Things have changed a little bit, see below


I’ve spent a fair bit of time looking at performance in China. From what I have seen, if you can keep a request in China, performance will be pretty solid. As soon as it has to transit the “Great Firewall”, it becomes a mess; very inconsistent performance and reliability. I have tried a lot of different combinations of CDN and hosting provider, trying to understand it and improve it, and frankly I’m more confused now than when I started. I think you’ll be okay with GCP, somehow they get a pretty reliable connection out of there; AWS is pretty solid, too, from what I’ve seen… it’s possible I was just lucky in both cases, of course, but I continually tested over a few month timespan.

I think you’re on the right track. If you are starting from scratch and can manage it, a separate domain/site for China, hosted in China is the way to go. Unfortunately, not everyone can do that, and in that case, the goal should be to create as simple of a site as possible; assume a certain number of requests will randomly fail or have performance issues. Don’t rely on 3rd parties to deliver your content, manage the delivery yourself. Optimize everything, send as few bytes as you can, cache as much as you can in China.

I’m not sure how much I can talk about my experiences with Cloudflare in China, but it is true that some features there are either not supported or not recommended. As an example, Argo isn’t available there; that implies a few things, some of which aren’t obvious – sites exposed via an Argo Tunnel in the US are not available in China, for example. Overall, I like their strategy, partnering with providers in China, and the experience has been good. There’s definitely some bumps that I hope they’ll iron out. I’m hoping that the recent announcement of the partnership with JD is a sign that they are interested in improving their presence in China.


Thanks for this feedback !

Durable Objects, a Strongly Consistent Global Memory Store

What is Durable Objects ?

Each time you need to create a counter, a room, a personal file attached to a user, …etc. that needs real time, you will create an instance of Durable Object, which can be seen as an internal worker (not accessible in front, only accessible through regular workers) with storage at edge in only 1 location at a time. The location varies and depends on usage. The Durable Object is moved to the location it is the most used. Yeah, objects in motion baby !

Use the right tool for the right job

  • If Heavy Writes, shared data (ex: counter, chat room)
    • Store in Durable Objects for immediate, Global Strong Consistency, in order to get the very latest state of the data (that might have been overwritten by others since the last time you read it). Durable Objects are single Threaded so it is like a transaction. If in your read call you also write, no one should be able to overwrite during this moment. It is like having a lock during the read call.
  • If Heavy Reads
    • If static asset (user data, image)
    • If the result of a dynamic call is a static asset
    • If the result of a dynamic call need to be global
      • Store globally in Workers KV (running at edge), eventually consistent in 60s (for now)
    • If the result of a dynamic call is not a static asset
    • If the result of a dynamic call don’t need to be global
      • Store locally in Cache API (running at edge)
    • In both cases
      • If you want to cache on the CDN
        • Send cache control headers (public + max-age)
      • If you do not want to cache on the CDN
        • Send cache control headers (no-store)

Comming soon

Workers KV will soon use Durable Objects to improve its consistency, and reduce the time taken to be globally consistent. But Workers KV is not planned to be strongly consistent.

NB : You can use your own hashes:

let objectId = MyDurableObjectClass.idFromName('myOwnStaticAssetHash');

Workers are available in China

Durable Objects are not yet available in China.

Now that we know

  • Durable Objects allow immediate, Global Strong Consistency (current advice from devs is : don’t use for static files, but I dunno)
  • Durable Objects will be available on the China Network
  • Workers are available on the China Network
  • We can have a single url to serve both outside and inside Mainland China

The only remaining questions are

1 Like

Cloud Storage is a single-region and KV is globally distributed, KV is actually cheap compared to the few distributed KV’s available.

1 Like

Right. For a fair comparison I updated with 3 x Multi-regional Google Cloud Storage and added Google Cloud CDN costs.

1 Like

Don’t miss that Cloud Storage also charge per operation. 10M operations cost 50$

Yes, I’d like to know the price for Durable Objects to be able to compare Write operations (As Durable Objects will fallback to Workers KV, and Durable Objects having its own pricing)

For 10 Billion operations

	                Read	   Write
Cloud Storage	    4 000 €	   50 000 €
CloudFlare KV     	5 000 €	   50 000 €


In both cases you have to avoid write at all costs (like debounce and temporize API calls on client side).


KV operations cost 25% much than GCS.

Difference mitigated by CDN.
CloudFlare’s CDN (Cache API) is free.

So even if with CloudFlare you pay 25% more in KV reads, and 5x more in KV GB, in the end, the free CDN reads/writes make the bill lighter.

I’d say CloudFlare wins.

If you consider that Cloud Storage still isn’t globally distributed, even on it’s “Multi-region” offer, then it’s a much higher cost due to egress between regions.

So Cloudflare definitely wins.



Workers KV unavailable in China (for now)

Workers KV 60s consistency might slow testing

Workers KV is an eventual consistency store. I need a strong consistent store (like Cloud Storage) because HTML will load dependencies (Service Worker, Web workers, other JavaScript files, CSS, images) and these files must absolutely exists when called. It’s a blue green deployment. Everything or nothing. The 60s penalty of Workers KV to become consistent between 2 updates is something to keep in mind. I would not agree to wait such a long time just to test a build. As a developer I mostly want “save / build / refresh / test” in less than 60s.

WebSockets with Durable objects looks juicy !

All these new features (Workers KV, Durable Objects + Websockets) are not yet available on the China Network. It means, until they are available, you need to forward requests outside.