Geo: Consider supporting writes to primary
In !1283 (merged), we are adding support for multiple read slaves that can write to a single master. The commits will be synchronous so that a change in the master will only take effect if all secondaries have committed the change.
What if we made GitLab Geo use this functionality across different datacenters? Here's how it would work:
- Let's say we have a primary Geo node in US East and secondary in Europe West.
- A user accessing the site in Europe West would be talking to an Geo node in Europe, with a local read-only DB there as well.
- The application would send any writes to the US East database.
Now this may not work well in practice if Rails sends a DB update for every page visit, but in theory reads should dominate the load.
This will likely slow down write performance since multiple nodes have to be involved, but it should simplify the read-only issues we have to deal with in gitlab-org/gitlab-ee#1744 while also making the Geo node a fully-functional version of GitLab. We would also have to find ways to propagate attachments and other files faster.
Thoughts?