Anik Sikder
Technical Writing/system-design/publish-subscribe-how-modern-systems-scale-without-becoming-a-monolith
article.sh

$ open article

system-design

Publish-Subscribe Explained: How Modern Systems Scale Without Becoming a Monolith

10 min readβ€’July 30, 2026
Publish Subscribe Event Driven Architecture Visualization

Hey developers! πŸ‘‹

Welcome back to our journey through communication patterns and distributed systems.

When a customer places an order online, they usually see something simple:

"Your order has been confirmed."

From the customer's perspective, the story ends there.

Behind the scenes, however, an entire chain of events begins.

The inventory must be updated.

The payment must be recorded.

The customer should receive an email.

Analytics dashboards need updating.

Fraud detection systems may need to run.

Loyalty points might need to be awarded.

Shipping labels may need to be generated.

What appears to be a single action is often dozens of actions happening across multiple systems.

And how those systems communicate determines whether a company can scale smoothlyβ€”or spend years fighting architectural bottlenecks.

This is where the Publish-Subscribe (Pub/Sub) pattern enters the picture.


The Architecture That Works Until It Doesn't

Imagine an e-commerce platform processing:

code
50 Orders Per Day

A customer places an order.

The Order Service directly calls:

code
Inventory Service
Email Service
Analytics Service
Billing Service
Shipping Service

Everything works.

The architecture feels simple.

The team ships features quickly.

Everyone is happy.

At first.


The Hidden Dependency Problem

The challenge isn't visible immediately.

It's hidden inside the dependency chain.

code
Order Service
 β”œβ”€β”€ Inventory
 β”œβ”€β”€ Email
 β”œβ”€β”€ Analytics
 β”œβ”€β”€ Billing
 └── Shipping

Every new business requirement adds another dependency.

Every dependency adds another failure point.

Over time:

code
Order Service
       ↓
Becomes The Center
Of Everything

The architecture slowly becomes more fragile.

Not because developers made mistakes.

Because the business kept growing.


A Real Failure Scenario

Imagine this workflow:

code
create_order()

reserve_inventory()

send_confirmation_email()

update_analytics()

Everything looks reasonable.

Until one day:

code
Email Service Fails

Now what happens?

In many systems:

code
Email Failed
      ↓
Workflow Stops
      ↓
Analytics Never Runs
      ↓
Customer Experience Suffers

A non-critical system suddenly affects a critical workflow.

The services are technically separate.

Operationally, they are tightly connected.

This is known as:

code
Tight Coupling

The Postmortem Nobody Wants to Write

A surprisingly common production incident looks like this:

What Happened?

A third-party email provider experienced elevated latency.

Impact

Order creation response times increased from:

code
200ms

to:

code
8–15 Seconds

Business Impact

  • Customers abandoned checkout
  • Conversion rates dropped
  • Support tickets increased
  • Revenue was affected

Root Cause

The Order Service waited for the Email Service before responding.

Architectural Problem

The platform treated a non-critical task as a critical dependency.


Notice something important.

The email wasn't required to create the order.

The order should have succeeded regardless.

The architecture created the outage.

Not the email provider.


A Different Way of Thinking

Most traditional systems think like this:

code
Do This
   ↓
Do That
   ↓
Do Another Thing

The workflow is command-driven.

Event-driven systems think differently.

code
Something Happened
        ↓
Whoever Cares Can Respond

That shift sounds small.

Architecturally, it's enormous.


Enter Publish-Subscribe

Instead of directly calling every downstream service, the Order Service publishes an event.

code
Order Service
      ↓
Order Created
      ↓
Message Broker
      ↓
Inventory
Email
Analytics
Billing
Shipping

The Order Service now has only two responsibilities:

code
Create Order
Publish Event

Done.

It no longer cares:

  • Who consumes the event
  • How many consumers exist
  • What consumers do
  • When consumers process it

It simply announces a fact:

code
Order Created

Anyone interested can react.


Think of Pub/Sub Like a News Agency

Imagine a news organization.

A reporter publishes breaking news.

code
Breaking News

The reporter doesn't individually call:

  • Television stations
  • Newspapers
  • Radio stations
  • Websites
  • Mobile apps

Instead:

code
Reporter
    ↓
News Agency
    ↓
Subscribers

Each subscriber receives the information independently.

