System Design · Chapters 13–14

The odds and ends — and how to actually choose

Two short chapters merged: a grab-bag of architecture patterns the course saved for last (webhooks, shared-nothing, peer-to-peer, and the decentralized web), then the pragmatic checklist for picking a technology stack that won't make you cry into a pillow.

🧭
How to read this

Two chapters, one page. The first half is a set of standalone architecture patterns — webhooks solve polling; shared-nothing kills single points of failure; peer-to-peer removes the central server entirely, which flows into the decentralized and federated social web. The second half is the course's practical advice on choosing server-side tech and vetting a stack. Anything marked [+] is context I added; everything else is rewritten from the nine teaching lessons.

Part A · More on architecture
01

Webhooks: stop polling, get called back

A webhook is a callback: instead of consumers repeatedly asking "anything new yet?", the server calls them when an event actually happens. Picture an API serving exclusive baseball events, consumed by many third-party services. If each one keeps polling to check whether an event occurred, the constant requests pile unnecessary load on the server and can bring it down — and consumers have no way to know new data isn't ready yet, so they just keep asking.

Webhooks flip that with an event-based mechanism and enable communication between two services without middleware. How it works:

  1. Register an endpoint. The consumer registers an HTTP endpoint with the service, along with a unique API key — like leaving a phone number: "call me here when something happens."
  2. Server fires on the event. When new information appears on the backend, the server fires an HTTP event to every registered endpoint, notifying them of the update.

Browser notifications are the everyday example — instead of you revisiting a site to check for new content, it notifies you when it publishes.

Polling (before) consumer consumer "new yet?" ⟳ ⟳ ⟳ server 😵 Webhooks (after) consumer consumer 1· register endpoint server 2· fires event only when new
Figure 1 — Polling overloads the server with "anything new?" requests; webhooks register once and let the server push an event only when there's something to report. Original diagram after Illustration 1.86.
02

Shared-nothing: every module stands alone

Shared-nothing architecture is a design where modules share no resources — not RAM (shared memory), not disk (a shared database), nothing. When several modules work together they often share memory and share the database; a shared-nothing system deliberately gives every module its own memory and its own disk.

The payoff is the elimination of all single points of failure: if several modules go down, the others stay unaffected, which helps both scalability and performance. (You've already met this idea in the course — Cassandra's peer-to-peer nodes are a shared-nothing design.) [+]

03

Peer-to-peer: remove the middleman entirely

A peer-to-peer (P2P) network lets computers (nodes) communicate directly with no central server — every node has equal rights and acts as both client and server. It's the base of blockchain tech, and you've used it via torrents. Each node is simultaneously a seeder (hosts data, uploads bandwidth to the network) and a leecher (downloads data). With no central server there's no single point of failure — even if some nodes go down, the network stays up.

Centralized server single point of failure Peer-to-peer node node node node node no center · equal peers
Figure 2 — Centralized (all traffic through one server) vs. peer-to-peer (direct connections, no center, no single point of failure). Original diagram after Illustrations 1.87–1.88.

Why centralization hurts

