stanford, cs 249 s modern content delivery the life of a

69
The Life of a Request: Past, present and future Marwan Fayed* Cloudflare Research * A view from within Cloudflare; all opinions are my own, but not all artwork. Stanford, CS 249 Փ Modern Content Delivery

Upload: others

Post on 04-Feb-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stanford, CS 249 S Modern Content Delivery The Life of a

The Life of a Request:Past, present and futureMarwan Fayed*Cloudflare Research

* A view from within Cloudflare; all opinions are my own, but not all artwork.

Stanford, CS 249 Modern Content Delivery

Page 2: Stanford, CS 249 S Modern Content Delivery The Life of a
Page 3: Stanford, CS 249 S Modern Content Delivery The Life of a

General Overview

90 Global Interns❖ San Francisco❖ New York❖ Austin❖ Champaign ❖ London ❖ Lisbon❖ Singapore❖ And many more places!

15 Teams❖ Research❖ Marketing❖ Special Projects❖ Engineering❖ Product Management❖ Security❖ Legal

Page 4: Stanford, CS 249 S Modern Content Delivery The Life of a

Activities & Presentations

❖ 1 1 Chats with C-suite Team❖ Mentor & Buddy Program❖ Intern Week: Games, Challenges, ❖ Bi-Weekly Newsletters❖ CloudflareTV Episodes❖ Blog Posts ❖ Company-Wide Internship Presentations in August

Page 5: Stanford, CS 249 S Modern Content Delivery The Life of a

Visit https://www.cloudflare.com/en-gb/careers/jobs/

Page 6: Stanford, CS 249 S Modern Content Delivery The Life of a

A Shared LanguageLet’s first establish

Page 7: Stanford, CS 249 S Modern Content Delivery The Life of a

“The life of a request” is a phrase...

● Used to describe where packets go to fulfill a request○ e.g. all the pieces involved in retrieving example.com

