CDN
From the Instance on the Side Navigation choose Settings -> CDN.
CDN works only for instances that don't use Basic Auth and are deployed to Alokai Console and Google Cloud Platform.
Caching allows saving pages rendered on the server for later use to avoid computationally expensive rendering from scratch when possible. This is especially useful when the application has pages that require a lot of computation, make many API calls, or change infrequently. It not only reduces the load on the server but also significantly improves performance.
When a request from the end user using a web browser is being sent to the origin server (hosting the website) the page needs to be built on the server and sent back to the user. This process takes more time to render the content which is not an advantage when end user visits the website for the first time.
When a CDN feature is implemented, and the first visitor enters the website, the flow looks like follows:
- CDN verifies whether the content is cached; if not, the CDN reaches the origin server,
- The end user needs to wait for the website to be built on the origin server,
- When the website is built, the origin server sends a page to the CDN endpoint,
- CDN conducts the process to cache the page,
- Finally, CDN sends the content to the site's visitor
- Of course, this flow also takes a bit longer, but only for the first time. When the second, and further visitors enter the website for the same content, CDN replies immediately because the content is already cached. This is the biggest advantage of using SSR and CDN combined.
Using a CDN offers a few significant benefits:
- Load times performance improvements,
- Protections against common cyber-attacks, for instance DDoS,
- Reliability is increased.
When CDN feature is enabled, then only gzip compression is available.
Enable CDN
CDN is responsible for caching Storefront Application Responses. It is available only in instances that don't use Basic Auth. To enable CDN for your instance, click the toggle button on the right side of the CDN card so that it changes the state to enabled.
If you would like to learn more about CDN and SSR Cache, visit Alokai Cloud documentation here.