Do we still need a CDN?

PixelsCommander ha released an interesting project called ViralSJ: a Node.js/Express.js library to distribute application via P2P, using WebRTC.

ViralJS creates a self-establishing and self-evolving CDN which moves data closer to client.

P2P content distribution allows to reduce server load which is going to be interesting for social and non-profit organizations and projects, also this may decrease network latency since peering could be set up in the way content to be delivered from the nearest peer available. For example after hitting corporative network application will be delivered inside of it using high speed internal channels without creating a load on company`s internet channel.

How does ViralJS work?

- When server receive a request for an app it determines are there any peers available nearby the requester.

- If there are no matching peers client receives full application code from server and small viral script (viral addition) is added to the end of application code. Viral addition executed on client after app transferred completely. It connects to server and notify server about one more peer available. Also viral addition is responsible for serving P2P requests from other clients, basically this is a code which send application to next peer;

- If server finds a correct peer it respond with a minimalistic script (thin client) which contains instruction to connect with peer X`s viral addition, receive application from there and deploy it locally;

- Server helps seeding peer and receiving peer to exchange P2P addresses;

- They establish direct connection and carrier sends application to the recipient;

- Recipient executes code it received which launches application and makes him one more active peer.

Cross-browser compatibility?


As on today P2P messaging between browsers (WebRTC technology) is supported by Firefox and Chrome.

Edge partially supports it, while Safari does not support it at all, but there is a fallback which does not reduce quality of delivered app: Safari and IE/Edge will just receive regular application without viral addition which means that there is no compatibility problem when start using P2P distribution.

P2P Distribution is interesting from infrastructure cost and latency reducing perspective, but also ViralJS it is an inspiring foundation for next quality leaps for brand new, experimental Web architectures and solutions.

However even it is amazing opportunity to move forward the answer to the question from title is: “Yes, we still need a server to make initial distribution and signaling between peers.”