Application Accelerator
Vary the cache key by query string, cookie, device group, or method with Application Accelerator, and cache one copy per variation.
Application Accelerator is a Platform Resource that unlocks four capabilities for the cache and the rules of an Application. With Application Accelerator on, an Application can add more parts of the request to the cache key, cache POST and OPTIONS responses, and keep a response in cache for less than 60 seconds. Its rules can also use more Rules Engine behaviors, such as Bypass Cache and Forward Cookies, and two more variables.
A cache files each stored response under a key built from the request. When that key holds only the URL, every visitor who requests the URL gets the same copy, even when the content changes with a cookie, a device, or an argument. Adding one of those inputs to the key gives each of its values a copy of its own. One URL then holds several correct responses, and each visitor receives the one that matches their request.
In an Application with Application Accelerator on, the key can take four inputs: a query-string argument, a cookie, the device group, and the request method. A device group is a name and a regular expression that the Application compares with the User-Agent header of each request.
Application Accelerator is off in a new Application, and each Application turns it on separately, in the Application’s modules.application_accelerator.enabled field in the API. Each cache setting of the Application holds how long a response stays in cache. It also sets which inputs vary the key, in its own modules.application_accelerator object. Then a rule with the Set Cache Policy behavior applies the cache setting to the requests the rule matches. Use Application Accelerator to cache separate copies of a page personalized by a cookie, an API response that changes with its query string, a catalog that differs by device, or a POST response.
Request path
A cache key is the index entry for a cached object. By default, Azion builds it from the scheme, the host, and the path of the request, so each path is one object in cache. Unless a cache setting varies the key by query string, every query string of a path maps to that one object. Each variation a cache setting turns on adds one input to the key, and each kind appends its own marker:
- A cookie variation appends the
@@separator, then the names and values of the cookies, each followed by;. - A device variation appends
@@and the name of the device group. - A cached
POSTresponse appends@@and the MD5 hash of the request body. A cachedOPTIONSresponse adds only its method prefix. - A query-string variation under
allowlistordenylist, thebehaviorvalues that name the arguments to keep or to leave out, appends@@, then?and the chosen arguments. Underall, which varies the key by every argument, the whole query string follows the path, before@@.
A request that uses any method other than GET or HEAD is a complex request, and its key carries the method as a prefix.
Solid arrows carry the request, and dotted arrows carry the response. Each label starts with the number of its step below.
- The request reaches the Application with its scheme, host, path, and query string.
- A Set Cache Policy rule applies a cache setting to the request.
- The key starts with the scheme, the host, and the path. Each variation in the cache setting’s
modules.application_acceleratorobject then appends its input, with the marker that this section lists for it. - When Cache holds a valid copy under that key, that copy becomes the response.
- Otherwise, the Connector routes the request to the origin server, and Cache stores the response under that key.
A cookie variation on a user cookie produces a key shaped like httpwww.example.com/@@user=user;. For a cached POST, the key is shaped like posthttpsdynamic.example.com/path@@md5_of_post_body. Two requests share a cached object when they produce the same key, and they get separate objects when they do not. For the full format and every input a key carries, refer to Cache keys.
For what turning on Application Accelerator unlocks, the cost of a variation, and purges, refer to Cache variation. That page also compares Bypass Cache with a time to live (TTL) of 0.
Cache setting structure
A cache setting holds the inputs that vary the cache key in its modules.application_accelerator object, which Azion Console shows as the Application Accelerator section of the setting only while Application Accelerator is on in the Application. This cache setting keeps a product listing for 30 seconds and gives each value of its category argument a copy of its own. Send it as the body of POST /v4/workspace/applications/<application-id>/cache_settings:
modules.application_acceleratorholds the four variation controls:cache_vary_by_querystring,cache_vary_by_cookies,cache_vary_by_devices, andcache_vary_by_method. A control the body leaves out keeps its default,ignore, or an empty list for the methods.behaviortakesignore,all,allowlist, ordenylist, and the device control takesignoreorallowlist. Here,allowlistvaries the key only by the arguments infields, andsort_enabledgroups every order of them under one key.max_ageset to30is accepted only while Application Accelerator is on. Without it, the floor is 60 seconds, and Azion API refuses a lower value with21021.- The Application carries a
modules.application_acceleratorobject of its own, and itsenabledfield turns Application Accelerator on.PATCH /v4/workspace/applications/<application-id>sets it with{ "modules": { "application_accelerator": { "enabled": true } } }. While that field isfalse, the API refuses with21013a cache setting that varies the cache: a query-string, cookie, or device-group variation whosebehavioris notignore, or a method incache_vary_by_method.
If you configured a Vary header or a cache-key rule elsewhere, the model transfers. You name the inputs that make two requests different, and each distinct value gets its own copy. Only the four variation controls set those inputs, so a request header such as Accept-Language cannot vary the key.
Scope and limits
- Application: Application Accelerator is off in a new Application, and it belongs to the Application, so one Application can have it on while another has it off. Turning it on leaves traffic as it was: the controls of a cache setting start at
ignore, and a cache setting reaches a request only through a Set Cache Policy rule. Main Settings shows where to turn it on in Azion Console and the API. - What Application Accelerator unlocks: cache variation, the caching of
POSTandOPTIONSresponses, and a Max Age, the cache setting’smodules.cache.max_agefield, as low as 0 seconds. It also unlocks Rules Engine behaviors and the${request_uri}and${device_group}variables, and an Application takes all of these or none. The behaviors are Add Request Cookie and Add Response Cookie, Bypass Cache, Capture Match Groups, Filter Request Cookie and Filter Response Cookie, Forward Cookies, and Rewrite Request. An Application passesPOST,PUT,PATCH,DELETE, andOPTIONSto the origin with or without Application Accelerator. Of those methods, Application Accelerator makes only thePOSTandOPTIONSresponses cacheable. - Variation size: each distinct value of a varied input is a separate cached object. A cookie unique to each visitor gives every visitor a copy, so the number of objects grows with the audience instead of with the content. For how an allowlist and sorting, the
sort_enabledfield, bound that number, refer to Cache variation, and for the practices, to Applications best practices. - Purges: cookie and device group variations survive a URL purge. A cache key purge reaches them, and so does a wildcard purge that ends the key with
@@*. Query-string variations are the exception. A URL purge reaches them when it sends the arguments in the order they were presented, or in alphabetical order withsort_enabledon. For the purge types, refer to Real-Time Purge. - Bypass Cache and a TTL of 0: Bypass Cache sends each request that its rule matches to the origin and keeps the response out of Azion’s cache. It acts on Azion’s cache only, so the Tiered Cache layer keeps caching objects for an Application whose cache settings turn Tiered Cache on. A Max Age of 0 seconds keeps the request on the cache path, and every request still reaches the origin. For how the two compare, refer to Bypass Cache and a TTL of 0.
- Neighbors: with Application Accelerator on, the variation controls of a cache setting decide what goes into a key, and Cache then keeps a separate copy for each value. To vary the cache on the
imsstring of Image Processor, addimsto the query-string allowlist of the cache setting that serves images. - Interfaces: you turn on Application Accelerator in Azion Console, through Azion API at
/v4/workspace/applications/<application-id>, and withazion update application --application-acceleratorin Azion CLI.azion.config.jssets it withapplicationAcceleratorEnabled, and Azion Lib withapplication_accelerationon an update. Azion Terraform Provider manages the Application resource that carries the switch. The variation controls belong to the cache setting, at/v4/workspace/applications/<application-id>/cache_settingsor throughazion create cache-settingflags such as--cache-by-query-stringand--cache-by-cookies.azion create cache-settingtakes device-group variation and the cache Max Age only in a--filebody. - Observability: with
Pragma: azion-debug-cacheon a request, thex-cache-keyheader of the response shows what each variation added to the key. APOSTreports-inx-cacheuntil thecache_vary_by_methodfield of the cache setting carriespost. To check the cache status of one response, refer to Check the cache status of a response. - Limits: with Application Accelerator on, the Max Age of a cache setting goes down to 0 seconds, or to 3 seconds when the cache setting also has Tiered Cache on. Turning it on can generate usage-related costs. For each TTL bound and the answer past it, refer to Applications limits, and for the rates, to Pricing. Azion pricing lists what each plan includes.
- Terms: the Applications glossary defines the words the Application Accelerator pages give a specific meaning, such as Advanced Cache Key, cache variation, and device group.