A content delivery network (CDN) reduces the load time of static content by storing cached versions in multiple geographic locations. Salesforce has a setting that enables Lightning Experience to leverage Akamai’s CDN with a simple click of a checkbox in Setup.

In this post, we explore how a CDN can boost performance. We present how it applies to the Salesforce Platform and we give some guidance on how to enable it for your org.

What is a content delivery network?

Diagram showing how content is more efficiently served from the CDN vs. served directly from Salesforce Data Centers leading to faster response time.

All of the assets used to render your site are stored in your company’s Salesforce instance. Your company’s instance is stored on one of Salesforce’s servers. The farther away your users are from the server where your instance is stored, the longer it takes to get assets to their computer and your site’s pages.

A content delivery network (CDN) is a geographically distributed network of servers that store cached versions of web assets. CDN minimizes delays in loading web page content by reducing the distance between the server and the user. It also increases the number of requests that the server can respond to since the CDN offloads a large portion of the server requests. By reducing the distance between the server and the user and increasing content availability and redundancy, CDNs improve website load times and site performance.

What happens when a CDN is enabled?

Caching on our CDN improves the performance and scale of your site. When your users access a site served by the Salesforce CDN, cached content is served directly from CDN servers. CDN servers are distributed globally and are often closer to your users than Salesforce servers. Because cached content is served directly from CDN servers, your users experience faster load times routinely and in times of high traffic. CDN caching can work with browser-side caching, which also improves performance.

When a CDN is enabled, it turns on CDN delivery for the static JavaScript and JSON files in the Lightning component framework that powers Lightning Experience. It does not distribute your Salesforce data or metadata in a CDN.

While enabling this feature is simple, our data shows that only 52% of Salesforce customers have it enabled. This setting is disabled by default for orgs created before the Winter ’19 release and is enabled by default for new orgs and all new and existing Experience Builder sites.

Steps to enable the CDN

From Setup, enter Session in the Quick Find box, and then select Session Settings.
Select the checkbox for “Enable Content Delivery Network (CDN) for Lightning Component framework.”
Click Save.

A CDN generally speeds up page load time. For a cold boot of Lightning Experience, we’ve found on average an improvement of 15% in load time for the 75th percentile of users.

The CDN also changes the source domain that serves the files. If your company has IP range restrictions for content served from Salesforce, test thoroughly before enabling this setting.

If you experience any issues, ask your IT department if your company’s firewall blocks any Akamai CDN content. Your IT department should ensure that https://static.lightning.force.com is added to any allowlist or firewall that your company operates. You can ping static.lightning.force.com, but you can’t browse directly to the root URL at https://static.lightning.force.com.

Important note

Don’t use IP addresses for network filtering because that can cause connectivity issues with https://static.lightning.force.com. IP addresses for https://static.lightning.force.com are dynamic and aren’t maintained in Salesforce’s list of allowed IP addresses.

Resources

About the authors

Eric Perret is Principal Engineer for the Lightning Web Runtime Services and Lightning Experience Performance teams. Find him online at https://www.ericperrets.info .

Ahmed Ghanem is Director of Product Management for Lightning Web Platform Teams. You can follow him on LinkedIn.

Greg Whitworth is Senior Director of LWC, LWR & the Standards & Web Platform teams. You can follow him on Twitter and LinkedIn.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS