The Application Layer & HTTP

peer-to-peer

Imagine a study group where, instead of one teacher lecturing thirty students, every student shares the pages they have copied with everyone else. The more people join, the more copies exist and the faster everyone gets the whole book. That is the spirit of peer-to-peer, or P2P: there is no special always-on server; instead, ordinary participants (peers) talk directly to one another and each one acts as both a client and a server at the same time.

Concretely, in a P2P file-sharing system like BitTorrent, a file is split into many small pieces. As soon as a peer downloads a piece, it can upload that piece to other peers who still need it. A peer that wants a file finds others who have pieces of it, downloads different pieces from different peers in parallel, and simultaneously serves the pieces it already has. There is no central machine through which all the data must flow — the work and the bandwidth are spread across everyone taking part.

The headline property is self-scaling: in client-server, more users means more load on one server, but in P2P, each new user brings its own upload capacity, so the system's total serving power grows as demand grows. The costs are real, though — peers come and go unpredictably (churn), finding who has what is harder without a central directory, and security and trust are trickier because you are downloading from strangers. Many real systems are hybrids: a central tracker or index helps peers find each other, but the bulk data still moves peer to peer.

A Linux distribution is released as a torrent. The first day, ten thousand people download it. In client-server, the project's one server would be crushed. In P2P, the ten thousandth downloader is also helping upload, so the swarm actually gets faster as it grows — the load is shared by the very people creating it.

Each peer is both consumer and provider, so capacity scales with the crowd instead of bottlenecking on one server.

P2P is not inherently "piracy" — it is a distribution architecture used by Linux mirrors, blockchains, and some video and software updaters. What flows over it is a separate question from how it flows.

Also called
P2P點對點對等網路