Dgraph @ Cloudflare Workers

Moved from GitHub dgraph/5502

Posted by chris-carrington:

Forum Post: Dgraph World Domination!

Cloudflare has this offering called Cloudflare Workers which is Serverless + instead of our code being pushed to 1 region, it’s pushed to each of Cloudflare’s 200+ regions around the globe, they call this The Edge (b/c we’re pushing our code right next to end users)!

Cloudflare Workers may be written in Web Assembly & Go may be converted to Web Assembly & Dgraph is written in Go, so what if Dgraph was converted to WebAssembly + deployed around the globe + on the Edge!

Thank you!

marvin-hansen commented :

That’s a bit of a stretch, but what you can do is this

  1. Use workers as distributed K/V cache before hitting DGraph (or any other DB on origin)
  2. Add some Rest API atop of workers and call them as @remote. See Docs below
  3. A combination of both i.e. process some data in workers using cached KV data, and only send the end result to DGraph or any other DB.

https://graphql.dgraph.io/docs/custom-logic/

Technically, it’s feasible to globally distribute a DB across hundreds of regions, in fact Google is doing just that, but it requires really sophisticated engineering and usually some Atomic / GPS clocks to ensure proper syncing. Don’t know if you really need that…