Click Below to Get the Code

Browse, clone, and build from real-world templates powered by Harper.
Tutorial
GitHub Logo

Resource Hints Explained | Preload, Preconnect, and Early Hints

Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.
Tutorial

Resource Hints Explained | Preload, Preconnect, and Early Hints

By
Joseph Yoo
June 4, 2025
By
Joseph Yoo
June 4, 2025
By
Joseph Yoo
June 4, 2025
June 4, 2025
Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.
Joseph Yoo
Forward Deployed Engineer

Resource hints like preload, preconnect, and early hints are essential tools for improving web performance, particularly when optimizing for metrics like LCP (Largest Contentful Paint) and TTFB (Time to First Byte). In this article, we walk through real-world examples, demonstrating the measurable impact of each hint.

‍

‍

Baseline: No Resource Hint

HTML File: no-preload.html
JavaScript File: loader.js

This setup loads an HTML file, which loads a JavaScript file, which then loads an image. Each step incurs its own latency.

<!-- no-preload.html -->
<html>
  <head></head>
  <body>
    <script src="../javascript/loader.js"></script>
  </body>
</html>

// loader.js
const img = new Image();
img.src = "../images/background.png";
document.body.appendChild(img);

Impact: Each asset waits for the previous to load before it begins, compounding latency.

‍

Client-Side Preload

HTML File: client-preload.html

By adding a <link rel="preload"> tag, we instruct the browser to fetch the image early—even before the JS requests it.

<link rel="preload" as="image" href="../images/background.png" />
<script src="../javascript/loader.js"></script>

Impact: The browser downloads the image in parallel with the JS file, saving one round-trip time.

‍

Early Hints Preload

HTML File: eh-preload.html

This version moves the preload hint to the server using an HTTP 103 Early Hints response:

HTTP/1.1 103 Early Hints
Link: </images/background.png>; rel=preload; as=image

HTTP/1.1 200 OK
Content-Type: text/html

Impact: Resources start loading before the full response even arrives, outperforming client-side preload.

‍

Client-Side Preconnect

HTML File: client-preconnect.html
JavaScript File: cdn-loader.js

In cases where only the domain of a resource is known, use preconnect:

<link rel="preconnect" href="https://cdn.example.com" />
<script src="https://cdn.example.com/cdn-loader.js"></script>
// cdn-loader.js
const img = new Image();
img.src = "https://img.example.com/background.png";
document.body.appendChild(img);

Impact: Reduces DNS, TCP, and TLS setup times for third-party resources, typically saving 100–300ms.

‍

Early Hints Preconnect

HTML File: eh-preconnect.html

Move the preconnect instruction to the server to get the benefits even earlier:

HTTP/1.1 103 Early Hints
Link: <https://cdn.example.com>; rel=preconnect
Link: <https://img.example.com>; rel=preconnect

HTTP/1.1 200 OK

Impact: Provides the most aggressive latency reduction for third-party connections.

‍

Key Takeaways

Focus your resource hints on LCP-contributing elements like large images, web fonts, or hero banners, and wherever possible, leverage Early Hints for the best performance. These optimizations not only improve load time and user experience but also contribute to higher search engine rankings. Just remember, more isn’t always better. Target only the assets that impact the initial user experience to avoid unnecessary overhead.

Resource hints like preload, preconnect, and early hints are essential tools for improving web performance, particularly when optimizing for metrics like LCP (Largest Contentful Paint) and TTFB (Time to First Byte). In this article, we walk through real-world examples, demonstrating the measurable impact of each hint.

‍

‍

Baseline: No Resource Hint

HTML File: no-preload.html
JavaScript File: loader.js

This setup loads an HTML file, which loads a JavaScript file, which then loads an image. Each step incurs its own latency.

<!-- no-preload.html -->
<html>
  <head></head>
  <body>
    <script src="../javascript/loader.js"></script>
  </body>
</html>

// loader.js
const img = new Image();
img.src = "../images/background.png";
document.body.appendChild(img);

Impact: Each asset waits for the previous to load before it begins, compounding latency.

‍

Client-Side Preload

HTML File: client-preload.html

By adding a <link rel="preload"> tag, we instruct the browser to fetch the image early—even before the JS requests it.

<link rel="preload" as="image" href="../images/background.png" />
<script src="../javascript/loader.js"></script>

Impact: The browser downloads the image in parallel with the JS file, saving one round-trip time.

‍

Early Hints Preload

HTML File: eh-preload.html

This version moves the preload hint to the server using an HTTP 103 Early Hints response:

HTTP/1.1 103 Early Hints
Link: </images/background.png>; rel=preload; as=image

HTTP/1.1 200 OK
Content-Type: text/html

Impact: Resources start loading before the full response even arrives, outperforming client-side preload.

‍

Client-Side Preconnect

HTML File: client-preconnect.html
JavaScript File: cdn-loader.js

In cases where only the domain of a resource is known, use preconnect:

<link rel="preconnect" href="https://cdn.example.com" />
<script src="https://cdn.example.com/cdn-loader.js"></script>
// cdn-loader.js
const img = new Image();
img.src = "https://img.example.com/background.png";
document.body.appendChild(img);

