why care about a cdn?

103
1 Workshops and Conference: May 9-11, 2016 2016 Stockholm Let us know what you think! Click “Engage” to rate a session. If you rate 12 sessions you get a cool GOTO prize!

Upload: elaine-greenberg

Post on 19-Jan-2017

83 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Why care about a CDN?

1

Workshops and Conference: May 9-11, 2016

2016

Stockholm

Let us know

what you think!

Click “Engage”to rate a session.If you rate 12 sessionsyou get a cool GOTO prize!

Page 2: Why care about a CDN?

Why the fuck care about a CDN? Artur Bergman, CEO/Founder, Fastly

Page 3: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• CEO && Founder • Wikia CTO• SixApart/LiveJournal• Velocity conference• Opensource developer• From Stockholm!

• @crucially

Artur Bergman

Page 4: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

2008 @ Wikia

Page 5: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• 5 years old• San Francisco HQ• London, Tokyo, New York, Denver• 270 employees

Fastly

Page 6: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

HTTP? use a CDN

Page 7: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

CDN??

Page 8: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Page 9: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

"Any sufficiently advanced technology is indistinguishable from magic." -- Arthur C Clarke

Page 10: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

"Any sufficiently advanced technology is indistinguishable from magic." -- Arthur C Clarke

"Any technology that is indistinguishable from magic for you is one you don't understand"

-- Artur Bergman

Page 11: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

No Magic

Page 12: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• nginx• haproxy• squid• varnish• apache mod_proxy• apache traffic server• ELB• F5 (terrible)

Reverse proxy

Page 13: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• offloads TLS• load balances• long running connections• rule based dispatch

Reverse proxy

Client Reverse proxy

App server

App server

App server

Page 14: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

CDN

Client

Reverse proxy

App server

App server

App server

Reverse proxy

Reverse proxy

Reverse proxy

Reverse proxy

Reverse proxy

Page 15: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client

App server

Page 16: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• offloads TLS• load balances• long running connections• rule based dispatch• cache (pass through)

Caching reverse proxy

Client Reverse proxy

App server

App server

App serverBig awesome cache

Page 17: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client

App server

Page 18: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client

App server

Page 19: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• 2x 2697v4 18+18 cores • 768 GB RAM (12 TB)• 48 TB of SSD (786 TB)• 40 Gbit/ethernet (640 Gbit)

• 16 per rack

Big awesome cache

Love the future

Page 20: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

User

DNS

CDN Pop

Origin

Page 21: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

User

DNS

CDN Pop

Origin

Page 22: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

User

DNS

CDN Pop

Origin

Page 23: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

User

DNS

CDN Pop

Origin

Cache miss

Page 24: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

User

DNS

CDN Pop

Origin

Cache miss

Page 25: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

User

DNS

CDN Pop

Origin

Cache miss

Page 26: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

User

DNS

CDN Pop

Origin

Cache hit

Page 27: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Like memcache/redis• Except

• Outside your datacenter• Passthrough• Close to user

Inside-out cache

Page 28: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• My content is• Private• Unique• Un-cacheable• Special snow flake

But but but

Page 29: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• My content is• Private• Unique• Un-cacheable• Special snow flake

But but butYeah right!

Don’t worry

Page 30: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Why?

Page 31: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Performance Security

Availability

Page 32: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Page 33: Why care about a CDN?

© 2015 All rights reservedThe Future of Content DeliveryThe Future of Content Delivery

Page 34: Why care about a CDN?

© 2015 All rights reservedThe Future of Content DeliveryThe Future of Content Delivery

Latency is a measure of time delay experienced in a system, the precise definition of which depends on the system and the time being measured. In communications, the lower limit of latency is determined by the medium being used for communications.

AKA waiting for shit.

Latency is the little-death that bring total obliteration

Page 35: Why care about a CDN?

© 2015 All rights reservedThe Future of Content DeliveryThe Future of Content Delivery

299 792 458 m / s

Page 36: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Fastly

Cache it locally

Page 37: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Performance Security

Availability

Page 38: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

?????

Page 39: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

160 Gbps DDOS

Page 40: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Layer 3/4 DDOS protection• UDP/ICMP/SYN

• Layer 7 DDOS protection• Inspect http traffic• Block/Redirect

• Instant visibility in edge traffic• Edge firewall rules

Security

Page 41: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Page 42: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Page 43: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYNfromChina!

Page 44: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Outsource your emotional burden• More capacity than attacker is all that matters• Distributed capacity• Largest seen

• > 200 million packets per second• > 400 Gbps

• If it is cached, its easy to serve very high request rate

A word on DDOS

Page 45: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Performance Security

Availability

Page 46: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

DDOS?

