Architecture styles and communication patterns

Developing applications on AWS

Ricardo Sueiras

Principal Technologist

Your instructor

instructor

Developing applications on AWS

What are architecture patterns?

 

 

Application architecture

 

  • Repeatable solution to a common problem.
  • Patterns help you know how to fit together AWS services.
  • Architecture determines how well your app works under load
  • Several architectural patterns you need to know.
Developing applications on AWS

Monoliths

 

 

diagram of an example monolith architecture

 

 

  • A single, tightly coupled unit.
  • One codebase, one deployment.
  • Simple to develop initially.
  • Painful to scale: you scale everything together.
Developing applications on AWS

Microservices

 

microservices architecture

 

  • Small, independent services: each owns one business capability.
  • Deploy, scale, and update each service independently.
  • Tradeoff: more operational complexity and service-to-service communication to manage.
Developing applications on AWS

Serverless

  • No infrastructure to manage, just code and configuration.
  • Build by composing managed AWS services.
  • AWS handles provisioning, scaling, and maintenance.
  • Tradeoff: execution time limits, cold starts, vendor lock in.
  • Near zero operational overhead and automatic scaling.

 

serverless architecture

Developing applications on AWS

Event-driven architecture (EDA)

  • Components communicate by producing and consuming events, not direct calls.
  • An event records something that happened (order placed, payment received, item shipped).
  • Producers emit events.
  • Consumers subscribe to the events they care about.

 

event driven architecture

Developing applications on AWS

Tightly and loosely coupled systems

  • Modern cloud apps are made up of multiple services.
  • Services must communicate and coordinate to complete work.
  • Synchronous communication is tightly coupled.
  • Asynchronous communication is loosely coupled.

tight and loosely coupled systems

Developing applications on AWS

Synchronous communication

 

synch comms

  • One service sends a request and waits for a response.
  • Caller is blocked until response or timeout.
  • Straightforward to implement and understand.
  • Tight coupling: downstream slowness or failure can cascade.
  • Mitigate with timeouts, retries, and circuit breakers.
Developing applications on AWS

Pattern: request/response

request response

  • Backbone of most application interfaces.
  • Predictable behavior.
  • Immediate feedback to users.
Developing applications on AWS

Asynchronous communication

 

aysnc comms

  • Sender does not wait for a response.
  • Sends a message or event, then continues processing.
  • Receiver processes the message independently.
  • Loosely coupled: better scalability and fault tolerance.
  • Handles traffic spikes and partial outages gracefully.
  • Challenges: duplicate messages, ordering, eventual consistency.
Developing applications on AWS

Pattern: queue-based decoupling

  • Producer sends messages to a queue.
  • Consumer pulls and processes messages independently.
  • Prevents failures from cascading.
  • Producer and consumer scale independently.

  queue based

Developing applications on AWS

Pattern: worker queue

  • Multiple workers pull messages from one queue.
  • Messages processed in parallel.
  • Enables horizontal scaling and higher throughput.
  • Message order not guaranteed

worker-queue

Developing applications on AWS

Pattern: publish/subscribe

  • Publishers send messages to an SNS topic.
  • Multiple subscribers receive the same message.
  • Real time broadcasting to many consumers.

 

pub subscribe pattern

Developing applications on AWS

Pattern: fan-out

fanout

  • One message delivered to multiple consumers simultaneously.
  • Widely used in event driven architectures.
  • Useful when multiple services must react to the same event.
Developing applications on AWS

Message ordering

message ordering

  • Some workloads must process messages in the correct sequence.
  • Amazon SQS FIFO and Kinesis support ordered processing.
  • Strict ordering reduces throughput.
  • Balance correctness with scalability.
Developing applications on AWS

Let's practice!

Developing applications on AWS

Preparing Video For Download...