Designing Distributed SystemsDistributed system patterns with CAP theorem, consistency models, and resilience