DEV Community

Siddhant Khare
Siddhant Khare

Posted on

4 2

Consistency v/s Availability

Let's take the following example, where S and A desire to work together on an online document.

Always consistent but not always available

One method is to lock the document while one person is working on it to stop the other person from working on it concurrently. This method is adopted by WordPress.

The disadvantage of this is that only one person may work on the document at a time when it is locked, preventing anyone else from editing it.

This ensures that the document is consistently available but not always available.

Both WordPress & MSFT SharePoint adopt this strategy

Always available, but not always consistent

Another strategy is to let both sides collaborate on the paper simultaneously. This is how Google Docs operates.

Conflicts could arise, and occasionally someone's work might be overwritten, as a result of this system.

This method ensures that the document is constantly available but is not always consistent.

Conclusion

Due to the unpredictability of network stability, partition tolerance in distributed systems is non-negotiable. As a result, an application must decide between availability and consistency.

A service could:

  • high availability by returning data that may be stale or high consistency by blocking any requests (not available) to the data until they are addressed (not consistent)

  • Both strategies include trade-offs, and the best choice relies on what's crucial for your application.

For example, an Amazon Cart's high availability is more crucial. However, the balance of a bank account must always remain consistent.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more