性能維持 スケーラビリティ 学べる教訓 コマンドとクエリ毎に専用DBを選定 コマンドモデルは整合性を重視したトランザクション向きDBを選定 クエリモデルは高速な読み取り・集計に特化したDBを選定 要件を満たせる場合は、コマンドとクエリで同じDBを選定 コマンドクエリ分離によるスケーラビリティの向上 "The code used is good, as evidenced by a consistent response time as the number of users and use of the CPU service increases. [...] The read and write processes can run in parallel safely." CQRS Pattern Success Story (D. Husni Fahri Rizal, 2020) 決済にイベントソーシングを適用 成功ポイント 真実の源泉 (ソース・オブ・トゥルース) の確立 すべての状態変更を不変のイベントログに記録 完全な監査証跡による事後検証と状態再現の容易さ 監査対応 トレーサビリティ 状態再現 学べる教訓 状態変更の履歴性が重要な領域での有効性 支払いやサブスクリプション管理など、履歴が重要な領域での選定 再構築前提の設計で開発速度が向上 "Even if something turns out to be wrong because of a bug we can fix it and rebuild the conclusion based on the data we have." The beautiful headache called event sourcing (Maurice Haak, Jaap Taal, 2020)