Skip main navigation

New offer! Get 30% off your first 2 months of Unlimited Monthly. Start your subscription for just £29.99 £19.99. New subscribers only. T&Cs apply

Find out more

The CAP triangle

What happens if we have two databases, one in London and one in New York. What if two people try and register the same username in both locations.
SPEAKER: Relational databases are fantastic at storing data, in particular keeping it consistent and accurate. However, because of the technical design of this class of storage, it can be a problem to store the same data in multiple places at the same time and continue to keep the data consistent and accurate. Let’s think about two databases, one in New York and one in London. These are connected together and interrogated by applications in America and the UK. However, what happens if the same data with different values is written to the databases on both sides of the Atlantic? What will be the correct value to store? For instance, what if two people try and register the same username in both locations.
Who gets the username? This will be made worse if the network between the two systems breaks. For a short time, both users are registered by both systems. When the network is fixed, which is the correct answer? This is called consistency. Both systems are inconsistent when the network is broken. As a designer, we need to decide what to do in this situation. Should we allow both systems to give different answers to their applications, or should our systems refuse to give an answer at all? We’re going to look at why this is such a problem, and how it can occur. Later in the week, you look at how modern systems can overcome this problem.
Although they can never fix it completely, they can be pretty good at making it look like there’s no longer a problem.

In the diagram below we can see that there are three relational databases in three locations.

We would like each of these databases to serve the same information to the client computers attached to each of them.

However, each of the clients may be adding and updating information to the data stores, each of the relational databases will be consistent (they will obey the rules of referential integrity internally) but how can we make sure that each database is updated with information from the other databases.

Before we can do that, we need to understand how each of the databases ensure integrity. How can each database ensure that it is internally consistent?

To do that we must understand transactions.

This article is from the free online

Data Science in the Games Industry

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now