A central server (like a messaging app's) routes every message through the hosting organization. The course flags three downsides:

P2P's decentralized architecture is resilient to all three: no one controls or can delete your data, because every node has equal rights. It also shines for large file sharing — instead of messenger size limits, costly cloud uploads, or couriering DVDs, you share a torrent (e.g. via BitTorrent, the most common P2P protocol, ~25M concurrent users) and friends download while re-hosting.

04

How P2P networks are organized

P2P runs an overlay network over TCP/IP that lets users connect directly and handles the heavy lifting; nodes are indexed and discoverable in it. A large file is split into equal-size chunks transferred in non-sequential order — a node downloading a 75GB file grabs chunks and re-hosts each as it arrives, making it more available (segmented P2P file transfer ). Networks come in three flavors:

Type How nodes link & search Examples
Unstructured Nodes connect randomly, no indexing. To find data you must scan every node — O(n). A billion nodes at 1s each = a billion seconds. Abysmal latency. Gossip, Kazaa, Gnutella
Structured Proper node indexing/topology via a distributed hash table — like a book's index instead of reading every page. Fast, targeted search. BitTorrent
Hybrid Cherry-picks from P2P and client-server — a centralized server for control plus P2P for availability. Most blockchain startups use this. blockchain platforms
🌐
Why P2P scales "to the moon"

To take down a blockchain network you'd have to take down every node worldwide. Nodes are added as more people use the app; ideally all nodes share bandwidth and storage equally, so the system scales automatically with zero data-storage/bandwidth cost and no third-party servers. Real P2P apps: Bitcoin/Peercoin, GitTorrent (decentralized GitHub), Twister (decentralized microblogging), Diaspora (decentralized social network on federated architecture).

05

The decentralized social web: bring your own data

Decentralized social networks run on servers spread across the globe, hosted by individuals — nobody has autonomous control, everybody has an equal say. Their scalability is directly proportional to the number of active users joining, so they don't hit the usual scaling walls. You host your own data instead of shipping it to a third-party server, so no one eavesdrops or modifies it at will. If BYOD is "Bring Your Own Device," this is Bring Your Own Data: the user-data layer is separate and runs on decentralized-web protocols with consistent formats across apps — so leaving a network doesn't kill your data; you carry it to the next app. Active examples: Minds, Mastodon, Diaspora, Friendica, Sola.

Bring your own data Carry data across apps. The blockchain game economy uses this — in-game items (swords, powers) keep value across games and survive a studio taking a game offline.
Data safety No private orgs eavesdropping; you decide who to share with; data is encrypted even from the network's own team; no selling for profit.
Economic compensation Diaspora, Sola, Friendica pay all parties — creators for content, hosts for compute (tokens/equity), moderators & devs via relevant ads or a token economy.
Infrastructure ease No single entity bears the cost; near-zero chance of going down. Data replicated across nodes like a ledger. Open-source protocols (e.g. ActivityPub) let the community keep building.

ActivityPub is an open decentralized social-networking protocol — it provides an API to access/modify content and to communicate with other pods in the federation, which leads directly into the next pattern.

06

Federated architecture: pods make the mesh discoverable

Federated architecture is an extension of decentralized architecture — a group of semi-autonomous entities that exchange information with each other. The real-world analogy: states run by state governments are partially self-governing, and they share information with each other and a central government to form a complete whole. It powers Mastodon, Minds, and Diaspora, though the model is still under active research with no standard rules.

In practice, a federated network has entities called servers or pods. Many nodes subscribe to a pod; multiple pods across the network link and share information, and individuals can host new pods — so the network keeps growing. If a link between pods breaks temporarily, the network stays up because nodes still reach each other through the pods they subscribe to.

Pod A Pod B Pod C pods share info nodes subscribe to pods · pods enable discovery
Figure 3 — Federated architecture: subscriber nodes cluster around linked pods, which relay information between clusters. Original diagram after Illustration 1.90.
🧭
Why pods, and not just raw P2P?

Pods enable node discovery. In a pure P2P network there's no way to discover other nodes without a centralized registry or a slow, tedious full-network scan. A pod solves that — it's the discovery point that makes the decentralized mesh usable.

Part B · Picking the right technology
07

Match the backend to the use case, not the hype

There's no rule that use case X demands technology Y — every use case has unique needs, there's no silver bullet, and everything has trade-offs. With that caveat, the course maps standard use cases to fitting backend tech:

Use case What it needs Fitting tech
Real-time data interaction
messaging, browser MMO games, collaborative editors, audio/video streaming (Spotify, Netflix)
A persistent client-server connection + non-blocking backend. NodeJS, Python Tornado; in Java: Spring Reactor, Play, Akka. Uber wrote its core trip-execution engine in Node.js to handle many concurrent connections.
Peer-to-peer web app
P2P distributed search, P2P live TV/radio
Direct browser-to-browser connectivity. JavaScript protocols DAT and IPFS; FreedomJS (framework for P2P web apps in modern browsers).
CRUD-based regular app
tax filing, employee/attendance management, booking portals, social sites
Standard MVC (Model-View-Controller) backend. Spring MVC, Python Django, Ruby on Rails, PHP Laravel, ASP.NET MVC.
Simple, small-scale app
blog, WordPress plugin, simple form, in-IFrame social apps, browser strategy games
Low complexity, quick to ship. PHP (and similar lightweight web frameworks / CMS options).

The meta-advice: once you start researching a technology and read its developer docs, one thing leads to the next — you'll discover the surrounding concepts and tools you need to implement your use case.

08

The tech-stack checklist

Picking the stack is crucial and hard to reverse once you're coding — the author frames these as a decade's worth of lessons learned the hard way (wasted months, unsupported tech, "crying into a pillow"). Six factors:

  1. Be thorough with the requirements. You can't pick the right tech while unclear on what you're building. Know whether data is relational, document-oriented, or unstructured; whether it'll grow exponentially or stay bounded; whether a monolith fits or you need modules. Splitting into modules with heterogeneous tech gives you an escape hatch if one technology doesn't work out.
  2. See if what you already know fits. Building with familiar tech skips the steep learning curve — you know the errors, exceptions, and fixes, so you ship faster. Don't chase shiny new toys or fall for hype until you truly need them; a novel exception with no answer online leaves you stranded.
  3. Check the community, docs, and support. An active community (GitHub, StackOverflow) means updated tools, libraries, and frameworks, plus help when you're stuck. Documentation should be smooth; official support is a bonus. Bigger community = better.
  4. Is it used by big guns in production? If major companies run it in production, it's battle-tested — you're less likely to hit inherent scalability, security, or design issues, since the codebase is continually patched by the owner and those companies' engineers.
  5. Check the license — is it open source? Open source lets you write custom features instead of waiting on the creator, costs no fees, and has a larger community since anyone can fork, extend, or fix it.
  6. Are skilled people available? As you grow you'll need to hire and move fast. It's far easier to find a MySQL admin or Java developer than a specialist in a newer, niche technology.
🎯
The through-line

Once you pick and start coding, there should be no looking back — you can't afford it. That's exactly why the checklist front-loads requirements clarity and de-risking (familiarity, community, production proof) over novelty.

09

Recap

Webhooks Event-based callbacks replace wasteful polling — register an endpoint, get called when something happens (e.g. browser notifications).
Shared-nothing Modules share no RAM or disk, killing single points of failure and aiding scalability.
Peer-to-peer No central server; equal nodes are both seeder and leecher. Resilient, private, scales free. BitTorrent, blockchain.
P2P network types Unstructured (random, O(n) search), structured (DHT-indexed, fast), hybrid (P2P + client-server).
Decentralized & federated web Bring-your-own-data social networks; pods make the decentralized mesh discoverable (Mastodon, Diaspora, ActivityPub).
Picking tech Match backend to use case (real-time/P2P/CRUD/simple); vet requirements, familiarity, community, production use, license, talent.
💡
The single idea underneath it all

Both halves of this page are about removing dependence on a single point — of failure, of control, or of regret. Webhooks, shared-nothing, and P2P each strip out a central bottleneck; the tech-stack checklist strips out the risk of betting everything on one poorly-vetted choice. Decentralize the architecture and de-risk the decision, and nothing single can take the whole thing down.

10

Further reading

These two chapters cite two external links. One resolves live; the other blocked automated access and is omitted (noted in the footer).

[1]
List of cryptocurrencies — Wikipedia Why read it: context for Section 03–04's P2P/blockchain examples — the range of cryptocurrencies built on peer-to-peer, decentralized foundations.