Stuff I do Follow me! https://pasztor.at @janoszen About this - - PowerPoint PPT Presentation

stuff i do
SMART_READER_LITE
LIVE PREVIEW

Stuff I do Follow me! https://pasztor.at @janoszen About this - - PowerPoint PPT Presentation

Stuff I do Follow me! https://pasztor.at @janoszen About this talk 1. The problem with CDNs About this talk 1. The problem with CDNs 2. How does a CDN work? About this talk 1. The problem with CDNs 2. How does a CDN work? 3. Static


slide-1
SLIDE 1
slide-2
SLIDE 2

Stuff I do

slide-3
SLIDE 3

Follow me!

https://pasztor.at @janoszen

slide-4
SLIDE 4

About this talk

  • 1. The problem with CDNs
slide-5
SLIDE 5

About this talk

  • 1. The problem with CDNs
  • 2. How does a CDN work?
slide-6
SLIDE 6

About this talk

  • 1. The problem with CDNs
  • 2. How does a CDN work?
  • 3. Static content CDN
slide-7
SLIDE 7

About this talk

  • 1. The problem with CDNs
  • 2. How does a CDN work?
  • 3. Static content CDN
  • 4. Hosting dynamic content
slide-8
SLIDE 8

Assumptions

You know what HTTP is.

slide-9
SLIDE 9

Assumptions

You know what HTTP is. You know what a DNS is.

slide-10
SLIDE 10

Assumptions

You know what HTTP is. You know what a DNS is. You know what a CDN is.

slide-11
SLIDE 11

Warning!

Don’t do this at home!

This is as experimental as it gets.

slide-12
SLIDE 12

The problem with CDNs

Low-traffic sites don’t work well with a CDN

slide-13
SLIDE 13

The problem with CDNs

slide-14
SLIDE 14

The problem with CDNs

slide-15
SLIDE 15

The problem with CDNs

slide-16
SLIDE 16

The problem with CDNs

slide-17
SLIDE 17

The problem with CDNs

slide-18
SLIDE 18

The problem with CDNs

slide-19
SLIDE 19

The problem with CDNs

slide-20
SLIDE 20

The problem with CDNs

slide-21
SLIDE 21

The problem with CDNs

slide-22
SLIDE 22

The problem with CDNs

User CDN Origin GET /avatar.jpg Cache

slide-23
SLIDE 23

The problem with CDNs

User CDN Origin GET /avatar.jpg Cache

slide-24
SLIDE 24

The problem with CDNs

User CDN Origin GET /avatar.jpg Cache GET /avatar.jpg

slide-25
SLIDE 25

The problem with CDNs

User CDN Origin Cache GET /avatar.jpg GET /avatar.jpg

slide-26
SLIDE 26

The problem with CDNs

User CDN Origin GET /avatar.jpg Cache GET /avatar.jpg

slide-27
SLIDE 27

The problem with CDNs

User CDN Origin Cache GET /avatar.jpg

slide-28
SLIDE 28

The problem with CDNs

User CDN Origin Cache ~30-40 ms ~160 ms

slide-29
SLIDE 29

The problem with CDNs

User CDN Origin Cache ~30-40 ms ~160 ms ~30-40 ms ~10 ms

slide-30
SLIDE 30

The problem with CDNs

User CDN Origin Cache ~30-40 ms ~160 ms ~160 ms ~30-40 ms ~10 ms

slide-31
SLIDE 31

The problem with CDNs

User CDN Origin Cache ~30-40 ms ~160 ms ~160 ms ~160 ms ~200 ms ~50 ms ~30-40 ms ~10 ms

slide-32
SLIDE 32

The problem with CDNs

Workaround:

slide-33
SLIDE 33

The problem with CDNs

Workaround:

Cache-Control: s-maxage=31536000

slide-34
SLIDE 34

The problem with CDNs

Caveat:

All files must have unique URLs! Does not always work.

slide-35
SLIDE 35

How do CDNs work?

Locating the proper edge node

slide-36
SLIDE 36

How do CDNs work?

User CDN POP in Europe CDN POP in the USA

