Eventual consistency is a data modeling concept that ensures that updates made to distributed NoSQL databases will eventually be reflected across all nodes. This ensures that identical database queries will return the same results after some period of time.
While many new database products were built upon the eventual consistency model, there are a number of reasons why eventual consistency falls short in the modern 5G era.
Keep reading to learn more about the history of eventual consistency, its advantages and disadvantages, and how it compares to the competing model of immediate consistency.
Eventual consistency history
While the concept of eventual consistency first emerged in the late 1970s, the term didn’t become mainstream until Amazon released DynamoDB a decade ago.
In recent years, eventually consistent NoSQL databases emerged to power social media networks and streaming services and enable businesses to make use of unstructured data. While traditional relational databases were designed to handle structured data like names, addresses, and dates, NoSQL databases can accommodate unstructured data like pictures, videos, and audio files.
Though NoSQL databases can accommodate unstructured data, they present a number of programming challenges to developers who cut their teeth on relational database management systems (RDBMS). Because a service like Facebook doesn’t need to be ACID-compliant, the company decided to build the NoSQL Cassandra database. This, in turn, enabled them to create a faster, more responsive service in exchange for accepting eventual consistency.
Eventual consistency advantages
The main reason companies use eventual consistency is that they’re able to build much faster applications that are highly available, highly performant, and highly scalable. Since the user experience is of the utmost importance to these organizations, their applications need to be exceptionally responsive. Otherwise, users will become frustrated when they’re looking for something to watch right now and the application takes forever to load.
When building distributed applications, companies need to make tradeoffs between availability and consistency. For example, since users don’t need to read every single person’s tweets in real time as they’re written — particularly users they don’t know and don’t follow — social media companies have opted to prioritize the former ahead of the latter.
Eventual consistency disadvantages
While eventual consistency is practical for many use cases, it quite often falls short for modern applications that require things such as ACID compliance, including 5G applications built by telco operators.
Some of the major disadvantages of eventual consistency include:
- Too much latency. In eventually consistent modeling, multiple copies of data are stored on different servers. Applications can read from any node and write to whichever copy they want. Over time, the data will proliferate across all nodes. Here’s the problem: Applications require lightning-fast latency in a 5G-powered world, and eventual consistency requires some interval of waiting — far too long to meet latency requirements.
- No guarantees of current data. Eventually consistent applications don’t always serve up the most up-to-date information. In a system with 10 nodes, seven of them might have current information but a user might end up querying one of the other three. As a result, the user might end up making a decision based on outdated or incorrect information. While it’s possible to work around this by building in functionality that ensures only the most current nodes are queried, doing so introduces additional latency.
- Unreliable writes. Unless the eventually consistent database is configured to ensure that a write is finished only when at least 51% of nodes hold the new data, there’s a chance that a conflicting write could have succeeded in the remaining clusters. The database will ultimately determine which write is correct, but there’s a nonzero chance it makes the wrong decision. This is a problem that can be solved — but, again, only by introducing additional latency.
Eventual consistency vs. immediate consistency
Organizations that wish to maximize the 5G opportunity need to build applications with immediate consistency. As the name suggests, immediate consistency is a data modeling concept that ensures data is replicated across distributed databases in near-real time.
Here’s how it works: When requests come in, an immediately consistent data platform –such as Volt Active Data– ends them to logical divisions known as partitions, each of which is responsible for handling a subset of data. Once a partition leader receives a request, it passes it to clone nodes, which then ensures that all replication occurs more or less simultaneously. As nodes are updated, the partition leader compares them with its own and then returns them to the client when everything agrees.
As a result, immediately consistent data platforms don’t allow conflicting writes or inaccurate reads. At the same time, they are capable of handling this process impressively quickly, enabling organizations to meet the latency requirements of 5G.
To witness the power of immediate consistency in action, take Volt Active Data for a spin, for free, today.