Out and About with Apache Traffic Server

47
Out and About with Apache Traffic Server Leif Hedstrom November 2011

description

Out and About with Apache Traffic Server. Leif Hedstrom November 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] - PowerPoint PPT Presentation

Transcript of Out and About with Apache Traffic Server

Page 1: Out and About with Apache Traffic Server

Out and About with Apache Traffic Server

Leif HedstromNovember 2011

Page 2: Out and About with Apache Traffic Server

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: Out and About with Apache Traffic Server

History of Traffic Server

Page 4: Out and About with Apache Traffic Server

Plenty of FOSS Proxy Servers

Page 5: Out and About with Apache Traffic Server

ATS HAproxy nginx

Squid Varnish mod_proxy

Worker Threads Y N N N Y Y

Multi-Process N Y Y N Y YEvent-driven Y Y Y Y sometimes YPlugin APIs Y N Y part Y YForward Proxy Y N N Y N YReverse Proxy Y Y Y Y Y YTransp. Proxy Y Y N Y N NLoad Balancer weak Y Y Y Y YPersistent Cache Y N Y Y sorta YESI Y N N Y kinda NICP Y N N Y N NKeep-Alive Y N Y Y Y YSSL Y N Y Y N YPipeline Y N Y Y N Y

Features

Page 6: Out and About with Apache Traffic Server

Mandatory useless benchmark …

Page 7: Out and About with Apache Traffic Server

Less useless benchmark …

Page 8: Out and About with Apache Traffic Server

Intermediaries - Forward Proxy

Page 9: Out and About with Apache Traffic Server

Intermediaries - Reverse Proxy

Page 10: Out and About with Apache Traffic Server

Intermediaries - Intercepting Proxy

Page 11: Out and About with Apache Traffic Server

Common enemies of performance

3-Way handshake

Congestion control

DNS lookups

Page 12: Out and About with Apache Traffic Server

Common enemies of performance

3-Way handshake

Congestion control

DNS lookups

Page 13: Out and About with Apache Traffic Server

TCP 3-way Handshake

Page 14: Out and About with Apache Traffic Server

Common enemies of performance

3-Way handshake

Congestion control

DNS lookups

Page 15: Out and About with Apache Traffic Server

Congestion control

Page 16: Out and About with Apache Traffic Server

Common enemies of performance

3-Way handshake

Congestion control

DNS lookups

Page 17: Out and About with Apache Traffic Server

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

Page 18: Out and About with Apache Traffic Server

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 19: Out and About with Apache Traffic Server

The concurrency problem

Page 20: Out and About with Apache Traffic Server

Solution 1: Multithreading

Page 21: Out and About with Apache Traffic Server

Problems with multi-threading

Page 22: Out and About with Apache Traffic Server

Solution 2: Event Processing

Page 23: Out and About with Apache Traffic Server

Problems with event processors

Page 24: Out and About with Apache Traffic Server

Traffic Server threads model

Page 25: Out and About with Apache Traffic Server

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

Page 26: Out and About with Apache Traffic Server

plugin.configrecords.configpartition.confighosting.configcache.configupdate.config

ip_allow.configstorage.configlogs_xml.configparent.configremap.configicp.config

Page 27: Out and About with Apache Traffic Server

records.configstorage.config

remap.config

Page 28: Out and About with Apache Traffic Server

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 29: Out and About with Apache Traffic Server

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 30: Out and About with Apache Traffic Server

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 31: Out and About with Apache Traffic Server

remap.config examplesmap 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 32: Out and About with Apache Traffic Server

remap.config examplesmap 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 33: Out and About with Apache Traffic Server

remap.config examplesmap 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: Out and About with Apache Traffic Server

remap.config examplesmap 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 35: Out and About with Apache Traffic Server

remap.config examplesmap 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 36: Out and About with Apache Traffic Server

Some interesting featuresRAM: 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”▫ And it’s not encumbered by any patents

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

Page 37: Out and About with Apache Traffic Server

Future directionsRelease 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 38: Out and About with Apache Traffic Server

Was this a huge waste of time, or?

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

Page 39: Out and About with Apache Traffic Server

39

A versatile tool

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

Page 40: Out and About with Apache Traffic Server

40

Yes, it’s fast, ridiculously fast

Page 41: Out and About with Apache Traffic Server

41

A vibrant community!

Page 42: Out and About with Apache Traffic Server

42

“If you are not using SSDs, you are wasting your life”

Artur Bergman

Page 43: Out and About with Apache Traffic Server

43

“If you are not using SSDs, you are wasting your life”

Artur Bergman

“If you are not using a caching proxy server, you are wasting your SSDs”

me

Page 44: Out and About with Apache Traffic Server

44

Page 45: Out and About with Apache Traffic Server

Four Horseman of Bad Performance–Data copies–Context Switches–Memory allocation–Lock contention

–Avoid these!

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

Page 46: Out and About with Apache Traffic Server

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 47: Out and About with Apache Traffic Server

Disk cache: “Cyclone”

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