Data Types

Upload CDN Permanent Cache

The Upload Content Delivery Network (CDN) includes a permanent cache to store processed files (e.g. optimized images).

Benefits

The Upload CDN's permanent cache:

Eliminates file reprocessing on edge cache misses.

Reduces download latency.

Reduces processing costs.

How it works

Upload's permanent cache is a configurable cache that stores processed files (e.g. optimized images) for near-instant subsequent requests.

By default, files that take longer than 500 milliseconds to process will be permanently cached.

When permanent caching is enabled:

1

Processed files will be automatically saved to Upload's permanent cache after generation.

2

Processed files will be served from the permanent cache or edge cache on all subsequent requests to the same URL.

3

Processed files will remain in the permanent cache until you reset your cache.

The download performance of a perma-cached file is identical to that of downloading a static asset (i.e. very fast).

Please note:

  • Permanent caching adds ~100ms of latency to the initial response.

  • This occurs once per URL: when both the permanent cache and edge cache are missed.

Performance

Example download performance of a 4000×2667 JPEG with image processing applied:

Upload.io (TTFB)Alternative Solution (TTFB)Edge CachePermanent Cache

1207ms

1815ms

MissMiss

18ms

48ms

HitHit

15ms

43ms

HitHit

171ms

1912ms

MissHit

28ms

93ms

HitHit

23ms

72ms

HitHit

...

...

......

20ms

64ms

HitHit

188ms

1851ms

MissHit

31ms

36ms

HitHit

21ms

67ms

HitHit

198ms

1940ms

MissHit

34ms

41ms

HitHit

21ms

32ms

HitHit

The Upload CDN further reduces latency by routing edge cache misses to a master edge cache node. This additional optimization reduces edge cache misses by keeping traffic within the edge network where possible: requests are only forwarded to the central permanent cache when both the regional edge cache nodes and the master edge cache node don't have a copy of the requested file.

Using these techniques, Upload is able to ensure there is only one file processing request per URL.

Without permanent caching or origin shielding, alternative solutions will perform file reprocessing on regional edge cache misses. Depending on the structure of the CDN, this could result in thousands of file processing requests per URL.

Measuring performance

Time to First Byte (TTFB) is a key metric for measuring the performance of a file processing solution.

TTFB measures the end-to-end latency of a request, and includes DNS resolution, TLS handshakes, and file processing.

We recommend using a TTFB tool like SpeedVitals TTFB when evaluating file processing solutions.

Asia Pacific & Africa: get a performance boost for these regions by using Upload's Extended Coverage option.

Measuring cache hits

The Upload CDN includes the following HTTP response headers to help users identify cache hits and misses:

HTTP/2 200
...
x-cache: Hit
x-cache-perma: Miss
x-cpu-on-cache-miss: 971
...
  • x-cache: header values containing Hit indicate the request was served from the edge cache, else:

  • x-cache-perma: header values containing Hit indicate the request was served from the permanent cache, else:

  • x-cpu-on-cache-miss: shows the file processing time (in milliseconds) spent on the request (if both of the above report Miss).

Cache resets

To reset your edge cache and permanent cache, click "Clear Cache" on the cache settings page in the Upload Dashboard.

Cache configuration

Upload's permanent cache can be configured via the URL (per request) and also via your account's settings (to control default cache behaviour).

Account settings

Your account's default cache behaviour is configured via the Upload Dashboard and determines:

  • Edge cache TTL duration.

    • The maximum amount of time a file will stay in a regional edge cache node.

    • Default: 1 year.

  • Permanent cache behaviour.

    • The strategy used to determine when to permanently cache a processed file.
    • Default: permanently cache files that take > 500 milliseconds to process.

Querystring parameters

You can override your account's default cache behaviour via the URL for each request:

  • ?v=123

    • Forces an edge cache miss and permanent cache miss each time 123 is changed to a unique value.

  • ?cache=false

    • Forces an edge cache miss and permanent cache miss on each request.

  • ?cache_ttl=31536000

    • Specifies the maximum time to store the file in the edge cache.

  • ?cache_perm=auto|false|true

    • Specifies whether to permanently cache the processed file.

    • Permanent caching adds ~100ms of latency to the initial request. This latency is incurred once per URL: when both the permanent cache and edge cache are missed (i.e. when the URL is first requested).

    • If auto is used, the file will be permanently cached if it takes > 500 milliseconds to process.

Your account's default cache behaviour is used for cache_ttl and cache_perm when they are omitted from the querystring.

Was this section helpful? Yes No

You are using an outdated browser.

This website requires a modern web browser -- the latest versions of these browsers are supported: