P2P-CDN

Parth
Written by Parth on
P2P-CDN
The code repository can be found here.

Content Distribution Networks (CDNs), are a network infrastructure built to distribute content provided by content providers to the clients requested on demand while maintaining the downstream latency or quality of service (QoS).

The network makes use of multiple cache servers placed at multiple geographical locations. When a user requests the data, the Domain Name Server (DNS) within the requested domain resolves the address to the authoritative DNS of the domain which has the closest cache server placed from the client. The cache server in turn serves that request and since the cache server is picked close to the client location, the QoS is maintained high.

CDNs provide the QoS that we aim for, but it comes at a cost. To expand the CDN coverage, we need more cache servers which is not scalable. These distributed cache servers in turn require periodic maintenance which is not cost effective either. In this project, we surveyed how we can leverage Peer-2-Peer (P2P) architecture combined with CDNs to inherit all the advantages of P2P architecture and not falling for the shortcomings of P2P architecture at the same time.

Implementation

We implemented a simplified architecture for a Peer-Assisted CDN by abstracting the tracker and CDN in the same node (the “server”). A single router connects both the clients and the server. Each link has a speed of 100Kbps and a propagation delay of 2ms. We use UDP as the transport layer protocol and each link is a PPP link.

Algorithm

  • Each packet, except a data packet, is prefixed with a header and flags to identify it at each node.
  • Server-Side: The server stores a list of nodes that have the data (thus acting as a tracker). It also is the primary source of data when a client requests it. When a client requests a packet: If no other peers are present, the server sends the requested packet and adds the client to the list of peers. Else, the server sends a list of peers and waits for an ACK from the client
  • Client-Side: The client acts as a requesting agent for a packet and as a peer. When a peer requests a packet: The peer will ask for fraction of the entire packet from the client i.e. : requested_packet_size = total_file_size / number_of_peers. The client sends the requested packet size. Once the peer recieves the packet it will send an ACK packet to the CDN server to update its peer list.

Results

Latency Results

The figure shows the download time for a file with respect to the number of peers. As one can see, the download time for a purely CDN approach is very similar compared to the hybrid Peer Assisted CDN approach thus verifying the applicability and practicality of Peer Assisted CDN.