● Consists of○ DNS○ content request (e.g. HTTP○ all services, requests, or connections, that trigger as a result.

Page 8: Stanford, CS 249 S Modern Content Delivery The Life of a

Jargon First!

User or Client(or “eyeball” if I slip)

Server

Origin server(source of truth)

Server somewhere on the Internet

Page 9: Stanford, CS 249 S Modern Content Delivery The Life of a

Tip 1 In computer networking, the ‘starting’ answer to ‘why’?

Page 10: Stanford, CS 249 S Modern Content Delivery The Life of a

Tip 1 In computer networking, the ‘starting’ answer to ‘why’?

9 times out of 10

ScaleOtherwise:

Page 11: Stanford, CS 249 S Modern Content Delivery The Life of a

Tip 1 In computer networking, the ‘starting’ answer to ‘why’?

9 times out of 10

ScaleOtherwise:

Money

Page 12: Stanford, CS 249 S Modern Content Delivery The Life of a

Tip 1 In computer networking, the ‘starting’ answer to ‘why’?

9 times out of 10

ScaleOtherwise:

Money

Tip 2 In content distribution and delivery, thinking of‘what?’ and ‘how?’...

Page 13: Stanford, CS 249 S Modern Content Delivery The Life of a

Tip 1 In computer networking, the ‘starting’ answer to ‘why’?

9 times out of 10

ScaleOtherwise:

Money

Tip 2 In content distribution and delivery, thinking of‘what?’ and ‘how?’...

...it helps to define things in terms of connection termination.

Page 14: Stanford, CS 249 S Modern Content Delivery The Life of a

More to come but...

User or Client(or “eyeball” if I

slip)

Server

Origin server(source of

truth)

Server in the Cloud

(hosted, proxy, etc.)

Question to ponder: Who is the Customer?

Page 15: Stanford, CS 249 S Modern Content Delivery The Life of a

Evolution of Content Delivery Networks“In the beginning…”

Page 16: Stanford, CS 249 S Modern Content Delivery The Life of a

1. One client, one server

● This is the traditional textbook view○ The foundation of user-oriented connections, for all delivery models○ great for teaching○ dominant through late 1990s

Internet

Page 17: Stanford, CS 249 S Modern Content Delivery The Life of a

1. One client, one server

● This is the traditional textbook view○ The foundation of user-oriented connections, for all delivery models○ great for teaching○ dominant through late 1990s

Internet

Page 18: Stanford, CS 249 S Modern Content Delivery The Life of a

1. One client, one server

● What is the problem here?○ Hint: The ‘Internet’ is growing fast (and faster with time)○ And what is the natural step to solve it?

Internet

Page 19: Stanford, CS 249 S Modern Content Delivery The Life of a

IDEA One client, many servers?

● The natural response is to have multiple servers

Internet

...

Page 20: Stanford, CS 249 S Modern Content Delivery The Life of a

It is One client, but not just many servers

● What is missing? Consider:○ routing, and by extension...○ … connection termination

Internet

...

Page 21: Stanford, CS 249 S Modern Content Delivery The Life of a

It is One client, but not just many servers

● Physics: A single packet can’t reach multiple recipients, nor should it.○ (unicast) Routing protocols forward to a single interface, not many;○ they have to, otherwise connection termination makes no sense

Internet

...

a.b.c.d

a.b.c.d

a.b.c.d

a.b.c.d

Page 22: Stanford, CS 249 S Modern Content Delivery The Life of a

It is One client, but not just many servers

● Insight: something has to terminate the connection.

Internet

...

a.b.c.d

a.b.c.d

a.b.c.d

a.b.c.d

Page 23: Stanford, CS 249 S Modern Content Delivery The Life of a

● One IP address for routing to, and connection termination○ with multiple connections at the back-end○ connected to duplicate servers that mirror content.

2. The server “farm” One client, one server, many back-ends

...

a.b.c.d

Page 24: Stanford, CS 249 S Modern Content Delivery The Life of a

● Notice that here, the provider is the origin of content, as well.○ e.g. the IBMs, Microsofts, Yahoos, etc.○ and so the back-ends might share or process between them.

2. The server “farm” One client, one server, many back-ends

...

a.b.c.d

Page 25: Stanford, CS 249 S Modern Content Delivery The Life of a

The “mix-and-match” periodSeparating provider service from origin services to share resources(or improving scale, while saving money, too).

Page 26: Stanford, CS 249 S Modern Content Delivery The Life of a

Background: Putting “bits on the wire” has a monetary cost

● Remember this?

“Time (in flight) is money, but there is even more to say...

Page 27: Stanford, CS 249 S Modern Content Delivery The Life of a

Background: Putting “bits on the wire” has a monetary cost

● Scaling-up with more servers ⟶ costs money○ hardware ○ storage○ space○ person time, and expertise○ Energy!

● Scaling-up with more network capacity ⟶ costs money○ network capacity○ more specialized devices (routers and switches)○ ...and everything else from above!

Page 28: Stanford, CS 249 S Modern Content Delivery The Life of a

What to do if you want to scale and save money?

Because as demand grows......most are unable to increase supply.

...

a.b.c.d

Page 29: Stanford, CS 249 S Modern Content Delivery The Life of a

Leads to two shifts in content delivery (late 1990s to late 2000s)

The ‘Classic’ CDN Model

● Content closer to users:○ Serve content on behalf

of the origin○ But “ground truth” lies

with owners

● Relies on DNS & CNAME)to redirect, with unicast, e.g. example.com⟶example.akamai.com

Virtual Hosting

● Infrastructure without costs○ Host services at provider○ Maintain control (origin)○ Offers isolation○ Scale-up as needed

● Rely on provider for servers, up-time, network resources, etc.

Page 30: Stanford, CS 249 S Modern Content Delivery The Life of a

Customer has a remote interface to control their origin (e.g. ssh or web)