That's exactly how Publish-Subscribe works.

The producer publishes.

Subscribers decide whether they care.


What Is Publish-Subscribe?

Publish-Subscribe is a messaging pattern where producers publish events to a broker, and consumers subscribe to events they are interested in.

The producer and consumer never communicate directly.

code
Producer
    ↓
Broker
    ↓
Consumer

This creates:

code
Loose Coupling

One of the most valuable properties in modern software architecture.


The Message Broker Becomes the Traffic Controller

A broker sits between producers and consumers.

Examples include:

  • Apache Kafka
  • RabbitMQ
  • Amazon SNS
  • Amazon SQS
  • Google Pub/Sub
  • NATS

The broker receives events and distributes them.

code
Publisher
    ↓
Broker
 β”œβ”€β”€ Inventory
 β”œβ”€β”€ Email
 β”œβ”€β”€ Billing
 β”œβ”€β”€ Analytics
 └── Fraud Detection

Services no longer need direct knowledge of one another.

The broker becomes the communication hub.


A Visual Mental Model

Direct Communication

code
Order Service
    β”œβ”€β”€ Inventory
    β”œβ”€β”€ Email
    β”œβ”€β”€ Billing
    β”œβ”€β”€ Analytics
    └── Shipping

Every new feature creates another dependency.


Publish-Subscribe

code
Order Service
      β”‚
      β–Ό
Order Created
      β”‚
      β–Ό
Broker
 β”œβ”€β”€ Inventory
 β”œβ”€β”€ Email
 β”œβ”€β”€ Billing
 β”œβ”€β”€ Analytics
 └── Shipping

The producer has one dependency.

The broker.

Nothing more.


Why Business Leaders Love Pub/Sub

Businesses don't buy architectures.

They buy outcomes.

Publish-Subscribe creates outcomes executives feel directly.


Faster Feature Delivery

Imagine marketing wants a loyalty points system.

In a tightly coupled system:

code
Modify Order Service
Retest Order Service
Redeploy Order Service
Risk Order Service

In Pub/Sub:

code
Create Loyalty Consumer
Subscribe To Order Created
Deploy Independently

The order workflow remains untouched.

New features can be delivered with lower risk.


Reduced Revenue Risk

Suppose Analytics fails.

With Pub/Sub:

code
Orders Continue
Payments Continue
Customers Continue

Only analytics is affected.

The failure becomes isolated.

The blast radius stays small.


Better Organizational Scaling

As companies grow:

code
Payments Team
Inventory Team
Growth Team
Customer Team
Data Team

Each team can independently subscribe to events.

Teams become less dependent on one another.

Development velocity increases.


Why Developers Love Pub/Sub

Developers eventually discover a painful truth:

Scaling dependencies is often harder than scaling traffic.

Pub/Sub helps solve that problem.


Loose Coupling

Without Pub/Sub:

code
Order Service
    ↓
Inventory
    ↓
Email
    ↓
Analytics

With Pub/Sub:

code
Order Service
      ↓
Broker
      ↓
Consumers

The producer only knows one thing:

code
Publish Event

Everything else becomes optional.


Independent Deployments

Teams can build:

code
Fraud Detection
Recommendation Engine
Customer Segmentation

without touching the ordering system.

This dramatically reduces deployment risk.


Better Resilience

Imagine Billing Service crashes.

The broker retains events.

When Billing returns:

code
Order Created #1001
Order Created #1002
Order Created #1003

can still be processed.

The system recovers gracefully.


The Hidden Challenges

Many architecture articles stop at the benefits.

Real systems don't.

Every architectural gain introduces tradeoffs.


Challenge #1: Eventual Consistency

In synchronous systems:

code
Order Created
Inventory Updated
Response Returned

Everything happens immediately.

In Pub/Sub:

code
Order Created
Response Returned

Inventory Updated Later

There is now a delay.

Different systems may temporarily disagree.

This is called:

Eventual Consistency

A fundamental reality of distributed systems.


Challenge #2: Duplicate Events

Networks fail.

Retries happen.

Consumers crash.

The same event may arrive twice.

code
Order Created #123
Order Created #123

Consumers must be:

code
Idempotent

Otherwise:

code
Inventory Reduced Twice
Customer Charged Twice

Bad days begin.


Challenge #3: Observability

