I am trying to use Mobile Data service in Bluemix and I come across the term last write wins. Can anyone explain what it is clearly? And what are the other options apart from it
4 Answers
Last write wins is a strategy of deciding which data is most up-to-date when replication is used. Cassandra can be the example. It's simple & fast (uses timestamps) but has limited guarantees - it can cause lost updates / writes. The reason being is that time in computer systems isn't very accurate and nodes sometimes go down.

- 2,279
- 3
- 28
- 43
Last write wins is basically used during synchronization of files for mobile applications through the File Sync plug-in.
File Sync is limited to use a "last write wins" policy when multiple applications are updating the same files. In "last write wins", the device's copy overwrites the copy stored by File Sync. The resulting behavior depends on whether you are running in automatic or manual mode."
You can visit below link for the reference:
https://www.ng.bluemix.net/docs/#services/mobiledata/index.html#filesync

- 5,001
- 11
- 47
- 72

- 294
- 1
- 9
Check out CouchDB and MongoDB on how they perform consistency... MongoDB uses locks to achieve consistency while CouchDB uses eventual consistency. Mobile data is based on Cloudant (CouchDB under the covers) hence why it Mobile Data uses eventual consistency "last write wins".

- 4,899
- 1
- 24
- 48
My understanding of "last write wins" is like this: Using Selenium i was the first user to book a tennis court on a website. However another user also managed to write to the same booking as we were within milliseconds of each other. The bookings have to be done at 7am. That gives us one whole second. I had managed to book the court and got the email notification that I had successfully booked this court. However, my colleague, who was slightly later (within the second) ended up being the last user to write (exit) to the booking (within the one second) and he also got a email notification. But much to my annoyance it was his name that appeared on the website as the user who had booked the court. His was the last write to the database and he wins - even though I beat him initially to the court booking. Once I had the final write there was probably a thousand of a second left enough for him to get the final write.
Ganz

- 21
- 1