Sample Header Ad - 728x90

Alternative to multi-master replication between local and cloud db when writes are infrequent and only 1 db at a time

0 votes
1 answer
161 views
**Background:** I have a closed-source app on my laptop that saves its data in a local SQLite database. I'm working on creating a mobile app for myself that would replicate the functionality of the desktop app, but run on mobile, consequently necessitating a Cloud database, for example any of the GCP SQL offerings **Constraints**: I will be the sole user of the application, so the DB writes will be very infrequent. Moreover, it can be guaranteed that no writes will happen simultaneously to the local and cloud DBs. The access pattern is more like: 1. Do some work on the laptop, work saved to local db 2. Sync data to cloud after app closes 3. Open app on phone sometime later, read and write to cloud db 4. Open laptop sometime later, get updates from cloud into local 5. Repeat **Issue:** Data needs to be eventually consistent between the mobile and the desktop app, i.e. the local SQLite and the cloud DB. I've read about multi-master replication, but this seems like an overkill since only one database is accessed at a time, and I feel that some simpler solution might fit the bill here. How could I solve this challenge? **Unsubstantiated idea?**: Perhaps it would be possible to emit a Pub/Sub event on writes to either db and have a serverless function listen on local write events, replicating them to the cloud db, and a daemon on the laptop, replicating the cloud writes to local. Would something like this work?
Asked by mikemykhaylov (1 rep)
Mar 13, 2024, 11:20 PM
Last activity: Jul 13, 2025, 03:03 PM