Treat content compression and DNS lookup performance as separate tasks. For content, enable compression, precompress static resources that change infrequently, and use browser caching. For DNS, evaluate providers’ lookup speeds and DNS response caching settings. Compressing files does not shorten DNS lookup times, and switching to Nginx or APC does not directly resolve DNS delays either. These approaches address different stages and cannot replace one another.
Distinguish between on-the-fly compression and precompression of static resources
A 2020 Semrush article notes that, after enabling Gzip or Brotli, you can adjust your compression approach based on how the content changes. Content generated on the fly cannot be compressed in advance. Resources such as CSS and JavaScript that remain unchanged for a period of time can be precompressed, with the server configured to serve the compressed versions.
- Dynamic content: Compress content as it is generated rather than simply applying the approach used for static files.
- Static resources: Precompress files using higher compression levels, such as Brotli 11. The article cautions that these levels are generally unsuitable for on-the-fly compression because processing is too slow.
- Repeat visits: Use browser caching so returning visitors do not need to download unchanged resources again. Compression reduces file size, while caching reduces repeat downloads.
For example, a stylesheet that will not be modified for a while can be compressed before it is served to users, rather than processed again for every request. However, you should not expect the same resource savings on every website.
Resize images first, then compare file size and image quality
The highest possible resolution should not be the sole goal for images. A 2024 Semrush article recommends resizing and compressing large images before uploading them, and suggests using WebP or AVIF. Image processing is separate from text compression; enabling server compression alone does not complete image optimization.
A 2023 article by 大文西 divides image compression into lossy and lossless types; lossy compression removes some image information. When choosing an image version, compare file sizes and check whether the image quality is acceptable, rather than simply choosing the smallest file. For example, product photos can first be resized to appropriate display dimensions, then checked for visible artifacts after compression.
DNS improvements address resolution speed, not file size
When a domain name needs to be resolved, the browser must obtain its IP address before it can connect and send an HTTP request. To reduce time to first byte, the 2020 Semrush article therefore recommends considering DNS lookup time as well as how quickly the server delivers content.
- Consider switching to a faster DNS provider to reduce resolution delays.
- Consider increasing the TTL of DNS responses so recursive resolvers keep cached responses longer, reducing the time needed for subsequent lookups.
These are approaches suggested by the article, not a single set of settings suitable for every website. The article does not provide TTL values suitable for every site or establish which provider is currently the fastest. Comparisons from that time should therefore not be used directly to decide which provider to choose today.
Content compression and DNS lookup performance: perspectives from across the web
Should you switch between different CDN hosts to speed up a website?
Not necessarily. An answer on Stack Exchange notes that switching to a different CDN host may require users to download another copy of the same file. If there is no need to distribute the load across CDNs, that answer recommends sticking with a single CDN. This advice concerns repeat downloads and load distribution; it does not establish which configuration will necessarily deliver faster DNS lookups.
What can you do if there are too many JavaScript files or they are not cached?
Ask developers to assess whether related scripts can be combined, and check the platform's or hosting service's compression and caching settings. Semrush notes that when a page depends on many separate JavaScript files, the numerous requests may slow loading; uncached scripts are downloaded again on every visit. You can also consider deferring nonessential scripts until after the main content has loaded.
Which formats can you test when you need to preserve high image quality?
You can test AVIF and JPEG XL, then compare actual file sizes and image quality. According to the Chrome team, JPEG XL offers greater compression efficiency than JPEG and supports lossless compression and HDR. JPEG XL may be particularly worth considering if you need lossless compression or want to preserve more image detail, especially in photographs. These formats are worth testing, but results will not necessarily be the same for every image.
References
- Two URL CDNs are better than one for SEO and Speed?webmasters.stackexchange.com — Discusses: Should you switch between different CDN hosts to speed up a website?
- JavaScript Explained for Beginners: What It Is and Why It Matterswww.semrush.com · 2021-09-01T13:57:00Z — Discusses: What can you do if there are too many JavaScript files or they are not cached?
- Google Images & Discover Previews Don’t Support JPEG XLwww.searchenginejournal.com · 2026-10-21T13:00:00+00:00 — Discusses: Which formats can you test when you need to preserve high image quality?
- 13種圖片壓縮工具比較,提昇網站效能與SEO排名www.da-vinci.com.tw · 2023-04-24T10:20:06+08:00 — Source used in the article above.
- 7-Step Ecommerce Website Audit to Boost Conversionswww.semrush.com · 2024-05-14T08:30:00Z — Source used in the article above.
- Is 100/100 PageSpeed score enough? The answer is No.www.semrush.com · 2020-07-30T13:00:00Z — Source used in the article above.
