Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Optimize Performance

Whether you're fine-tuning global delivery or preparing for high-traffic scenarios, this section provides the tools and knowledge to make your project perform at its best.
Whether you're fine-tuning global delivery or preparing for high-traffic scenarios, you can find tools to make your project perform at its best.

With a combination of global content delivery, smart caching, and flexible hosting regions, you can ensure your users always get the fastest and most responsive experience
With a combination of global content delivery, smart caching, and flexible hosting regions, ensure your users always get the fastest and most responsive experience.

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><a href="manage-cdn-caching.md">CDN Caching and Optimizations</a></td><td>Deliver your content quickly and efficiently while handling spikes in traffic without compromising the experience for visitors. </td><td><a href="manage-cdn-caching.md">manage-cdn-caching.md</a></td><td><a href="../.gitbook/assets/Documentations Icons_Umbraco_CMS_Reference_Caching.png">Documentations Icons_Umbraco_CMS_Reference_Caching.png</a></td></tr><tr><td><a href="migrate-between-regions.md">Migrate between regions</a></td><td>Need to move your project closer to your primary audience? This article will help you migrate your project(s) from one region to another.</td><td><a href="migrate-between-regions.md">migrate-between-regions.md</a></td><td><a href="../.gitbook/assets/Documentations Icons_Umbraco_CMS_Implementation_Custom_Routing.png">Documentations Icons_Umbraco_CMS_Implementation_Custom_Routing.png</a></td></tr></tbody></table>
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,46 @@

After [adding hostnames](../../go-live/manage-hostnames/) to your project, it's possible to configure Content Delivery Network (CDN) Caching. This can be done for all or specific hostnames within your project.

These caching options all relate to the traffic that goes through your hostname from the origin (Umbraco Cloud) to the end-user i.e. the traffic of your website and assets from the webserver to the browser.
The caching options relate to the traffic that goes through your hostname from the origin (Umbraco Cloud) to the end-user. This is the traffic of your website and assets from the webserver to the browser.

The options that are currently available are:

* Enable Cache (default: On)
* Cache TTL (default: 120 minutes)
* Cache TTL: Time to Live (default: 120 minutes)
* Cache Everything (default: off)

![Default Options](../../build-and-customize-your-solution/set-up-your-project/project-settings/images/CDN-caching-default.png)

When a new hostname is added to a Project, the default settings will be applied. However, you can change the default settings for your project, so that the new hostnames will get the settings you have chosen. This also means that if you enable caching in the default settings and add a new hostname, that caching will be enabled for that new hostname.
When a new hostname is added to a Project, the default settings will be applied. However, you can change the default settings for your project so that the new hostnames will get the settings you have chosen. This means that when enabling caching in the default settings and adding a new hostname, caching is enabled for that new hostname.

## Caching Explained

When Caching is enabled on your project it means that static assets like CSS and images are going to be cached in the Content Delivery Network (CDN) used by Umbraco Cloud. How assets are cached is up to you, as you can control it through 'cache-control headers'.
When caching is enabled on your project static assets like CSS and images are cached in the Content Delivery Network (CDN) used by Umbraco Cloud. How assets are cached is up to you, as you can control it through 'cache-control headers'.

By default, Umbraco Cloud will enforce a minimum Time to Live (TTL) based on the Plan of your Umbraco Cloud Project, which means that assets cannot be cached for a shorter period than what your Plan allows. You can always choose a longer duration, especially, if you don't expect your assets to change.
By default, Umbraco Cloud enforces a minimum TTL based on the plan of your Umbraco Cloud Project. This means that assets cannot be cached for a shorter period than what your Plan allows. You can always choose a longer duration, especially, if you don't expect your assets to change.

These files types are cached as static assets through the CDN: '7z', 'csv', 'gif', 'midi', 'png', 'tif', 'zip', 'avi', 'doc', 'gz', 'mkv', 'ppt', 'tiff', 'zst', 'avif', 'docx', 'ico', 'mp3', 'pptx', 'ttf', 'apk', 'dmg', 'iso', 'mp4', 'ps', 'webm', 'bin', 'ejs', 'jar', 'ogg', 'rar', 'webp', 'bmp', 'eot', 'jpg', 'otf', 'svg', 'woff', 'bz2', 'eps', 'jpeg', 'pdf', 'svgz', 'woff2', 'class', 'exe', 'js', 'pict', 'swf', 'xls', 'css', 'flac', 'mid', 'pls', 'tar', 'xlsx'.
The following file types are cached as static assets through the CDN:

If you want to disable caching on certain types of static assets, you can use a 'no-cache' cache-control header, which will be respected by the caching strategy in the CDN. You can utilize an outbound rewrite rule to add such a cache-control header to the request.
| `7z` | `ppt` | `webm` | `bz2` |
| `csv` | `tiff` | `bin` | `eps` |
| `gif` | `zst` | `ejs` | `jpeg` |
| `midi`| `avif` | `jar` | `pdf` |
| `png` | `docx` | `ogg` | `svgz` |
| `tif` | `ico` | `rar` | `woff2` |
| `zip` | `mp3` | `webp` | `class` |
| `avi` | `pptx` | `bmp` | `exe` |
| `doc` | `ttf` | `eot` | `js` |
| `gz` | `apk` | `jpg` | `pict` |
| `mkv` | `dmg` | `otf` | `swf` |
| `ps` | `iso` | `svg` | `xls` |
| `mp4` | `css` | `woff` | `flac` |
| `pls` | `mid` | `tar` | `xlsx` |