Page 47: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Prince died :(

Page 48: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Prince died :( 140k rps

16k rps

Page 49: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Prince died :( 140k rps

16k rps

autoscale lol!

Page 50: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• CDN handles entire spike• news sites• download sites• cache it and it doesn’t matter

• stale-if-error• stale-while-revalidate

No origin load

Page 51: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Fastly• Telia• NTT• Cogent• Comcast• Level3• + Peering

CDNs have many ISPs

Page 52: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• “Faster than the internet”• “Route around problems”

• Continuously choose the best path • Between customer and us• Between us and origin

CDNs have many ISPs

Page 53: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Beat speed of light• Move data close to the user• Personalize the data close to the user• Defend against attacks close to the attacker

• DDOS is ever growing thread

• Only way to expand into new markets without significant capital or operational outlay and risk

Do things at the edge

Page 54: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

you use all the time

Page 55: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Python Software Foundation• NPM• Ruby Core• Ruby Gems• Metacpan• MIT Scratch• kernel.org

opensource

Page 56: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Hashicorp• New Relic• Maven• Github• Package cloud

• Check your build systems firewall log :)

developer tools

Page 57: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

why do you care? about future of CDN

Page 58: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• My content is• Private• Unique• Un-cacheable• Special snow flake

But but butYeah right!

Don’t worry

Page 59: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Dynamic Site Acceleration • Not just magic lies

• TCP• HTTP• TLS

Page 60: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 100 ms

Page 61: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 100 msSYNACK 100 ms

Page 62: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 100 msSYNACK 100 msTLS HS 100 ms

Page 63: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 100 msSYNACK 100 msTLS HS 100 msTLS HS 100 ms

Page 64: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 100 msSYNACK 100 msTLS HS 100 msTLS HS 100 msRequest 100 ms

Page 65: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 100 msSYNACK 100 msTLS HS 100 msTLS HS 100 msRequest 100 msResponse 100 ms

Page 66: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 100 msSYNACK 100 msTLS HS 100 msTLS HS 100 msRequest 100 msResponse 100 ms

Total 600 ms to slow start

Page 67: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 20 msSYNACK 20 msTLS HS 20 msTLS HS 20 msRequest 20 msResponse 20 ms

Page 68: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 20 msSYNACK 20 msTLS HS 20 msTLS HS 20 msRequest 20 msResponse 20 ms

Request 100 msResponse 100 ms

Page 69: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

SYN 20 msSYNACK 20 msTLS HS 20 msTLS HS 20 msRequest 20 msResponse 20 ms

Request 100 msResponse 100 ms

Total 320 ms and no slow start

Page 70: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Location based• Time based• Changes based on user or machine input

• Separate public and private APIs• Reuse on mobile and progressive web apps

Usually cacheable

Page 71: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Instant purge (cache-invalidation)• Instant configuration• Instant stats• Instant logs• Edge dictionaries

• Very large edge caches == higher hit rate

Key developer friendly features

Page 72: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

curl -X PURGE https://www.fastly.com/

• 150 ms to purge world wide• dramatically changes what you can cache if you can invalidate

Instant purge

Page 73: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Instant purge• News articles• Inventory data• Sport scores• Wikis• Blogs• API metadata

Page 74: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Surrogate-Key invalidationSurrogate-Key: tag1 tag2 tag3

• Purge by tag• All objects matching tag gets wipe

• let us handle the cache dependencies (secondary index)• track collections by objects that went into them

Page 75: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Instant config• Varnish VCL• 100% API accesible• Deploy around the world in 5 seconds

• Load balancing rules• IP blocks• Custom edge logic

Page 76: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Instant logfiles• Streaming log files (1-2 seconds delay)

• syslog• S3/GCS• Fluentd• Splunk• elk

• We don’t store any logs on a permanent basis

Page 77: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Instant stats• Realtime stream• Hook into your alerting for instant notice on bad deploys

Page 78: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Page 79: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Page 80: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Programmatic edge• Load balance between cloud providers

• (get rid of your load balancers)• Route to different services based on any attribute in the

request• Handle failover• Edge authentication using edge dictionaries (key-value store)• Offload offload offload

Page 81: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Page 82: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Page 83: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Page 84: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Segmentation Service

Authentication headers provided

Page 85: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Segmentation Service

Page 86: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Segmentation Service

API service

Authentication + Segmentation headers provided

Page 87: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Segmentation Service

API service

Page 88: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Segmentation Service

API service

Page 89: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Segmentation Service

API service

Cacheable

Cacheable

Page 90: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Segmentation Service

API service

Second request

Page 91: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Client Fastly

Authentication service

Segmentation Service

API service

Revoke access Send surrogate-key purge for user

Page 92: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

HOW??

Page 93: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

1. The network is reliable.2. Latency is zero.3. Bandwidth is infinite.4. The network is secure.5. Topology doesn't change.6. There is one administrator.7. Transport cost is zero.8. The network is homogeneous.

Fallacies of distributed systems

Page 94: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

1. The network is reliable.2. Latency is zero.3. Bandwidth is infinite.4. The network is secure.5. Topology doesn't change.6. There is one administrator.7. Transport cost is zero.8. The network is homogeneous.

At Fastly

Page 95: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Very little off the shelf software works for us• Most software written for 2-3 nearby datacenter• No virtualization

• Most things not written for our scale (up)

• Apparently few people continuously push 20 Gbps/server

Technologies

Page 96: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• haproxy (TLS termination)• h2o (http2)• varnish (caching)• bird (bgp daemon)• knot (dns daemon)• ubuntu linux

• C / Go / Ruby mix

Technologies

Page 97: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Hate specific built hardware• Routers• Load balancers• Firewalls

• Arista / Cumulus • Linux on a switch with an API• BGP on the caches themselves• Treat it all as code

Networking

Page 98: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Purging based on bimodal multicast• Other services rely on purging

• Example config push => purge => fetch of new config

• Need to be extremely resilient in face of the internet

Coordination Technologies

Page 99: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Physical hardware for forwarding plane

• Google Bigtable/Bigquery for analytics• AWS for control plane• Datadog for monitoring

Providers

Page 100: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

• Varnish on AWS around the world• Route53 to send to closest user

• You have a simple CDN!

Just! build your own

Page 101: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

EITHER WAY USE ONE

Page 102: Why care about a CDN?

© 2016 All rights reservedGoto Stockholm 2016

Thank you!

Page 103: Why care about a CDN?

=

103

Workshops and Conference: May 9-11, 2016

2016

Stockholm

Please remember torate this session

...Thank You!