DEV Community

Cover image for Distributed persistent rendering, oh my
Cassidy Williams for Contenda

Posted on • Originally published at blog.brainstory.ai on

Distributed persistent rendering, oh my

Building a Jamstack site can be compared to filling a box with different Pokémon. Each Pokémon represents a different page you might want to add. However, as the site grows larger, this box becomes filled with more and more Pokémon, and consequently, the build times for your site start to increase.

Consider evolving a Pokémon, akin to updating a page on your site. Suddenly, you have to take all the pages out and rebuild the entire site. This can become quite cumbersome and time-consuming, especially for larger sites. That’s where Distributed Persistent Rendering comes in.

What is DPR?

DPR, or Distributed Persistent Rendering, is a framework-agnostic approach to building web applications. It allows you to build some parts of your site early, while postponing other parts for later. This method was inspired by early web development techniques and is designed to work with any platform or framework.

In a DPR model:

  1. Some pages are pre-built as usual. These are the critical content that needs to be upfront and pre-built every single time.
  2. Other pages are deferred. These pages are built and cached at the edge when they are requested for the first time, so they don’t need to be built again.

On-Demand Builders

On-demand builders is an early implementation of DPR at Netlify. It’s as simple as wrapping your serverless function with a couple of lines of code. This allows you to deploy a few pages while other pages are pulled in as needed and then cached.

This approach can be particularly beneficial for sites with thousands of product pages. Instead of having to pre-build all these pages, you can build them on-demand, maintaining fast build times while still offering a full range of products.

At Contenda, our sharing feature was built with on-demand builders! You can check out how we used built that feature in the linked post.

Atomic and Immutable Deploys

DPR maintains the atomic and immutable deploys guarantee that comes with the Jamstack.

  • Atomic Deploys: The entire build is served to the user in one state, meaning that your URL is a source of truth.
  • Immutable Deploys: Things don’t change the build. If a page needs to change, a new build is required.

Get Involved

If you’d like to experiment with on-demand builders, you can try them on Netlify or with the frameworks that support them, like Eleventy or Astro.

Additionally, I recommend checking out some of the videos on Eleventy by Zach Leatherman. They provide valuable insight into the world of Jamstack and DPR.

Remember, the power of DPR and Jamstack is in your hands. So, go ahead, fill that box with Pokémon, evolve them when needed, and build your site efficiently and effectively.

Until next time, happy coding!

This post was authored with the help of Contenda Studio! Sign up here for free.

Top comments (3)

Collapse
 
lilchenzo profile image
Lilly

moar pokemon themed content

Collapse
 
philipjohnbasile profile image
Philip John Basile

Loved the content! We need more Pokemon tie ins!!!

Collapse
 
avidlarge profile image
David Large

Love it! I, too, would appreciate more Pokemon analogies in my Jamstack Alakazamstack.