...
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.
Code Block |
---|
CONFIG proxy.config.reverse_proxy.enabled INT 0
CONFIG proxy.config.url_remap.remap_required INT 0
|
Step 2 – Optimize
CPU Cores (also multiple CPUs)
The default config for ATS supports up to 2 CPU cores. I have 4 and decided to update the config to reflect that.
One could actually increase this setting higher, but I'm not a huge fan of Hyperthreading so I didn't bother.
Code Block |
---|
CONFIG proxy.config.exec_thread.limit INT 4 |
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.
Code Block |
---|
CONFIG proxy.config.http.chunking.size INT 16384 |
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.
Code Block |
---|
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.
Code Block |
---|
CONFIG proxy.config.http.origin_server_pipeline INT 16 CONFIG proxy.config.http.user_agent_pipeline INT 256 |
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.
Code Block |
---|
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.
...
Code Block |
---|
CONFIG proxy.config.http.cache.heuristic_max_lifetime INT 7776000 |
HTTP "Last Modified" Support
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.
Code Block |
---|
CONFIG proxy.config.http.cache.heuristic_lm_factor FLOAT 1.000000 |
HTTP 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.
Code Block |
---|
CONFIG proxy.config.http.cache.fuzz.min_time INT -1 |
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:
...
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.
Code Block |
---|
CONFIG proxy.config.cache.threads_per_disk INT 4 |
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.
Code Block |
---|
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.
Code Block |
---|
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.
Code Block |
---|
CONFIG proxy.config.hostdb.size INT 8192 CONFIG proxy.config.hostdb.storage_size INT 4194304 |
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.
Code Block |
---|
CONFIG proxy.config.hostdb.timeout INT 129600
|
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.
Code Block |
---|
CONFIG proxy.config.reverse_proxy.enabled INT 0
CONFIG proxy.config.url_remap.remap_required INT 0
|
HTTP Socket I/O Buffers
The default config for ATS leaves these disabled. I believe these to be useful
for HTTP streaming applications such as Internet Radio and YouTube.
However, setting these too large tends to slow down the cache overall.
Code Block |
---|
CONFIG proxy.config.net.sock_send_buffer_size_in INT 131072 CONFIG proxy.config.net.sock_recv_buffer_size_in INT 131072 CONFIG proxy.config.net.sock_send_buffer_size_out INT 131072 CONFIG proxy.config.net.sock_recv_buffer_size_out INT 131072 |
Miscellaneous Task Threads
Similar to the first setting in this document, the default config for ATS supports up to 2 CPU cores.
I have 4 and decided to update the config to reflect that. One could actually increase this setting higher,
but I'm not a huge fan of Hyperthreading so I didn't bother.
...