Virtual Hosting

● The customer is on-site.

e.f.h.iw.x.y.z

...

a.b.c.de.f.h.i Example1.com

Example2.com

Example3.com

...all co-exist.

Page 31: Stanford, CS 249 S Modern Content Delivery The Life of a

Customer has no access to provider, only updates content

The ‘Classic’ CDN Model

● The customer is off-site

e.f.h.iw.x.y.z

...

a.b.c.de.f.h.i

example.com

Page 32: Stanford, CS 249 S Modern Content Delivery The Life of a

The Reverse Proxy period + AnycastKeeping the content, while shifting the origins edge out into the network

Page 33: Stanford, CS 249 S Modern Content Delivery The Life of a

The classic ‘forward proxy’ (for comparison)

● A forward proxy terminates client connection ● A forward proxy ‘acts’ on behalf of the user (or user’s organization)● Proxy is transparent, and pre-configured

example.com

Page 34: Stanford, CS 249 S Modern Content Delivery The Life of a

The ‘reverse proxy’

● A reverse proxy terminates client connection ● A reverse proxy acts on behalf of the origin● Proxy is transparent, and inserted into request path via DNS

example.com

Origin

Page 35: Stanford, CS 249 S Modern Content Delivery The Life of a

Functionally similar, operationally opposite

Forward Proxy

● Terminates client connection

● A forward proxy acts on behalf of the user (or user’s org)

● Proxy is transparent

● Pre-configured

Reverse Proxy

● Terminates client connection

● A reverse proxy acts on behalf of the origin

● Proxy is transparent

● Inserted into request path via DNS

Page 36: Stanford, CS 249 S Modern Content Delivery The Life of a

Important: The reverse proxy acts on behalf of the origin

● Provides “network as a service” NaaS functionality○ e.g. DoS protection, certificate mgmt (HTTPS , firewall, cache, ...

example.com

Origin

Page 37: Stanford, CS 249 S Modern Content Delivery The Life of a

In a Cloudflare context

● DNS (authoritative)● DoS● Firewall● HTTPS● Caching not content● ...

Page 38: Stanford, CS 249 S Modern Content Delivery The Life of a

Breaking this down into steps

● Authoritative DNS is the key to service management

Authoritative DNSA example.com ?

a.b.c.d

https://example.com<h1 Welcome</h1https://example.com

<h1 Welcome</h1

1

2

3 4

5

(stay tuned for more on step 4.)

Page 39: Stanford, CS 249 S Modern Content Delivery The Life of a

Pause for a moment -- there is a strong implication on an Internet ideal

● Seminal work, 1981.

Page 40: Stanford, CS 249 S Modern Content Delivery The Life of a

Pause for a moment -- there is a strong implication on an Internet ideal

● The end-to-end principle says, “application-specific features reside in the communicating end nodes of the network, rather than in intermediary nodes, such as gateways and routers, that exist to establish the network. Wikipedia]”

● What does this mean for content delivery architectures?○ Ask David Clark, Nov 20!

Page 41: Stanford, CS 249 S Modern Content Delivery The Life of a

Implication: From e2e to e2e(dge)

● In the content-oriented Internet, connections are end-to-edge

A 1 connectionB 2 connectionsC 3 connections -- 6 IP addresses, 4 of those in the edge infrastructure!

Page 42: Stanford, CS 249 S Modern Content Delivery The Life of a

But inside the edge, it’s possible to adapt to Internet events

Page 43: Stanford, CS 249 S Modern Content Delivery The Life of a

Globally, within 50ms of 95% of world’s Internet users

The Cloudflare Network

10,000Interconnects

25M+Web requests per second

12MDNS requests per second

Spans more than cities in more than countries

43

250 100

Page 44: Stanford, CS 249 S Modern Content Delivery The Life of a

