SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
Replacing Squid with ATS
ApacheCon 2015, Austin TX
Kit Chan (kichan@yahoo-inc.com)
Chiru Jaladi (chiru@yahoo-inc.com)
Before We Begin
This Talk
1) Not about how to choose a proxy server
2) Does not cover all Squid Use Cases
Agenda
History
Reasons
Details
Use Cases
Learnings
Squid in Yahoo
The year is 2006
● Dawn of SOA/Web Service in Yahoo!
● Squid improves performance through
caching
○ Other benefits - routing & ACL
Squid in Yahoo
● Mark Nottingham was the
Champion of Squid in
Yahoo!
● Collapsed Forwarding added
to Squid 2.6
● SWR/SIE added to Squid
2.7
https://www.mnot.net/personal/mn.jpg
Squid in Yahoo
● Squid 3.0 - Rewrite of Squid in C++
○ ESI
○ ICAP
● Squid 3.2 - multiple worker support
● Backward Incompatibilities
○ No Collapse Forwarding till 3.5+
○ No SIE till 3.2+
○ Still no SWR
○ BLOCKERS!!!
ATS in Yahoo
Inktomi
● TS 2.0 - 1998, 3.0 - 1999, 4.0 - 2000
● Customers - AOL, @Home
● e.g. - Transcoding images to smaller sizes
for AOL dialup users
ATS in Yahoo
YTS
● Inktomi Acquired by Yahoo - late 2002 /
early 2003
● Renamed to YTS - Efforts resumed around
late 2005
● By Feb 2010, served 30 billion objects, 400
terabytes a day for Yahoo
ATS in Yahoo
ASF
● Preparation - 700K lines of code change, 9
Months
● Apache Incubator in July 2009
● TLP in April 21, 2010
Cost of maintenance
Unresolved Blockers to Upgrade
Performance Limitation in 2.7
Why?
http://www.jillianney.com/wp-content/uploads/2012/01/why.jpg
Details - Configuration
Squid - squid.conf
http_port 3128 vhost http11
cache_mem 10 GB
negative_ttl 15 seconds
connect_timeout 15 seconds
forward_timeout 10 seconds
read_timeout 15 seconds
pconn_timeout 70 seconds
persistent_request_timeout 65 seconds
Details - Configuration
ATS - records.config
CONFIG proxy.config.http.server_ports STRING 3128
# ATS requires disk cache to be set up through storage.config as well
CONFIG proxy.config.cache.ram_cache.size INT 2147483648
CONFIG proxy.config.http.negative_caching_enabled INT 1
CONFIG proxy.config.http.negative_caching_lifetime INT 15
Details - Configuration
ATS - records.config (cont)
CONFIG proxy.config.http.connect_attempts_timeout INT 15
CONFIG proxy.config.http.keep_alive_no_activity_timeout_in INT 15
CONFIG proxy.config.http.keep_alive_no_activity_timeout_out INT 30
CONFIG proxy.config.http.transaction_no_activity_timeout_in INT 30
CONFIG proxy.config.http.transaction_no_activity_timeout_out INT 30
CONFIG proxy.config.http.transaction_active_timeout_in INT 30
CONFIG proxy.config.http.transaction_active_timeout_out INT 30
CONFIG proxy.config.http.accept_no_activity_timeout INT 12
Details - Log
Squid - squid.conf
logfile_rotate 240
logformat ysquid_extended %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un
%Sh/%<A %mt
access_log daemon:/usr/local/var/logs/squid/access.log ysquid_extended
cache_log /usr/local/var/logs/squid/cache.log
debug_options ALL,1
Details - Log
ATS - records.config
CONFIG proxy.config.log.logging_enabled INT 3
CONFIG proxy.config.log.logfile_dir STRING logs/trafficserver
CONFIG proxy.config.log.custom_logs_enabled INT 1
CONFIG proxy.config.log.rolling_enabled INT 1
CONFIG proxy.config.log.rolling_interval_sec INT 3600
CONFIG proxy.config.log.rolling_offset_hr INT 0
CONFIG proxy.config.log.rolling_size_mb INT 6000
CONFIG proxy.config.log.auto_delete_rolled_files INT 1
CONFIG proxy.config.diags.debug.enabled INT 0
CONFIG proxy.config.diags.debug.tags STRING http.*|dns.*
Details - Log
ATS - logs_xml.config
<LogFormat>
<Name = "ats_generic_config"/>
<Format = "ts=%<cqtq> url=%<cqu> host=%<{Host}cqh> duration=%<ttms>
status=%<pssc> cache=%<crc> ostatus=%<sssc> uurl=%<cquuc> conn=%
<cfsc>/%<pfsc> ip=%<chi> cqhm=%<cqhm> pscl=%<pscl> age=%<{Age}ssh> "/>
</LogFormat>
<LogObject>
<Format = "ats_generic_config"/>
<Filename = "mon"/>
<Mode = "ascii"/>
</LogObject>
Details - Metrics
● e.g. cache hit ratio, avg latency, # of reqs
● Squid
○ squidclient mgr:info
○ squidclient mgr:counters
● ATS
○ traffic_line -r
○ https://docs.trafficserver.apache.
org/en/latest/reference/commands/traffic_line.en.
html
Details - SWR/SIE (RFC 5861)
Details - Collapsed Forwarding
● Multiple client requests as one server
request
● Prevent “Thundering Herds” problem
Details - SWR/SIE/Collapsed
Forwarding
Squid - squid.conf
collapse_forwarding on
max_stale 8 hours
refresh_pattern . 5 0 480 stale-while-revalidate=15 ignore-reload override-lastmod
Details - SWR/SIE/Collapsed
Forwarding
ATS
● Collapse Forwarding - check out wiki page
● experimental stale_while_revalidate plugin
● TS-1463
○ once the fetch of the object is initiated, the original
object is not allowed to be served from cache
● TS-1996
○ Deprecated API - TSHttpTxnNewCacheLookupDo()
Details - Fixing the Plugin (SWR)
ATS Origin
1. client req in swr
2. serve stale
3. async req (?swr=1)
4. valid async resp
5. post async content to
original URL to update
the cache
Details - Fixing the Plugin (SIE)
ATS Origin
1. client req in sie
4. intercept return with async resp
2. async req (?swr=1)
3. valid async resp
ATS Origin
1. client req in sie
4. serve stale
2. async req (?swr=1)
3. 5xx for async resp
Details - ACL control (Squid)
Based on src, dst, time, regex, schema etc.
Squid.conf
# Example 1 (give access only to certain clients)
acl myclients src 172.16.5.0/24
http_access allow myclients
http_access deny all
# Example 2 (disable cache for responses from a domain)
acl someserver dstdomain .someserver.com
cache deny someserver
Details - ACL control (ATS)
remap.config
ip_allow.config (Similar to Example 1)
cache.config (Similar to Example 2)
map http://www.x.com/ http://server.hoster.com/
src_ip=123.12.3.000-123.12.3.123 action=ip_allow
dest_domain=mydomain.com action=never-cache
Details - Extensibility (Squid)
● Helper program for ACL, URL Manipulation,
DNS lookup
○ Rigid and limited
○ e.g. controlling ACL in squid.conf
external_acl_type yca_helper cache=5000 concurrency=1000 children=2 grace=1
%SRC %{App-Auth} %DATA /usr/local/libexec/squid/yca_acl.pl
acl yca external yca_helper
acl yca_appids ext_user REQUIRED
deny_info YCA_AUTH_REQ yca
deny_info YCA_WRONG_APPID yca_appids
Details - Extensibility (ATS)
ATS - Plugins (C, C++, Lua)
https://docs.trafficserver.apache.org/en/latest/_images/transact_hook75.jpg
Type
1. sibling (ICP*)
2. parent
Details - Peering (Squid)
Parent Selection method
1. carp*, round-robin,
user-hashing etc.
2. originserver (reverse
proxy)
ICP: Internet Cache Protocol
Carp: Cache Array Protocol
Details - Peering (Squid)
# Example 1 (ICP)
cache_peer 172.16.1.123 sibling 3129 5500 weight=1
# Example 2 (Reverse Proxy mode)
cache_peer localhost parent 8080 0 originserver no-query no-digest
# Example 3 (Carp routing)
cache_peer server1.com parent 3128 0 carp no-query no-digest monitortimeout=15
monitorinterval=60 monitorurl=/status.html name=andy
cache_peer server2.com parent 3128 0 carp no-query no-digest monitortimeout=15
monitorinterval=60 monitorurl=/status.html name=mandy
Squid.conf
Details - Peering (ATS)
Type
1. Sibling (ICP*)
2. Parent
* Our Squid ICP peering use case (Example 1) is not needed when we deploy with
hierarchical caching + consistent hashing
Details - Peering (ATS)
remap.config (Similar to Squid Example 2)
parent.config (Similar to Squid Example 3)
dest_domain=. method=get parent="p1.x.com:8080; p2.y.com:8080"
round_robin=true
dest_domain=. method=get parent="p1.x.com:8080|1.0; p2.y.com:8080|2.0"
round_robin=consistent_hash
map http://www.x.com/ http://server1.com/
Use Cases - Forward Proxy
https://docs.trafficserver.apache.org/en/latest/_images/cache_miss.jpg
squid.conf
Use Cases - Forward Proxy (Squid)
http_port 80 vhost
# protecting proxy by only allowing clients to connect to port 80
acl Safe_ports port 80
http_access deny !Safe_ports
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
http_access allow localhost
http_access allow localnet
Use Cases - Forward Proxy (ATS)
records.config
remap.config
CONFIG proxy.config.reverse_proxy.enabled INT 0
CONFIG proxy.config.http.server_ports 80
# for security purpose require remap (Optional)
CONFIG proxy.config.url_remap.remap_required INT 1
# map all origin servers for which we need forward proxy
map http://server1.com/ http://server1.com/
Use Cases - Reverse Proxy
https://docs.trafficserver.apache.org/en/latest/_images/revproxy.jpg
Use Cases - Reverse Proxy (Squid)
Squid.conf
http_port 80 accel defaultsite=server1.com
# allow access to origin server
cache_peer endpoint.com parent 80 0 no-query originserver name=myAccess
# access controls
acl our_sites dstdomain server1.com server2.com
http_access allow our_sites
cache_peer_access myAccess allow our_sites
cache_peer_access myAccel deny all
Use Cases - Reverse Proxy (ATS)
1. records.config
2. remap.config
CONFIG proxy.config.http.server_ports 80
CONFIG proxy.config.reverse_proxy.enabled INT 1
CONFIG proxy.config.url_remap.remap_required INT 1
map http://www.server1.com/ http://www.endpoint.com/
map http://www.server2.com/ http://www.endpoint.com/
Learnings
● Managing an open source project
○ Backward compatibility
● Squid configuration
○ config can be confusing when they exist in same file
○ allow/deny pattern confusing
● ATS configuration
○ ATS configuration complicated/disjoint, but clean
○ ATS plugins more flexible
● Improved Performance
○ CPU/Latency/RPS
● Migration
○ (Automated) Testing is important
Automated Testing
● TSQA
○ integration/functional testing framework
○ Not just for ATS, can be used for other proxy server
(e.g. squid)
○ To be used heavily during migration
Q&A
Reference
Choosing a Proxy Server -
https://www.slideshare.net/bryan_call/choosing-a-proxy-server-apachecon-2014
Squid-2.6 - http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE24-RELEASENOTES.
html#s1
Squid-2.7 - http://www.squid-cache.org/Versions/v2/2.7/squid-2.7.STABLE9-RELEASENOTES.
html#s1
Squid-3.0 - http://www.squid-cache.org/Versions/v3/3.0/RELEASENOTES.html#s4
Squid-3.2 - http://www.squid-cache.org/Versions/v3/3.2/RELEASENOTES.html#s2
Squid-3.5 - http://www.squid-cache.org/Versions/v3/3.5/squid-3.5.3-RELEASENOTES.html#s2
SIE Squid Bug - http://bugs.squid-cache.org/show_bug.cgi?id=2255
SWR Squid Bug - http://bugs.squid-cache.org/show_bug.cgi?id=2256
Reference (Cont)
ATS records.config - https://docs.trafficserver.apache.org/en/latest/reference/configuration/records.
config.en.html
ATS logs_xml.config - https://docs.trafficserver.apache.org/en/latest/reference/configuration/logs_xml.
config.en.html
ATS traffic_line - https://docs.trafficserver.apache.org/en/latest/reference/commands/traffic_line.en.
html
ATS Collapsed Fowarding wiki - https://cwiki.apache.org/confluence/display/TS/Collapsed+Forwarding
ATS stale_while_revalidate plugin - https://docs.trafficserver.apache.
org/en/latest/reference/plugins/stale_while_revalidate.en.html
ATS Plugin developer guide - https://docs.trafficserver.apache.org/en/latest/sdk/index.en.html

