usenix lisa 2011

50
An introduction to Apache Traffic Server Leif Hedstrom December 2011

Upload: leif-hedstrom

Post on 08-May-2015

2.290 views

Category:

Technology


0 download

DESCRIPTION

My deck from Usenix LISA 2011. Mostly the same as the ApacheCon presentation.

TRANSCRIPT

Page 1: Usenix lisa 2011

An introduction to Apache Traffic Server

Leif HedstromDecember 2011

Page 2: Usenix lisa 2011

Who am I?

• One of the drivers to open source Traffic Server (at Yahoo)

• Committer for Apache Traffic Server• VP of Apache Traffic Server PMC• ASF member• Go Daddy’s Principal Architect for Hosting

[email protected]@zwoop+zwoop

Page 3: Usenix lisa 2011

History of Traffic Server

Page 4: Usenix lisa 2011

Plenty of FOSS Proxy Servers

Page 5: Usenix lisa 2011

ATS HAproxy nginx

Squid Varnish mod_proxy

Worker Threads Y N N N Y Y

Multi-Process N Y Y N Y Y

Event-driven Y Y Y Y sometimes Y

Plugin APIs Y N Y part Y Y

Forward Proxy Y N N Y N Y

Reverse Proxy Y Y Y Y Y Y

Transp. Proxy Y Y N Y N N

Load Balancer weak Y Y Y Y Y

Persistent Cache Y N Y Y sorta Y

ESI Y N N Y kinda N

ICP soon N N Y N N

Keep-Alive Y N Y Y Y Y

SSL Y N Y Y N Y

Pipeline Y N Y Y N Y

Features

Page 6: Usenix lisa 2011

Mandatory useless benchmark …

Page 7: Usenix lisa 2011

Less useless benchmark …

Page 8: Usenix lisa 2011

Intermediaries - Forward Proxy

Page 9: Usenix lisa 2011

Intermediaries - Reverse Proxy

Page 10: Usenix lisa 2011

Intermediaries - Intercepting Proxy

Page 11: Usenix lisa 2011

Web Cash?

http://www.flickr.com/photos/amagill/3366720659/

Page 12: Usenix lisa 2011

No, Web Cache!

http://www.flickr.com/photos/dglazkov/287092560/

Page 13: Usenix lisa 2011

Common enemies of performance

3-Way handshake

Congestion control

DNS lookups

Page 14: Usenix lisa 2011

Common enemies of performance

3-Way handshake

Congestion control

DNS lookups

Page 15: Usenix lisa 2011

TCP 3-way Handshake

Page 16: Usenix lisa 2011

Common enemies of performance

3-Way handshake

Congestion control

DNS lookups

Page 17: Usenix lisa 2011

Congestion control

Page 18: Usenix lisa 2011

Common enemies of performance

3-Way handshake

Congestion control

DNS lookups

Page 19: Usenix lisa 2011

http://news.example.com/http://finance.example.com/http://groups.example.com/

Page 20: Usenix lisa 2011

http://news.example.com/http://finance.example.com/http://groups.example.com/

vshttp://www.example.com/newshttp://www.example.com/financehttp://www.example.com/groups

Page 21: Usenix lisa 2011

The concurrency problem

Page 22: Usenix lisa 2011

Solution 1: Multithreading

Page 23: Usenix lisa 2011

Problems with multi-threading

Page 24: Usenix lisa 2011

Solution 2: Event Processing

Page 25: Usenix lisa 2011

Problems with event processors

Page 26: Usenix lisa 2011

Traffic Server threads model

Page 27: Usenix lisa 2011

http://www.flickr.com/photos/stuartpilbrow/3345896050/

Page 28: Usenix lisa 2011

plugin.config

records.config

partition.config

hosting.config

cache.config

update.config

ip_allow.config

storage.config

logs_xml.config

parent.config

remap.config

icp.config

Page 29: Usenix lisa 2011

records.config

storage.config

remap.config

Page 30: Usenix lisa 2011

records.config for reverse proxyCONFIG proxy.config.http.server_port INT 80

CONFIG proxy.config.cache.ram_cache.size INT 1GCONFIG proxy.config.cache.ram_cache_cutoff INT 1MCONFIG proxy.config.reverse_proxy.enabled INT 1CONFIG proxy.config.url_remap.remap_required INT 1CONFIG proxy.config.url_remap.pristine_host_hdr INT 0CONFIG proxy.config.http.negative_caching_enabled INT 1CONFIG proxy.config.http.negative_caching_lifetime INT 120CONFIG proxy.config.http.cache.ignore_client_cc_max_age INT 1CONFIG proxy.config.http.normalize_ae_gzip INT 1

Page 31: Usenix lisa 2011

records.config for reverse proxyCONFIG proxy.config.http.server_port INT 80

CONFIG proxy.config.cache.ram_cache.size INT 1GCONFIG proxy.config.cache.ram_cache_cutoff INT 1MCONFIG proxy.config.reverse_proxy.enabled INT 1CONFIG proxy.config.url_remap.remap_required INT 1CONFIG proxy.config.url_remap.pristine_host_hdr INT 0CONFIG proxy.config.http.negative_caching_enabled INT 1CONFIG proxy.config.http.negative_caching_lifetime INT 120CONFIG proxy.config.http.cache.ignore_client_cc_max_age INT 1CONFIG proxy.config.http.normalize_ae_gzip INT 1