slide-37
SLIDE 37

How do CDNs work?

User CDN POP in Europe CDN POP in the USA

slide-38
SLIDE 38

How do CDNs work?

User CDN POP in Europe CDN POP in the USA

slide-39
SLIDE 39

How do CDNs work?

User CDN POP in Europe CDN POP in the USA

slide-40
SLIDE 40

How do CDNs work?

User CDN POP in Europe CDN POP in the USA

slide-41
SLIDE 41

How do CDNs work?

User CDN POP in Europe CDN POP in the USA

slide-42
SLIDE 42

How do CDNs work?

User CDN POP in Europe CDN POP in the USA I have 1.2.3.4!

slide-43
SLIDE 43

How do CDNs work?

User CDN POP in Europe CDN POP in the USA I have 1.2.3.4!

slide-44
SLIDE 44

How do CDNs work?

User CDN POP in Europe CDN POP in the USA I have 1.2.3.4!

slide-45
SLIDE 45

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4

slide-46
SLIDE 46

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 I have 1.2.3.4!

slide-47
SLIDE 47

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 I have 1.2.3.4!

slide-48
SLIDE 48

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 I have 1.2.3.4!

slide-49
SLIDE 49

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 I have 1.2.3.4!

slide-50
SLIDE 50

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 I have 1.2.3.4!

slide-51
SLIDE 51

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 I have 1.2.3.4!

slide-52
SLIDE 52

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 1.2.3.4

slide-53
SLIDE 53

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 1.2.3.4 3 hops 6 hops

slide-54
SLIDE 54

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 1.2.3.4

slide-55
SLIDE 55

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 1.2.3.4 10.1.0.1 10.2.0.1

slide-56
SLIDE 56

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 1.2.3.4 10.1.0.1 10.2.0.1

What is the IP for pasztor.at?

slide-57
SLIDE 57

How do CDNs work?

User CDN POP in Europe CDN POP in the USA 1.2.3.4 1.2.3.4 10.1.0.1 10.2.0.1

10.1.0.1

slide-58
SLIDE 58

How do CDNs work?

User CDN POP in Europe CDN POP in the USA

Anycast is ONLY used for DNS lookups!

See https://engineering.linkedin.com/network-performance/tcp-over-ip-anycast-pipe-dream-or-reality

slide-59
SLIDE 59

Hosting static content

Part 1:

Finding a DNS provider

slide-60
SLIDE 60

Hosting static content

Anycast servers

slide-61
SLIDE 61

Hosting static content

Anycast servers Latency- or GeoIP based responses

slide-62
SLIDE 62

✓ ✓

Hosting static content

Anycast servers Latency- or GeoIP based responses

slide-63
SLIDE 63

Hosting static content

eu-central-1.glb.techblog.cloud. IN A 18.194.241.96 us-east-1.glb.techblog.cloud. IN A 54.152.113.29 us-west-1.glb.techblog.cloud. IN A 52.9.244.13

slide-64
SLIDE 64

Hosting static content

eu-central-1.glb.techblog.cloud. IN A 18.194.241.96 us-east-1.glb.techblog.cloud. IN A 54.152.113.29 us-west-1.glb.techblog.cloud. IN A 52.9.244.13 glb.techblog.cloud. IN ALIAS eu-central-1.glb.techblog.cloud. glb.techblog.cloud. IN ALIAS us-east-1.glb.techblog.cloud. glb.techblog.cloud. IN ALIAS us-west-1.glb.techblog.cloud.

slide-65
SLIDE 65

Hosting static content

slide-66
SLIDE 66

Hosting static content

Part 2:

Docker

slide-67
SLIDE 67

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance My laptop EC2 instance EC2 instance

slide-68
SLIDE 68

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

ECS AGENT

My laptop ECS ECS ECS EC2 instance

ECS AGENT

EC2 instance

ECS AGENT

slide-69
SLIDE 69

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

ECS AGENT WEB SERVER

My laptop ECS ECS ECS EC2 instance

ECS AGENT WEB SERVER

EC2 instance

