4. Architecture Components at a Glance

ComponentPrimary purposeUse whenWatch out for
CDNCache content near usersStatic assets, media, cacheable responsesInvalidation, stale content, private-data leakage
Load balancerDistribute incoming trafficMultiple service instancesHealth checks, connection draining, sticky sessions
API gatewayCentralize API routing and policiesMultiple APIs or servicesBecoming a bottleneck or policy monolith
Application serviceExecute business logicDomain operations and workflowsStateful instances, overloaded responsibilities
CacheReduce repeated reads and latencyHot or recomputable dataStaleness, eviction, stampedes
Relational databaseTransactions and relational queriesStrong constraints and multi-row transactionsHot rows, connection limits, write scaling
Document databaseFlexible document-shaped recordsAggregate-oriented access patternsCross-document transactions and index design
Key-value storeFast lookup by keySessions, counters, simple access patternsLimited query flexibility
Search engineFull-text and relevance searchText search, filtering, rankingEventual indexing and operational complexity
Message brokerDecouple producers and consumersAsync jobs and event-driven workflowsDuplicate delivery, backlog, ordering
Object storageDurable blob storageImages, videos, backups, large filesAccess control, metadata lookup, lifecycle policies
Stream processorProcess continuous event flowsReal-time metrics and transformationsLate events, replay, state management

A common request path: client → DNS/CDN → load balancer or gateway → application service → cache/database or message broker → response.

Not every architecture needs every component. Add a component only when a requirement, bottleneck, isolation boundary, or failure mode justifies it.

Key Takeaways
  • Choose components based on access patterns and requirements.
  • Avoid introducing infrastructure without a clear purpose.
  • Understand each component's operational costs and failure modes.
  • Know which components are on the synchronous request path.