Введение
Модель согласованности, используемая в распределенных вычислениях для обеспечения высокой доступности. Конечная согласованность — это модель согласованности, применяемая в распределенных вычислениях для достижения высокой доступности, которая неформально гарантирует, что если к элементу данных не вносятся новые изменения, то в конечном итоге все обращения к этому элементу будут возвращать последнее обновленное значение. Конечная согласованность, также известная как оптимистическая репликация, широко используется в распределенных системах и берет свое начало в ранних проектах мобильных вычислений. Система, достигшая конечной согласованности, часто называется сошедшейся или достигшей конвергенции реплик. Конечная согласованность представляет собой слабую гарантию — большинство более строгих моделей, таких как линеаризуемость, тривиально являются конечно согласованными. Сервисы с конечной согласованностью часто классифицируются как предоставляющие семантику BASE (в основном доступные, мягкое состояние, конечная согласованность) в отличие от традиционных ACID (атомарность, согласованность, изоляция, долговечность). В химии основание является противоположностью кислоты, что помогает запомнить эту аббревиатуру. Согласно тому же источнику, приблизительные определения каждого термина в BASE следующие:
В основном доступные: операции чтения и записи доступны в максимально возможной степени (с использованием всех узлов кластера базы данных), но могут быть несогласованными (запись может не сохраниться после разрешения конфликтов, а чтение может не получить последнюю запись).
Мягкое состояние: без гарантий согласованности, через некоторое время у нас есть лишь определенная вероятность узнать состояние, поскольку оно может еще не сойтись.
Конечная согласованность: если мы выполним несколько записей, а затем система будет функционировать достаточно долго, мы сможем узнать состояние данных; любые последующие чтения этого элемента данных будут возвращать одно и то же значение.
Eventual consistency is a consistency model used in distributed computing to achieve high availability that informally guarantees that, if no new updates are made to a given data item, eventually all accesses to that item will return the last updated value. Eventual consistency, also called optimistic replication, is widely deployed in distributed systems and has origins in early mobile computing projects. A system that has achieved eventual consistency is often said to have converged, or achieved replica convergence. Eventual consistency is a weak guarantee – most stronger models, like linearizability, are trivially eventually consistent. Eventually consistent services are often classified as providing BASE semantics (basically available, soft state, eventual consistency), in contrast to traditional ACID (atomicity, consistency, isolation, durability). In chemistry, a base is the opposite of an acid, which helps in remembering the acronym. According to the same resource, these are the rough definitions of each term in BASE:
Basically available: reading and writing operations are available as much as possible (using all nodes of a database cluster), but might not be consistent (the write might not persist after conflicts are reconciled, and the read might not get the latest write)
Soft state: without consistency guarantees, after some amount of time, we only have some probability of knowing the state, since it might not yet have converged
Eventually consistent: If we execute some writes and then the system functions long enough, we can know the state of the data; any further reads of that data item will return the same value
Eventual consistency is sometimes criticized as increasing the complexity of distributed software applications. This is partly because eventual consistency is purely a liveness guarantee (reads eventually return the same value) and does not guarantee safety: an eventually consistent system can return any value before it converges.
Конечная согласованность иногда подвергается критике за увеличение сложности распределенных программных приложений. Это частично связано с тем, что конечная согласованность является лишь гарантией живучести (чтения в конечном итоге возвращают одно и то же значение) и не гарантирует безопасности: система с конечной согласованностью может возвращать любое значение до момента сходимости.
Eventual consistency is a consistency model used in distributed computing to achieve high availability that informally guarantees that, if no new updates are made to a given data item, eventually all accesses to that item will return the last updated value. Eventual consistency, also called optimistic replication, is widely deployed in distributed systems and has origins in early mobile computing projects. A system that has achieved eventual consistency is often said to have converged, or achieved replica convergence. Eventual consistency is a weak guarantee – most stronger models, like linearizability, are trivially eventually consistent. Eventually consistent services are often classified as providing BASE semantics (basically available, soft state, eventual consistency), in contrast to traditional ACID (atomicity, consistency, isolation, durability). In chemistry, a base is the opposite of an acid, which helps in remembering the acronym. According to the same resource, these are the rough definitions of each term in BASE:
Basically available: reading and writing operations are available as much as possible (using all nodes of a database cluster), but might not be consistent (the write might not persist after conflicts are reconciled, and the read might not get the latest write)
Soft state: without consistency guarantees, after some amount of time, we only have some probability of knowing the state, since it might not yet have converged
Eventually consistent: If we execute some writes and then the system functions long enough, we can know the state of the data; any further reads of that data item will return the same value
Eventual consistency is sometimes criticized as increasing the complexity of distributed software applications. This is partly because eventual consistency is purely a liveness guarantee (reads eventually return the same value) and does not guarantee safety: an eventually consistent system can return any value before it converges.
Сильная конечная согласованность
В то время как окончательная согласованность является лишь гарантией живучести (обновления в конечном итоге будут видны), строгая окончательная согласованность (SEC) добавляет гарантию безопасности, согласно которой любые два узла, получившие один и тот же (неупорядоченный) набор обновлений, окажутся в одном и том же состоянии. Более того, если система монотонна, приложение никогда не столкнется с откатами. Распространенный способ обеспечения SEC — использование реплицированных типов данных, не допускающих конфликтов.