skip to content

A full content cook takes hours and blocks artists; what incremental-build and derived-data-cache strategy would you set for the team?

level: principalimportance: should knowfreq 32%

answer

  1. conversion as a pure function
  2. what the cache key must include
  3. who fills the shared cache
  4. hit rate, size and invalidation

basics

~20 s

Treat each conversion as a deterministic function, key its output by a hash of source, settings, platform, converter version and dependencies, and share that cache, kept warm by a farm that cooks every submit, so incremental cooks fetch instead of recompute.

solid answer

~50 s

Hours-long cooks redo conversions whose inputs did not change. First, a **derived-data cache**: each conversion is treated as a pure function, and its output is stored under a key hashed from the source content, the settings, the target platform, the converter's version and the hashes of anything it read; leaving the converter version out serves stale results after a bug fix, and timestamps cannot key a cache shared across machines, since the same bytes carry different timestamps on each. Second, an **incremental cook** driven by a dependency graph, recording the dependencies each converter actually reads. Third, **cache tiers**: local, a shared on-site cache and a remote one for distributed staff. Fourth, a **cook farm** that cooks every submitted change for each platform, so artists who sync find hits. The judgment calls: storage and bandwidth against hours saved, purging bad entries, and whether artists cook at all.

go deeper

for a junior

Recall that a cache can store each converted asset so unchanged assets are not converted again on every build.

for a middle

Explain what a derived-data cache key must contain and the failures each omission causes, such as stale output after a converter fix.

for a senior

Design the incremental cook: discovered dependencies, cache tiers and a farm that warms the shared cache on every submit, and diagnose a falling hit rate.

for a principal

Own the trade-offs: storage and bandwidth cost against hours saved, who may write the shared cache, when to force rebuilds, and which teams cook at all.

## Why a full cook takes hours A cook converts every asset a build needs into one platform's runtime format: texture compression, mesh optimisation, shader variant compilation, audio encoding, level baking. Each step is CPU-heavy, a large project has hundreds of thousands of assets, and every platform multiplies the work. When a cook starts from nothing, all of it runs again, even though almost none of the inputs changed since yesterday. Artists waiting on that cook to test on a device, or blocked by a broken nightly, are the real cost. The fix is to never compute the same output twice, which needs a cache whose keys are trustworthy. ## The rule: conversion as a pure function The foundation is treating each conversion as a **pure function**: the same inputs always produce the same output. Then the output can be stored and reused wherever the same inputs appear. The **derived-data cache** stores outputs under a key that must cover every input that could change them: - a **hash of the source content**, not its timestamp or path; - the **import and cook settings** for the asset; - the **target platform** and any platform-specific options; - the **converter's version**, bumped whenever its code changes output; - the **hashes of dependencies** the converter reads, such as included shader files or a texture embedded in a material. Each omission has a recognisable failure. Without the converter version, a bug fix in the texture compressor changes nothing, because every key still hits the old, buggy output. Keying on file timestamps instead of content fails twice: the same bytes carry different timestamps on every machine and after every branch switch, so a shared cache cannot match them, and a tool that sets timestamps from commit time can make a changed file look older than its last output. Undeclared dependencies cause the quietest failure: an edited include file leaves stale shaders in place. Pure functions also require **determinism**. A converter that embeds a timestamp, iterates a hash map in random order or depends on thread timing produces different bytes for identical inputs. Downstream keys that include those bytes then miss, and patches grow because unchanged content looks changed. ## Incremental cooking An **incremental cook** walks the dependency graph from the build's root assets and reconverts only what changed and what depends on it. The graph has two sources: references stored in asset data, and dependencies each converter **discovers while running**, which it must report so the next cook knows to recheck them. The incremental cook asks the cache before converting anything, so the first machine to convert an asset pays for everybody. ## Cache tiers | Tier | Where it lives | Serves | Typical concern | |---|---|---|---| | Local | each workstation | that person's repeated cooks | disk space | | Shared | an on-site server | the office and the build farm | capacity, eviction | | Remote | a hosted store | distributed staff, cloud build machines | bandwidth, access control | A lookup tries the nearest tier first and fills the nearer tiers on a hit further out. ## Running the farm A **cook farm** is a set of build machines that cook every submitted change for each shipping platform. Its main product is not the build but the **warm cache**: when an artist syncs in the morning, the outputs for everything submitted overnight already exist, so their local cook downloads instead of computing. The farm also catches a broken asset minutes after it is submitted rather than at the nightly build. ## The trade-offs a lead owns Several of these choices have no single right answer: 1. **Storage and bandwidth against time.** A shared cache for several platforms can grow very large; the team chooses eviction rules (least recently used, per-branch retention) and pays for capacity. 2. **Invalidation.** Bumping a converter version forces a full rebuild of everything it produced; the team decides when that cost is worth it and how to purge a poisoned entry written by a faulty machine. 3. **Who cooks at all.** Many artists can iterate on editor data with on-demand conversion and never run a full cook; reserving full cooks for device testing and the farm saves more than any cache. 4. **Trust.** Writes from personal machines can poison the shared cache; some teams let only the farm write to it and let workstations read. 5. **Per-platform cost.** Each platform multiplies cook time and cache size, so a team may cook secondary platforms less often. ## What to measure Track the **cache hit rate** per tier, the time of a cook after a typical day's changes, the farm's time from submit to warm cache, cache size and growth, and the count of rebuilds caused by version bumps. A falling hit rate often means a non-deterministic converter or a key that includes something it should not.

  • What goes wrong if workstations can write freely to the shared derived-data cache?
    A machine with a locally modified converter, a different tool version or a hardware fault can write wrong output under a correct key, and every other machine then trusts it. Some teams let only the farm write to the shared tier while workstations read from it and write locally; others verify writes by spot-checking them against a fresh conversion.
  • How do you find out which converter is making the cache miss more than it should?
    Log the hit rate per converter and compare keys for the same asset across two machines or two runs. If inputs match but outputs differ, the converter is non-deterministic: an embedded timestamp, unordered iteration or thread timing. If keys differ for identical inputs, something incidental such as an absolute path or machine name has leaked into the key.

  • File modification timestamps are a reliable key for incremental cooking on a team.
  • Leaving the converter's version out of the cache key is harmless.
  • A faster machine for the nightly cook solves cook times for the whole team.
  • Converter output does not need to be deterministic if the cache is keyed by inputs.
  • Every artist should run a full cook before testing any change.