Weitere ähnliche Inhalte

Was ist angesagt?

Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014bryan_call
 
Load Balancing with Nginx
Load Balancing with NginxLoad Balancing with Nginx
Load Balancing with NginxMarian Marinov
 
Load Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesLoad Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesSeveralnines
 
How To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - SlidesHow To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - SlidesSeveralnines
 
Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Harish S
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by StepKim Stefan Lindholm
 
Using HAProxy to Scale MySQL
Using HAProxy to Scale MySQLUsing HAProxy to Scale MySQL
Using HAProxy to Scale MySQLBill Sickles
 
Web Server Load Balancer
Web Server Load BalancerWeb Server Load Balancer
Web Server Load BalancerMobME Technical
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpSander Temme
 
HAProxy scale out using open source
HAProxy scale out using open sourceHAProxy scale out using open source
HAProxy scale out using open sourceIngo Walz
 
Introduction to Haproxy
Introduction to HaproxyIntroduction to Haproxy
Introduction to HaproxyShaopeng He
 
NGINX: High Performance Load Balancing
NGINX: High Performance Load BalancingNGINX: High Performance Load Balancing
NGINX: High Performance Load BalancingNGINX, Inc.
 
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyNginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyAmit Aggarwal
 
NginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniquesNginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniquesClaudio Borges
 
