Background Fetch Plugin¶
This is a plugin for Apache Traffic Server that allows you to proactively fetch content from Origin in a way that it will fill the object into cache. This is particularly useful when all (or most) of your client requests are of the byte-Range type. The underlying problem being that Traffic Server is not able to cache request / responses with byte ranges.
Using the plugin¶
This plugin currently only functions as a global plugin, and it takes not arguments or parameters. In plugin.config, simply add:
background_fetch.so
Functionality¶
Examining the responses from origin, we decide to trigger a background fetch of the original (Client) request under these conditions:
- The request is a GET request (we only support these right now)
- The response is a 206 response
- The original client request, and the Origin server response, is clearly indicating that the response is cacheable. This uses the new API c:func:TSHttpTxnIsCacheable(), which also implies honoring current Traffic Server configurations.
Once deemed a good candidate to performance a background fetch, we’ll replay the original client request through the Traffic Server proxy again, except this time eliminating the Range header. This is transparent to the original client request, which continues as normal.
Only one background fetch per URL is ever performed, making sure we do not accidentally put pressure on the origin servers.
Future additions¶
The infrastructure is in place for providing global and per-remap configurations. This could include:
- Limiting the background fetches to certain Content-Types
- Limiting the background fetches to content of certain sizes
None of this is currently not implemented.