﻿---
title: Sizing a host
description: What a host needs to give Isomer, drawn from the benchmark results.
url: https://docs-v3-preview.elastic.dev/isomer/benchmarks/sizing
---

# Sizing a host
This page turns the [raw results](https://docs-v3-preview.elastic.dev/isomer/benchmarks/results) into guidance for a host. Every figure here comes from a committed baseline: the machine and Node version are on the results page. Memory figures carry across machines better than times do. Sections marked pending wait on suites that don't exist yet.

## Loading

A bare Node process holds about 42 MB RSS before it loads anything ([`node`](/isomer/benchmarks/results#loading-each-entry)). Loading Isomer adds to that:
- The SDK and the runtime with takumi, what a server that draws images needs besides a pack, reach about 69 MB RSS with 8 MB of heap held ([`host:image`](/isomer/benchmarks/results#loading-each-entry)). With agent-tools instead of takumi, about 64 MB ([`host:agent`](/isomer/benchmarks/results#loading-each-entry)).
- A pack adds its own. With the SDK and the runtime, the charts pack reaches about 74 MB ([`charts:host`](/isomer/benchmarks/results#loading-each-entry)) and the slides pack about 92 MB ([`slides:host`](/isomer/benchmarks/results#loading-each-entry)). Compare a pack's host row with the [`@elastic/isomer-runtime`](/isomer/benchmarks/results#loading-each-entry) row, about 64 MB, for what the pack adds: loading the runtime loads the SDK's root entry with it.
- The Elastic Charts engine loads `@elastic/charts` with it, as one prebundled Node build: about 110 CommonJS modules, 9 MB of heap and 84 MB RSS. Its `./engine` and `./node` entries load as much. With the SDK and the runtime it reaches about 94 MB ([`charts-elastic:host`](/isomer/benchmarks/results#loading-each-entry)). A process that only validates or resolves charts never needs it.

To see what your own pack adds, [benchmark it](/isomer/benchmarks#benchmarking-a-pack).

## Importing only what you use

The SDK's root entry loads about 150 modules and bundles to about 185 KB minified for Node. Its subpaths cost less ([Loading each entry](/isomer/benchmarks/results#loading-each-entry), [Bundling each entry](/isomer/benchmarks/results#bundling-each-entry)):

| You need                                                             | Import                                      | Loads                                          | Bundles (Node, minified) |
|----------------------------------------------------------------------|---------------------------------------------|------------------------------------------------|--------------------------|
| Plain-text rendering                                                 | `@elastic/isomer-sdk/text`                  | 3 modules                                      | under 1 KB               |
| A pack's schema helpers (`z`, `requiredString`, URL rules), no React | `@elastic/isomer-sdk/schema`                | about 110 modules, 3.7 MB heap, most of it zod | about 2 KB, zod aside    |
| Chart contracts for a materializer                                   | `@elastic/isomer-primitives-charts/schema`  | about 160 modules                              | about 125 KB             |
| Scene resolution alone                                               | `@elastic/isomer-primitives-charts/resolve` | about 30 modules                               | about 50 KB              |
| The composition validator and parser                                 | `@elastic/isomer-sdk`                       | about 150 modules                              | about 185 KB             |
| Every surface, assembled from your packs                             | `@elastic/isomer-runtime`                   | about 220 modules                              | about 340 KB             |

Loading takumi costs little on its own (about 19 modules and 15 ms). Its fonts register on the first draw; see [First draw](#first-draw).

## Bundling

A host that bundles Isomer, such as a render service or a browser app, ships what each entry pulls in besides its peers ([Bundling each entry](/isomer/benchmarks/results#bundling-each-entry)):
- Most of the SDK root's 185 KB isn't the SDK's own code, which is about 40 KB. The rest is the Markdown parser that renders Markdown content (`micromark`, `mdast-util-to-markdown`, and `character-entities` at 35 KB on its own). `./react` and `./slack` pull the parser in too.
- `./html` pulls in `acorn`, about 120 KB, which checks embedded scripts. So does the runtime, which bundles every surface: about 340 KB for Node and about 300 KB for the browser.
- The slides pack bundles to about 545 KB and the charts pack to about 400 KB. Each pack's own code is a little over half of that; the rest is mostly the SDK, the Markdown parser and `@elastic/distillate`.
- The Elastic Charts engine's entries are about 65 KB each, but `@elastic/charts`, their peer, isn't counted. A host that draws with Elastic Charts ships it anyway.
- takumi bundles only for Node, to about 46 KB. That excludes its native renderer, a per-platform binary the bundle loads at runtime (see [Installing](#installing)), and the PDF worker with its `takumi-pdf` dependency, which loads separately when a host first draws a PDF.


## What a composition costs

What it costs to assemble a runtime and to validate and render a composition, apart from what a pack's own renderers do ([SDK and runtime overhead](/isomer/benchmarks/results#sdk-and-runtime-overhead)):
- **Assembling a runtime** builds the composition schema, so its cost grows with the number of primitive types: about 1.5 ms and 0.2 MB of heap for 10 types, and about 5.5 ms and 1.7 MB for 200, apart from defining the pack. Assemble once per process and reuse the runtime.
- **The first validate** costs about ten times the later ones: about 2 ms against 0.2 ms at 10 types and 100 nodes, and about 4 ms at 200 types. Validate one composition at startup if the first request's latency matters.
- **Validation is most of a composition's cost, and it grows with nodes:** about 1.2 µs per node with 8-character labels, so 4,000 nodes, about 60% of what the SDK's default input budget admits for nodes this small, validate in about 4.6 ms. Each surface's `render` validates first, so the render columns are end to end: at 4,000 nodes, about 6 ms for HTML, 5 ms for text and 5.9 ms for a snapshot. The columns are timed one after another on the same runtime, and these timings vary by tens of percent between recordings, so don't subtract one column from another. Peak RSS rises about 13 KB per node, to about 140 MB at 4,000. That is the high-water mark of a process rendering them many times over, garbage included, so it overstates what one render holds.
- **Nesting depth** costs almost nothing up to 24 levels, the deepest measured.
- **Text length** costs HTML rendering, which escapes it: 900,000 label characters add about 2 ms. Validation doesn't notice it.

A real pack's renderers cost more than these trivial ones; [Drawing a chart](#drawing-a-chart) has a chart's.

## Drawing a chart

What a server pays to draw charts to PNG with the charts pack, the Elastic Charts engine and takumi, with Inter Latin registered ([Drawing charts](/isomer/benchmarks/results#drawing-charts)):
- **Loading the engine adds about 20 MB.** Loaded and with fonts registered, a process holds about 85 MB RSS without an engine and about 105 MB with Elastic Charts. One cold xy chart at 2× is ready about 220 ms after the process starts and peaks at about 165 MB.
- **A small chart is cheap once loaded:** about 4 ms to resolve and draw and 5 ms to rasterize at 1×, for the pack's metric and xy examples.
- **Data size drives memory, and the `snapshot` surface drives time.** One xy line at the charts pack's whole input budget, about 250,000 values, takes about 70 ms to validate, about 530 ms to render as a snapshot, and under 100 ms to rasterize. Resolving its Scene once takes about 330 ms, and with no engine the same snapshot takes about 455 ms, so Elastic Charts itself adds about 75 ms; the rest is the surface's own work around the chart, including validating again. It peaks at about 390 MB, about 280 MB above what loading holds, the request's data included. At a quarter and half of the budget, that peak above loading is about 120 MB and 160 MB.
- **Splitting the same data across a 40-panel grid** peaks a little lower, at about 330 MB, but takes about 190 ms to rasterize, since the picture holds 40 charts.
- **With no engine,** the pack draws a summary in place of each chart. At the whole budget it still resolves the Scene, so it peaks at about 290 MB, and its snapshot takes about 455 ms.

Size a render process for the largest chart it accepts. The input budget bounds its data, and a lower `inputBudget` lowers the peak. It doesn't bound the picture: these peaks are at the suite's snapshot size and 2× scale, so a host that accepts a larger viewport or PNG scale bounds those separately.

## First draw

What takumi costs on its own on macOS arm64 with Node 22.22.0, `@takumi-rs/core` 2.22.1 and `takumi-pdf` 0.21.3, drawing the slides pack's 33-slide `isomer-every-surface` deck with the theme's 10 font faces registered ([Rasterizing with takumi](/isomer/benchmarks/results#rasterizing-with-takumi)):
- **Loading takumi is cheap.** A process that has loaded it, created a backend and drawn an empty SVG holds about 57 MB RSS. Registering the 10 faces on that first draw adds about 1 MB and a few milliseconds.
- **A PNG is quick once fonts are in.** One 1920×1080 slide at 1× takes about 15 ms cold and about 6 ms after that. At 2× each takes about 16 ms, and the whole deck peaks at about 153 MB against about 94 MB at 1×. SVG is cheaper still, about 1.3 ms a slide. These per-output times exclude the setup included in the table’s `First output` column.
- **The first PDF starts a worker.** A cold one-page PDF takes about 130 ms including benchmark setup and raises peak RSS by about 75 MB. That includes starting the worker, its WebAssembly engine and its own copy of the fonts, as well as drawing the page; the suite doesn't separate them. The whole deck as one PDF takes about 225 ms including setup and peaks at about 160 MB, so each page past the first costs a few milliseconds. Later PDFs of the deck take about 60 ms.
- **`close()` gives some of that back.** After the deck's PDF, closing the worker brought RSS down by about 26 MB on macOS, which seldom returns freed pages to the system.


### Under repeated draws

Between the first and last of 20 passes of the deck, RSS increased ([`png-repeat`](/isomer/benchmarks/results#rasterizing-with-takumi), [`pdf-repeat`](/isomer/benchmarks/results#rasterizing-with-takumi)):
- **PNG:** about 9 MB past the first pass after 660 PNGs. With `cacheMaxBytes: 0`, growth was about 7.5 MB, and the median draw took about 8 ms against about 4 ms with the default cache. The final RSS was about 94 MB with no cache against about 102 MB with it.
- **PDF:** about 29 MB past the first PDF after 20, reaching about 186 MB RSS after the run. The suite doesn't measure the worker's WebAssembly memory apart from the rest.

Each repeated row samples RSS after its first and final passes. Those two samples cannot distinguish sustained growth from an early rise followed by a plateau, or predict whether growth eventually stops.
Both were measured on macOS only. A long-running render process should watch its RSS, and a process that only draws PDFs now and then can `close()` the worker between them.

## Concurrent draws

A burst of 16 small xy PNGs at 2×, requested at once and drawn with the Elastic Charts engine ([Drawing charts](/isomer/benchmarks/results#drawing-charts)):
- Through a limiter of 2, it peaks at about 255 MB, 150 MB above what loading holds. The median PNG call takes about 22 ms, and all 16 are done in about 265 ms.
- With no limiter, it peaks at about 325 MB. All 16 PNG calls start at once but share libuv's thread pool, four threads by default, so the median call takes about 100 ms, most of it waiting for a thread. All 16 are done in about 235 ms, about 30 ms sooner, for about 70 MB more.

A limiter trades a little latency for a lower, bounded peak, so limit draws in flight with the limiter the takumi docs give. To run the bursts:
```sh
pnpm bench charts --scenarios charts-elastic:burst-limited,charts-elastic:burst-unlimited
```

PNG, SVG and measure calls run on the libuv thread pool ([Rendering a PDF](/isomer/image-takumi#rendering-a-pdf)), so draws in flight at once each hold their memory at once. The pool has 4 threads unless `UV_THREADPOOL_SIZE` says otherwise, and that caps takumi's parallelism: the 33 slides requested at once finish in about 65–70 ms against about 210 ms one at a time, and peak about 35 MB higher, whether a limiter of 4 holds them or none does ([`png-burst-4`, `png-burst`](/isomer/benchmarks/results#rasterizing-with-takumi)). With this deck, a limiter of 4 and no limiter finished in the same total time, and their peaks were within a few MB of each other. That says nothing about a host's own limiter, which usually also holds the synchronous `snapshot` render and each request's input and output, and keeps takumi from crowding other work on the libuv pool, such as file system, zlib, crypto and DNS calls.

## Containers and heap limits

Pending: the smallest cgroup memory limit and `--max-old-space-size` that a draw succeeds under, including the profile Kibana forks its render process with.

## Installing

Pending: installed size per package, including takumi's per-platform native binary, and the package directories a host's build must keep.