Pergunta

There are multiple aspects and quality that are desirable for a distributed system. Among these are consistency and availability. According to the CAP theorem, if partition tolerance is a must, the system designer can choose from a spectrum of models that trade off between consistency and availability. Jepsen provides an interactive diagram that shows multiple models that trade off between very consistent and very available (although not an exhaustive list). For systems that require high availability, the designers may choose to use a weaker consistency model.

In this question, let's take strong consistency to mean linearizability and weak consistency to mean any other models weaker than linearizability (e.g. sequential consistency, causal consistency, strong eventual consistency (SEC), etc.). One of the consequential requirements of linearizability is that the system needs to have a global clock.

In many modern systems, all operations performed are associated with a timestamp at which the operation was executed. This implies that some global clock is used. Therefore, does it makes any sense to design a system to be weakly consistent?

Foi útil?

Solução

Yes, it does. It makes sense whenever rectifying the consistency problems after-the-fact has advantages over preventing them in the first place. The reduced performance needed to ensure strong consistency is always a factor.

For example take a hotel booking system. You can separate accepting the booking and confirming it. You allow people to place bookings; the booking system has an eventually consistent information on the capacity and will, by logical consequence, allow overbooking. Once your eventually consistent capacity is at 0 you can be sure that you are either fully booked or overbooked. You can then choose the customers whose bookings you'll cancel or not confirm (legal differences mostly).

With this system you could probably reach a better utilization of the hotel than if you had a slow website that blocks new bookings once the capacity is reached (mostly due to UX problems with performance and people tending to cancel bookings).

Licenciado em: CC-BY-SA com atribuição
scroll top