Tracing a monolithic workflow is straightforward.

code
Request
   ↓
Response

Tracing an event-driven workflow is not.

code
Order Created
      ↓
Inventory Updated
      ↓
Billing Generated
      ↓
Email Sent
      ↓
Analytics Updated

One user action may generate dozens of events.

Understanding failures becomes significantly harder.

This is why mature organizations invest heavily in:

  • Distributed tracing
  • Correlation IDs
  • Event monitoring
  • Audit logs

How Modern Platforms Actually Think

The most scalable architectures rarely ask:

Which service should call which?

Instead they ask:

What business events exist?

Examples:

code
Order Created
Payment Authorized
Shipment Created
Invoice Generated
User Registered
Subscription Renewed

These events become the language of the business.

Systems are built around reacting to those events.

The architecture evolves alongside the organization.


The Architect's Lesson

Publish-Subscribe teaches a powerful principle:

Growth becomes easier when systems communicate through events instead of dependencies.

The evolution often looks like this:

code
Direct Calls
      β”‚
      β–Ό
Too Many Dependencies
      β”‚
      β–Ό
Publish-Subscribe
      β”‚
      β–Ό
Loose Coupling
      β”‚
      β–Ό
Independent Scaling

The goal isn't messaging.

The goal is adaptability.


TL;DR Quick Recap

  • Publish-Subscribe is an event-driven communication pattern.
  • Producers publish events without knowing who consumes them.
  • Consumers subscribe to events they care about.
  • Message brokers distribute events between systems.
  • Pub/Sub reduces coupling between services.
  • Teams can deploy independently.
  • Failures become more isolated.
  • Eventual consistency and observability become important challenges.
  • Modern scalable platforms are often built around business events.

Final Thoughts: Systems That Speak in Events 🧠

Many growing companies eventually discover the same lesson.

Direct communication feels simple.

Until growth arrives.

Every new dependency creates risk.

Every new integration increases complexity.

Publish-Subscribe changes the conversation.

Instead of asking:

code
Who should I call?

systems begin asking:

code
What happened?

That shiftβ€”from commands to eventsβ€”is one of the most important architectural transitions in modern software engineering.

Because the companies that scale successfully are rarely the ones with the most services.

They're the ones with the clearest events.


A Little Engineering Joke to End On πŸ˜„

Why did the Order Service stop calling everyone directly?

Because it got tired of being the group project coordinator.


Frequently Asked Questions

What is Publish-Subscribe?

Publish-Subscribe (Pub/Sub) is a messaging pattern where producers publish events and consumers subscribe to the events they care about.


What problem does Pub/Sub solve?

It reduces direct dependencies between services, improving scalability, resilience, and team autonomy.


What is a message broker?

A message broker is an intermediary system that receives, stores, and distributes events between producers and consumers.


Is Pub/Sub synchronous or asynchronous?

Most Pub/Sub systems are asynchronous.

Producers publish events and continue without waiting for consumers.


Why is Pub/Sub popular in microservices?

Because it enables loose coupling, independent deployments, better fault isolation, and easier organizational scaling.


What are the downsides of Pub/Sub?

Common challenges include:

  • Eventual consistency
  • Duplicate event handling
  • Increased operational complexity
  • Difficult observability and debugging

Key Takeaways

  • Publish-Subscribe is an event-driven communication pattern.
  • Producers publish facts rather than calling services directly.
  • Consumers independently react to events.
  • Message brokers decouple producers from consumers.
  • Pub/Sub improves scalability, resilience, and team autonomy.
  • Eventual consistency is a normal part of the model.
  • Observability becomes increasingly important.
  • Modern architectures often scale by thinking in events rather than direct dependencies.

If you found this article useful, share it with fellow backend engineers, system architects, platform engineers, and distributed systems enthusiasts exploring communication patterns at scale.


About the Author

Anik Sikder is a Software Engineer specializing in Backend Systems, SaaS Architecture, Cloud Infrastructure, Python, Django, FastAPI, distributed systems, and scalable software engineering.

He writes about system design, networking, distributed systems, cloud computing, software architecture, and modern engineering practices.

$ tags

publish-subscribepubsubevent-driven-architecturedistributed-systemssoftware-architecturesystem-designscalabilitymessagingkafkarabbitmq

$ ls related_articles

status: end_of_file