optional · CSS study notes
Peer To Peer Systems
🧭
On this page — click any heading below to jump straight to it. ⬅️ Back to P-II.II. Computer Communications & Networks
OSI Layer: Application Layer (L5–L7)
Definition
Peer-to-Peer (P2P) systems are decentralised network architectures where each node ("peer") acts as both client and server, sharing resources (files, compute, bandwidth) directly with other peers rather than routing every interaction through a central, always-on server.
Types of P2P Architecture (by Degree of Centralisation)
1. Pure (Unstructured) P2P
- Fully decentralised — no central server or index at all; peers connect to a somewhat random subset of other peers, and queries are typically flooded outward hop by hop until they find a match.
- Advantages: maximum resilience (no single point of failure whatsoever); simple to join, no central infrastructure cost.
- Disadvantages: searching/discovery is inefficient (flooding wastes bandwidth and doesn't guarantee finding existing content); does not scale well as the network grows.
- Example: early Gnutella.
2. Centralised (Hybrid-Index) P2P
- Uses a central server purely for indexing/discovery (who has what), while the actual data transfer happens directly peer-to-peer once two peers are matched.
- Advantages: fast, efficient search (a simple lookup at the central index) while still offloading the heavy bandwidth cost of data transfer onto the peers themselves.
- Disadvantages: the central index is a single point of failure — if it goes down, peers can no longer find each other even though they could still transfer data.
- Example: original Napster (central index of who has which song; direct peer-to-peer download).
3. Structured (Hybrid, DHT-based) P2P
- No single central index; instead, peer discovery is handled by a Distributed Hash Table (DHT) distributed across the peers themselves, so there is no single point of failure yet search remains efficient (typically
O(log N)hops). - Advantages: combines pure P2P's resilience with efficient, deterministic lookup.
- Disadvantages: more complex protocol design and maintenance overhead (peers must maintain routing state as others join/leave).
- Example: BitTorrent's "trackerless" mode using a Kademlia-based DHT; modern blockchain peer-discovery layers.
Comparison Table
| Basis | Pure P2P | Centralised (Hybrid-Index) | Structured (DHT-based) |
|---|---|---|---|
| Central point | None | Central index server | None (distributed index) |
| Search method | Flooding | Direct lookup at index | DHT routing (e.g., O(log N)) |
| Single point of failure | None | Yes (the index server) | None |
| Search efficiency | Low (wasteful, not guaranteed) | High | High |
| Example | Early Gnutella | Original Napster | BitTorrent DHT/Kademlia |
Advantages of P2P (General)
- Self-scalability — each new peer adds demand but also adds serving capacity (bandwidth/storage), unlike client-server where only demand grows against a fixed server capacity.
- No single point of failure in pure/structured designs — highly resilient to individual node failure.
- Cost-effective — no expensive dedicated server infrastructure required; uses otherwise idle end-user resources.
Challenges of P2P
- Security and trust — harder to enforce authentication/access control without a central authority.
- Free-riding — peers who consume (download) far more than they contribute (upload), degrading overall system health.
- Peer churn — nodes join and leave unpredictably, requiring the system to constantly adapt its routing/index state.
- Legal/copyright concerns — historically associated with unauthorised file sharing/piracy, inviting regulatory scrutiny.
Numerical (linking to distribution time)
For a file F shared with N peers, comparing to client-server: if server upload rate is u_s, peer upload rates sum to Σuᵢ, and slowest peer download rate is d_min:
- Client-server distribution time =
max(N·F/u_s, F/d_min)— grows linearly with N. - P2P distribution time ≈
max(F/u_s, F/d_min, N·F/(u_s + Σuᵢ))— grows far more slowly because total upload capacity scales with N (see the "Network Application Architectures" page for a full worked comparison).
CSS Exam Angle
- This topic connects directly to "Network Application Architectures" (client-server vs P2P) — cross-reference both for a stronger, more complete answer if asked broadly about network application models.
- Classify P2P explicitly into pure, centralised, and structured (DHT-based) rather than treating "P2P" as one monolithic category — this is the depth examiners reward.
- The self-scalability argument, ideally backed by the distribution-time reasoning above, is what separates a top answer from a generic one.
Example
BitTorrent-based file sharing (structured/DHT-based, trackerless mode) and blockchain networks (e.g., Bitcoin's peer-to-peer network for block/transaction propagation; do not assume all blockchain peer discovery uses a DHT) are both modern, real-world P2P systems worth citing as current examples rather than only historical ones like Napster.
Likely Questions
- Explain peer-to-peer network architecture, its advantages, and challenges.
- Classify P2P systems into pure, centralised, and structured types with an example of each.
- Why is Napster considered a single point of failure despite being a P2P system?
- Explain self-scalability in P2P systems and how it differs fundamentally from client-server scaling.
📜 Past-Paper Questions & Structured Answers
Questions are paraphrased; answer focus is suggested guidance, not an official marking scheme.
2026 · Paper-II · Q1 item 17 · 1 mark
Question (paraphrased): What roles can nodes have in peer-to-peer networking?
Answer: B — a peer can act as a client, a server, or both. A BitTorrent peer can download pieces while uploading pieces to others. This differs from an architecture with one dedicated server and many clients. P2P can still use a tracker or other central discovery component; the defining point is resource sharing among peers. Source paper
Related preparation: P2P is an overlay example for 2024 Q4(b); the full seven-mark overlay/CDN answer is in Content Distribution Networks. A P2P definition alone does not answer that question.