I have a website which I am currently hosting on a single server in Europe. To improve the latency for non-European users I would like to add local servers in the US and Asia.Keeping static files in sync is no problem. We add new content only once a day, so a simple rsync cron job will do fine to keep files updated.What I am totally stuck on is how to handle this on the database side? I would prefer a single master database that holds all user information, so that if a local server ever goes offline we always have the user data in the main server (regardless of backups).So far we consider 2 options:A database with Geo Replication supportA database that supports geo replication out of the box. Should be very easy to setup and should have very low latency for DB writes (ie. without having to wait for a 'write success' message on the master server).Programmatic approach with a master and a local databaseA user is visiting from one region at the same time, so we could cook something up that connects to both the master and the local database. At first login all user information would be pulled from the master database and cached in the local database. All data generated by the user from then on, could be stored in the local database and synched back to the master database in the background. Could work, but seems overly complex and hard to fix if something goes out of sync?A little more background information on the database
- our database does a lot of reads and few writes
- database performance is not an issue at all. So we are only looking to improve the user experience (lower latency)
- a user does not generate much data (10kb in general, 200kb at maximum)
- we are not a bank or stock exchange, if some user data is synched back to the master server a minute or even a few minutes later it's not a big problem.
- is there a name that describes this specific problem? (so I can Google better)
- is there a database that does geo replication out of the box without latency penalty? (Couchbase perhaps?)
- would the programmatic approach be doable, or will it be a world of pain?