Skip to main content
SaaS|Frontend Developer / Performance Engineer

Website Speed & Performance Optimization

Analyze compression, caching, protocols, and page weight for faster load times

Every 100ms of latency costs conversions. EdgeDNS audits compression, cache, HTTP/2 + HTTP/3 (DNS-confirmed via HTTPS RR), resource hints with fetchpriority and crossorigin validation, redirect chains, and page weight — and pulls real-user Core Web Vitals from Chrome's CrUX dataset so synthetic measurements line up with what visitors actually experience.

The Challenge

Performance regressions creep in silently — a deploy disables Brotli compression, a CDN change drops cache headers, a third-party script doubles page weight, a redirect chain adds 300ms of latency. Without continuous monitoring AND real-user data, these issues compound until visitors leave and Core Web Vitals fail.

The Solution

Use EdgeDNS performance APIs to continuously verify compression (gzip/Brotli/zstd with quality-level hints), cache headers (RFC 9111 + CDN-targeted directives like Cloudflare-CDN-Cache-Control), HTTP/2 and HTTP/3 availability (confirmed via HTTPS DNS records, RFC 9460), resource hints (including fetchpriority and crossorigin correctness), redirect chains (with hop categorization and canonical-mismatch detection), and total page weight (with third-party origin bucketing and image-format audit). The composite performance score blends synthetic measurements with CrUX real-user field data — so you see both what you build and what users experience.

Endpoints Used

Combine these EdgeDNS endpoints to build this solution.

GET
/v1/domain/compressionTry in Playground

Compression Check: Verify gzip, Brotli, and zstd support with compression ratios, quality-level hints, and double-encoding diagnosis

GET
/v1/domain/cacheTry in Playground

Cache Headers: Analyze Cache-Control, ETag validation, CDN-targeted directives (CDN-Cache-Control, Surrogate-Control), and remaining-fresh-time at the edge

GET
/v1/domain/http-versionTry in Playground

HTTP Version: Check HTTP/2 and HTTP/3 support, DNS-confirmed via HTTPS DNS record (RFC 9460), plus 103 Early Hints capability

GET
/v1/domain/resource-hintsTry in Playground

Resource Hints: Discover preconnect, preload, fetchpriority, Speculation Rules; validate crossorigin and `as=` attributes; detect duplicate hints

GET
/v1/domain/redirectTry in Playground

Redirect Chain: Trace redirect hops with category labels (protocol-upgrade, canonical, mixed-content, open-redirect-suspect), follow meta-refresh, and optionally compare final URL to its rel=canonical

GET
/v1/domain/response-timeTry in Playground

Response Time: Measure TTFB with p90/p95/p99 tail latencies (web.dev 2026 thresholds) and parse Server-Timing for per-component backend breakdown

GET
/v1/domain/page-weightTry in Playground

Page Weight: Total size + breakdown by resource type, third-party origin bucketing, image-format audit (JPEG/PNG → AVIF/WebP), font-display coverage, LCP candidate heuristic, render-blocking ranking

GET
/v1/score/performanceTry in Playground

Performance Score: Composite 0-100 score blending synthetic measurements with CrUX real-user Core Web Vitals (LCP/INP/CLS/TTFB p75) by form factor

GET
/v1/domain/search-readinessTry in Playground

Search Readiness: Detect soft 404s, mixed content, and missing security headers — the silent regressions that hurt both UX and rankings

Results You Can Achieve

Synthetic + real-user CWV in one score

The performance score endpoint pulls CrUX field data alongside synthetic measurements — see what you build and what real visitors actually experience, with per-form-factor breakdown (phone vs desktop).

DNS-confirmed HTTP version detection

HTTP/2 and HTTP/3 support is verified via the authoritative HTTPS DNS record (RFC 9460) when published — no more "inferred" credit for HTTP/1.1-only origins masquerading as modern.

Third-party weight breakdown by origin

Page weight is bucketed by registrable origin and tagged first-party vs third-party. The single line "3rd parties = 62% of weight" drives more fixes than any synthetic score.

Modern resource-hint validation

Detects fetchpriority on the LCP image, validates crossorigin on font preloads (a silent LCP killer), surfaces missing `as=` (preloads that browsers ignore), and parses the Speculation Rules API.

