rit 2011 ats
DESCRIPTION
My Apache Traffic Server presentation for RIT++ in Russia, 2011.TRANSCRIPT
Apache Traffic Server
Leif Hedstrom
Principal Architect, Akamai Technologies
@zwoop
History and introduction
Choosing a proxy
Setup
Origins of the software
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
Forward Proxy
Reverse Proxy
Intercepting Proxy
Plenty of FOSS Proxy Servers
Choosing an intermediary
SMP Scalability and performance
Four Horseman of Bad Performance
Data copiesContext SwitchesMemory allocationLock contention
Avoid these!
http://pl.atyp.us/content/tech/servers.html
Traffic Server threads model
Event Processing
Disk cache: “Cyclone”
http://www.flickr.com/photos/gsfc/4461843139/
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)
Clustering
http://www.flickr.com/photos/vax-o-matic/2465358707/
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)
HTTP/1.1 Features
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
Ease of use, extensible
http://www.flickr.com/photos/stuartpilbrow/3345896050/
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
Configurations
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
records.config storage.config
remap.config
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
CONFIG proxy.config.url_remap.remap_required INT 1
CONFIG proxy.config.reverse_proxy.enabled INT 1
CONFIG proxy.config.url_remap.remap_required INT 0
CONFIG proxy.config.reverse_proxy.enabled INT 0
Content on the Edge
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
Enemies of Web performance
TCP 3-way Handshake
Congestion avoidance
TCP Connection Management
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
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!
Content Delivery: Correctness first
The concurrency problem
Solution 1: Multithreading
Problems with multi-threading