last reviewed by Netlify Support in June 2024
This article will describe our most frequent performance troubleshooting caveats and advice, for speeding up your Netlify site.
Our CDN may behave a bit differently than you or your typical benchmarking tools expect. When you say your site is slow, this is what we check on:
- Is DNS configured correctly, to leverage our CDN? Also: are you proxying to us, which adds a hop to any pageload and will thus slow down every pageload?
- Are you using any custom caching settings? We review them to ensure you aren’t preventing safe types of caching (essentially: do you change
cache-control: max-age=0,public,must-revalidate
to something more restrictive?) and we also check how well your site makes use of our caching model by not changing unnecessarily many files with each deploy. - Check your auth. Make sure you’re not using the
Basic Auth
type of password protection, since HTTP basic auth protected content cannot be cached on our CDN, as authentication is done at the origin, not the edge. Our other types of protection, including Identity service using JWT’s, and all of our other team-wide & site-wide protection do all authenticate with good performance, at the edge. - Consider what content needs to be dynamic. If your page has consistent content between deploys, you should not be using a lambda function - SSR nor ISR to render it! If your lambda output can be cached, prefer ISR to SSR, to allow our CDN to temporarily cache the output to save visitors in the near-term future from having to wait for your lambda to run again. If your images don’t need to be resized dynamically, don’t set up your site to do that. If you have an Edge Function running on every asset load for your site - are you sure it needs to run for all of them? Could you perhaps apply it more selectively?
- You’re only as fast as your backend. If you proxy to another service or call functions, keep in mind that we can’t accelerate those things nor control how fast they respond. If your functions are running slowly check out this guide on how to troubleshoot why they are slow
- Keep in mind that our CDN caches opportunistically and cache is per-node; busy sites (excluding dynamic/un-cacheable content such as SSR for Next.js or Gatsby sites) are served from cache. Most locations have several nodes, so you may need to reload several times to get your content cached in your nearest location when testing a new page or site.
- Our CDN does not effectively cache large files (several megabytes and larger); keep things small.
Finally, please keep in mind that automated performance or load testing is forbidden without specific written permission from our team by our terms of service - and we generally don’t grant that permission below the Enterprise account level, so if you see some sporadically slow behavior, setting up a 10,000 page load test might lead to more consistent results, but it could also lead to us deactivating your account. So, please follow the guidance below for help in diagnosing, instead!
Still have trouble? Please send us a HAR file (preferrered) demonstrating the issue - after scrubbing it of sensitive details using https://har-sanitizer.pages.dev/ (please make sure to only redact the Authorization
field, and any other sensitive tokens as well as any cookies excepting ones that start with nf_
which are all safe to share)! Or at a minimum, you can send us the x-nf-request-id for a slow request. Then, we’ll be happy to investigate.