
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Thu, 09 Apr 2026 06:08:35 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Smart Hints make code-free performance simple]]></title>
            <link>https://blog.cloudflare.com/smart-hints/</link>
            <pubDate>Mon, 19 Jun 2023 13:01:00 GMT</pubDate>
            <description><![CDATA[ We’re excited to announce we’re making Early Hints and Fetch Priorities automatic using the power of Cloudflare’s network ]]></description>
            <content:encoded><![CDATA[ <p></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/71HWydR0EwctKPYRncEFvy/254415bf6576a561d8639180f828b4cd/image4-3.png" />
            
            </figure><p>Today, we’re excited to announce how we’re making Early Hints and <a href="https://web.dev/fetch-priority/">Fetch Priorities</a> automatic using the power of Cloudflare’s network. Almost a <a href="/early-hints-performance/">year ago</a> we launched <a href="/early-hints/">Early Hints</a>. Early Hints are a method that allows web servers to asynchronously send instructions to the browser whilst the web server is getting the full response ready. This gives proactive suggestions to the browser on how to load the webpage faster for the visitor rather than idly waiting to receive the full webpage response.</p><p>In initial lab experiments, we observed page load improvements exceeding 30%. Since then, we have sent about two-trillion hints on behalf of over 150,000 websites using the product.</p><p>In order to effectively use Early Hints on a website, HTTP link headers or HTML link elements must be configured to specify which assets should be preloaded or which third-party servers should be preconnected. Making these decisions requires understanding how your website interacts with browsers, and identifying render-blocking assets to hint on without implementing prioritization strategies that <a href="/early-hints-performance/#:~:text=It%E2%80%99s%20quite%20possible,mobile%20connection%20settings.">saturate network bandwidth</a> on non-critical assets (i.e. you can’t just Early Hint everything and expect good results).</p><p>For users who possess this knowledge and can configure Early Hints at the origin (or via a Worker), it works seamlessly. However, for users who lack access to their origin server (e.g. SaaS platforms), or are unsure about the optimal assets to preload/prioritize, or simply prefer to focus on building their own application, the question arises: "<i>As an intermediary server, shouldn't Cloudflare know the best way to prioritize my website for performance</i>?"</p><p>The answer is <b>yes</b>, which is why we’re excited to start talking about how Smart Hints will determine the best priority for web assets without developers needing to configure anything. If you’re interested in helping us beta test this feature, you can sign up <a href="https://dash.cloudflare.com?to=/:account/:zone/speed/optimization">here</a> and we will contact you with further instructions on helping us test Smart Hints later this year.</p>
    <div>
      <h3>Background</h3>
      <a href="#background">
        
      </a>
    </div>
    <p>When you visit a webpage, your browser is actually requesting numerous individual resources from the server. These resources include everything from visible elements like images, text, and videos, to the behind-the-scenes logic (JavaScript, etc.) that powers the website analytics, functionality, and more. The order in which these resources are loaded by the browser plays a crucial role in determining how quickly users can view and interact with the page.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1Bg1lqmo1GvJuO45fUqPw4/262928332c4c731f6d3226658424634c/image3-2.png" />
            
            </figure><p>When your browser receives a response from the server, it parses the HTML response sequentially, from start to finish.When the HTML response arrives in the browser, it is split into two parts: the <code>&lt;head&gt;</code> and the <code>&lt;body&gt;</code>.</p><p>The <code>&lt;head&gt;</code> section appears at the beginning of the HTML response and contains essential elements like stylesheets, scripts, and other instructions for the browser. Stylesheets define how the page should look, while scripts provide the necessary logic for interactive features and functionality.<sup>1</sup></p><p>While stylesheets are important to load quickly as browsers will wait for them to know how to display content to the visitor, scripts are interesting because they can behave differently based on instructions provided to the browser. If a script lacks specific instructions (defer/async/inline for example), it can become a "blocking" resource. When the browser encounters a blocking script resource, it pauses processing the webpage and waits until the script is fully loaded and completely executed. This ensures that the script's functionality is available for the visitor to use. However, this blocking behavior can delay the display of content to the user, as the browser needs to wait for the script to finish before proceeding further.</p><p>Until the browser reaches the <code>&lt;body&gt;</code> section of the document, there is nothing visible to the visitor. That's why it's crucial to optimize the loading process of the <code>&lt;head&gt;</code> section as much as possible. By minimizing the time it takes for stylesheets and blocking scripts to load, the browser can start rendering the page content sooner, allowing visitors to see and interact with the webpage faster.</p><p>Achieving optimal web performance can be a complex challenge. While browsers are generally in charge of determining the order of loading different resources it needs to build a page, there have been a variety of tools that have been released recently (<a href="/early-hints-performance/">Early Hints</a>, <a href="https://web.dev/fetch-priority/">Fetch Priority</a>, <a href="https://www.cloudflare.com/learning/performance/what-is-lazy-loading/">Lazy-Loadin</a>g, <a href="/better-http-2-prioritization-for-a-faster-web/">H2</a> Priorities) to help developers specify unique resource priority for browsers to improve website load performance. Although these tools and methods for specifying resource priority can be effective, they require implementation and testing to make sure they are implemented correctly.</p>
    <div>
      <h3>Prioritization Tools</h3>
      <a href="#prioritization-tools">
        
      </a>
    </div>
    <p>Two methods that have gained a lot of popularity for improving website performance have been Early Hints and Fetch Priorities. These tools help give browsers information about how it should load resources in the correct order to improve performance of critical resources.</p><p><i>Early Hints</i></p><p>Early Hints allow the server to provide some information to the client before the final response is available.</p><p>When a client sends a request to a server, the server can respond with an "early hint" to provide a clue about the final response. This early hint is a separate response that includes headers related to the final response, such as important static objects that can be fetched early, and links to where to get related resources.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1YUg3DWKVa8PZEB0YQ2zkU/fc6fcb5005c567f37f203326e6538885/image1-4.png" />
            
            </figure><p>The purpose of Early Hints is to allow the client to start processing the received information while waiting for the final response. The client can use the Early Hint to initiate early resource preloading, and preconnecting to servers that will have information for the final response, which can lead to faster page load times.</p><p><i>Fetch Priority</i></p><p>Another powerful tool in optimizing resource loading is Fetch Priorities, previously known as Priority Hints.</p><p>When analyzing a webpage, web browsers often prioritize the fetching of resources such as scripts and stylesheets to optimize the download sequence and efficiently use bandwidth. The priorities assigned to these resources are determined by browsers based on factors like resource type, placement within the webpage, and its location within the HTML response. For instance, images within the visible area for the visitor should be given higher priority, whereas essential scripts loaded early in the <code>&lt;head&gt;</code> section may be assigned a very high priority. Although browsers generally handle priority assignment effectively, it's worth noting that they may not always be optimal for every scenario.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4PnNA8LMQijlVtiw7VsVLo/c67e993e168e5b93fcc6d53c6c3d9a26/Fetch-Priorities.png" />
            
            </figure><p>By leveraging <a href="https://web.dev/fetch-priority/">Fetch Priorities</a>, developers gain additional control over resource loading and assign higher/lower priorities to different resources on their webpage, which can help optimize the overall performance of web pages.</p><p>While Early Hints and Fetch Priorities are all incredibly useful for optimizing web page performance, they often require access to the HTML resources in order to change their priorities and knowledge about how to best prioritize against other resources. While these tools working together allow for increasingly complex performance strategies to be implemented by developers, they also require a lot of testing, configuration, and management as web pages change over time. Smart Hints will make using these tools easier to manage by using our RUM data beacons and heuristics to better implement prioritization strategies without developers needing to lift a finger.</p>
    <div>
      <h3>How are we going to prioritize assets?</h3>
      <a href="#how-are-we-going-to-prioritize-assets">
        
      </a>
    </div>
    <p>Cloudflare's Smart Hints will leverage the capabilities of Early Hints and Fetch Priority features to optimize resource delivery by using our vast RUM data for websites across the Internet; we’re going to optimize resource prioritization on the fly. Smart Hints will dynamically determine the appropriate hints and priorities based on a specific response on the fly.</p><p>But how?</p><p>Cloudflare collects performance data in two ways - Synthetic testing and Real User Measurements (RUM). Synthetic testing collects performance data by loading a web page in an automated browser in a controlled environment. RUM also collects performance data, but from real users navigating to the web page on real browsers. RUM works by injecting a small piece of JavaScript, or beacon, into the web page. Cloudflare collects vast amounts of RUM data across thousands of sites.</p><p>From these two performance data sources, Cloudflare can intelligently analyze the loading bottlenecks of web pages. If the loading bottlenecks are caused by the download of render-blocking resources, Cloudflare can generate Smart Hints for the browser to prioritize the download of these resources.</p><p>As we roll out Smart Hints, we will explore the use of learning models to look for patterns that could be turned into heuristics. These heuristics could then be leveraged to improve performance for similar sites that do not use RUM or synthetic testing.</p><p>With Smart Hints, Cloudflare can revolutionize the way websites and applications are delivered, making the browsing experience faster, smoother, and more delightful. By inferring the right priority for a given client, Cloudflare will help customers find the best priorities for their websites’ performance while minimizing the time it takes to optimize an ever-changing webpage.</p>
    <div>
      <h3>How can I help Cloudflare do this?</h3>
      <a href="#how-can-i-help-cloudflare-do-this">
        
      </a>
    </div>
    <p>Before we roll this out more broadly, we will be performing large-scale beta tests of our systems to ensure that we’re making the best performance decisions for all kinds of content.</p><p>Over the next few months we’ll be building a beta cohort and working with them to ensure everyone has a great experience with Smart Hints. If you’d like to help us in this endeavor, please sign up to be part of the closed beta <a href="https://dash.cloudflare.com?to=/:account/:zone/speed/optimization">here</a> (located in the <b>Speed Tab</b> of the dashboard) and we will get in touch when we’re ready for you to enable it and how to provide feedback.</p>
    <div>
      <h3>Conclusion</h3>
      <a href="#conclusion">
        
      </a>
    </div>
    <p>We’re looking forward to working with our community to build and optimize this no-code/configuration experience to bring massive improvements to page load to everyone.</p>
    <div>
      <h3>Watch on Cloudflare TV</h3>
      <a href="#watch-on-cloudflare-tv">
        
      </a>
    </div>
    <div></div><p><sup>1</sup>Yes, scripts and stylesheets can also be placed within the <code>&lt;body&gt;</code> section, but their primary location is in the <code>&lt;head&gt;</code>.</p> ]]></content:encoded>
            <category><![CDATA[Speed Week]]></category>
            <category><![CDATA[Early Hints]]></category>
            <guid isPermaLink="false">3qE11RYK6usjrFnlN4mAEB</guid>
            <dc:creator>Alex Krivit</dc:creator>
        </item>
        <item>
            <title><![CDATA[Cloudflare Pages gets even faster with Early Hints]]></title>
            <link>https://blog.cloudflare.com/early-hints-on-cloudflare-pages/</link>
            <pubDate>Fri, 07 Oct 2022 13:00:00 GMT</pubDate>
            <description><![CDATA[ Announcing support for sending Early Hints from your Cloudflare Pages projects ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Last year, we demonstrated what we meant by “lightning fast”, <a href="/cloudflare-pages-is-lightning-fast/">showing Pages' first-class performance</a> in all parts of the world, and today, we’re thrilled to announce an integration that takes this commitment to speed even further – introducing Pages support for Early Hints! Early Hints allow you to unblock the loading of page critical resources, ahead of any slow-to-deliver HTML pages. Early Hints can be used to improve the loading experience for your visitors by significantly reducing key performance metrics such as the largest contentful paint (LCP).</p>
    <div>
      <h2>What is Early Hints?</h2>
      <a href="#what-is-early-hints">
        
      </a>
    </div>
    <p><a href="/early-hints/">Early Hints</a> is a new feature of the Internet which is <a href="https://developer.chrome.com/blog/early-hints/#implementing-early-hints">supported in Chrome since version 103</a>, and that <a href="/early-hints-performance/">Cloudflare made generally available</a> for websites using our network. Early Hints supersedes <a href="https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYLvmQUBY/m/vOWBKZGoAQAJ">Server Push</a> as a mechanism to "hint" to a browser about critical resources on your page (e.g. fonts, CSS, and above-the-fold images). The browser can immediately start loading these resources before waiting for a full HTML response. This uses time that was otherwise previously wasted! Before Early Hints, no work could be started until the browser received the first byte of the response. Now, the browser can fill this time usefully when it was previously sat waiting. Early Hints can bring significant improvements to the performance of your website, particularly for metrics such as LCP.</p>
    <div>
      <h3>How Early Hints works</h3>
      <a href="#how-early-hints-works">
        
      </a>
    </div>
    <p>Cloudflare caches any <code>preload</code> and <code>preconnect</code> type <code>Link</code> headers sent from your 200 OK response, and sends them early for any subsequent requests as a 103 Early Hints response.</p><p>In practical terms, an HTTP conversation now looks like this:</p><p><b>Request</b></p>
            <pre><code>GET /
Host: example.com</code></pre>
            <p><b>Early Hints Response</b></p>
            <pre><code>103 Early Hints
Link: &lt;/styles.css&gt;; rel=preload; as=style</code></pre>
            <p><b>Response</b></p>
            <pre><code>200 OK
Content-Type: text/html; charset=utf-8
Link: &lt;/styles.css&gt;; rel=preload; as=style

&lt;html&gt;
&lt;!-- ... --&gt;
&lt;/html&gt;</code></pre>
            
    <div>
      <h2>Early Hints on Cloudflare Pages</h2>
      <a href="#early-hints-on-cloudflare-pages">
        
      </a>
    </div>
    <p>Websites hosted on Cloudflare Pages can particularly benefit from Early Hints. If you're using <a href="/cloudflare-pages-goes-full-stack/">Pages Functions</a> to generate dynamic server-side rendered (SSR) pages, there's a good chance that Early Hints will make a significant improvement on your website.</p>
    <div>
      <h3>Performance Testing</h3>
      <a href="#performance-testing">
        
      </a>
    </div>
    <p>We created a simple demonstration e-commerce website in order to evaluate the performance of Early Hints.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/77w2Mw6t1Oku0C2uFulZvH/09416e738ac559f7977e8d76614ad0af/image2-7.png" />
            
            </figure><p>This landing page has the price of each item, as well as a remaining stock counter. The page itself is just hand-crafted HTML and CSS, but these pricing and inventory values are being templated in live for every request with <a href="https://developers.cloudflare.com/pages/platform/functions/">Pages Functions</a>. To simulate loading from an external data-source (possibly backed by <a href="https://developers.cloudflare.com/workers/runtime-apis/kv/">KV</a>, <a href="https://developers.cloudflare.com/workers/runtime-apis/durable-objects/">Durable Objects</a>, <a href="/introducing-d1/">D1</a>, or even an external API like Shopify) we've added a fixed delay before this data resolves. We include <code>preload</code> links in our response to some critical resources:</p><ul><li><p>an external CSS stylesheet,</p></li><li><p>the image of the t-shirt,</p></li><li><p>the image of the cap,</p></li><li><p>and the image of the keycap.</p></li></ul><p>The very first request makes a waterfall like you might expect. The first request is held blocked for a considerable amount of time while we resolve this pricing and inventory data. Once loaded, the browser parses the HTML, pulls out the external resources, and makes subsequent requests for their contents. The CSS and images extend the loading time considerably given their large dimensions and high quality. The largest contentful paint (LCP) occurs when the t-shirt image loads, and the document finishes once all requests are fulfilled.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/24N9FzqlRfCtlSGuPlUPic/8650a76a958f4946e20c6680cb01ac84/image1-10.png" />
            
            </figure><p>Subsequent requests are where things get interesting! These <code>preload</code> links are cached on Cloudflare's global network, and are sent ahead of the document in a 103 Early Hints response. Now, the waterfall looks much different. The initial request goes out the same, but now, requests for the CSS and images slide much further left since they can be started as soon as the 103 response is delivered. The browser starts fetching those resources while waiting for the original request to finish server-side rendering. The LCP again occurs once the t-shirt image has loaded, but this time, it's brought forward by <b>530ms</b> because it started loading <b>752ms</b> faster, and the document is fully loaded <b>562ms</b> faster, again because the external resources could all start loading faster.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2Z05bcWVJtHoo9kkgl6IJj/941868fd08a160c81c61be2590b19107/image3-3.png" />
            
            </figure><p>The final four requests (highlighted in yellow) come back as 304 Not Modified responses using a <code>If-None-Match</code> header. By default, Cloudflare Pages requires the browser to confirm that all assets are fresh, and so, on the off chance that they were updated between the Early Hints response and when they come to being used, the browser is checking if they have changed. Since they haven't, there's no contentful body to download, and the response completes quickly. This can be avoided by setting a custom <code>Cache-Control</code> header on these assets using <a href="https://developers.cloudflare.com/pages/platform/headers/">a <code>_headers</code> file</a>. For example, you could cache these images for one minute with a rule like:</p>
            <pre><code># _headers

/*.png
  Cache-Control: max-age=60</code></pre>
            <p>We could take this performance audit further by exploring other features that Cloudflare offers, such as <a href="https://support.cloudflare.com/hc/en-us/articles/200168196">automatic CSS minification</a>, <a href="https://developers.cloudflare.com/images/">Cloudflare Images</a>, and <a href="https://developers.cloudflare.com/images/image-resizing/">Image Resizing</a>.</p><p>We already serve Cloudflare Pages from <a href="/cloudflare-pages-is-lightning-fast/">one of the fastest networks in the world</a> — Early Hints simply allows developers to take advantage of our global network even further.</p>
    <div>
      <h2>Using Early Hints and Cloudflare Pages</h2>
      <a href="#using-early-hints-and-cloudflare-pages">
        
      </a>
    </div>
    <p>The Early Hints feature on Cloudflare is currently restricted to caching <code>Link</code> headers in a webpage's response. Typically, this would mean that Cloudflare Pages users would either need to use the <code>_headers</code> file, or Pages Functions to apply these headers. However, for your convenience, we've also added support to transform any <code>&lt;link&gt;</code> HTML elements you include in your body into <code>Link</code> headers. This allows you to directly control the Early Hints you send, straight from the same document where you reference these resources – no need to come out of HTML to take advantage of Early Hints.</p><p>For example, for the following HTML document, will generate an Early Hints response:</p><p><b>HTML Document</b></p>
            <pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;link rel="preload" as="style" href="/styles.css" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;!-- ... --&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>
            <p><b>Early Hints Response</b></p>
            <pre><code>103 Early Hints
Link: &lt;/styles.css&gt;; rel=preload; as=style</code></pre>
            <p>As previously mentioned, <code>Link</code> headers can also be set with a <a href="/custom-headers-for-pages/"><code>_headers</code> file</a> if you prefer:</p>
            <pre><code># _headers

/
  Link: &lt;/styles.css&gt;; rel=preload; as=style</code></pre>
            <p>Early Hints (and the automatic HTML <code>&lt;link&gt;</code> parsing) has already been enabled automatically for all <code>pages.dev</code> domains. If you have any custom domains configured on your Pages project, make sure to enable Early Hints on that domain in the Cloudflare dashboard under the "Speed" tab. More information can be found in our <a href="https://developers.cloudflare.com/pages/platform/early-hints/">documentation</a>.</p><p>Additionally, in the future, we hope to support the Smart Early Hints features. Smart Early Hints will enable Cloudflare to automatically generate Early Hints, even when no <code>Link</code> header or <code>&lt;link&gt;</code> elements exist, by analyzing website traffic and inferring which resources are important for a given page. We'll be sharing more about Smart Early Hints soon.</p><p>In the meantime, try out <a href="https://developers.cloudflare.com/pages/platform/early-hints/">Early Hints on Pages</a> today! Let us know how much of a loading improvement you see in <a href="https://discord.com/invite/cloudflaredev">our Discord server</a>.</p>
    <div>
      <h2>Watch on Cloudflare TV</h2>
      <a href="#watch-on-cloudflare-tv">
        
      </a>
    </div>
    <div></div><p></p> ]]></content:encoded>
            <category><![CDATA[Early Hints]]></category>
            <category><![CDATA[Cloudflare Pages]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <category><![CDATA[Product News]]></category>
            <guid isPermaLink="false">3XJwgZh2bmW4PvjEU8BlCg</guid>
            <dc:creator>Greg Brimble</dc:creator>
        </item>
        <item>
            <title><![CDATA[Early Hints update: How Cloudflare, Google, and Shopify are working together to build a faster Internet for everyone]]></title>
            <link>https://blog.cloudflare.com/early-hints-performance/</link>
            <pubDate>Thu, 23 Jun 2022 15:59:08 GMT</pubDate>
            <description><![CDATA[ During a time of uncertainty due to the global pandemic, a time when everyone was more online than ever before, Cloudflare, Google, and Shopify all came together to build and test Early Hints ]]></description>
            <content:encoded><![CDATA[ <p></p><p>A few months ago, we wrote a <a href="/early-hints/">post</a> focused on a product we were building that could vastly improve page load performance. That product, known as Early Hints, has seen wide adoption since that original post. In early benchmarking experiments with Early Hints, we saw performance improvements that were as high as 30%.</p><p>Now, with over 100,000 customers using Early Hints on Cloudflare, we are excited to talk about how much Early Hints have improved page loads for our customers in production, how customers can get the most out of Early Hints, and provide an update on the next iteration of Early Hints we’re building.</p>
    <div>
      <h3>What Are Early Hints again?</h3>
      <a href="#what-are-early-hints-again">
        
      </a>
    </div>
    <p>As a reminder, the browser you’re using right now to read this page needed instructions for what to render and what resources (like images, fonts, and scripts) need to be fetched from somewhere else in order to complete the loading of this (or any given) web page. When you decide you want to see a page, your browser sends a request to a server and the instructions for what to load come from the server’s response. These responses are generally composed of a multitude of <a href="https://developer.chrome.com/docs/devtools/resources/#browse">resources</a> that tell the browser what content to load and how to display it to the user. The servers sending these instructions to your browser often need time to gather up all of the resources in order to compile the whole webpage. This period is known as “server think time.” Traditionally, during the “server think time” the browser would sit waiting until the server has finished gathering all the required resources and is able to return the full response.</p><p>Early Hints was designed to take advantage of this “server think time” to send instructions to the browser to begin loading readily-available resources <i>while</i> the server finishes compiling the full response. Concretely, the server sends two responses: the first to instruct the browser on what it can begin loading right away, and the second is the full response with the remaining information. By sending these hints to a browser before the full response is prepared, the browser can figure out what it needs to do to load the webpage faster for the end user.</p><p>Early Hints uses the <a href="https://datatracker.ietf.org/doc/html/rfc8297">HTTP status code 103</a> as the first response to the client. The “hints” are HTTP headers attached to the 103 response that are likely to appear in the final response, indicating (with the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link">Link</a> header) resources the browser should begin loading while the server prepares the final response. Sending hints on which assets to expect before the entire response is compiled allows the browser to use this “think time” (when it would otherwise have been sitting idle) to fetch needed assets, prepare parts of the displayed page, and otherwise get ready for the full response to be returned.</p><p>Early Hints on Cloudflare accomplishes performance improvements in three ways:</p><ul><li><p>By sending a response where resources are directed to be <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload">preloaded</a> by the browser. Preloaded resources direct the browser to begin loading the specified resources as they will be needed soon to load the full page. For example, if the browser needs to fetch a font resource from a third party, that fetch can happen before the full response is returned, so the font is already waiting to be used on the page when the full response returns from the server.</p></li><li><p>By using <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preconnect">preconnect</a> to initiate a connection to places where content will be returned from an origin server. For example, if a Shopify storefront needs content from a Shopify origin to finish loading the page, preconnect will warm up the connection which improves the performance for when the origin returns the content.</p></li><li><p>By caching and emitting Early Hints on Cloudflare, we make an efficient use of the full waiting period - not just server think time - which includes transit latency to the origin. Cloudflare sits within 50 milliseconds of 95% of the Internet-connected population globally. So while a request is routed to an origin and the final response is being compiled, Cloudflare can send an Early Hint from much closer and the browser can begin loading.</p></li></ul>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5X6KUywKFKIT4njcqG6oDx/6f2dba740fc457b264f93e5a0f84a0cb/image1-26.png" />
            
            </figure><p>Early Hints is like multitasking across the Internet - at the same time the origin is compiling resources for the final response and making calls to databases or other servers, the browser is already beginning to load assets for the end user.</p>
    <div>
      <h3>What’s new with Early Hints?</h3>
      <a href="#whats-new-with-early-hints">
        
      </a>
    </div>
    <p>While developing Early Hints, we’ve been fortunate to work with Google and Shopify to collect data on the performance impact. Chrome provided web developers with <a href="https://developer.chrome.com/en/docs/web-platform/origin-trials/">experimental access</a> to both <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload">preload</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preconnect">preconnect</a> support for Link headers in Early Hints. Shopify worked with us to guide the development by providing test frameworks which were invaluable to getting real performance data.</p><p>Today is a big day for Early Hints. Google <a href="https://developer.chrome.com/blog/early-hints/">announced</a> that Early Hints is available in Chrome version 103 with support for preload and preconnect to start. Previously, Early Hints was available via an <a href="https://developer.chrome.com/en/docs/web-platform/origin-trials">origin trial</a> so that Chrome could measure the full performance benefit (A/B test). Now that the data has been collected and analyzed, and we’ve been able to prove a substantial improvement to page load, we’re excited that Chrome’s full support of Early Hints will mean that many more requests will see the performance benefits.</p><p>That's not the only big news coming out about Early Hints. Shopify battle-tested Cloudflare’s implementation of Early Hints during <a href="https://blog.cloudflare.com/the-truth-about-black-friday-and-cyber-monday/">Black Friday/Cyber Monday</a> 2021 and is sharing the performance benefits they saw during the busiest shopping time of the year:</p><blockquote><p>Today, HTTP 103 Early Hints ships with Chrome 103!</p><p>Why is this important for <a href="https://twitter.com/hashtag/webperf?src=hash&amp;ref_src=twsrc%5Etfw">#webperf</a>? How did <a href="https://twitter.com/Shopify?ref_src=twsrc%5Etfw">@Shopify</a> help make all merchant sites faster? (LCP over 500ms faster at p50!) ?</p><p>Hint: A little collaboration w/ <a href="https://twitter.com/Cloudflare?ref_src=twsrc%5Etfw">@cloudflare</a> &amp; <a href="https://twitter.com/googlechrome?ref_src=twsrc%5Etfw">@googlechrome</a> <a href="https://t.co/Dz7BD4Jplp">pic.twitter.com/Dz7BD4Jplp</a></p><p>— Colin Bendell (@colinbendell) <a href="https://twitter.com/colinbendell/status/1539322190541295616?ref_src=twsrc%5Etfw">June 21, 2022</a></p></blockquote><p>While talking to the audience at <a href="https://www.cloudflare.com/connect2022/">Cloudflare Connect London</a> last week, Colin Bendell, Director, Performance Engineering at Shopify summarized it best: "<i>when a buyer visits a website, if that first page that (they) experience is just 10% faster, on average there is a 7% increase in conversion</i>". The beauty of Early Hints is you can get that sort of speedup easily, and with Early Hints that can be one click away.</p><p>You can see a portion of his talk here:</p><div></div>
<p></p><p>The headline here is that during a time of vast uncertainty due to the global pandemic, a time when everyone was more online than ever before, when people needed their Internet to be reliably fast — Cloudflare, Google, and Shopify all came together to build and test Early Hints so that the whole Internet would be a faster, better, and more efficient place.</p><p>So how much did Early Hints improve performance of customers’ websites?</p>
    <div>
      <h3>Performance Improvement with Early Hints</h3>
      <a href="#performance-improvement-with-early-hints">
        
      </a>
    </div>
    <p>In our simple tests back in September, we were able to accelerate the <a href="https://web.dev/lcp/#what-is-lcp">Largest Contentful Paint (LCP)</a> by 20-30%. Granted, this result was on an artificial page with mostly large images where Early Hints impact could be maximized. As for Shopify, we also knew their storefronts were <a href="/early-hints/#how-can-we-speed-up-slow-dynamic-page-loads">particularly good candidates</a> for Early Hints. Each mom-and-pop.shop page depends on many assets served from cdn.shopify.com - speeding up a preconnect to that host should meaningfully accelerate loading those assets.</p><p>But what about other zones? We expected most origins already using Link preload and preconnect headers to see at least modest improvements if they turned on Early Hints. We wanted to assess performance impact for other uses of Early Hints beyond Shopify’s.</p><p>However, <a href="https://www.cloudflare.com/application-services/solutions/app-performance-monitoring/">getting good data on web page performance impact</a> can be tricky. Not every 103 response from Cloudflare will result in a subsequent request through our network. Some hints tell the browser to preload assets on important third-party origins, for example. And not every Cloudflare zone may have <a href="/introducing-browser-insights/">Browser Insights</a> enabled to gather Real User Monitoring data.</p><p>Ultimately, we decided to do some lab testing with <a href="https://www.webpagetest.org/">WebPageTest</a> of a sample of the most popular websites (top 1,000 by request volume) using Early Hints on their URLs with preload and preconnect Link headers. WebPageTest (which we’ve <a href="/workers-and-webpagetest/">written about in the past</a>) is an excellent tool to visualize and collect metrics on web page performance across a variety of device and connectivity settings.</p>
    <div>
      <h3>Lab Testing</h3>
      <a href="#lab-testing">
        
      </a>
    </div>
    <p>In our earlier blog post, we were mainly focused on Largest Contentful Paint (LCP), which is the time at which the browser renders the largest visible image or text block, relative to the start of the page load. Here we’ll focus on improvements not only to LCP, but also <a href="https://web.dev/fcp">FCP (First Contentful Paint)</a>, which is the time at which the browser first renders visible content relative to the start of the page load.</p><p>We compared test runs with Early Hints support off and on (in Chrome), across four different simulated environments: desktop with a cable connection (5Mbps download / 28ms <a href="https://www.cloudflare.com/learning/cdn/glossary/round-trip-time-rtt/">RTT</a>), mobile with 3G (1.6Mbps / 300ms RTT), mobile with low-latency 3G (1.6Mbps / 150ms RTT) and mobile with 4G (9Mbps / 170ms RTT). After running the tests, we cleaned the data to remove URLs with no visual completeness metrics or less than five DOM elements. (These usually indicated document fragments vs. a page a user might actually navigate to.) This gave us a final sample population of a little more than 750 URLs, each from distinct zones.</p><p>In the box plots below, we’re comparing FCP and LCP percentiles between the timing data control runs (no Early Hints) and the runs with Early Hints enabled. Our sample population represents a variety of zones, some of which load relatively quickly and some far slower, thus the long whiskers and string of outlier points climbing the y-axis. The y-axis is constrained to the max p99 of the dataset, to ensure 99% of the data are reflected in the graph while still letting us focus on the p25 / p50 / p75 differences.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1j17ZcUiVpUfYsuGE2INtM/42a00c9d5f429f2dbc712bf749ab9069/image2-26.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7h5iGHo8JCg7a6tYeBxaiV/80c501e9d52cb7deacaa43034b277fe9/image6-10.png" />
            
            </figure><p>The relative shift in the box plot quantiles suggest we should expect modest benefits for Early Hints for the majority of web pages. By comparing FCP / LCP percentage improvement of the web pages from their respective baselines, we can quantify what those median and p75 improvements would look like:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1MNoOPalsR0oildpZutzx6/fd9fbd6b10f9521a6466045a17c41012/image8-7.png" />
            
            </figure>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5BlauSorivIGRF5fZiu5Oy/45a0544dc24dab19fd23f2f238ce9f74/image4-14.png" />
            
            </figure><p>A couple observations:</p><ul><li><p>From the p50 values, we see that for 50% of web pages on desktop, Early Hints improved FCP by more than 9.47% and LCP by more than 6.03%. For the p75, or the upper 25%, FCP improved by more than 20.4% and LCP by more than 15.97%.</p></li><li><p>The sizable improvements in First Contentful Paint suggest many hints are for <a href="https://web.dev/render-blocking-resources/">render-blocking assets</a> (such as critical but dynamic stylesheets and scripts that can’t be embedded in the HTML document itself).</p></li><li><p>We see a greater percentage impact on desktop over cable and on mobile over 4G. In theory, the impact of Early Hints is bounded by the load time of the linked asset (i.e. ideally we could preload the entire asset before the browser requires it), so we might expect the FCP / LCP reduction to increase in step with latency. Instead, it appears to be the other way around. There could be many variables at play here - for example, the extra bandwidth the 4G connection provides seems to be more influential than the decreased latency between the two 3G connection settings. Likely that wider bandwidth pipe is especially helpful for URLs we observed that preloaded larger assets such as JS bundles or font files. We also found examples of pages that performed consistently worse on lower-grade connections (see our note on “over-hinting” below).</p></li><li><p>Quite a few sample zones cached their HTML pages on Cloudflare (~15% of the sample). For CDN cache hits, we’d expect Early Hints to be less influential on the final result (because the “server think time” is drastically shorter). Filtering them out from the sample, however, yielded almost identical relative improvement metrics.</p></li></ul><p>The relative distributions between control and Early Hints runs, as well as the per-site baseline improvements, show us Early Hints can be broadly beneficial for use cases beyond Shopify’s. As suggested by the p75+ values, we also still find plenty of case studies showing a more substantial potential impact to LCP (and FCP) like the one we observed from our artificial test case, as indicated from these WebPageTest waterfall diagrams:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4SXT10k2QdHrLaBfVW2ygc/c40ba4f5f31aa48aa5c59658382dc699/image3-18.png" />
            
            </figure><p>These diagrams show the network and rendering activity on the same web page (which, bucking the trend, had some of its best results over mobile – 3G settings, shown here) for its first ten resources. Compare the WebPageTest waterfall view above (with Early Hints disabled) with the waterfall below (Early Hints enabled). The first green vertical line in each indicates First Contentful Paint. The page configures Link preload headers for a few JS / CSS assets, as well as a handful of key images. When Early Hints is on, those assets (numbered 2 through 9 below) get a significant head start from the preload hints. In this case, FCP and LCP improved by 33%!</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2zORzzS6Qvh3eX4KEvUW0P/854ed6d6fca1e26e5389e7736cf0b1e4/image5-9.png" />
            
            </figure>
    <div>
      <h3>Early Hints Best Practices and Strategies for Better Performance</h3>
      <a href="#early-hints-best-practices-and-strategies-for-better-performance">
        
      </a>
    </div>
    <p>The effect of Early Hints can vary widely on a case-by-case basis. We noticed particularly successful zones had one or more of the following:</p><ul><li><p>Preconnect Link headers to important third-party origins (e.g. an origin hosting the pages’ assets, or Google Fonts).</p></li><li><p>Preload Link headers for a handful of critical render-blocking resources.</p></li><li><p>Scripts and stylesheets split into chunks, enumerated in preload Links.</p></li><li><p>A preload Link for the LCP asset, e.g. the featured image on a blog post.</p></li></ul><p>It’s quite possible these strategies are already familiar to you if you work on web performance! Essentially the <a href="https://web.dev/uses-rel-preload/">best</a> <a href="https://web.dev/uses-rel-preconnect/">practices</a> that apply to using Link headers or  elements in the HTML  also apply to Early Hints. That is to say: if your web page is already using preload or preconnect Link headers, using Early Hints should amplify those benefits.</p><p>A cautionary note here: while it may be safer to aggressively send assets in Early Hints versus <a href="https://web.dev/performance-http2/">Server Push</a> (as the hints won’t arbitrarily send browser-cached content the way <a href="/early-hints/#didn-t-server-push-try-to-solve-this-problem">Server Push might</a>), it is still possible to _over-_hint non-critical assets and saturate network bandwidth in a similar manner to <a href="https://docs.google.com/document/d/1K0NykTXBbbbTlv60t5MyJvXjqKGsCVNYHyLEXIxYMv0/edit">overpushing</a>. For example, one page in our sample listed well over 50 images in its 103 response (but not one of its render-blocking JS scripts). It saw improvements over cable, but was consistently worse off in the higher latency, lower bandwidth mobile connection settings.</p><p>Google has great guidelines for configuring Link headers at your origin in their <a href="https://developer.chrome.com/blog/early-hints/">blog post</a>. As for emitting these Links as Early Hints, Cloudflare can take care of that for you!</p>
    <div>
      <h3>How to enable on Cloudflare</h3>
      <a href="#how-to-enable-on-cloudflare">
        
      </a>
    </div>
    <ul><li><p>To enable Early Hints on Cloudflare, simply sign in to your account and select the domain you’d like to enable it on.</p></li><li><p>Navigate to the <b>Speed Tab</b> of the dashboard.</p></li><li><p>Enable Early Hints.</p></li></ul><p>Enabling Early Hints means that we will harvest the preload and preconnect Link headers from your origin responses, cache them, and send them as 103 Early Hints for subsequent requests so that future visitors will be able to gain an even greater performance benefit.</p><p>For more information about our Early Hints feature, please refer to our <a href="/early-hints/">announcement post</a> or our <a href="https://developers.cloudflare.com/cache/about/early-hints/">documentation</a>.</p>
    <div>
      <h3>Smart Early Hints update</h3>
      <a href="#smart-early-hints-update">
        
      </a>
    </div>
    <p>In our <a href="/early-hints/">original blog post</a>, we also mentioned our intention to ship a product improvement to Early Hints that would generate the 103 on your behalf.</p><p>Smart Early Hints will generate Early Hints even when there isn’t a Link header present in the origin response from which we can harvest a 103. The goal is to be a no-code/configuration experience with massive improvements to page load. Smart Early Hints will infer what assets can be preloaded or <a href="https://web.dev/priority-hints/">prioritized</a> in different ways by analyzing responses coming from our customer’s origins. It will be your one-button web performance guru completely dedicated to making sure your site is loading as fast as possible.</p><p>This work is still under development, but we look forward to getting it built before the end of the year.</p>
    <div>
      <h3>Try it out!</h3>
      <a href="#try-it-out">
        
      </a>
    </div>
    <p>The promise Early Hints holds has only started to be explored, and we’re excited to continue to build products and features and make the web performance reliably fast.</p><p>We’ll continue to update you along our journey as we develop Early Hints and look forward to your <a href="https://community.cloudflare.com/">feedback</a> (special thanks to the Cloudflare Community members who have already been invaluable) as we move to bring Early Hints to everyone.</p> ]]></content:encoded>
            <category><![CDATA[Product News]]></category>
            <category><![CDATA[Early Hints]]></category>
            <category><![CDATA[Partners]]></category>
            <guid isPermaLink="false">5T0MhC5gTkcWdAymdWAovY</guid>
            <dc:creator>Alex Krivit</dc:creator>
            <dc:creator>Edward Wang</dc:creator>
        </item>
        <item>
            <title><![CDATA[Early Hints: How Cloudflare Can Improve Website Load Times by 30%]]></title>
            <link>https://blog.cloudflare.com/early-hints/</link>
            <pubDate>Thu, 16 Sep 2021 13:00:04 GMT</pubDate>
            <description><![CDATA[ Today, Cloudflare is announcing support for Early Hints. Early Hints takes advantage of “server think time” to asynchronously send instructions to the browser to begin loading resources while the origin server is compiling the full response, which can improve page load time by 30%.  ]]></description>
            <content:encoded><![CDATA[ <p></p><p>Want to know a secret about Internet performance? Browsers spend an inordinate amount of time twiddling their thumbs waiting to be told what to do. This waiting impacts page load performance. Today, we’re excited to announce support for Early Hints, which dramatically improves browser page load performance and reduces thumb-twiddling time.</p><p>In initial tests using Early Hints, we have observed more than 30% improvement to page load time for browsers visiting a website for the first time.</p><p>Early Hints is available in beta today — Cloudflare customers can request access to Early Hints in the dashboard’s <a href="https://dash.cloudflare.com/?to=/:account/:zone/speed/optimization#sxg-card">Speed tab</a>. <b>It’s free for all customers because we think the web should be fast!</b></p>
    <div>
      <h2>Early Hints in a nutshell</h2>
      <a href="#early-hints-in-a-nutshell">
        
      </a>
    </div>
    <p>Browsers need instructions for what to render and what resources need to be fetched to complete “painting” a given web page. These instructions come from a server response. But the servers sending these responses often need time to compile these resources — this is known as “server think time.” While the servers are busy during this time… browsers sit idle and wait.</p><p>Early Hints takes advantage of “server think time” to asynchronously send instructions to the browser to begin loading resources while the origin server is compiling the full response. By sending these hints to a browser before the full response is prepared, the browser can figure out what it needs to do to load the webpage faster for the end user. Faster page loads and lower user-perceived latency means happier users!</p><p>More formally, Early Hints is a <a href="https://httpwg.org/specs/rfc8297.html">web standard</a> that defines a new HTTP status code (103 Early Hints) that defines new interactions between a client and server. 103s are served to clients while a 200 OK (or error) response is being prepared (the so-called “server think time”), and contain hints on which assets will likely be needed to fully render the web page. This hinting speeds up page loads and generally reduces user-perceived latency.</p><p>Sending hints on which assets to expect before the entire response is compiled allows the browser to use think time (when it would otherwise have been waiting) to fetch needed assets, prepare parts of the displayed page, and otherwise get ready for the full response to be returned.  </p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1qObHIONmupAcBER3OlArB/7008b143ba42ee3efc4ba844b738b017/Early-hints-diagram-1.png" />
            
            </figure><p>Cloudflare, as an edge network that sits in between client and server, is well positioned to issue these hints to clients on servers’ behalf. This is true for a few reasons:</p><ol><li><p>103 is an experimental status code that origins may not be able to emit on their own, mostly for legacy reasons. Much of the machinery that powers the web <a href="https://datatracker.ietf.org/doc/html/rfc2616#section-10.1">incorrectly</a> assumes that HTTP requests always correspond 1:1 with HTTP responses. This mistaken premise is baked into most HTTP server software, making it difficult for origin servers to emit Early Hints 103 responses prior to a “final” 200 OK response.</p><p>Cloudflare edge servers handling this complexity on behalf of our customers neatly sidesteps these technical challenges and gets the adoption flywheel spinning faster on this exciting new technology (more on this flywheel later).</p></li><li><p>Cloudflare’s edge is <a href="/last-mile-insights/">very close to end users</a>. This means we can serve hints very quickly, filling even the smallest of server think blocks with useful information the client can use to get a jump start on loading assets.</p></li><li><p>Cloudflare already sees request and response flow from our customers. We use this data to generate hints automatically, without a customer needing to make any origin changes at all.</p></li></ol>
    <div>
      <h2>How can we speed up “slow” dynamic page loads?</h2>
      <a href="#how-can-we-speed-up-slow-dynamic-page-loads">
        
      </a>
    </div>
    <p>The typical request/response cycle between browsers and servers leaves a lot of room for optimization. When you type an address into the search bar of your browser and press Enter, a series of things happen to get you the content you need, as quickly as possible. Your browser first converts the hostname in the URL into an IP address, then establishes an initial connection to the server where the content is stored.</p><p>After the connection is established, the actual request is sent. This is often a GET request with a bunch of information about what the browser can and cannot display to the end user. Following the request, the browser must wait for the origin server to send the first bytes of the response before it begins to render the page. In this time, the server is busy executing all sorts of business logic (looking things up in databases, personalizing the page, detecting fraud, etc.) before spitting a response out to the browser.</p><p>Once the response for the original HTML page is received, the browser then needs to parse the page, generate a Document Object Model (DOM), and begin loading subresources specified on the page, like images, scripts, and additional stylesheets.</p><p>Let’s take a look at this in action. Below is the performance waterfall for a checkout page on pinecoffeesupply.com, a coffee shop with a storefront on Shopify:  </p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4aRDbD5ou2c5Ks22NKIG0l/4a779d81fad0f618aadd4e67ddfcd045/pasted-image-0--3-.png" />
            
            </figure><p>Page rendering cannot complete (and the shopper can’t get their coffee fix, and the coffee shop can’t get paid!) until key assets are loaded. Information on subresources needed for the browser to load the page aren’t available until the server has thought about and returned the initial response (the first document in the above table). In the above example, the page load could have been accelerated had the browser known, prior to receiving the full response, that the stylesheet and the four subsequent scripts will be needed to render the page.</p><p>Attempting to parallelize this dependency is what Early Hints is all about — productively using that “server think time” to help get the browser going on critical steps to render the page before the full server response arrives. The green “thinking” bar overlaps with the blue “content download” bar, allowing both the browser and server to be preparing the page at the same time. No more waiting. This is what Early Hints is all about!</p><blockquote><p><i>"Entrepreneurs know that first impressions matter. Shopify's own data shows that on average, when a store improves the speed of the first page in the buyer journey by 10%, there is a 7% increase in conversion. We see great promise in Early Hints being another tool to help improve the performance and experience for all merchants and customers."</i>— <a href="https://twitter.com/colinbendell"><b>Colin Bendell</b></a>, Director Performance Engineering at Shopify</p></blockquote>
    <div>
      <h2>How does Early Hints speed things up?</h2>
      <a href="#how-does-early-hints-speed-things-up">
        
      </a>
    </div>
    <p>Early Hints is a status code used in non-final HTTP responses. It is designed to <a href="https://www.cloudflare.com/learning/performance/speed-up-a-website/">speed up overall page load times</a> by giving the browser an early signal about what certain linked assets might appear in the final response. The browser takes those hints and begins preparing the page for when the final 200 OK response from the server arrives.</p><p>The RFC provides this example of how the request/response cycle will look with Early Hints:</p><p><b>Client request:</b></p>
            <pre><code>GET / HTTP/1.1 
Host: example.com</code></pre>
            <p><b>Server responses:</b><i>Early Hint Response</i></p>
            <pre><code>HTTP/1.1 103 Early Hints
     Link: &lt;/style.css&gt;; rel=preload; as=style
     Link: &lt;/script.js&gt;; rel=preload; as=script</code></pre>
            <p>⏱_...Server Think Time…_ ⏱</p><p><i>Full Response</i></p>
            <pre><code>HTTP/1.1 200 OK
     Date: Thurs, 16 Sept 2021 11:30:00 GMT
     Content-Length: 1234
     Content-Type: text/html; charset=utf-8
     Link: &lt;/style.css&gt;; rel=preload; as=style
     Link: &lt;/script.js&gt;; rel=preload; as=script

[Rest of Response]</code></pre>
            <p>Seems simple enough. We’ve neatly communicated information to the browser on what resources it should consider preloading while the server is computing a full response.</p><p>This isn’t a new idea though!</p>
    <div>
      <h2>Didn’t server push try to solve this problem?</h2>
      <a href="#didnt-server-push-try-to-solve-this-problem">
        
      </a>
    </div>
    <p>There have been previous attempts at solving this problem, notably HTTP/2 “server push”. However, server push suffered from two major problems:</p>
    <div>
      <h3>Server push sent the wrong bytes at the wrong time</h3>
      <a href="#server-push-sent-the-wrong-bytes-at-the-wrong-time">
        
      </a>
    </div>
    <p>The server pushed assets to the client, without great awareness of what was already present in browser caches, without knowing how much “server think time” would elapse and how best to spend it. Web performance guru Pat Meenan <a href="https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYLvmQUBY/m/vdDcuLu8AAAJ">summarized server push’s gotchas</a> in a mail thread discussing Chrome’s intent to deprecate and remove server push support:</p><blockquote><p><i>Push sounds like a great solution, particularly when it can be done intelligently to not push resources already in cache and if it can exactly only fill the wait time while a CDN edge goes back to an origin for the HTML but getting those conditions right in practice is extremely rare. In virtually every case I have seen, the pushed resources end up delaying the HTML itself, the CSS and other render-blocking resources. Delaying the HTML is particularly bad because it delays the browser's discovery of all of the other resources on the page. Preload works with the normal document parsing and resource discovery, letting preloaded resources intermix with other important resources and giving the dev, browsers and origins more control over prioritization.</i></p></blockquote><p>Early Hints avoids these issues by “hinting” (vs. push being dictatorial) to clients which assets they should load, allowing them to prioritize resource loads with more complete information about what they will likely need to render a page, what they have cached, and other heuristics.</p><p>Using Early Hints with “rel=preload” solves the unsolicited bytes problem, but can still suffer from the ordering issue (forcing clients to load the wrong bytes at the wrong time). Early Hints’ superpower may actually be its use in conjunction with “rel=preconnect”. Many pages load hundreds of third party resources, and setting up connections and <a href="https://www.cloudflare.com/learning/ssl/transport-layer-security-tls/">TLS</a> sessions with each outside origin is time (but not bandwidth) intensive. Setting up these third party origin connections early, during think time, has practical advantages for page loading experience without the potential collateral damage of using “rel=preload”.</p>
    <div>
      <h3>Server push wasn’t broadly implemented</h3>
      <a href="#server-push-wasnt-broadly-implemented">
        
      </a>
    </div>
    <p>The other notable issue with Server Push was that browsers supported it, and some origin servers implemented the feature, but no major <a href="https://www.cloudflare.com/application-services/products/cdn/">CDN products</a> (Cloudflare’s included) deemed the feature promising enough to implement and support at scale. Support for standards like server push or Early Hints in each key piece of the web content supply chain is critical for mass adoption.</p>
    <div>
      <h2>Cracking the chicken and egg problem</h2>
      <a href="#cracking-the-chicken-and-egg-problem">
        
      </a>
    </div>
    
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/6Hh14GoS4bGQk2oVGserQa/d388f0369ca8cd322640f0d28c9a50fe/Frame-662.png" />
            
            </figure><p>Standards like Early Hints often don’t get off the ground because of this chicken and egg problem: clients have no reason to support new standards without server support and servers have no reason to implement support without clients speaking their language. As previously discussed, Early Hints is particularly complicated for origins to directly support, because 103 is an unfamiliar status code and multiple responses to a single request may not be a well-supported pattern in common HTTP server and application stacks.</p><p>We’ve tackled this in a few ways:</p><ol><li><p>Close partnership with Google Chrome and other browser teams to build support for the same standard at the same time, ensuring a critical mass of adoption for Early Hints from day one.</p></li><li><p>Developing ways for hints to be emitted by our edge to clients with support for the standard <i>without requiring support for the standard from the origin.</i> We’ve been fortunate to have a ready, willing, and able design partner in Shopify, whose performance engineering team has been instrumental in shaping our implementation and testing our production deployment.</p></li></ol><p>We plan to support Early Hints in two ways: one enabled now, and the other coming soon.</p>
    <div>
      <h3>Now: Turning 200 OK Link: headers into 103 Early Hints</h3>
      <a href="#now-turning-200-ok-link-headers-into-103-early-hints">
        
      </a>
    </div>
    <p>To avoid requiring origins to emit 103 responses from their origins directly, we settled on an approach that takes advantage of something many customers already used to indicate which assets an HTML page depends on, the Link: response header.</p><ul><li><p>When Cloudflare gets a response from the origin, we will parse it for <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link">Link headers</a> with preload or preconnect <i>rel</i> types. These <i>rel</i> types indicate to the browser that the asset should be loaded as soon as possible (preload), or that a connection should be established to the specified origin but no bytes should be transferred (preconnect).</p></li><li><p>Cloudflare takes these headers and caches them at our edge, ready to be served as a 103 Early Hints payload.</p></li><li><p>When subsequent requests come for that asset, we immediately send the browser the cached Early Hints response while proxying the request to the origin server to generate the full response.</p></li><li><p>Cloudflare then proxies the full response from origin to the browser when it’s available.</p></li><li><p>When the full response is available, it will contain Link headers (that’s how we started this whole story). We will compare the Link headers in the 200 response with the cached version to make sure that they are the most up to date. If they have changed since they’ve been cached, we will automatically purge the out-of-date Early Hints and re-cache the new ones.</p></li></ul>
    <div>
      <h3>Coming soon: Smart Early Hints generation at the edge</h3>
      <a href="#coming-soon-smart-early-hints-generation-at-the-edge">
        
      </a>
    </div>
    <p>We’re working hard on the next version of Early Hints. Smart Early Hints will use <a href="https://www.cloudflare.com/learning/ai/what-is-machine-learning/">machine learning</a> to generate Early Hints even when there isn’t a Link header present in the response from which we can harvest a 103. By analyzing historical request/response cycles for our customers, we can infer what assets being preloaded would help browsers load a webpage more quickly.</p><p>Look for Smart Early Hints in the next few months.</p>
    <div>
      <h3>Browser support</h3>
      <a href="#browser-support">
        
      </a>
    </div>
    <p>As previously mentioned, we’ve partnered closely with Google Chrome and other browser vendors to ensure that their implementations of Early Hints interoperate well with Cloudflare’s. Google Chrome, Microsoft Edge, and Mozilla Firefox have announced their intention to support Early Hints. Progress for this support can be tracked <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=671310">here</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1407355">here</a>. We expect more browsers to announce support soon.</p>
    <div>
      <h2>Benchmarking the impact of Early Hints</h2>
      <a href="#benchmarking-the-impact-of-early-hints">
        
      </a>
    </div>
    <p>Once you get accepted into the beta and enable the feature, you can see Early Hints in action using Google Chrome, version 94 or higher. As of Sept 16th 2021, the <a href="https://www.chromium.org/getting-involved/dev-channel">Chrome Dev channel</a> is at version 94.</p>
    <div>
      <h3>Testing Early Hints with Chrome version 94 or higher</h3>
      <a href="#testing-early-hints-with-chrome-version-94-or-higher">
        
      </a>
    </div>
    <p>Early Hints support is available in Chrome by running (assuming a Mac, but the same flag works on Windows or Linux):</p><p><code>open /Applications/Google\ Chrome\ Dev.app --args --enable-features=EarlyHintsPreloadForNavigation</code></p>
    <div>
      <h3>Testing Early Hints with Web Page Test</h3>
      <a href="#testing-early-hints-with-web-page-test">
        
      </a>
    </div>
    <ol><li><p>Open <a href="http://webpagetest.org">webpagetest.org</a> (a free performance testing tool).</p></li><li><p>Specify the desired test URL. It should have the necessary preload/preconnect <i>rel</i> types in the Link header of the response.</p></li><li><p>Choose <b>Chrome Canary</b> (or any Chrome version higher than 94) for the browser</p></li><li><p>Under <b>advanced settings</b>, select <b>Chromium</b>.</p></li><li><p>At the bottom of the <a href="https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/early-hints.md">Chromium</a> section there’s a command-line section where you should paste Chrome’s Early Hints flag: <code>--enable-features=EarlyHintsPreloadForNavigation.</code></p></li></ol><ul><li><p>To see the page load comparison, you can remove this flag and Early Hints won’t be enabled.</p></li></ul><p>You can also test via Chrome’s <a href="https://developer.chrome.com/blog/origin-trials/">Origin Trials</a>.</p><p>Using Web Page Test, we’ve been able to observe greater than <b>30% improvement</b> to a page's content loading in the browser as measured by Largest Contentful Paint (<a href="https://web.dev/lcp/">LCP</a>). An example test filmstrip:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4fsbcbAWGRutiLn0znk1K2/5b83f317e6dea72d8ab7a0c348c3f368/image2021-9-14_12-34-3.png" />
            
            </figure>
    <div>
      <h3>A few other considerations when testing...</h3>
      <a href="#a-few-other-considerations-when-testing">
        
      </a>
    </div>
    <ul><li><p>Chrome will not support Early Hints on HTTP/1.1 (or earlier protocols).</p></li><li><p>Chrome will not support Early Hints on subresource requests.</p></li><li><p>We encourage testers to see how different <i>rel</i> types improve performance along with other Cloudflare performance enhancements like Argo.</p></li><li><p>It can be hard to see which resources are actually being loaded early as a result of Early Hints. Interrogating the ResourceTiming API will return initiator=EarlyHints for those assets.</p></li></ul>
    <div>
      <h2>Signing up for the Early Hints beta</h2>
      <a href="#signing-up-for-the-early-hints-beta">
        
      </a>
    </div>
    <p>Early Hints promises to revolutionize web performance. Support for the standard is live at our edge globally and is being tested by customers hungry for speed.</p><p>How to sign up for Cloudflare’s Early Hints beta:</p><ol><li><p>Sign in to your <b>Cloudflare Account</b></p></li><li><p>In the dashboard, navigate to <a href="https://dash.cloudflare.com/?to=/:account/:zone/speed/optimization#sxg-card"><b>Speed</b> tab</a></p></li><li><p>Click on the <b>Optimization</b> section</p></li><li><p>Locate the <b>Early Hints beta</b> sign up card and request access. We’re enabling access for users on the beta list in batches.</p></li></ol><p>Early Hints holds tremendous promise to speed up everyone’s experience on the web. It’s exactly the kind of product we like working on at Cloudflare and exactly the kind of feature we think should be free, for everyone. Be sure to check out the beta and let us know what you think.</p><p>You can explore our beta implementation in the <a href="https://dash.cloudflare.com/?to=/:account/:zone/speed/optimization#sxg-card"><b>Speed tab</b></a>. And if you’re an engineer interested in improving the performance of the web for all, <a href="http://cloudflare.com/jobs">come join us</a>!</p>
    <div>
      <h2>Watch on Cloudflare TV</h2>
      <a href="#watch-on-cloudflare-tv">
        
      </a>
    </div>
    <div></div> ]]></content:encoded>
            <category><![CDATA[Speed Week]]></category>
            <category><![CDATA[Speed & Reliability]]></category>
            <category><![CDATA[Early Hints]]></category>
            <category><![CDATA[Product News]]></category>
            <guid isPermaLink="false">4mm77x7VCxATw1OXDv5rfk</guid>
            <dc:creator>Alex Krivit</dc:creator>
        </item>
    </channel>
</rss>