You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 62 Next »

While the default configuration values for ATS will get you up and running,
at the moment they're designed for regression testing and not real-world applications.

This page documents what I've discovered myself through a fair amount of experimentation
and real-world experience.

The following lists the steps involved in taking a generic configuration,
and modifying it for my own needs. Yours may vary, however, and I'll do my best
to indicate which settings should be sized based on your install.

All three Wiki pages use configuration examples from my running home Traffic Server setup.

Current Home Machine

  • Make/Model: Apple iMac Mid 2011
  • CPU: 3.4 Ghz Intel Core i7 (quad-core w/Hyperthreading)
  • Memory: 8GB
  • Disk: 1TB
  • OS: Mac OS X v10.8.5
  • Cache Size: 3GB

Current Testing Regimen

The following settings have been tested against the following:

  • IPv4 websites
  • IPv6 websites
  • Explicitly difficult web pages (i.e. Bing Image Search)
  • Explicitly SSL web sites (i.e. Facebook)
  • Internet Radio (various types)

The following settings are all located in /usr/local/etc/trafficserver/records.config.
When adding lines, simply organize them in alphabetic sequence.

Step 1 – Disable Reverse Proxy

Reverse Proxy Settings

As I'm using ATS as purely a forward-only web proxy cache, I decided to turn these off.
I believe the default settings enable ATS as both a forward and reverse cache.

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

Reverse Proxy Object Expiration Fuzzy Logic

I had to dig into the codebase for this one. Apparently this is a feature designed for reverse proxies
to "sweep" the cache at defined intervals. My memory's a bit foggy, so apologies if I got the definition wrong.
In any case, this functionality doesn't help a forward proxy cache whose goal is to keep objects in the cache.
The following setting disables this feature.

CONFIG proxy.config.http.cache.fuzz.min_time INT 0

Step 2 – Optimize

CPU Cores (also multiple CPUs)

The default config for ATS supports up to 2 CPU cores. I have 4, but discovered over time that using all of them
causes problems with iTunes, and World of Warcraft. In the hopes of avoiding problems like that, I decided to
configure my ATS to use just one core where possible.

CONFIG proxy.config.exec_thread.limit INT 1

HTTP Chunking

The default config for ATS specifies that the proxy itself use data "chunks" of 4KB each. Being that I'm on a
high-speed Internet link at home, I decided to increase this. I originally went with 128KB, only to find my
Internet Radio seemed to be having problems. 16KB should remedy that.

CONFIG proxy.config.http.chunking.size INT 16K

HTTP Connection Sharing

The default config for ATS specifies that outbound connections be shared within connection pools
on a per-thread basis. Fair enough. For some reason, though, this caused me no end of performance
problems. Thus, the following specifies one "global" connection pool which is much faster.

CONFIG proxy.config.http.share_server_sessions INT 1

Inbound And Outbound HTTP Connections

The default config for ATS sets these artificially low. I found that remote webservers themselves actually
slow down if more than 16 simultaneous connections are attempted. Also, most popular browsers support
up to 256 simultaneous connections from browser to proxy server so our ATS config should reflect that.

CONFIG proxy.config.http.origin_server_pipeline INT 16
CONFIG proxy.config.http.user_agent_pipeline INT 256

HTTP Connection Timeouts

I decided to use Mozilla Firefox's values here, along with one of my own.
It turns out proxy.config.http.transaction_active_timeout_in was essentially shutting down my
streaming Internet Radio connections. I increased that setting from 15 minutes to 12 hours.

CONFIG proxy.config.http.keep_alive_no_activity_timeout_in INT 115
CONFIG proxy.config.http.keep_alive_no_activity_timeout_out INT 115
CONFIG proxy.config.http.transaction_no_activity_timeout_in INT 90
CONFIG proxy.config.http.transaction_no_activity_timeout_out INT 90
CONFIG proxy.config.http.transaction_active_timeout_in INT 43200
CONFIG proxy.config.http.transaction_active_timeout_out INT 43200
CONFIG proxy.config.http.accept_no_activity_timeout INT 30

HTTP Background Fill Competion

There's an algorithm here that I don't fully understand, but this setting should guarantee that objects
loaded in the background are cached regardless of their size.

CONFIG proxy.config.http.background_fill_completed_threshold FLOAT 1.000000

HTTP Cache Options

The following settings are pretty important. I'll go through them one at a time.

This one defines a global variable whose function is to indicate whether specific HTTP headers
are necessary to properly cache an object. As it turns out, much of this functionality is
included in HTTP 1.1 and thus additional headers aren't really necessary.

CONFIG proxy.config.http.cache.required_headers INT 0

The next specifies how "stale" an object should be before it gets fetched again from the Internet.
The default config for ATS specifies that after 1 week(604800 seconds), any object that is "stale"
should be flushed from the cache. I'd prefer that it stick around for about 3 months.

CONFIG proxy.config.http.cache.max_stale_age INT 7776000

This one specifies whether or not to use HTTP "range" requests. While having this option enabled
will save bandwidth, it also slows page loading.

CONFIG proxy.config.http.cache.range.lookup INT 0

The default config for ATS specifies that after 1 day(86,400 seconds), any object without a specific expiration
should be flushed from the cache. I'd prefer that it stick around for about 3 months. This setting is contentious
in that what it should be is debatable.

CONFIG proxy.config.http.cache.heuristic_max_lifetime INT 7776000

There's an algorithm here that I don't fully understand, but this setting should guarantee that the relevant
information regarding an object's "last modified" date is fully support by the cache.

CONFIG proxy.config.http.cache.heuristic_lm_factor FLOAT 1.000000

HTTP RAM Cache

While the default ATS options for this may be optimal under heavy load,
I found using the simpler LRU algorithm much faster and more useful.

The following specifies 1GB of RAM cache, with objects of unlimited size,
to be managed using LRU. During normal use, RAM utilization will rise and rise
until all 1GB is used, then the LRU algorithm should kick in. Also,
figure on at least 100MB of general RAM overhead for ATS in addition to this.

CONFIG proxy.config.cache.ram_cache.size INT 1G
CONFIG proxy.config.cache.ram_cache_cutoff INT 0
CONFIG proxy.config.cache.ram_cache.algorithm INT 1
CONFIG proxy.config.cache.ram_cache.use_seen_filter INT 0

NOTE: This setting should be sized relative to the amount of memory you want to use.
Also, it requires restarting ATS to properly take effect.

Cache Minimum Average Object Size

This setting is pretty important. It defines a global variable whose function is to both structure the cache
for future objects, as well as optimize other areas. For my purposes, I decided an "average Internet object"
is roughly 32KB in size, and so we can do the following math:

Average Internet Object Size: 32KB
Disk Cache Size: 3GB
Disk Cache Size In Bytes: 3221225472 (3 * 1024 * 1024 * 1024)
Average Internet Object Size In Bytes: 32768 (32 * 1024)
Disk Cache Object Capacity: 98304 (3221225472 / 32768)

CONFIG proxy.config.cache.min_average_object_size INT 96K

NOTE: This setting should be sized relative to the size of your disk cache.
Also, it requires clearing the disk cache and restarting ATS to properly take effect.

Cache Threads Per Disk Spindle

My setting here is somewhat of a rough guess. I've had issues in the past with Squid as a web cache
and increasing the threads dedicated to disk access definitely helped. However, with ATS I've actually
noticed a speed boost by decreasing this setting. My current theory is that this setting should allow
for one thread per CPU core.

CONFIG proxy.config.cache.threads_per_disk INT 1

Cache Disk Write Lock Delay

The default setting for ATS is unfortunately quite low. For some reason this caused a repeatable,
large delay when loading Bing Image Search results. The following setting removes most of the delays
and seems to speed up the cache overall a bit.

CONFIG proxy.config.cache.mutex_retry_delay INT 50

Maximum Concurrent DNS Queries

The default settings for ATS regarding DNS are set pretty high. I decided for my purposes to lower them,
Your Milage May Vary on these.

CONFIG proxy.config.dns.max_dns_in_flight INT 512

DNS Internet Protocol Preference

I've no idea if this setting really helps or not, but I like to specify my preference for IPv6 over IPv4
as much as possible.

CONFIG proxy.config.hostdb.ip_resolve STRING ipv6;ipv4

DNS Host Cache Database Size

The default settings for ATS regarding DNS are set pretty high. I think the following represents a pretty
good balance between caching too much and caching too little in terms of DNS.

CONFIG proxy.config.hostdb.size INT 8K
CONFIG proxy.config.hostdb.storage_size INT 4M

DNS Host Cache Database Timeout

The default config for ATS specifies that after 1 day(1,440 minutes), all DNS records should be flushed
from the cache. I'd prefer that they stick around for about 3 months.

CONFIG proxy.config.hostdb.timeout INT 129600

HTTP Socket I/O Buffers

The default config for ATS leaves these disabled. I believe these to be somewhat useful
for HTTP streaming applications such as Internet Radio and YouTube. However,
setting these too large tends to slow down the cache overall.

CONFIG proxy.config.net.sock_send_buffer_size_in INT 0
CONFIG proxy.config.net.sock_recv_buffer_size_in INT 0
CONFIG proxy.config.net.sock_send_buffer_size_out INT 0
CONFIG proxy.config.net.sock_recv_buffer_size_out INT 128K

Step 3 – Secure

Maximum Inbound Concurrent Connections

The default config for ATS specifies that this server can handle up to 30,000 connections.
For my purposes, that's a bit excessive. I figure with 1,024 connections there's plenty
of "elbow room".

CONFIG proxy.config.net.connections_throttle INT 1K

That's it. Go ahead and refresh your cache(if necessary), restart ATS, and enjoy your tuned proxy server.

  • No labels