Distributed persistent rendering, oh my
Tags: jamstack, netlify, astro, 11ty
Published: 2023-08-16 19:12:40

---
title: Distributed persistent rendering, oh my
published: true
date: 2023-08-16 00:00:00 UTC
tags: jamstack, netlify, astro, 11ty
canonical_url: https://blog.brainstory.ai/dpr-ohmy/
cover_image: https://images.unsplash.com/photo-1613771404784-3a5686aa2be3?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1738&q=80
---

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.

{% youtube DPzVLaWv4fk %}

## 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](https://dev.to/contenda/using-netlify-on-demand-builders-astro-edge-functions-to-make-a-blog-sharing-generator-20lf) 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](https://youtu.be/bENDCw9aLV0). 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!