SystemCity
WorkspaceProblemsCanvasPricing
Sign in
S

SystemCity

AI-powered system design tutor. Learn architecture, ace interviews, build real systems.

Learn

  • Learn System Design
  • Interview Prep Guide
  • All Problems
  • Glossary
  • Compare
  • Design Canvas

Product

  • Pricing
  • Portfolio
  • Support

Legal

  • Terms
  • Privacy
  • Refunds

© 2026 SystemCity. All rights reserved.

Master system design · interview prep · 120+ problems

Back to glossary

Communication & APIs

Pub/Sub

Also known as: Publish/Subscribe, Publish-Subscribe

A messaging pattern where publishers emit messages to topics without knowing who consumes them, and subscribers receive messages from topics they care about.

In depth

Publish/Subscribe (pub/sub) is a messaging pattern that decouples senders from receivers. Publishers post messages to a named topic; subscribers register interest in a topic and receive every message published to it. Neither side knows about the other directly — the broker handles routing.

Pub/sub enables fan-out: one event (a user signs up) triggers many independent reactions (welcome email, analytics event, CRM sync, recommendation refresh) without the publisher needing to know the list of consumers. New consumers can be added without changing the publisher.

Implementations vary in semantics: Redis Pub/Sub is fire-and-forget with no persistence; Google Pub/Sub and AWS SNS+SQS provide durable delivery with retries; Kafka offers persistent, replayable topic logs with consumer groups for parallel consumption. Choose based on whether you need durability, ordering, replay, and at-least-once vs exactly-once delivery.

When to use

Use pub/sub for event broadcasting, fan-out workflows, decoupled microservice communication, and any "this happened, react however you want" pattern.

Tradeoffs

Pub/sub makes the system harder to reason about: who reacts to what is implicit. Debugging requires good observability. Without durability, messages can be lost during consumer downtime.

Related terms

Message Queue

A buffer that holds messages between producers and consumers, enabling asynchronous processing and decoupling of services.

Webhook

An HTTP callback that one system sends to another to notify it of an event, enabling push-style integrations between services.

REST API

An architectural style for web APIs based on HTTP verbs (GET, POST, PUT, DELETE) acting on resources identified by URLs.

gRPC

A high-performance RPC framework using HTTP/2, Protocol Buffers, and code generation for type-safe, low-latency service-to-service communication.

GraphQL

A query language for APIs that lets clients request exactly the fields they need in a single request, eliminating over- and under-fetching.

WebSocket

A persistent, bidirectional communication channel between client and server over a single TCP connection — the standard for real-time web features.

Practice this concept

AdvancedInfrastructure

Design a Serverless Computing Framework