"매 architecture 는 trade-off 의 명시화". Monolith → Modular monolith → Service-oriented → Microservices → Cells/Serverless 의 spectrum 에서 팀 규모, 도메인 복잡도, scale 요구에 맞춰 선택. 2026 현재 majority 는 modular monolith + targeted services.
classOrderService{constructor(privatewriteDb: Pool,privatereadDb: Pool){}asynccreate(o: Order){returnthis.writeDb.tx(async(tx)=>{awaittx.insert("orders",o);awaittx.publish("order.created",o);});}asyncquery(userId: string){returnthis.readDb.query("SELECT * FROM orders_view WHERE user_id=$1",[userId]);}}
BEGIN;INSERTINTOorders(...)VALUES(...);INSERTINTOoutbox(topic,payload)VALUES('order.created',$1);COMMIT;-- separate poller publishes outbox → kafka, then deletes
5. Backpressure with bounded queue
sem:=make(chanstruct{},100)// max 100 in-flighthttp.HandleFunc("/",func(whttp.ResponseWriter,r*http.Request){select{casesem<-struct{}{}:deferfunc(){<-sem}()handle(w,r)default:http.Error(w,"busy",503)}})
6. Cell-based isolation
Customer A → Cell-1 (LB, app, DB shard)
Customer B → Cell-2 (LB, app, DB shard)
Customer C → Cell-1
# Cell failure blast radius = 1 cell only