Cloudflare operates Anycast for all content (not just DNS

● Every PoP / datacenter● advertises same IP ranges

● Closest PoP / datacenter● selected by BGP shortest path

● From “One machine, one IP” ● to “Many machines, many IPs!”

Page 45: Stanford, CS 249 S Modern Content Delivery The Life of a

Anycast in Action (comparison):

Page 46: Stanford, CS 249 S Modern Content Delivery The Life of a

Anycast in Action:

Page 47: Stanford, CS 249 S Modern Content Delivery The Life of a

“Stay close” is another consequence of anycast

The Cloudflare Network

47

Page 48: Stanford, CS 249 S Modern Content Delivery The Life of a

Anycast in Action:

Page 49: Stanford, CS 249 S Modern Content Delivery The Life of a

Anycast in Action:

Page 50: Stanford, CS 249 S Modern Content Delivery The Life of a

“Stay close” is another consequence of anycast

The Cloudflare Network

50

Page 51: Stanford, CS 249 S Modern Content Delivery The Life of a

...and ways this influences thinking.

Inside Cloudflare

But first an aside on ‘value’.

Page 52: Stanford, CS 249 S Modern Content Delivery The Life of a

Keep things Simple: Every Internet user can be a customer

Page 53: Stanford, CS 249 S Modern Content Delivery The Life of a

And remember, money changes things

● Cloudflare’s pricing model changes definitions of ‘value’

● DNS (authoritative)● DoS● Firewall● HTTPS● Caching● ...

Page 54: Stanford, CS 249 S Modern Content Delivery The Life of a

And remember, money changes things

● Cloudflare’s pricing model changes definitions of ‘value’

● DNS (authoritative)● DoS● Firewall● HTTPS● Caching● ...

Page 55: Stanford, CS 249 S Modern Content Delivery The Life of a

Keep the systems simple, or at least uniform.

Inside Cloudflare:

Step 4., as promised.

Page 56: Stanford, CS 249 S Modern Content Delivery The Life of a

The conventional view of the data center

● Large, dedicated facilities

● Require large up-front investments

● Different servers and machines have different services○ a single request can spawn countless other ‘microservice’ requests

● (worth thinking about other attributes)

Page 57: Stanford, CS 249 S Modern Content Delivery The Life of a

“Life of a Request” inside Cloudflare

ECMP + Consistent Hashing → forwards all packets in a flow to a single server!

Page 58: Stanford, CS 249 S Modern Content Delivery The Life of a

“Life of a Request”

First thing that happens: Denial of service protections

Page 59: Stanford, CS 249 S Modern Content Delivery The Life of a

“Life of a Request”

Next is “layer-4 load balancing -- details on ‘Unimog’ at https://blog.cloudflare.com/unimog-cloudflares-edge-load-balancer/

Page 60: Stanford, CS 249 S Modern Content Delivery The Life of a

“Life of a Request” L4LB to other PoPs and data centers, too

Page 61: Stanford, CS 249 S Modern Content Delivery The Life of a

Increasingly, one global edge

Page 62: Stanford, CS 249 S Modern Content Delivery The Life of a

“Life of a Request”

Clients connect only after DoS protections and load-balancing!

Page 63: Stanford, CS 249 S Modern Content Delivery The Life of a

“Life of a Request”

Page 64: Stanford, CS 249 S Modern Content Delivery The Life of a

“Life of a Request”

Every server participates in a shared distributed cache

Page 65: Stanford, CS 249 S Modern Content Delivery The Life of a

Every edge server is identical.

Page 66: Stanford, CS 249 S Modern Content Delivery The Life of a

Also, there are core data centers for logs & configs

Page 67: Stanford, CS 249 S Modern Content Delivery The Life of a

Sometimes Twitterknows before we do.

This is getting better!

Page 68: Stanford, CS 249 S Modern Content Delivery The Life of a

Every edge server is identical.

Page 69: Stanford, CS 249 S Modern Content Delivery The Life of a

Questions welcomed.