Content Caching with NGINX and NGINX Plus
Content Caching with NGINX and NGINX PlusContent Caching with NGINX and NGINX Plus
Content Caching with NGINX and NGINX PlusKevin Jones
 
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기NAVER D2
 

Was ist angesagt? (18)

Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014
 
Load Balancing with Nginx
Load Balancing with NginxLoad Balancing with Nginx
Load Balancing with Nginx
 
Load Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesLoad Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - Slides
 
How To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - SlidesHow To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - Slides
 
Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Nginx - Tips and Tricks.
Nginx - Tips and Tricks.
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by Step
 
How to monitor NGINX
How to monitor NGINXHow to monitor NGINX
How to monitor NGINX
 
Using HAProxy to Scale MySQL
Using HAProxy to Scale MySQLUsing HAProxy to Scale MySQL
Using HAProxy to Scale MySQL
 
Web Server Load Balancer
Web Server Load BalancerWeb Server Load Balancer
Web Server Load Balancer
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling Up
 
HAProxy scale out using open source
HAProxy scale out using open sourceHAProxy scale out using open source
HAProxy scale out using open source
 
Introduction to Haproxy
Introduction to HaproxyIntroduction to Haproxy
Introduction to Haproxy
 
NGINX: High Performance Load Balancing
NGINX: High Performance Load BalancingNGINX: High Performance Load Balancing
NGINX: High Performance Load Balancing
 
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyNginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
 
