Successfully reported this slideshow.

Apache con 2011 gd

2,189 views

Published on

My ApacheCon 2011 presentation. I you someone liked it.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Apache con 2011 gd

  1. 1. Out and About with Apache Traffic ServerLeif HedstromNovember 2011
  2. 2. 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 zwoop@apache.org @zwoop +zwoop
  3. 3. History of Traffic Server Inkt omi Yahoo A pache T raffic Server T raffic Server T raffic Server1995 2000 2005 2010
  4. 4. Plenty of FOSS Proxy Servers
  5. 5. Features ATS HAproxy ngin Squid Varnish mod_proxy xWorker Threads Y N N N Y YMulti-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
  6. 6. Mandatory useless benchmark … 120,000 100,000 80,000 Throughput 60,000 40,000 20,000 0 ATS 2.1.9 Nginx 0.8.53 Varnish 2.1.5 Req / sec
  7. 7. Less useless benchmark … 120,000 4.0 3.5 100,000 Time to firt res p onse 3.0 80,000Throughput 2.5 60,000 2.0 s 1.5 40,000 1.0 20,000 0.5 0 0.0 ATS 2.1.9 Nginx 0.8.53 Varnish 2.1.5 Req / sec Latency (ms)
  8. 8. Intermediaries - Forward Proxy
  9. 9. Intermediaries - Reverse Proxy
  10. 10. Intermediaries - Intercepting Proxy
  11. 11. Common enemies of performance3-Way handshake Congestion control DNS lookups
  12. 12. Common enemies of performance3-Way handshake
  13. 13. TCP 3-way Handshake
  14. 14. Common enemies of performance Congestion control
  15. 15. Congestion control
  16. 16. Common enemies of performance DNS lookups
  17. 17. http://news.example.com/http://finance.example.com/http://groups.example.com/
  18. 18. vshttp://www.example.com/newshttp://www.example.com/financehttp://www.example.com/groups
  19. 19. The concurrency problem
  20. 20. Solution 1: Multithreading Single CPU Dual CPU Thread 1 Thread 1 Thread 2 Thread 3 Thread 2 Thread 1 Thread 3 Thread 3 Thread 1 Thread 3 Time Time
  21. 21. Problems with multi-threading "When two trains approach each other at a crossing, both shall come to a full stop and neither shall start up again until the other has gone." From Wikipedia, Illogical statute passed by Kansas legislation .
  22. 22. Solution 2: Event Processing Scheduled Network Disk I/O events events events Queue Event Loop Disk HTTP state Accept handler machine handler Can generate new events
  23. 23. Problems with event processors
  24. 24. Asynchronous event processor Asynchronous event processor RAM cache ... n threads per core Asynchronous event processor Disk cache Disk I/O thread Disk I/O thread ... m threads per disk Disk I/O thread Shared Resources ConfigsReloadable Accept threads (per port) Logging threads Traffic Server threads model etc.Stats, logs ~10 threads Various "admin" threads
  25. 25. http://www.flickr.com/photos/stuartpilbrow/3345896050/
  26. 26. plugin.config ip_allow.configrecords.config storage.configpartition.config logs_xml.confighosting.config parent.configcache.config remap.configupdate.config icp.config
  27. 27. records.config for reverse proxyCONFIG proxy.config.http.server_port INT 80CONFIG 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_ageINT 1CONFIG proxy.config.http.normalize_ae_gzip INT 1
  28. 28. records.config for reverse proxyCONFIG proxy.config.http.server_port INT 80CONFIG proxy.config.reverse_proxy.enabled INT 1CONFIG proxy.config.url_remap.remap_required INT 1
  29. 29. records.config for forward proxyCONFIG proxy.config.http.server_port INT 8080CONFIG proxy.config.reverse_proxy.enabled INT 0CONFIG proxy.config.url_remap.remap_required INT 0
  30. 30. 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.comredirect http://example.com http://www.example.comregex_map http://(.*).example.com http://o.example.com/$1map / http://kitchensink.example.com
  31. 31. remap.config examplesmap http://www.example.com/css http://css.example.commap http://www.example.com http://real.example.com
  32. 32. remap.config examplesreverse_map http://real.example.com http://www.example.com
  33. 33. remap.config examplesregex_map http://(.*).example.com http://o.example.com/$1
  34. 34. remap.config examplesmap / http://kitchensink.example.com
  35. 35. 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” ▫ And it’s not encumbered by any patentsDisk: Supports various block sizes (SSD)Disk: Can be tuned for various object sizesDisk: No file system overhead (RAW disks)
  36. 36. Future directionsRelease early, and oftenFull IPv6 supportNPN, SNI and other SSL improvementsImproved 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!
  37. 37. Was this a huge waste of time, or?
  38. 38. A versatile tool 39
  39. 39. Yes, it’s fast, ridiculously fast 40
  40. 40. A vibrant community! The ApacheSoftware Foundationhttp://www.apache.org/ 41
  41. 41. “If you are not using SSDs, you arewasting your life” Artur Bergman 42
  42. 42. “If you are not using a caching proxyserver, you are wasting your SSDs” me 43
  43. 43. 44
  44. 44. Four Horseman of Bad Performance–Data copies–Context Switches–Memory allocation–Lock contention–Avoid these! http://pl.atyp.us/content/tech/servers.html
  45. 45. records.config for reverse proxyCONFIG proxy.config.http.cache.ignore_client_cc_max_ageINT 1CONFIG proxy.config.http.normalize_ae_gzip INT 1
  46. 46. Disk cache: “Cyclone”

×