Skip to content

Commit

Permalink
Remove duplication on performance page for frontend caching proxies (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne authored and gasman committed Apr 29, 2024
1 parent b266e54 commit afbafd6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Expand Up @@ -9,6 +9,7 @@ Changelog
* Refactor redirects edit view to use the generic `EditView` and breadcrumbs (Rohit Sharma)
* Fix: Make `WAGTAILIMAGES_CHOOSER_PAGE_SIZE` setting functional again (Rohit Sharma)
* Fix: Enable `richtext` template tag to convert lazy translation values (Benjamin Bach)
* Docs: Remove duplicate section on frontend caching proxies from performance page (Jake Howard)


6.1 (xx.xx.xxxx) - IN DEVELOPMENT
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced_topics/images/image_serve_view.md
Expand Up @@ -123,7 +123,7 @@ urlpatterns = [
[django-sendfile](https://github.com/johnsensible/django-sendfile) offloads the job of transferring the image data to the web
server instead of serving it directly from the Django application. This could
greatly reduce server load in situations where your site has many images being
downloaded but you're unable to use a [](caching_proxy) or a CDN.
downloaded but you're unable to use a [caching proxy](performance_frontend_caching) or a CDN.

You first need to install and configure django-sendfile and configure your
web server to use it. If you haven't done this already, please refer to the
Expand Down
16 changes: 5 additions & 11 deletions docs/advanced_topics/performance.md
Expand Up @@ -60,16 +60,18 @@ The same can be achieved in Python using [`generate_image_url`](dynamic_image_ur

When using a queryset to render a list of images or objects with images, you can [prefetch the renditions](prefetching_image_renditions) needed with a single additional query. For long lists of items, or where multiple renditions are used for each item, this can provide a significant boost to performance.

(performance_page_urls)=
(performance_frontend_caching)=

## Frontend caching
## Frontend caching proxy

Many websites use a frontend cache such as Varnish, Squid, Cloudflare or CloudFront to gain extra performance. The downside of using a frontend cache though is that they don't respond well to updating content and will often keep an old version of a page cached after it has been updated.
Many websites use a frontend cache such as [Varnish](https://varnish-cache.org/), [Squid](http://www.squid-cache.org/), [Cloudflare](https://www.cloudflare.com/) or [CloudFront](https://aws.amazon.com/cloudfront/) to support high volumes of traffic with excellent response times. The downside of using a frontend cache though is that they don't respond well to updating content and will often keep an old version of a page cached after it has been updated.

Wagtail supports being [integrated](frontend_cache_purging) with many CDNs, so it can inform them when a page changes, so the cache can be cleared immediately and users see the changes sooner.

If you have multiple frontends configured (eg Cloudflare for one site, CloudFront for another), it's recommended to set the [`HOSTNAMES`](frontendcache_multiple_backends) key to the list of hostnames the backend can purge, to prevent unnecessary extra purge requests.

(performance_page_urls)=

## Page URLs

To fully resolve the URL of a page, Wagtail requires information from a few different sources.
Expand All @@ -90,14 +92,6 @@ Wagtail is tested on PostgreSQL, SQLite, and MySQL. It may work on some third-pa

We recommend PostgreSQL for production use, however, the choice of database ultimately depends on a combination of factors, including personal preference, team expertise, and specific project requirements. The most important aspect is to ensure that your selected database can meet the performance and scalability requirements of your project.

(caching_proxy)=

## Caching proxy

To support high volumes of traffic with excellent response times, we recommend a caching proxy. Both [Varnish](https://varnish-cache.org/) and [Squid](http://www.squid-cache.org/) have been tested in production. Hosted proxies like [Cloudflare](https://www.cloudflare.com/) should also work well.

Wagtail supports automatic cache invalidation for Varnish/Squid. See [](frontend_cache_purging) for more information.

### Image attributes

For some images, it may be beneficial to lazy load images, so the rest of the page can continue to load. It can be configured site-wide [](adding_default_attributes_to_images) or per-image [](image_tag_alt). For more details you can read about the [`loading='lazy'` attribute](https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading#images_and_iframes) and the [`'decoding='async'` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-decoding) or this [web.dev article on lazy loading images](https://web.dev/lazy-loading-images/).
Expand Down
3 changes: 2 additions & 1 deletion docs/releases/6.2.md
Expand Up @@ -26,7 +26,8 @@ depth: 1

### Documentation

* ...
* Remove duplicate section on frontend caching proxies from performance page (Jake Howard)


### Maintenance

Expand Down

0 comments on commit afbafd6

Please sign in to comment.