Tail latency + Server-Timing backend attribution

p90/p95/p99 TTFB for SRE-grade visibility, plus Server-Timing parsing so a single "db=180ms, render=22ms" line tells you whether the bottleneck is database or app code.

Pre-deploy CI gate for performance regressions

Run the same audit in CI; fail the pipeline if compression, cache headers, HTTP/2 confidence, or security headers regress before users see it.

Page weight + 3G / 4G / broadband estimated load times

Protocol-aware load-time model (HTTP/2 multiplexing halves serial-connection penalty) across three connection profiles for performance-budget enforcement.

Code Example

Run a performance audit in CI/CD

javascript
const domain = 'staging.example.com';
const headers = { 'Authorization': 'Bearer YOUR_API_KEY' };

const [compression, cache, httpVersion, pageWeight, score, readiness] = await Promise.all([
  fetch(`https://api.edgedns.dev/v1/domain/compression?domain=${domain}`, { headers }),
  fetch(`https://api.edgedns.dev/v1/domain/cache?domain=${domain}`, { headers }),
  fetch(`https://api.edgedns.dev/v1/domain/http-version?domain=${domain}`, { headers }),
  fetch(`https://api.edgedns.dev/v1/domain/page-weight?domain=${domain}`, { headers }),
  fetch(`https://api.edgedns.dev/v1/score/performance?domain=${domain}`, { headers }),
  fetch(`https://api.edgedns.dev/v1/domain/search-readiness?domain=${domain}`, { headers }),
].map(p => p.then(r => r.json())));

const issues = [];

// Compression — recognize zstd alongside gzip/brotli
if (!compression.data.isCompressed) issues.push('Compression disabled');

// Cache — flag broken ETag validation (origin sets ETag but ignores If-None-Match)
if (!cache.data.isCacheable) issues.push('Response not cacheable');
if (cache.data.etag && cache.data.etagValidates === false) issues.push('ETag set but does not return 304');

// HTTP version — require DNS-confirmed HTTP/2 (HTTPS RR), not just "inferred"
if (httpVersion.data.http2Confidence === 'inferred') {
  issues.push('HTTP/2 not DNS-confirmed — publish an HTTPS DNS record with alpn=h2,h3');
}

// Page weight — enforce budget AND flag uncompressed assets / heavy third parties
if (pageWeight.data.totalSizeBytes > 2_000_000) issues.push('Page exceeds 2MB budget');
const thirdPartyPct = pageWeight.data.byOrigin
  ?.filter((o) => o.isThirdParty)
  .reduce((s, o) => s + o.percentage, 0) ?? 0;
if (thirdPartyPct >= 50) issues.push(`Third-party assets are ${thirdPartyPct.toFixed(0)}% of page weight`);
if (pageWeight.data.imageFormatAudit?.length > 0) {
  issues.push(`${pageWeight.data.imageFormatAudit.length} large images could move to AVIF/WebP`);
}

// Score — synthetic floor + CrUX field-data overlay
if (score.data.score < 80) issues.push(`Performance score is ${score.data.score} (target ≥ 80)`);
const lcpP75 = score.data.cwv?.byFormFactor?.all?.lcp?.value;
if (lcpP75 && lcpP75 > 2500) issues.push(`Real-user LCP p75 is ${Math.round(lcpP75)}ms (CWV threshold: 2500ms)`);

// Search-readiness regressions
if (readiness.data.softFourOhFour?.detected) issues.push('Soft 404 detected on homepage');
if ((readiness.data.mixedContent?.issues?.length ?? 0) > 0) issues.push('Mixed content present');
if (!readiness.data.securityHeaders?.hasCsp) issues.push('Missing Content-Security-Policy');

if (issues.length > 0) {
  console.error('Performance gate FAILED:', issues);
  // Sorted recommendations with estimated point impact tell you what to fix first
  console.error('Top fixes:', score.data.recommendationsWithImpact?.slice(0, 3));
  process.exit(1);
}
console.log('Performance gate PASSED — grade', score.data.grade);

Learn More

Explore industry standards and best practices related to this use case.

Ready to build Website Speed & Performance Optimization?

Get started with 200 free API requests per month. No credit card required.

Other Use Cases