Page 32: Usenix lisa 2011

records.config for forward proxyCONFIG proxy.config.http.server_port INT 8080

CONFIG proxy.config.cache.ram_cache.size INT 1GCONFIG proxy.config.cache.ram_cache_cutoff INT 1MCONFIG proxy.config.reverse_proxy.enabled INT 0CONFIG proxy.config.url_remap.remap_required INT 0CONFIG proxy.config.url_remap.pristine_host_hdr INT 0CONFIG proxy.config.http.negative_caching_enabled INT 1CONFIG proxy.config.http.negative_caching_lifetime INT 120CONFIG proxy.config.http.cache.ignore_client_cc_max_age INT 1CONFIG proxy.config.http.normalize_ae_gzip INT 1

Page 33: Usenix lisa 2011

remap.config examples

map http://www.example.com/css http://css.example.commap http://www.example.com http://real.example.comreverse_map http://real.example.com http://www.example.com

redirect http://example.com http://www.example.com

regex_map http://(.*)\.example.com http://o.example.com/$1

map / http://kitchensink.example.com

Page 34: Usenix lisa 2011

remap.config examples

map http://www.example.com/css http://css.example.commap http://www.example.com http://real.example.comreverse_map http://real.example.com http://www.example.com

redirect http://example.com http://www.example.com

regex_map http://(.*)\.example.com http://o.example.com/$1

map / http://kitchensink.example.com

Page 35: Usenix lisa 2011

remap.config examples

map http://www.example.com/css http://css.example.commap http://www.example.com http://real.example.comreverse_map http://real.example.com http://www.example.com

redirect http://example.com http://www.example.com

regex_map http://(.*)\.example.com http://o.example.com/$1

map / http://kitchensink.example.com

Page 36: Usenix lisa 2011

remap.config examples

map http://www.example.com/css http://css.example.commap http://www.example.com http://real.example.comreverse_map http://r.example.com http://www.example.com

redirect http://example.com http://www.example.com

regex_map http://(.*)\.example.com http://o.example.com/$1

map / http://kitchensink.example.com

Page 37: Usenix lisa 2011

remap.config examples

map http://www.example.com/css http://css.example.commap http://www.example.com http://real.example.comreverse_map http://r.example.com http://www.example.com

redirect http://example.com http://www.example.com

regex_map http://(.*)\.example.com http://o.example.com/$1

map / http://kitchensink.example.com

Page 38: Usenix lisa 2011

Some interesting features

RAM: Optional compression–Various compression levels supported–Very fast (virtually no overhead using the faster algo)

RAM: Several cache eviction algorithms–CLFUS algorithm avoids the classic problem on an LRU during “scans”

Disk: Supports various block sizes (SSD)Disk: Can be tuned for various object sizesDisk: No file system overhead (RAW disks)

Page 39: Usenix lisa 2011

Future directions

Release early, and oftenFull IPv6 supportNPN, SNI and other SSL improvementsImproved memory management, support debug features in e.g. jemalloc and tcmalloc

Optimizations for SSD (“stacked” caches)

More focus on plugins, and plugin APIs–Hopefully a real load balancer plugin!

Page 40: Usenix lisa 2011

Was this a huge waste of time, or?

http://www.flickr.com/photos/simpologist/16734948/

Page 41: Usenix lisa 2011

41

A versatile tool

http://www.flickr.com/photos/airosan/2232394342/

Page 42: Usenix lisa 2011

42

Yes, it’s fast, ridiculously fast

Page 43: Usenix lisa 2011

43

A vibrant community!

Page 44: Usenix lisa 2011

Artur Bergman tells us if we’re not using SSD drives,

we’re wasting our lives.

Page 45: Usenix lisa 2011

Artur Bergman tells us if we’re not using SSD drives,

we’re wasting our lives.

I’d say, if you are not using a caching proxy, you’re

wasting your SSDs!

Page 46: Usenix lisa 2011

46

Page 47: Usenix lisa 2011

47

Contact me

Page 48: Usenix lisa 2011

records.config for reverse proxyCONFIG proxy.config.http.server_port INT 80

CONFIG proxy.config.cache.ram_cache.size INT 1GCONFIG proxy.config.cache.ram_cache_cutoff INT 1MCONFIG proxy.config.reverse_proxy.enabled INT 1CONFIG proxy.config.url_remap.remap_required INT 1CONFIG proxy.config.url_remap.pristine_host_hdr INT 0CONFIG proxy.config.http.negative_caching_enabled INT 1CONFIG proxy.config.http.negative_caching_lifetime INT 120CONFIG proxy.config.http.cache.ignore_client_cc_max_age INT 1CONFIG proxy.config.http.normalize_ae_gzip INT 1

Page 49: Usenix lisa 2011

Four Horseman of Bad Performance

–Data copies–Context Switches–Memory allocation–Lock contention

–Avoid these!

http://pl.atyp.us/content/tech/servers.html

Page 50: Usenix lisa 2011

Disk cache: “Cyclone”

http://www.flickr.com/photos/gsfc/4461843139/