An Uber-like Content Delivery Network

Anton Lakhtikov
5 min readFeb 8, 2023

--

If you have many users and a lot of static web content, you typically want to use a CDN to deliver it efficiently. Traditional CDN providers own or rent all of the necessary infrastructure and have no untrusted parts in their networks, but this comes with a high cost for customers—for example, AWS charges between $20 and $87 per TB of traffic.

An alternative solution is to hire a couple of engineers, rent a few servers and build your own CDN, which can cost as little as $2 per TB.

Each of these approaches has bright and dark sides. Can we combine the best parts of both worlds: reliable, safe delivery with decent service and low price?

Fig 1. How Midjourney /imagine Farba CDN

At Farba, we are building a zero-cost CDN infrastructure where all edge servers belong to anonymous Peers. A Peer can rent a server, set up a competitive price, and earn money when serving someone's static web content. Customers can save up to 10x on their traffic bills using our network.

It’s like Uber but for CDN

Using a sharing economy model forces you to take extra precautions and checks to safely deliver static web content to the end user. Let's see how it works in our case.

Frontend

To utilize the Farba CDN network, you need to take two steps:

  1. Add the Farba CDN javascript file[1] to your HTML document:

<script src="https://farbacdn.github.io/farba-public/build/farbacdn.min.js"></script>

2. Replace the src attribute of any objects you wish to deliver via our network with the data-src attribute and add the farba class to the tag. For example, instead of:

<img src="/uploads/FullSky_WMAP_2048W.png"/>

use:

<img class="farba" data-src="/uploads/FullSky_WMAP_2048W.png"/>

There is no need to change your DNS records, and you can easily opt-in and out of the Farba CDN network. Additionally, Farba can work on top of any existing CDN/Anti-DDoS solutions. So you can still be under DDoS protection from a prominent provider while delivering static web content from our peer-to-peer network.

Backend

In our CDN, we have four different roles:

  • User
  • Original Server (trusted source)
  • Balancer (trusted source)
  • Peer (untrusted source)
Fig 2. Backend model

When the User opens a web page from the Original Server, our CDN javascript sends a request to the Balancer. The Balancer then sends back a JSON reply with vital information:

  • The nearest location of the file within the Farba Network
  • The size of the file
  • The cryptographic digest of the file
Fig 3. JSON reply

Now the CDN script knows the new location of the requested file and can make an XMLHttpRequest(XHR) download call. Since the requested file comes from an untrusted source, the next step is to verify the integrity of the file. The script calculates the hash sum and compares it to the digest from the JSON reply. If the sums match, the script displays the downloaded file to the User. If the sums do not match, the script sends a new GET request to the Original Server to ensure that the User receives the file in any case.

Breakdown of Monthly Traffic

Let's dive into the numbers and see how much traffic one 1 Gbps (dedicated, unlimited) server can generate in a month.

In theory, with a 1 Gbps server, we can serve 128 MB per second. Based on 80% server utilization for 10 hours a day, we estimate that 100 TB of traffic can be served monthly.

128 MB * 80% * 3600 seconds * 10 hours * 30 days = 110592000 MB ≈ 100 TB

Fig 4. Usual traffic patterns

We plan to serve everything above the red line using Peers with limited bandwidth — for example, a Peer with 1 Gbps and 30 TB of monthly traffic and a small number of 95th percentile servers belonging to Farba.

This schema will help us effectively manage daily peak traffic and maintain a significant reserve of bandwidth.

Business model

Our business model is straightforward: we charge a 20% commission on each transaction between Customers and Peers.

Let's examine the potential earnings for a Peer in the US and European markets. The Peer can:

  • Rent a server with 1 Gbps dedicated, unlimited bandwidth for $200 per month
  • Set a price of $6 per TB
  • Serve 100 TB of traffic
  • Earn $600 ($480 after commission)

Alternatively, the Peer can opt to "earn" traffic and use it for their needs. For example, if the Peer needs 800 TB of traffic for their project per month, they can rent just one 10 Gbps server and benefit from our global network at no extra cost.

Chicken-or-egg problem

We need both Peers and Customers to make our network work, but how do we get started without one or the other?

We have deployed several "fake" Peers in the US and Europe, which means our network is ready to serve Customers from day one.

As the demand for our services grows, we will open our network for third parties and gradually onboard new Peers to ensure all existing Peers have enough work to do. We aim to keep all Peers busy while ensuring our network has enough capacity to handle increasing traffic. Our approach to accepting new Peers will be based on a "first come, first serve" policy, so be sure to join our waiting list.

Demo

You can view a live demo on our website. There, you can open a Developer Console to find out how the Farba CDN system actually works:

https://farbacdn.com/usage/demo/

Fig 5. Demo page

Where can you get a server

LeaseWeb

https://tinyurl.com/mtkahcu9

Fig 6. LeaseWeb 1 Gbps server (Seatle, WA)

FDCServers

https://www.fdcservers.net/budget-server-2

Fig 7. FDCServers 10 Gbps server (Seatle, WA)

OVH

https://tinyurl.com/smxm7b3u

Fig 8. OVH 2 Gbps server (Hillsboro, OR)

OneProvider

https://oneprovider.com/configure/dediconf/3688

Fig 9. OneProvider 1 Gbps / 100 TB server (Seatle, WA)

If you are interested in becoming a Peer, you can sign up for our waiting list by sending an email to peers@farbacdn.com. If you are a Customer, contact us at customers@farbacdn.com, and for Investors, email vc@farbacdn.com.

Reference

[1] https://github.com/FarbaCDN/farba-public

--

--