dotnetcore / CAP

Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
http://cap.dotnetcore.xyz
MIT License
6.7k stars 1.29k forks source link

Is it feasible to use the local message repository SQLite/LiteDB ? #1418

Closed dengyangxi closed 1 year ago

dengyangxi commented 1 year ago

When there is a large amount of messages, due to the existing mechanism, one message requires 4 DB operations, resulting in a deadlock。

Is it feasible to use the local message repository SQLite/LiteDB ?

for example: image


947aa4a685fa5fe418be3012efc2441

yang-xiaodong commented 1 year ago

Hello,

Thank you for your feedback. In our system design, a message is operated on twice at the publisher side. On the consumer side, the number of operations depends on whether your subscribers are in multiple consumer groups. The minimum is also twice. If your publisher and consumer sides use the same database or are located within the same service, then there are four operations for the database. For the message, the same message is still operated on twice. This is our design, ensuring the reliability of the message.

The point you need to clarify is how your deadlock occurred, as it's unrelated to the number of database operations.

Based on your illustrative diagram, it appears that business SQL operations and event messages cannot be guaranteed to remain within the same transaction.

Thanks