Impact: Reduces DNS, TCP, and TLS setup times for third-party resources, typically saving 100–300ms.

‍

Early Hints Preconnect

HTML File: eh-preconnect.html

Move the preconnect instruction to the server to get the benefits even earlier:

HTTP/1.1 103 Early Hints
Link: <https://cdn.example.com>; rel=preconnect
Link: <https://img.example.com>; rel=preconnect

HTTP/1.1 200 OK

Impact: Provides the most aggressive latency reduction for third-party connections.

‍

Key Takeaways

Focus your resource hints on LCP-contributing elements like large images, web fonts, or hero banners, and wherever possible, leverage Early Hints for the best performance. These optimizations not only improve load time and user experience but also contribute to higher search engine rankings. Just remember, more isn’t always better. Target only the assets that impact the initial user experience to avoid unnecessary overhead.

Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.

Download

White arrow pointing right
Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.

Download

White arrow pointing right
Discover how resource hints like preload, preconnect, and Early Hints can dramatically boost web performance. Learn how each hint impacts key metrics like LCP and TTFB, with practical examples and implementation strategies to speed up page load and enhance user experience.

Download

White arrow pointing right

Explore Recent Resources

Tutorial
GitHub Logo

Real-Time Pub/Sub Without the Stack

Explore a real-time pub/sub architecture where MQTT, WebSockets, Server-Sent Events, and REST work together with persistent data storage in one end-to-end system, enabling real-time interoperability, stateful messaging, and simplified service-to-device and browser communication.
Harper Learn
Tutorial
Explore a real-time pub/sub architecture where MQTT, WebSockets, Server-Sent Events, and REST work together with persistent data storage in one end-to-end system, enabling real-time interoperability, stateful messaging, and simplified service-to-device and browser communication.
A man with short dark hair, glasses, and a goatee smiles slightly, wearing a black shirt in front of a nature background.
Ivan R. Judson, Ph.D.
Distinguished Solution Architect
Tutorial

Real-Time Pub/Sub Without the Stack

Explore a real-time pub/sub architecture where MQTT, WebSockets, Server-Sent Events, and REST work together with persistent data storage in one end-to-end system, enabling real-time interoperability, stateful messaging, and simplified service-to-device and browser communication.
Ivan R. Judson, Ph.D.
Jan 2026
Tutorial

Real-Time Pub/Sub Without the Stack

Explore a real-time pub/sub architecture where MQTT, WebSockets, Server-Sent Events, and REST work together with persistent data storage in one end-to-end system, enabling real-time interoperability, stateful messaging, and simplified service-to-device and browser communication.
Ivan R. Judson, Ph.D.
Tutorial

Real-Time Pub/Sub Without the Stack

Explore a real-time pub/sub architecture where MQTT, WebSockets, Server-Sent Events, and REST work together with persistent data storage in one end-to-end system, enabling real-time interoperability, stateful messaging, and simplified service-to-device and browser communication.
Ivan R. Judson, Ph.D.
News
GitHub Logo

Harper Recognized on Built In’s 2026 Best Places to Work in Colorado Lists

Harper is honored as a Built In 2026 Best Startup to Work For and Best Place to Work in Colorado, recognizing its people-first culture, strong employee experience, and values of accountability, authenticity, empowerment, focus, and transparency that help teams thrive and grow together.
Announcement
News
Harper is honored as a Built In 2026 Best Startup to Work For and Best Place to Work in Colorado, recognizing its people-first culture, strong employee experience, and values of accountability, authenticity, empowerment, focus, and transparency that help teams thrive and grow together.
Colorful geometric illustration of a dog's head resembling folded paper art in shades of teal and pink.
Harper
News

Harper Recognized on Built In’s 2026 Best Places to Work in Colorado Lists

Harper is honored as a Built In 2026 Best Startup to Work For and Best Place to Work in Colorado, recognizing its people-first culture, strong employee experience, and values of accountability, authenticity, empowerment, focus, and transparency that help teams thrive and grow together.
Harper
Jan 2026
News

Harper Recognized on Built In’s 2026 Best Places to Work in Colorado Lists

Harper is honored as a Built In 2026 Best Startup to Work For and Best Place to Work in Colorado, recognizing its people-first culture, strong employee experience, and values of accountability, authenticity, empowerment, focus, and transparency that help teams thrive and grow together.
Harper
News

Harper Recognized on Built In’s 2026 Best Places to Work in Colorado Lists

Harper is honored as a Built In 2026 Best Startup to Work For and Best Place to Work in Colorado, recognizing its people-first culture, strong employee experience, and values of accountability, authenticity, empowerment, focus, and transparency that help teams thrive and grow together.
Harper
Comparison
GitHub Logo

Harper vs. Standard Microservices: Performance Comparison Benchmark

