views:

347

answers:

4

I'm facing the following challenge:

I have a bunch of databases in different geographical locations where the network may fail a lot (I'm using cellular network). I need to keep all the databases synchronized but there is no need to be in real time. I'm using Java but I have the freedom to choose any free database.

Any suggestions on how I can achieve this.

Thanks.

A: 

I don't know your requirements or your apps, but this isn't a quick answer type of question. I'm very interested to see what others have to say. However, I have a suggestion that may or may not work for you, depending on your requirements and situation. particularly, this will not help if your users need to use the app even when the network is unavailable (offline access).

Keeping a bunch of small databases synchronized is a fairly complex task to do correctly. Is there any possibility of just having one centralized database, and either having the client applications connect directly to it or (my preferred solution) write some web services to handle accessing/updating data rather than having a bunch of client databases?

I realize this limits offline access, but there are various caching strategies you can use. (Which of course, leads you back to your original question.)

David Stratton
+3  A: 

I am not aware of any databases that will give you this functionality out of the box; there is a lot of complexity here due to the need for eventual consistency and conflict resolution (eg, what happens if the network gets split into 2 halves, and you update something to the value 123 while I update it on the other half to 321, and then the networks reconnect?)

You may have to roll your own.

For some ideas on how to do this, check out the design of Yahoo's PNUTS system: http://research.yahoo.com/node/2304 and Amazon's Dynamo: http://www.allthingsdistributed.com/2007/10/amazons%5Fdynamo.html

SquareCog
+1. Good links!
David Stratton
The Yahoo paper is very interesting.The idea of developing my own solution was already on my mind. I'd love to have something like GIT for databases
jassuncao
The thing about Git is, it makes you perform a manual merge when there are conflicting updates. That's generally not a viable option for databases.. So you need a consistency model that leads to as few surprises as possible.
SquareCog
+3  A: 

It's a problem with a quite established corpus of research (of which people is apparently unaware). I suggest to not reinvent a poor, defective wheel if not absolutely necessary (such as, for example, so unusual requirements to allow a trivial solution).

Some keywords: replication, mobile DBMSs, distributed disconnected DBMSs.

Also these research papers are relevant (as an example of this research field):

  1. Distributed disconnected databases,
  2. The dangers of replication and a solution,
  3. Improving Data Consistency in Mobile Computing Using Isolation-Only Transactions,
  4. Dealing with Server Corruption in Weakly Consistent, Replicated Data Systems,
  5. Rumor: Mobile Data Access Through Optimistic Peer-to-Peer Replication,
  6. The Case for Non-transparent Replication: Examples from Bayou,
  7. Bayou: replicated database services for world-wide applications,
  8. Managing update conflicts in Bayou, a weakly connected replicated storage system,
  9. Two-level client caching and disconnected operation of notebook computers in distributed systems,
  10. Replicated document management in a group communication system,

... and so on.

MaD70
Great collection of information. Thank you.
jassuncao
You are welcome.
MaD70
+1  A: 

Check out SymmetricDS. SymmetricDS is web-enabled, database independent, data synchronization/replication software. It uses web and database technologies to replicate tables between relational databases in near real time. The software was designed to scale for a large number of databases, work across low-bandwidth connections, and withstand periods of network outage.

chenson42
Yeah. I already looked at it and give it a spin. Looks pretty god.Proabably is what's going to be used
jassuncao