Caching
CachingCaching
Caching
 
NginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniquesNginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniques
 
Content Caching with NGINX and NGINX Plus
Content Caching with NGINX and NGINX PlusContent Caching with NGINX and NGINX Plus
Content Caching with NGINX and NGINX Plus
 
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
[Hello world 오픈세미나]varnish로 웹서버성능 향상시키기
 

Ähnlich wie ReplacingSquidWithATS

Troubleshooting Apache Cloudstack
Troubleshooting Apache CloudstackTroubleshooting Apache Cloudstack
Troubleshooting Apache CloudstackRadhika Puthiyetath
 
Trouble shooting apachecloudstack
Trouble shooting apachecloudstackTrouble shooting apachecloudstack
Trouble shooting apachecloudstackSailaja Sunil
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsMarcus Frödin
 
Linux HTTPS/TCP/IP Stack for the Fast and Secure Web
Linux HTTPS/TCP/IP Stack for the Fast and Secure WebLinux HTTPS/TCP/IP Stack for the Fast and Secure Web
Linux HTTPS/TCP/IP Stack for the Fast and Secure WebAll Things Open
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTanel Poder
 
Practical non blocking microservices in java 8
Practical non blocking microservices in java 8Practical non blocking microservices in java 8
Practical non blocking microservices in java 8Michal Balinski
 
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атакСтек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атакPositive Hack Days
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisationgrooverdan
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTanel Poder
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
Elasticsearch on Kubernetes
Elasticsearch on KubernetesElasticsearch on Kubernetes
Elasticsearch on KubernetesJoerg Henning
 
