Managing "state"
In software design, there's a concept called the "source of truth" (SoT). The idea is that, to guarantee atomic updates to some data, the change must be fully written to a SoT as a transaction. Once this is performed, the transaction is "committed", and cannot be undone. If the write fails, the entire transaction is discarded.
For many systems, there is a single source of truth that records all transactions.
However, this doesn't have to be the case. Each piece of information must have a single SoT, but unrelated data can be safely divided between several SoT.
(Aside: The plural of "Source of Truth" can be "Sources of Truth", to avoid the strange s in Source of Truth's)
One trick I find pretty interesting, is that a source of truth can be moved (or more precisely, migrated).
Migrating
To migrate, the "old" source of truth just needs to record the location of a "new" source of truth, then stop accepting transactions.
Any system which relied on the old SoT can then just connect to the new SoT instead.
In practice, this can get very complicated, though it's relatively simple in concept.
Migrating: Bonus exercise
!If the location of a SoT can change, does the "location" information for this SoT also need to be stored in a SoT?
! Answer: Yes. 125
I've already dealt with this in the migration section, how did I do it?
Regarding latency
All that really needs to be done, is to move the SoT for each piece of data closer to where it's needed, using the migration described above.
For example: bank accounts could be migrated as people travel around the galaxy. For a shared/company account, funds within the account could be broken down and given to separate branches.
Things to remember
* There's no free lunch. If the SoT is far away, at least one round-trip is required to access it, or alternatively, to request that it be moved.
* Data that doesn't ever change can be duplicated without risk of being incorrect. (caching)
* Sometimes slightly outdated data is "good enough" for now and can fixed later. (the common example for this is the view count on a youtube video) 337