ECS AGENT WEB SERVER

slide-70
SLIDE 70

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

ECS AGENT WEB SERVER

My laptop ECS ECS ECS EC2 instance

ECS AGENT WEB SERVER

EC2 instance

ECS AGENT WEB SERVER

ECR

slide-71
SLIDE 71

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

ECS AGENT WEB SERVER

My laptop ECR ECS ECS ECS EC2 instance

ECS AGENT WEB SERVER

EC2 instance

ECS AGENT WEB SERVER Docker Image Webserver Content

slide-72
SLIDE 72

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

ECS AGENT WEB SERVER

My laptop ECR ECS ECS ECS EC2 instance

ECS AGENT WEB SERVER

EC2 instance

ECS AGENT WEB SERVER Docker Image

slide-73
SLIDE 73

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

ECS AGENT WEB SERVER

My laptop ECS ECS ECS EC2 instance

ECS AGENT WEB SERVER

EC2 instance

ECS AGENT WEB SERVER Docker Image

ECR

slide-74
SLIDE 74

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

ECS AGENT WEB SERVER

My laptop ECR ECS ECS ECS EC2 instance

ECS AGENT WEB SERVER

EC2 instance

ECS AGENT WEB SERVER

slide-75
SLIDE 75

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

WEB SERVER

My laptop ECR EC2 instance

WEB SERVER

EC2 instance

WEB SERVER ECS AGENT

ECS ECS ECS

ECS AGENT ECS AGENT

slide-76
SLIDE 76

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

WEB SERVER

My laptop ECS ECS ECS EC2 instance

WEB SERVER

EC2 instance

WEB SERVER ECS AGENT

ECR

ECS AGENT ECS AGENT

slide-77
SLIDE 77

Hosting static content

us-west-1 us-east-1 eu-central-1 EC2 instance

ECS AGENT WEB SERVER

My laptop ECR ECS ECS ECS EC2 instance

ECS AGENT WEB SERVER

EC2 instance

ECS AGENT WEB SERVER

slide-78
SLIDE 78

Hosting dynamic content

Can it run Wordpress?

slide-79
SLIDE 79

Hosting dynamic content

us-west-1 us-east-1 eu-central-1 EC2 instance EC2 instance EC2 instance

slide-80
SLIDE 80

Hosting dynamic content

us-west-1 us-east-1 eu-central-1 EC2 instance EC2 instance EC2 instance INTERNET

slide-81
SLIDE 81

Hosting dynamic content

us-west-1 us-east-1 eu-central-1 EC2 instance EC2 instance EC2 instance INTERNET

Docker Swarm Overlay Network

slide-82
SLIDE 82

Hosting dynamic content

us-west-1 us-east-1 eu-central-1 EC2 instance EC2 instance EC2 instance INTERNET

WEB SERVER WEB SERVER WEB SERVER

slide-83
SLIDE 83

Hosting dynamic content

us-west-1 us-east-1 eu-central-1 EC2 instance EC2 instance EC2 instance INTERNET

WEB SERVER WEB SERVER WEB SERVER GALERA GALERA GALERA

slide-84
SLIDE 84

Hosting dynamic content

slide-85
SLIDE 85

Hosting dynamic content

Unsolved issues:

slide-86
SLIDE 86

Hosting dynamic content

Unsolved issues: Distributing Static Content

slide-87
SLIDE 87

Hosting dynamic content

Unsolved issues: Distributing Static Content Downtime-less Updates

slide-88
SLIDE 88

Hosting dynamic content

Unsolved issues: Distributing Static Content Downtime-less Updates Monitoring

slide-89
SLIDE 89

Summary

Is it worth it?

slide-90
SLIDE 90

Summary

slide-91
SLIDE 91

Summary

slide-92
SLIDE 92

Summary

slide-93
SLIDE 93

Summary

slide-94
SLIDE 94

Summary

Probably not.

slide-95
SLIDE 95

Summary

Questions?

Many thanks to Bence Sántha, Dan Radenković, Gábor Vereb, János Angeli, Krisztián Papp for their inspiration and feedback.