Nginx Scalable Stack
Nginx Scalable StackNginx Scalable Stack
Nginx Scalable StackBruno Paiuca
 
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Ontico
 
Openstack 101
Openstack 101Openstack 101
Openstack 101POSSCON
 
SiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingSiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingMarian Marinov
 
SecZone 2011: Scrubbing SAP clean with SOAP
SecZone 2011: Scrubbing SAP clean with SOAPSecZone 2011: Scrubbing SAP clean with SOAP
SecZone 2011: Scrubbing SAP clean with SOAPChris John Riley
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisationgrooverdan
 

Ähnlich wie ReplacingSquidWithATS (20)

Troubleshooting Apache Cloudstack
Troubleshooting Apache CloudstackTroubleshooting Apache Cloudstack
Troubleshooting Apache Cloudstack
 
Trouble shooting apachecloudstack
Trouble shooting apachecloudstackTrouble shooting apachecloudstack
Trouble shooting apachecloudstack
 
Haproxy - zastosowania
Haproxy - zastosowaniaHaproxy - zastosowania
Haproxy - zastosowania
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Linux HTTPS/TCP/IP Stack for the Fast and Secure Web
Linux HTTPS/TCP/IP Stack for the Fast and Secure WebLinux HTTPS/TCP/IP Stack for the Fast and Secure Web
Linux HTTPS/TCP/IP Stack for the Fast and Secure Web
 
Pixels_Camp
Pixels_CampPixels_Camp
Pixels_Camp
 
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel PoderTroubleshooting Complex Oracle Performance Problems with Tanel Poder
Troubleshooting Complex Oracle Performance Problems with Tanel Poder
 
Practical non blocking microservices in java 8
Practical non blocking microservices in java 8Practical non blocking microservices in java 8
Practical non blocking microservices in java 8
 
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атакСтек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
Стек Linux HTTPS/TCP/IP для защиты от HTTP-DDoS-атак
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisation
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
 
Sun Web Server Brief
Sun Web Server BriefSun Web Server Brief
Sun Web Server Brief
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Elasticsearch on Kubernetes
Elasticsearch on KubernetesElasticsearch on Kubernetes
Elasticsearch on Kubernetes
 
Nginx Scalable Stack
Nginx Scalable StackNginx Scalable Stack
Nginx Scalable Stack
 
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
 
Openstack 101
Openstack 101Openstack 101
Openstack 101
 
SiteGround Tech TeamBuilding
SiteGround Tech TeamBuildingSiteGround Tech TeamBuilding
SiteGround Tech TeamBuilding
 
SecZone 2011: Scrubbing SAP clean with SOAP
SecZone 2011: Scrubbing SAP clean with SOAPSecZone 2011: Scrubbing SAP clean with SOAP
SecZone 2011: Scrubbing SAP clean with SOAP
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisation
 

