Peer-to-Peer (P2P) is an architecture that allows arbitrary end systems to directly communicate. Although they are known mostly for illegal activity, the architecture makes up the backbone of VoIP, and other legitimate services.
Peer-to-Peer distribution time is logarithmic relative to the number of users on the P2P application. Where as the client-server structure would grow linearly relative to the number of users.
BitTorrent: uses a tit-for-tat system. If you allow others to download from you, then you are rewarded. This provides incentive for people to contribute to the network. It will re-evaluate the top 4 best peers to download from every 10 seconds.
Say there are n coupons. To receive a prize you must collect all unique coupons. For your first coupon, it is unique. The next coupon we have a N-1/N probability of finding a coupon we have already gotten before. We need to use a Bernoulli random variable to see the probability of getting a coupon we currently have. Therefore, we need: 1 + N/N-1 + N/N-2 +… + N.
Because of the increased difficulty as we collect more coupons, BitTorrent and other P2P networks use a “rarest first” system, that allows users to download the rarest packet first, then it will go to sending the more common packets and end with the most common packet.
P2P differs from typical client-server applications in that the service is shared jointly among the peers rather than provided by the servers. P2P doesn’t contain anything illegal, merely the use is known for distribution of copyrighted content.
Skype is inherently P2P: pairs of users communicate, but it is a proprietary application layer protocol that we can infer by reverse engineering.
There are roughly ~1 Billion YouTube users, and ~75 Million Netflix users. These services account for about 16% of downstream residential ISP traffic.
Videos are stored with a ton of redundancy, because if you look at most videos there is a large amount of colors and intensities that are the exact same from frame to frame.
There are different encoding protocols that can reduce the size of the video, but there is still a lot of redundancy.
Dynamic, Adaptive Streaming over HTTP (DASH):
MPEG-DASH is a popular algorithm. The client adjusts the rate at which it is downloading chunks from the servers. The servers break up the video into chunks.
Content Distribution Networks (CDNs): are responsible for directing a user to a nearby copy of the content and then the client will connect to that server to retrieve the content. Large companies like Google and Netflix have their own CDNs because of how much content they own.