Eventual consistency

This is a well-known characteristic of NoSQL databases. This isn't an issue for transactional databases, which are the primary data-persistence mechanism for the centralized architecture. However, when data gets separated into many logical or physical databases, the consistency feature can't be attained easily. 

For example, consider what would happen if a user fetched their timeline at the same time that one of their friends deleted their account:

  1. The timeline service fetches the list of friends from the friend service and sees a friend ID that it needs to resolve
  2. Friend deletes the account, which deletes the user object from the user service, as well as all of the friend references in the friend service
  3. Timeline service attempts to turn the friend ID into user details by making a request to the user service, but receives a 404 Not Found response instead

It's clear that decentralized data modeling requires extra conditional handling to detect and handle race conditions where underlying data has changed between requests. For complex applications, it becomes necessary to have some tables together in the same database to fulfill the database transaction. The idea is that these linked tables have to be handled by a single microservice. If related data needs strong consistency, the option is to use the proven two-phase commit mechanism.