ReplacingSquidWithATS

  • 1. Replacing Squid with ATS ApacheCon 2015, Austin TX Kit Chan (kichan@yahoo-inc.com) Chiru Jaladi (chiru@yahoo-inc.com)
  • 2. Before We Begin This Talk 1) Not about how to choose a proxy server 2) Does not cover all Squid Use Cases
  • 4. Squid in Yahoo The year is 2006 ● Dawn of SOA/Web Service in Yahoo! ● Squid improves performance through caching ○ Other benefits - routing & ACL
  • 5. Squid in Yahoo ● Mark Nottingham was the Champion of Squid in Yahoo! ● Collapsed Forwarding added to Squid 2.6 ● SWR/SIE added to Squid 2.7 https://www.mnot.net/personal/mn.jpg
  • 6. Squid in Yahoo ● Squid 3.0 - Rewrite of Squid in C++ ○ ESI ○ ICAP ● Squid 3.2 - multiple worker support ● Backward Incompatibilities ○ No Collapse Forwarding till 3.5+ ○ No SIE till 3.2+ ○ Still no SWR ○ BLOCKERS!!!
  • 7. ATS in Yahoo Inktomi ● TS 2.0 - 1998, 3.0 - 1999, 4.0 - 2000 ● Customers - AOL, @Home ● e.g. - Transcoding images to smaller sizes for AOL dialup users
  • 8. ATS in Yahoo YTS ● Inktomi Acquired by Yahoo - late 2002 / early 2003 ● Renamed to YTS - Efforts resumed around late 2005 ● By Feb 2010, served 30 billion objects, 400 terabytes a day for Yahoo
  • 9. ATS in Yahoo ASF ● Preparation - 700K lines of code change, 9 Months ● Apache Incubator in July 2009 ● TLP in April 21, 2010
  • 10. Cost of maintenance Unresolved Blockers to Upgrade Performance Limitation in 2.7 Why? http://www.jillianney.com/wp-content/uploads/2012/01/why.jpg
  • 11. Details - Configuration Squid - squid.conf http_port 3128 vhost http11 cache_mem 10 GB negative_ttl 15 seconds connect_timeout 15 seconds forward_timeout 10 seconds read_timeout 15 seconds pconn_timeout 70 seconds persistent_request_timeout 65 seconds
  • 12. Details - Configuration ATS - records.config CONFIG proxy.config.http.server_ports STRING 3128 # ATS requires disk cache to be set up through storage.config as well CONFIG proxy.config.cache.ram_cache.size INT 2147483648 CONFIG proxy.config.http.negative_caching_enabled INT 1 CONFIG proxy.config.http.negative_caching_lifetime INT 15
  • 13. Details - Configuration ATS - records.config (cont) CONFIG proxy.config.http.connect_attempts_timeout INT 15 CONFIG proxy.config.http.keep_alive_no_activity_timeout_in INT 15 CONFIG proxy.config.http.keep_alive_no_activity_timeout_out INT 30 CONFIG proxy.config.http.transaction_no_activity_timeout_in INT 30 CONFIG proxy.config.http.transaction_no_activity_timeout_out INT 30 CONFIG proxy.config.http.transaction_active_timeout_in INT 30 CONFIG proxy.config.http.transaction_active_timeout_out INT 30 CONFIG proxy.config.http.accept_no_activity_timeout INT 12
  • 14. Details - Log Squid - squid.conf logfile_rotate 240 logformat ysquid_extended %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt access_log daemon:/usr/local/var/logs/squid/access.log ysquid_extended cache_log /usr/local/var/logs/squid/cache.log debug_options ALL,1
  • 15. Details - Log ATS - records.config CONFIG proxy.config.log.logging_enabled INT 3 CONFIG proxy.config.log.logfile_dir STRING logs/trafficserver CONFIG proxy.config.log.custom_logs_enabled INT 1 CONFIG proxy.config.log.rolling_enabled INT 1 CONFIG proxy.config.log.rolling_interval_sec INT 3600 CONFIG proxy.config.log.rolling_offset_hr INT 0 CONFIG proxy.config.log.rolling_size_mb INT 6000 CONFIG proxy.config.log.auto_delete_rolled_files INT 1 CONFIG proxy.config.diags.debug.enabled INT 0 CONFIG proxy.config.diags.debug.tags STRING http.*|dns.*
  • 16. Details - Log ATS - logs_xml.config <LogFormat> <Name = "ats_generic_config"/> <Format = "ts=%<cqtq> url=%<cqu> host=%<{Host}cqh> duration=%<ttms> status=%<pssc> cache=%<crc> ostatus=%<sssc> uurl=%<cquuc> conn=% <cfsc>/%<pfsc> ip=%<chi> cqhm=%<cqhm> pscl=%<pscl> age=%<{Age}ssh> "/> </LogFormat> <LogObject> <Format = "ats_generic_config"/> <Filename = "mon"/> <Mode = "ascii"/> </LogObject>
  • 17. Details - Metrics ● e.g. cache hit ratio, avg latency, # of reqs ● Squid ○ squidclient mgr:info ○ squidclient mgr:counters ● ATS ○ traffic_line -r ○ https://docs.trafficserver.apache. org/en/latest/reference/commands/traffic_line.en. html
  • 18. Details - SWR/SIE (RFC 5861)
  • 19. Details - Collapsed Forwarding ● Multiple client requests as one server request ● Prevent “Thundering Herds” problem
  • 20. Details - SWR/SIE/Collapsed Forwarding Squid - squid.conf collapse_forwarding on max_stale 8 hours refresh_pattern . 5 0 480 stale-while-revalidate=15 ignore-reload override-lastmod
  • 21. Details - SWR/SIE/Collapsed Forwarding ATS ● Collapse Forwarding - check out wiki page ● experimental stale_while_revalidate plugin ● TS-1463 ○ once the fetch of the object is initiated, the original object is not allowed to be served from cache ● TS-1996 ○ Deprecated API - TSHttpTxnNewCacheLookupDo()
  • 22. Details - Fixing the Plugin (SWR) ATS Origin 1. client req in swr 2. serve stale 3. async req (?swr=1) 4. valid async resp 5. post async content to original URL to update the cache
  • 23. Details - Fixing the Plugin (SIE) ATS Origin 1. client req in sie 4. intercept return with async resp 2. async req (?swr=1) 3. valid async resp ATS Origin 1. client req in sie 4. serve stale 2. async req (?swr=1) 3. 5xx for async resp
  • 24. Details - ACL control (Squid) Based on src, dst, time, regex, schema etc. Squid.conf # Example 1 (give access only to certain clients) acl myclients src 172.16.5.0/24 http_access allow myclients http_access deny all # Example 2 (disable cache for responses from a domain) acl someserver dstdomain .someserver.com cache deny someserver
  • 25. Details - ACL control (ATS) remap.config ip_allow.config (Similar to Example 1) cache.config (Similar to Example 2) map http://www.x.com/ http://server.hoster.com/ src_ip=123.12.3.000-123.12.3.123 action=ip_allow dest_domain=mydomain.com action=never-cache
  • 26. Details - Extensibility (Squid) ● Helper program for ACL, URL Manipulation, DNS lookup ○ Rigid and limited ○ e.g. controlling ACL in squid.conf external_acl_type yca_helper cache=5000 concurrency=1000 children=2 grace=1 %SRC %{App-Auth} %DATA /usr/local/libexec/squid/yca_acl.pl acl yca external yca_helper acl yca_appids ext_user REQUIRED deny_info YCA_AUTH_REQ yca deny_info YCA_WRONG_APPID yca_appids
  • 27. Details - Extensibility (ATS) ATS - Plugins (C, C++, Lua) https://docs.trafficserver.apache.org/en/latest/_images/transact_hook75.jpg
  • 28. Type 1. sibling (ICP*) 2. parent Details - Peering (Squid) Parent Selection method 1. carp*, round-robin, user-hashing etc. 2. originserver (reverse proxy) ICP: Internet Cache Protocol Carp: Cache Array Protocol
  • 29. Details - Peering (Squid) # Example 1 (ICP) cache_peer 172.16.1.123 sibling 3129 5500 weight=1 # Example 2 (Reverse Proxy mode) cache_peer localhost parent 8080 0 originserver no-query no-digest # Example 3 (Carp routing) cache_peer server1.com parent 3128 0 carp no-query no-digest monitortimeout=15 monitorinterval=60 monitorurl=/status.html name=andy cache_peer server2.com parent 3128 0 carp no-query no-digest monitortimeout=15 monitorinterval=60 monitorurl=/status.html name=mandy Squid.conf
  • 30. Details - Peering (ATS) Type 1. Sibling (ICP*) 2. Parent * Our Squid ICP peering use case (Example 1) is not needed when we deploy with hierarchical caching + consistent hashing
  • 31. Details - Peering (ATS) remap.config (Similar to Squid Example 2) parent.config (Similar to Squid Example 3) dest_domain=. method=get parent="p1.x.com:8080; p2.y.com:8080" round_robin=true dest_domain=. method=get parent="p1.x.com:8080|1.0; p2.y.com:8080|2.0" round_robin=consistent_hash map http://www.x.com/ http://server1.com/
  • 32. Use Cases - Forward Proxy https://docs.trafficserver.apache.org/en/latest/_images/cache_miss.jpg
  • 33. squid.conf Use Cases - Forward Proxy (Squid) http_port 80 vhost # protecting proxy by only allowing clients to connect to port 80 acl Safe_ports port 80 http_access deny !Safe_ports acl localnet src 10.0.0.0/8 # RFC1918 possible internal network http_access allow localhost http_access allow localnet
  • 34. Use Cases - Forward Proxy (ATS) records.config remap.config CONFIG proxy.config.reverse_proxy.enabled INT 0 CONFIG proxy.config.http.server_ports 80 # for security purpose require remap (Optional) CONFIG proxy.config.url_remap.remap_required INT 1 # map all origin servers for which we need forward proxy map http://server1.com/ http://server1.com/
  • 35. Use Cases - Reverse Proxy https://docs.trafficserver.apache.org/en/latest/_images/revproxy.jpg
  • 36. Use Cases - Reverse Proxy (Squid) Squid.conf http_port 80 accel defaultsite=server1.com # allow access to origin server cache_peer endpoint.com parent 80 0 no-query originserver name=myAccess # access controls acl our_sites dstdomain server1.com server2.com http_access allow our_sites cache_peer_access myAccess allow our_sites cache_peer_access myAccel deny all
  • 37. Use Cases - Reverse Proxy (ATS) 1. records.config 2. remap.config CONFIG proxy.config.http.server_ports 80 CONFIG proxy.config.reverse_proxy.enabled INT 1 CONFIG proxy.config.url_remap.remap_required INT 1 map http://www.server1.com/ http://www.endpoint.com/ map http://www.server2.com/ http://www.endpoint.com/
  • 38. Learnings ● Managing an open source project ○ Backward compatibility ● Squid configuration ○ config can be confusing when they exist in same file ○ allow/deny pattern confusing ● ATS configuration ○ ATS configuration complicated/disjoint, but clean ○ ATS plugins more flexible ● Improved Performance ○ CPU/Latency/RPS ● Migration ○ (Automated) Testing is important
  • 39. Automated Testing ● TSQA ○ integration/functional testing framework ○ Not just for ATS, can be used for other proxy server (e.g. squid) ○ To be used heavily during migration
  • 40. Q&A
  • 41. Reference Choosing a Proxy Server - https://www.slideshare.net/bryan_call/choosing-a-proxy-server-apachecon-2014 Squid-2.6 - http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE24-RELEASENOTES. html#s1 Squid-2.7 - http://www.squid-cache.org/Versions/v2/2.7/squid-2.7.STABLE9-RELEASENOTES. html#s1 Squid-3.0 - http://www.squid-cache.org/Versions/v3/3.0/RELEASENOTES.html#s4 Squid-3.2 - http://www.squid-cache.org/Versions/v3/3.2/RELEASENOTES.html#s2 Squid-3.5 - http://www.squid-cache.org/Versions/v3/3.5/squid-3.5.3-RELEASENOTES.html#s2 SIE Squid Bug - http://bugs.squid-cache.org/show_bug.cgi?id=2255 SWR Squid Bug - http://bugs.squid-cache.org/show_bug.cgi?id=2256
  • 42. Reference (Cont) ATS records.config - https://docs.trafficserver.apache.org/en/latest/reference/configuration/records. config.en.html ATS logs_xml.config - https://docs.trafficserver.apache.org/en/latest/reference/configuration/logs_xml. config.en.html ATS traffic_line - https://docs.trafficserver.apache.org/en/latest/reference/commands/traffic_line.en. html ATS Collapsed Fowarding wiki - https://cwiki.apache.org/confluence/display/TS/Collapsed+Forwarding ATS stale_while_revalidate plugin - https://docs.trafficserver.apache. org/en/latest/reference/plugins/stale_while_revalidate.en.html ATS Plugin developer guide - https://docs.trafficserver.apache.org/en/latest/sdk/index.en.html