1

Background:

I know of quite a few large scale systems, especially in e-commerce domain where distributed transactions are used along with eventual consistency.

Question:

Is it possible to have a distributed transaction (over two networked resources) with strong consistency guarantees. I keep hearing/reading about it in theory (using 2 phase commits), but have never had a chance to come across one such system.

Or it is not at all possible to achieve it at all ? Any insights/relevant article appreciated.

Harshit
  • 1,174
  • 1
  • 9
  • 24

1 Answers1

1

Right away I can suggest at least two modern distributed databases that fit your requirements: TiKV and CocroachDB. Both of them are CP systems (in terms of CAP theorem) both support ACID, both use two-phase commit algorithms for distributed transactions. It also possible to set up two-phase commits within PostgreSQL. And I believe there are much more databases that support distributed transactions while preserving strong consistency guarantees.

As I know, there are not too much options for distributed strong consistent database design: you may use either two-phase commit (or its variations like three-phase commit), or distributed consensus algorithms like Raft. I would suggest you to read a comprehensive guide by Martin Kleppman.

Vitaly Isaev
  • 5,392
  • 6
  • 45
  • 64
  • Thanks Vitaly. Agreed, that by definition these CP systems should support strong consistency. Still , Can there be any remote corner case (or assumptions made while designing), where these CP systems could trade off consistency ? – Harshit Mar 31 '19 at 04:31
  • 1
    @Harshit could you please clarify your last question? Do you mean if there are cases when CP databases can sacrifice consistency? I believe this cases must be be considered as bugs. In case of network split all members of CP database must switch into read-only mode and disable all mutating requests (like INSERT, UPDATE, DELETE and so on). This will preserve strong consistency guarantees. Some CP databases may slightly weaken the requirements to reduce latency, when for a successful request handling the consistent response is expected not from every node, but just from majority of nodes. – Vitaly Isaev Mar 31 '19 at 15:16
  • Bingo. Thanks for clarification. – Harshit Mar 31 '19 at 18:27