HACKER Q&A
📣 throaway_pirate

How do you handle global web scale?


My company has web app users all over the world. They collaborate in real-time, and the app is very write-heavy.

Latency became a huge issue for database writes. The solution we came up with was to split up the app -- multiple regions with their own master database (no syncing cross-regions) and subdomain (e.g. africa.mywebsite.com).

This is working well. There is no concern that there will be any cross-region collaboration between users (at least for now). But it feels like a hack. I want everyone to just be able to go to app.mywebsite.com regardless of region.

There has to be a better way. What strategies are other companies using to solve latency across the globe?


  👤 toast0 Accepted Answer ✓
(simple) databases per region is a good solution. If you want to make it work in a single domain, you can do things like put frontend servers with the databases, and more widely distributed proxies that send to the right frontend depending on the user/document/whatever. Or you can do a frontend/backend 'multi-tier' architecture and send requests to the proper backend.

👤 taf2
Speed of light is unfortunately one of the main reasons to do region specific databases… you might be able to do it globally with some sort of clever UI to smooth out the effect of delay and maybe a kind of event stream ordering actions by time… but all depends on the purpose of the writes and how those writes impact other users…

👤 _448
If you can change your DB, then Apache CouchDB[0] handles this out of the box. Otherwise consider something like Apace ShardingSphere[1].

[0] https://couchdb.apache.org

[1] https://shardingsphere.apache.org


👤 rtcoms
Have you looked at Fly.io ?

https://fly.io/docs/introduction/


👤 mmerlin
Maybe consider Planetscale / Vitess