If you want to disable caching on certain types of static assets, you can use a 'no-cache' cache-control header. This will be respected by the caching strategy in the CDN. You can utilize an outbound rewrite rule to add such a cache-control header to the request.

The following example adds a cache-control header with 'no-cache' as the value when the requested Url contains a PDF file:

```
```xml
<rewrite>
<outboundRules>
<rule name="Set Cache-Control - No-Cache PDF">
Expand Down Expand Up @@ -54,7 +69,8 @@ When **Cache Everything** is enabled, everything including the webpage is cached
When a webpage is cached, it will be stripped of any cookies that are otherwise part of the request. If you use cookies as part of the website, be aware of the implications of using Cache Everything.
{% endhint %}

When using Cache Everything you should use a Cache TTL, which matches the Editor's expectations of when the webpage is refreshed with a new version loaded from the origin. As an example, choosing a Cache TTL of 2 hours means that the webpage will be served from the cache for 2 hours and then it will be refreshed with a copy from the origin. If Editors make changes every 30 minutes, they will have to wait at least two hours until they can see the changes on the website.

When using Cache TTL, the Editor's expectations of when the webpage is refreshed is matched with a new version loaded from the origin. As an example, choosing a Cache TTL of 2 hours means that the webpage will be served from the cache for 2 hours. Then it will be refreshed with a copy from the origin. If Editors make changes every 30 minutes, they will have to wait at least two hours until they can see the changes on the website.

{% hint style="warning" %}
We recommend using Cache Everything with caution.
Expand All @@ -64,13 +80,13 @@ We recommend using Cache Everything with caution.

![Purge Cache](../../build-and-customize-your-solution/set-up-your-project/project-settings/images/CDN-purge.png)

When assets are cached for a long time and you need to refresh them, you can choose to purge the CDN cache to remove everything from the cache and force a refresh. This can be useful after having deployed changes to JS and CSS files, which are cached in the CDN. If you have caching enabled, you can purge the cache in the Purge Cache section at the bottom of the page.
When you need to refresh cached assets, you can purge the CDN cache to remove everything and force a refresh. This can be useful after having deployed changes to JS and CSS files, which are cached in the CDN. If you have caching enabled, you can purge the cache in the Purge Cache section at the bottom of the page.

Cache purging is done per hostname and it can take up to 30 seconds before assets are completely gone from the CDN, as it's refreshed globally.
Cache purging is done per hostname and can take up to 30 seconds before assets are gone from the CDN, as it's refreshed globally.

By default, all hostnames are selected, but you can choose to purge specific hostnames from the environments in your Umbraco Cloud project.

Purging the cache is a heavy operation, so there is a constraint on how many purge requests can be done within 24 hours. The 24 hours starts from the moment you Purge. So if you have 2 Purge requests available and Purge twice within an hour, then you can Purge again in 23 hours (for the first Purge request) and then again in 24 hours (for the second Purge request).
Purging the cache is a heavy operation, so there is a constraint on how many purge requests can be done within 24 hours. The 24 hours starts from the moment you Purge. If you have 2 Purge requests available and Purge twice within an hour, you can Purge again in 23 hours and then 24 hours.

In the Purge Cache section, you can see how many Purge requests you have available and when.

Expand Down Expand Up @@ -108,12 +124,12 @@ The number of Cache Purge requests within 24 hours:

## CDN Caching and Optimizations

From your Umbraco Cloud Project, click **CDN Caching & Optimization** from the **Settings** dropdown to configure the caching options. All settings are scoped per environment, so if you have multiple environments and add your hostnames to different environments you can select the environment at the top of the page.
From your Umbraco Cloud Project, click **CDN Caching & Optimization** from the **Settings** dropdown to configure the caching options. All settings are scoped per environment. This means that if you have multiple environments you can select the specific environment at the top of the page.

Aside from environments, the CDN Caching & Optimization page is divided into two parts: **Default Settings** and **Hostname Specific Settings**.

![Default Settings](../../build-and-customize-your-solution/set-up-your-project/project-settings/images/CDN-caching-hostname.png)

Use the **Default settings** to configure default settings that should be applied to new and existing hostnames.

If you want to have different caching options for different hostnames, then select the hostname under **Hostname-specific settings** and adjust the options for that specific hostname. This might be useful if you want to test the different options on another hostname than your primary hostname.
If you want to have different caching options for different hostnames, select the hostname under **Hostname-specific settings** and adjust the options. This might be useful if you want to test the different options on another hostname than your primary hostname.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ The East US and West EU regions will be used as examples in this article.
* A local setup that can run an Umbraco instance. Learn more about this in the [Requirements](https://docs.umbraco.com/umbraco-cms/fundamentals/setup/requirements) article.

{% hint style="info" %}
If you want to migrate an Umbraco 8 project, you will need to upgrade to the latest supported [Long-Term-Supported (LTS)](https://umbraco.com/products/knowledge-center/long-term-support-and-end-of-life/) version of Umbraco CMS.

If you want to migrate an Umbraco 8 project, you must upgrade to the latest supported [Long-Term-Supported (LTS)](https://umbraco.com/products/knowledge-center/long-term-support-and-end-of-life/) version of Umbraco CMS.

{% endhint %}

## Prepare your projects
Expand Down