๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • ์žฅ์›์ต ๊ธฐ์ˆ ๋ธ”๋กœ๊ทธ
๐Ÿคท๐Ÿผ‍โ™€๏ธ Etc.../- ๊ธฐํƒ€

[๊ธฐ์ˆ  ์•„ํ‹ฐํด ๋ฆฌ๋ทฐ] CodeOpinion - McDonald’s Journey to Event-Driven Architecture

by Wonit 2023. 1. 26.

ํ•ด๋‹น ๊ธ€์€ ๊ฐœ๋ฐœ, ๊ธฐ์ˆ ๊ด€๋ จ ์•„ํ‹ฐํด์ด๋‚˜ ๋ธ”๋กœ๊ทธ ๊ธ€ ํ˜น์€ ์œ ํŠœ๋ธŒ ์˜์ƒ์˜ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•˜๊ฑฐ๋‚˜ ํ›„๊ธฐ๋ฅผ ์ ๋Š” ๊ธ€์ž…๋‹ˆ๋‹ค.

๋ฆฌ๋ทฐํ•  ๊ธ€: 'CodeOpnion' ์˜ 'McDonald’s Journey to Event-Driven Architecture'

 

McDonald’s Journey to Event-Driven Architecture

McDonald's uses Event-Driven Architecture! Here's a breakdown of all the components and how they all work together and why.

codeopinion.com

 

์ฃผ์ œ์™€ ๊ฐ„๋‹จ ์š”์•ฝ

 

  • ๋งฅ๋„๋‚ ๋“œ๋Š” EDA ๋ฅผ ๊ตฌ์„ฑํ•˜๊ณ ์žˆ๋‹ค
    • AWS ํ™˜๊ฒฝ ์•ˆ์—์„œ MSK (managed streaming for kafka) ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค
    • ๊ธ€์“ด์ด๋Š” ๋งฅ๋„๋‚ ๋“œ ๊ธฐ์ˆ ๋ธ”๋กœ๊ทธ๋ฅผ ํ†ตํ•ด์„œ ์Šต๋“ํ•œ ๋…ธํ•˜์šฐ ๋ช‡๊ฐ€์ง€๋ฅผ ์ •๋ฆฌํ•จ
  • Schema Registry
    • event ์˜ schema definition ์„ ๊ด€๋ฆฌ
      • event ๋Š” ๋‹จ์ผ ์ง„์‹ค ๊ณต๊ธ‰์›์œผ๋กœ์จ ์ด๋ฒคํŠธ ์Šคํ‚ค๋งˆ์˜ ์ฃผ์ธ์€ ํ•˜๋‚˜์—ฌ์•ผ ํ•œ๋‹ค
      • ์ด๋ ‡๊ฒŒ ํ•จ์œผ๋กœ (data quality issue) ๋ฅผ ํ•ด๊ฒฐ
    • producer ์™€ consumer ๋Š” schema registry ๋ฅผ ํ†ตํ•ด์„œ ์ด๋ฒคํŠธ์˜ payload ์™€ version ์„ ๊ด€๋ฆฌ
      • producer ๋Š” ์ด๋ฒคํŠธ ์Šคํ‚ค๋งˆ์˜ registry ์— ์ปค์Šคํ…€ SDK ๋ฅผ ํ†ตํ•ด์„œ ์ ‘๊ทผํ•ด์„œ validation
      • consumer ๋Š” ์—ญ์‹œ ์ด๋ฒคํŠธ ์Šคํ‚ค๋งˆ์˜ registry ์— ์ปค์Šคํ…€ sdk ๋ฅผ ํ†ตํ•ด์„œ ์ ‘๊ทผํ•ด์„œ validation
  • Validation
    • ๋งŒ์•ฝ producer ๊ฐ€ publish ์— ์‹คํŒจํ•œ๋‹ค๋ฉด?
      • DLT (dead letter topic) ๋กœ ์‹คํŒจ๋œ ๋ฉ”์‹œ์ง€๋ฅผ ์ „์†กํ•œ๋‹ค
      • DLQ ํ˜น์œผ DLT ์— ๋น ์ง„ ๋ฉ”์‹œ์ง€๋ฅผ ๋‹ค์‹œ ์ž˜ ์ •๋น„ํ•ด์„œ ๋‹ค์‹œ topic ์— ์ •์ƒ publish ํ•ด์•ผํ•จ
  • Reliable Publishing
    • ์ด๋ฒคํŠธ์— ๋Œ€ํ•œ publish ๊ฐ€ ์‹คํŒจํ•œ๋‹ค๋ฉด dynamoDB ์— ํ•ด๋‹น ์ด๋ฒคํŠธ๋ฅผ ์ €์žฅํ•จ
      • ๋žŒ๋‹ค๋ฅผ ์ด์šฉํ•˜์—ฌ ์ด๋ฒคํŠธ ๋ฐœํ–‰์„ retry ํ•  ์ˆ˜ ์žˆ์Œ
    • outbox ํŒจํ„ด๋ฅผ ์ด์šฉํ•˜๋Š” ๊ฒƒ๋„ ํ•˜๋‚˜์˜ ๋ฐฉ๋ฒ•

 

๋ฆฌ๋ทฐ์™€ ๋‚˜์˜ ํ•ด์„

 

์ด ๊ธ€์„ ์ฝ๊ณ  ์ง€๋‚œ ๊ณผ๊ฑฐ์˜ ์ž‘์—…๋“ค์ด ๋ช‡๊ฐ€์ง€ ๋– ์˜ค๋ฅธ ๊ฒƒ์ด ์žˆ๋‹ค.

 

outbox table ๊ฐœ๋…์„ ํ™œ์šฉํ•œ event streaming platform ์„ ๋งŒ๋“ค ๋•Œ, ์ด์™€ ๊ฐ™์€ ๊ณ ๋ฏผ๋“ค์„ ํ–ˆ์—ˆ๋‹ค.

 

ํ•ด๋‹น ํ”Œ๋žซํผ์„ ์‚ฌ์šฉํ•˜๋Š” ํด๋ผ์ด์–ธํŠธ๋“ค์€ ์ด๋ฒคํŠธ ๋ฒ„์ „์— ๋Œ€ํ•ด์„œ ์‹ ๊ฒฝ์จ์•ผ ํ–ˆ๊ณ , ์ด๋ฒคํŠธ ํƒ€์ž…๊ณผ definition ์— ๋Œ€ํ•ด์„œ๋„ ๊ณ ๋ฏผํ–ˆ์–ด์•ผ ํ–ˆ๋‹ค

 

์—ฌ๊ธฐ์„œ ํ•œ๊ฐ€์ง€ ์‹ ๊ธฐํ•œ ์ ์€ ๋งฅ๋„๋‚ ๋“œ๋Š” ๋ฉ”์‹œ์ง€ ๋ฐœํ–‰์— ์‹คํŒจํ•  ๊ฒฝ์šฐ, dynamoDB ๋ฅผ ์ด์šฉํ•œ๋‹ค๋Š” ์ ์ด๋‹ค.

 

์™œ ๊ตณ์ด dynamoDB ๋ฅผ ์‚ฌ์šฉํ• ๊นŒ?

 

๋‚ด๊ฐ€ ์ฐพ์•„๋ณธ ๊ฐ€์žฅ ํฐ ์ด์œ ๋Š”

 

  • fully managed service by aws -> lambda ์™€ ์—ฐ๋™์ด ์‰ฝ๋‹ค?

 

์ผ ๊ฒƒ์ด๋‹ค.

 

์ด์™ธ์—๋„ EDA ์— ๊ด€๋ จ๋œ ๋‚ด์šฉ์„ ๋” ์ž์„ธํžˆ ์•Œ๊ณ ์‹ถ๋‹ค๋ฉด ์• ๋ค ๋ฒจ๋ฉ”์–ด์˜ ์ด๋ฒคํŠธ ๊ธฐ๋ฐ˜ ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค ๊ตฌ์ถ• ์ฑ…์ด ๋งŽ์€ ๋„์›€์ด ๋ ๊ฒƒ ๊ฐ™๋‹ค

๋Œ“๊ธ€