rit 2011 ats

42
Apache Traffic Server Leif Hedstrom Principal Architect, Akamai Technologies [email protected] [email protected] @zwoop

Upload: leif-hedstrom

Post on 21-Jan-2015

3.456 views

Category:

Technology


2 download

DESCRIPTION

My Apache Traffic Server presentation for RIT++ in Russia, 2011.

TRANSCRIPT

Page 1: Rit 2011 ats

Apache Traffic Server

Leif Hedstrom

Principal Architect, Akamai Technologies

[email protected]

[email protected]

@zwoop

Page 2: Rit 2011 ats

History and introduction

Choosing a proxy

Setup

Page 3: Rit 2011 ats

Origins of the software

Page 4: Rit 2011 ats
Page 5: Rit 2011 ats

Why HTTP proxy / cache?Better performance

Save money (or other scarce resources)

Make operations less of a pain in the …

Easier web development

Better user experience

Lets look at the three common HTTP proxy configurations

Page 6: Rit 2011 ats

Forward Proxy

Page 7: Rit 2011 ats

Reverse Proxy

Page 8: Rit 2011 ats

Intercepting Proxy

Page 9: Rit 2011 ats

Plenty of FOSS Proxy Servers

Page 10: Rit 2011 ats

Choosing an intermediary

Page 11: Rit 2011 ats

SMP Scalability and performance

Page 12: Rit 2011 ats

Four Horseman of Bad Performance

Data copiesContext SwitchesMemory allocationLock contention

Avoid these!

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

Page 13: Rit 2011 ats

Traffic Server threads model

Page 14: Rit 2011 ats

Event Processing

Page 15: Rit 2011 ats

Disk cache: “Cyclone”

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

Page 16: Rit 2011 ats

Some interesting featuresRAM: Optional compression

Various compression levels supportedVery fast (virtually no overhead using the faster

algo)

RAM: Several cache eviction algorithmsCLFUS algorithm avoids the classic problem on an

LRU during “scans”And it’s not encumbered by any patents

Disk: Supports various block sizes (e.g. SSD)

Disk: Can be tuned for various object sizes

Disk: No file system overhead (RAW disks)

Page 17: Rit 2011 ats

Clustering

http://www.flickr.com/photos/vax-o-matic/2465358707/

Page 18: Rit 2011 ats

Traffic Server performance

400,000 requests / sec in a production CDN50 Gbps / second (95-percentile)

Many more request handled for HTML

100,000 requests / sec with small content out of RAM cache, on a single (lab) quad-core

3.6Gbps out of a single box, with larger content (4x GigE NIC bonded)

19Gbps on “localhost” using 2 CPUs (for large objects, 1MB in the test)

Page 19: Rit 2011 ats

HTTP/1.1 Features

Page 20: Rit 2011 ats

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 Y* N?

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 part Y Y Y Y Y

Cache Y N Y Y Y Y

ESI soon N N Y Y N

ICP Y 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

Page 21: Rit 2011 ats

Ease of use, extensible

Page 22: Rit 2011 ats

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

Page 23: Rit 2011 ats

Traffic Server making Ops easyTraffic Server will restart automatically if it crashes

Traffic Server will kill itself if it isn’t responding

Traffic Server can reload most configurations without server restarts

Adding plugins is a matter of dropping in the shared object, and restarting

Speaking of plugins, we have a very flexible plugin APIs for C/C++ developers (hopefully some scripted languages soon)

Stats and configurations are accessible via command line utilities

Page 24: Rit 2011 ats

Configurations

Page 25: Rit 2011 ats

plugin.config

records.config

volume.config

hosting.config

cache.config

update.config

ip_allow.config

storage.config

logs_xml.config

parent.config

remap.config

icp.config

Page 26: Rit 2011 ats

records.config storage.config

remap.config

Page 27: Rit 2011 ats

Critical in records.config

CONFIG proxy.config.exec_thread.autoconfig INT 1CONFIG proxy.config.exec_thread.autoconfig.scale FLOAT 2.0CONFIG proxy.config.exec_thread.limit INT 2

CONFIG proxy.config.http.server_port INT 8080

CONFIG proxy.config.http.cache.http INT 1CONFIG proxy.config.cache.ram_cache.size INT 512M

CONFIG proxy.config.reverse_proxy.enabled INT 1CONFIG proxy.config.url_remap.remap_required INT 1CONFIG proxy.config.url_remap.pristine_host_hdr INT 0

CONFIG proxy.config.ssl.enabled INT 0CONFIG proxy.config.ssl.server.cert.filename STRING server.pem

Page 28: Rit 2011 ats

CONFIG proxy.config.url_remap.remap_required INT 1

CONFIG proxy.config.reverse_proxy.enabled INT 1

Page 29: Rit 2011 ats

CONFIG proxy.config.url_remap.remap_required INT 0

CONFIG proxy.config.reverse_proxy.enabled INT 0

Page 30: Rit 2011 ats

Content on the Edge

Page 31: Rit 2011 ats

Traffic Server configurationCONFIG proxy.config.http.server_port INT 80CONFIG proxy.config.cache.ram_cache.size INT 4096MCONFIG proxy.config.url_remap.remap_required INT 1

map http://cdn.example.com/js http://js.example.comreverse_map http://js.example.com http://cdn.example.com/js

map http://cdn.example.com/css http://css.example.comreverse_map http://css.example.com http://cdn.exampe.com/css

map http://cdn.example.com/img http://img.example.comreverse_map http://img.example.com http://cdn.example.com/img

/dev/sd2

Page 32: Rit 2011 ats

Enemies of Web performance

Page 33: Rit 2011 ats

TCP 3-way Handshake

Page 34: Rit 2011 ats

Congestion avoidance

Page 35: Rit 2011 ats

TCP Connection Management

Page 36: Rit 2011 ats

ATS Connection mgmt configurationCONFIG proxy.config.http.server_port INT 80CONFIG proxy.config.cache.ram_cache.size INT 0CONFIG proxy.config.url_remap.remap_required INT 1

CONFIG proxy.config.http.send_http11_requests INT 1CONFIG proxy.config.http.share_server_sessions INT 1CONFIG proxy.config.http.server_max_connections INT 2000

CONFIG proxy.config.http.keep_alive_no_activity_timeout_out INT 60CONFIG proxy.config.http.transaction_no_activity_timeout_out INT 60

map http://www.example.com/ http://real-www.example.com

Page 37: Rit 2011 ats

Executive SummaryUnderstand your requirements

Evaluate available software, services and solutions

Apache Traffic Server is

Fast and SMP scalable

Battle hardened

HTTP/1.1 compliant

Easy to configure and manage

Extensible

Actively developed

And of course, it’s free!

Page 38: Rit 2011 ats

Content Delivery: Correctness first

Page 39: Rit 2011 ats
Page 40: Rit 2011 ats

The concurrency problem

Page 41: Rit 2011 ats

Solution 1: Multithreading

Page 42: Rit 2011 ats

Problems with multi-threading