A detailed performance benchmark comparing a traditional microservices architecture with Harper’s unified runtime. Using a real, fully functional e-commerce application, this report examines latency, scalability, and architectural overhead across homepage, category, and product pages, highlighting the real-world performance implications between two different styles of distributed systems.
Comparison
A detailed performance benchmark comparing a traditional microservices architecture with Harper’s unified runtime. Using a real, fully functional e-commerce application, this report examines latency, scalability, and architectural overhead across homepage, category, and product pages, highlighting the real-world performance implications between two different styles of distributed systems.
Person with short dark hair and moustache, wearing a colorful plaid shirt, smiling outdoors in a forested mountain landscape.
Aleks Haugom
Senior Manager of GTM & Marketing
Comparison

Harper vs. Standard Microservices: Performance Comparison Benchmark

A detailed performance benchmark comparing a traditional microservices architecture with Harper’s unified runtime. Using a real, fully functional e-commerce application, this report examines latency, scalability, and architectural overhead across homepage, category, and product pages, highlighting the real-world performance implications between two different styles of distributed systems.
Aleks Haugom
Dec 2025
Comparison

Harper vs. Standard Microservices: Performance Comparison Benchmark

A detailed performance benchmark comparing a traditional microservices architecture with Harper’s unified runtime. Using a real, fully functional e-commerce application, this report examines latency, scalability, and architectural overhead across homepage, category, and product pages, highlighting the real-world performance implications between two different styles of distributed systems.
Aleks Haugom
Comparison

Harper vs. Standard Microservices: Performance Comparison Benchmark

A detailed performance benchmark comparing a traditional microservices architecture with Harper’s unified runtime. Using a real, fully functional e-commerce application, this report examines latency, scalability, and architectural overhead across homepage, category, and product pages, highlighting the real-world performance implications between two different styles of distributed systems.
Aleks Haugom
Tutorial
GitHub Logo

A Simpler Real-Time Messaging Architecture with MQTT, WebSockets, and SSE

Learn how to build a unified real-time backbone using Harper with MQTT, WebSockets, and Server-Sent Events. This guide shows how to broker messages, fan out real-time data, and persist events in one runtime—simplifying real-time system architecture for IoT, dashboards, and event-driven applications.
Harper Learn
Tutorial
Learn how to build a unified real-time backbone using Harper with MQTT, WebSockets, and Server-Sent Events. This guide shows how to broker messages, fan out real-time data, and persist events in one runtime—simplifying real-time system architecture for IoT, dashboards, and event-driven applications.
A man with short dark hair, glasses, and a goatee smiles slightly, wearing a black shirt in front of a nature background.
Ivan R. Judson, Ph.D.
Distinguished Solution Architect
Tutorial

A Simpler Real-Time Messaging Architecture with MQTT, WebSockets, and SSE

Learn how to build a unified real-time backbone using Harper with MQTT, WebSockets, and Server-Sent Events. This guide shows how to broker messages, fan out real-time data, and persist events in one runtime—simplifying real-time system architecture for IoT, dashboards, and event-driven applications.
Ivan R. Judson, Ph.D.
Dec 2025
Tutorial

A Simpler Real-Time Messaging Architecture with MQTT, WebSockets, and SSE

Learn how to build a unified real-time backbone using Harper with MQTT, WebSockets, and Server-Sent Events. This guide shows how to broker messages, fan out real-time data, and persist events in one runtime—simplifying real-time system architecture for IoT, dashboards, and event-driven applications.
Ivan R. Judson, Ph.D.
Tutorial

A Simpler Real-Time Messaging Architecture with MQTT, WebSockets, and SSE

Learn how to build a unified real-time backbone using Harper with MQTT, WebSockets, and Server-Sent Events. This guide shows how to broker messages, fan out real-time data, and persist events in one runtime—simplifying real-time system architecture for IoT, dashboards, and event-driven applications.
Ivan R. Judson, Ph.D.
Podcast
GitHub Logo

Turn Browsing into Buying with Edge AI

Discover how Harper’s latest features streamline development, boost performance, and simplify integration. This technical showcase breaks down real-world workflows, powerful updates, and practical tips for building faster, smarter applications.
Select*
Podcast
Discover how Harper’s latest features streamline development, boost performance, and simplify integration. This technical showcase breaks down real-world workflows, powerful updates, and practical tips for building faster, smarter applications.
Person with short hair wearing a light blue patterned shirt, smiling widely outdoors with blurred greenery and trees in the background.
Austin Akers
Head of Developer Relations
Podcast

Turn Browsing into Buying with Edge AI

Discover how Harper’s latest features streamline development, boost performance, and simplify integration. This technical showcase breaks down real-world workflows, powerful updates, and practical tips for building faster, smarter applications.
Austin Akers
Dec 2025
Podcast

Turn Browsing into Buying with Edge AI

Discover how Harper’s latest features streamline development, boost performance, and simplify integration. This technical showcase breaks down real-world workflows, powerful updates, and practical tips for building faster, smarter applications.
Austin Akers
Podcast

Turn Browsing into Buying with Edge AI

Discover how Harper’s latest features streamline development, boost performance, and simplify integration. This technical showcase breaks down real-world workflows, powerful updates, and practical tips for building faster, smarter applications.
Austin Akers