Skip to main content

Upgrading to 1.5.0

1.5.0 is a minor release. A 1.4.7 configuration loads and behaves as before, and no configuration change is required. Upgrade first and run on your existing settings. Then, if you want the speed-up, change the optional settings below one at a time, checking your pages after each.

What the release contains is in the changelog. In short: renders no longer stall on two waits inside the DevTools client, Chrome no longer builds hidden browser interface and a spare process for every render, the render waits can be tuned, there is an optional headless-shell browser, and Chromium is 156.0.8078.108.

What changes without a configuration change​

  • Chrome does less work per render. PRISM switches off the address bar's suggestion popup and the spare renderer process, which Chromium 156 built for every render's browser context. Peak memory at the same number of tabs is about half of what it was. Rendered pages are not affected.
  • No more 10-second stalls on single-page apps. A navigation could wait out render.timeout_secs on a page that had finished loading, and the render was then retried. If you watch prism_render_retries_total, expect it to drop.
  • No 2-second wait after navigation. Renders under concurrent load finish sooner.
  • Chromium 156.0.8078.108 in the image. The previous version is no longer available from Debian.

Because renders finish sooner, one PRISM instance can now send more renders per second to the origin. If the origin was sized for PRISM's old pace, keep render.pool.tabs where it is for the upgrade and raise it later.

Upgrade​

Docker. The image is about 320 MB larger than 1.4.7's (1.47 GB against 1.15 GB), because it carries chromium-headless-shell next to the full Chromium.

docker pull docker.trident-cache.com/prism:v1.5.0
docker run --rm docker.trident-cache.com/prism:v1.5.0 --version
# trident-prism 1.5.0

Packages.

# Debian / Ubuntu
sudo apt update && sudo apt install --only-upgrade prism
# RHEL / Fedora / Rocky
sudo dnf upgrade prism
# Alpine
sudo apk upgrade prism

Kubernetes. The Helm chart is 0.1.8 with appVersion 1.5.0, and deploy/k8s/deployment.yaml points at v1.5.0.

After the restart, check that the instance renders:

prism --version # trident-prism 1.5.0
curl -s http://127.0.0.1:4001/ready # 200 once Chrome is up

Optional: tune for speed​

The settings below are what the 1.5.0 benchmark used. They took the benchmark storefront from 1.95 to 21.0 renders per second at sixteen concurrent renders on 4 CPUs. Each one is optional, and the waits and the scroll depend on how your site loads, so change one at a time and compare the output.

Capture a baseline​

Pick the pages that matter: home, a category, a product and a search result. For each, clear the cached copy, request it as a crawler and save the HTML:

ADMIN=http://127.0.0.1:4001
TOKEN=your-admin-token
for path in / /category/shoes /product/blue-shoe "/search?q=shoe"; do
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "{\"url\": \"$path\"}" "$ADMIN/purge/url" > /dev/null
name=$(echo "$path" | tr '/?=' '___')
curl -s -A "Googlebot/2.1 (+http://www.google.com/bot.html)" \
"https://www.example.com$path" > "before$name.html"
done

Replace the paths and the host with your own; the host is wherever crawlers reach PRISM. After each change, run the same loop, saving to after… files, and compare. A loading skeleton, a spinner, an empty product grid or missing prices in the new HTML mean the render was taken too early. If you see one, go back to the previous value.

1. Render with the headless shell​

[render]
browser = "headless-shell"

The headless shell is the same Chromium engine and version without browser windows or interface. The browser context PRISM opens for every render costs it next to nothing. In the benchmark it doubled throughput under concurrency (11.4 → 21.0 renders per second) and lowered p95 from 1.66 to 0.89 seconds.

  • Docker: the image already has it. Set the option and restart.
  • Debian or Ubuntu packages: sudo apt install chromium-headless-shell.
  • Fedora or RHEL packages: sudo dnf install chromium-headless.
  • Anything else: point CHROME_HEADLESS_SHELL at a chrome-headless-shell executable, for example from Chrome for Testing.

Check the start-up log for rendering with the headless shell and the path. If PRISM cannot find a shell it logs a warning and renders with the full Chromium, so a missing package costs speed, not rendering. More detail is in render.browser.

2. Wait for the network on single-page apps​

[render]
wait_for = "networkidle"

The default, load, does not wait for the data a single-page app fetches after the page has loaded, so a crawler can get the empty shell. The framework presets (React, Vue, Angular, Next.js, Magento PWA) already use networkidle. Skip this step if your configuration has it.

3. Shorten the fixed waits​

[render]
dom_idle_initial_delay_ms = 0 # default 1000
dom_idle_settle_ms = 0 # default 300
network_quiet_ms = 300 # default 500

With the defaults, every networkidle render waits at least 1.3 seconds after the page has loaded. These values save about 0.7 seconds per render. The first delay exists for sites that paint their loading skeleton late. If your skeleton appears late, set dom_idle_initial_delay_ms back toward 1000 and keep the rest. A site that fetches in a chain with pauses between the requests needs a longer network_quiet_ms. See Tuning the waits.

4. Scroll faster​

[render]
auto_scroll_step_px = 1000 # default 400
auto_scroll_step_delay_ms = 25 # default 100

A 3000-pixel page scrolls in about 0.1 seconds instead of 0.8. Check that sections that load as they come into view, such as product grids and reviews, are still in the HTML.

5. Add tabs​

[render.pool]
tabs = 16 # default 8

The benchmark used 16 tabs on 4 CPUs. Raise the number gradually from 8 while watching CPU, memory, prism_render_queue_depth and the origin's load. The memory estimate PRISM logs at start-up assumes the full browser and is conservative with the headless shell, so go by measured usage. See Capacity Planning.

Watch after each change​

  • prism_render_incomplete_total rises when a wait ends on its time limit instead of the page settling.
  • prism_render_retries_total should stay near zero.
  • prism_render_duration_ms shows what each change bought.

Rolling back​

  • One setting: remove it or set it back to the default shown above, and restart.
  • The headless shell: remove browser or set browser = "chromium", and restart.
  • Back to 1.4.7: 1.4.7 refuses configuration keys it does not know. Before you downgrade, remove browser, chrome_disable_features, dom_idle_initial_delay_ms, dom_idle_settle_ms, network_quiet_ms, auto_scroll_step_px and auto_scroll_step_delay_ms. Then install the old version: docker.trident-cache.com/prism:v1.4.7, sudo apt install prism=1.4.7-1 or sudo dnf downgrade prism-1.4.7.