CDN & Caching
At Candu, we go to great length to ensure that any component that we load will be served to your customers extremely quickly. Since the very beginning, we've have always implemented a High Avaliability Architecture, with a strong focus on Performance & Reliability.
In this article, we'll be discussing some of our caching choices and how they will impact your customer experience.
Strategy overview
To provide the best customer experience, we adopt a tiered strategy across several network layers:
- Browser caching: Browser caching refers to the process of storing web resources on the client's web browser. When a user visits a website, the browser downloads these resources and stores them locally. The next time the user accesses the same website, the browser checks if it already has a cached copy of the requested resource before fetching it from the server. If a cached copy exists and is still valid the browser retrieves the resource from its local cache.
- Edge caching: Edge caching, also known as content delivery network (CDN) caching, takes place at the edge servers distributed in various geographical locations. CDNs consist of a network of servers located closer to end users. Candu uses Cloudflare as CDN. When a user requests a resource, the CDN's edge server closest to the user's location handles the request. If the requested resource is already cached on the edge server, it is delivered directly to the user without having to traverse the entire network path to the origin server.
Content
Content is served as json
from https://cdn.candu.ai/contentDocument
. We adopt the following strategy:
- Browser cache: 5 minutes.
- Edge cache: at least 4 hours. Cache is invalidated when a content is published.
If you publish a new content version, changes will be seen by all your users within 5 minutes, depending on when the asset was stored in their browser cache.
Changes to the segment membership will automatically invalidate the cache.
Placements and Configuration
Placements and configuration are served as json
from https://cdn.canud.ai/config
. We adopt the following strategy:
- Browser cache: 5 minutes.
- Edge cache: at least 4 hours. Cache is invalidated when there are changes to placements.
If you update any placement, changes will be seen by all your users within 5 minutes, depending on when the asset was stored in their browser cache.
CSS assets
Given that css assets play a big role in the end user experience we employ the following strategies:
- Browser cache: 5 minutes. Some assets that already have versioning build in will have longer caching since they will expire immediately when a new version is published.
- Edge cache: at least 4 hours. Cache is invalidated when are changes to placements.
SDK
Since the SDK is not updated often, we have a much longer caching strategy.
- Browser cache: 4 hours.
- Edge cache: at least 4 hours. Cache invalidation is managed exclusively by Candu engineers when releasing new versions.
Updated 6 months ago