DEV Community

Cover image for Zero-Downtime Migrations: The Expand/Contract Discipline That Keeps prod Alive
Mango Developer
Mango Developer

Posted on Originally published at mangodeveloper.com

Zero-Downtime Migrations: The Expand/Contract Discipline That Keeps prod Alive

The first time I took down a checkout system with a ALTER TABLE users ADD COLUMN ... was on a Sunday afternoon. The migration itself ran in 11 seconds on staging. On prod, with 80 million rows and a long-running transaction holding a shared lock, it ran for 38 minutes, during which every INSERT into users queued up behind it until the connection pool exhausted and the API started returning 503s. I learned the hard way that "it worked on staging" is not a migration strategy.

The thing nobody tells you about migrations is that the schema change itself is rarely the hard part. The hard part is doing it while writes are still coming in, while replicas are still catching up, while an analytics query is holding a lock you didn't know about, and while your deployment pipeline is happily rolling out new code that assumes the new schema already exists. Zero-downtime migration is a discipline, not a tool. This article is that discipline, written down.

Why Migrations Lock (and Why You Should Care)

Most relational databases use some flavor of two-phase locking for DDL. The behavior varies wildly between engines, versions, and even the specific clause you're executing. Here's the cheat sheet I keep taped to my monitor.

Operation MySQL 5.7 MySQL 8.0 (instant) Postgres 14+ Notes
ADD COLUMN ... DEFAULT NULL Rebuilds table Instant No table lock MySQL 8 instant DDL is a life-saver
ADD COLUMN ... DEFAULT 'x' Rebuilds table Instant (mostly) No table lock Postgres 11+ does not rewrite
ADD COLUMN ... NOT NULL Rebuilds table Rebuilds (sometimes) Short lock + full scan Postgres 12+ can skip scan if default constant
ADD INDEX Online (in-place) Online CONCURRENTLY Always use CONCURRENTLY on Postgres
DROP COLUMN Rebuilds table Instant Short lock, logical drop Column data removed lazily on Postgres
CHANGE COLUMN type Rebuilds table Rebuilds table Rewrites table Plan for a long migration
RENAME COLUMN Rebuilds (older) Instant Short lock Newer engines handle this gracefully

The lesson from this table: a one-line ALTER TABLE is never just one operation. The DBA in your head should always ask "what's the lock mode, how long, and what's queuing behind it." If you can't answer that for every migration you ship, you're rolling dice.

The Expand/Contract Pattern

Every zero-downtime migration I've shipped in the last decade reduces to three phases. I learned this pattern from a talk by Martin Fowler and it has aged better than any framework I've used.

CodeCopy

Enter fullscreen mode Exit fullscreen mode

EXPAND MIGRATE CONTRACT
(deploy schema) (backfill data) (remove old)
────────────────────────────────────────────────────────────────►
T1: ALTER TABLE ADD new_col T2: UPDATE in batches T3: ALTER TABLE DROP old_col
T1: Code reads both T2: Code reads new T3: Code reads only new
writes new T2: Writes both T3: App deployed with new only

Enter fullscreen mode Exit fullscreen mode

The three phases, in plain English:

  1. Expand - Add the new schema (column, table, index) without removing the old one. Deploy app code that writes to both old and new. Reads still use the old.
  2. Migrate - Backfill the existing rows so old and new are consistent. Deploy app code that reads from new but still writes both (for safety).
  3. Contract - Once you're confident the new path works, deploy code that only reads/writes the new. Then drop the old schema in a follow-up migration.

The pattern trades one scary migration for three boring ones. Boring is the goal.

Prerequisites

  • A relational database (Postgres 14+ or MySQL 8.0+ for the cleaner DDL semantics). This article uses Postgres examples; the principles transfer.
  • A migration tool that supports raw SQL, not just ORM DSLs. Alembic, Flyway, golang-migrate, and Atlas all do. I'll use Alembic because it's the Python default.
  • A way to ship app code in stages (feature flags, gradual rollouts, or at least multiple deploys per day). If you deploy once a week, zero-downtime is much harder.
  • Monitoring on lock waits, replication lag, and slow queries. Without this, you're flying blind.
  • A rollback plan for every change. Migrations should be reversible in code, even if you rarely use it.

You also need the discipline to refuse one-shot migrations that "just rename a column." Renames are the worst-case scenario-they look trivial, but if any code path still references the old name, prod breaks the moment the rename lands.

Migration Tooling Comparison

Tool Language Strengths Weaknesses Sweet spot
Alembic Python Tight SQLAlchemy integration, autogenerate Autogenerate misses data migrations SQLAlchemy apps
Flyway JVM Simple SQL-first, mature No data migration framework Java/Kotlin shops
golang-migrate Go Single binary, CI-friendly No data migration framework Polyglot or Go shops
Atlas Go Declarative schema, plan diffing Newer ecosystem, learning curve Modern infra-as-code shops
Liquibase JVM XML/YAML/JSON, rollback support Verbose, slow for large schemas Enterprise shops with audit needs

I default to Alembic for Python services and golang-migrate for everything else. Both let you write plain SQL when you need to (and you will). The mistake is reaching for a tool's autogenerate and shipping whatever it spits out-autogenerate doesn't know about CONCURRENTLY, doesn't batch backfills, and doesn't understand that you wanted to expand first.

Postgres DDL Cheat Sheet (The Stuff That Bites)

If you're on Postgres, here are the rules I follow for every migration. They're not optional.

  • Always use CREATE INDEX CONCURRENTLY for new indexes. The non-concurrent version takes a ShareLock that blocks writes.
  • Never add a NOT NULL column with a default in one statement if the table is large. Split it: add nullable with default, backfill, then ALTER ... SET NOT NULL (which on Postgres 12+ is fast if the default is a constant).
  • Never drop a column the same deploy you stop writing to it. Wait one deploy cycle. Old code may still be running on a replica or a stuck pod.
  • ALTER TABLE ... SET NOT NULL still scans the table to verify no nulls. On Postgres 18+ you can use SET NOT NULL with a check constraint pre-check; on earlier versions, add a CHECK constraint first (validated concurrently), then SET NOT NULL skips the scan.
  • Rebuilding indexes uses REINDEX INDEX CONCURRENTLY (Postgres 12+). Don't use plain REINDEX on prod.
  • Changing column types almost always rewrites the table. Plan accordingly or use a new column + backfill + rename.

Here's an Alembic migration that adds a nullable column and a concurrent index, the safe way:

PythonCopy

Enter fullscreen mode Exit fullscreen mode


python
'''add_email_verified_at_column

Revision ID: a1b2c3d4
Revises: 9z8y7x6w
Create Date: 2025-01-15 10:30:00 UTC
'''
from alembic import op
import sqlalchemy as sa

revision = "a1b2c3d4"
down_revision = "9z8y7x6w"
branch_labels = None
depends_on = None

def upgrade() -> None:
# Expand: add nullable column, no default, no lock contention.
op.add_column(
"users",
sa.Column("email_verified_at", sa.DateTime(timezone=True), nullable=True),
)
# Safe concurrent index for the backfill query.
op.execute(
"CREATE INDEX CONCURRENTLY IF NOT EXISTS "
"ix_users_email_verified_at_null ON users (id) "
"WHERE email_verified_at IS NULL"
)

def downgrade() -> None:
op.execute("DROP INDEX CONCURRENTLY IF EXISTS ix_users_email_verified_at_null")
op.drop_column("users", "email_verified_at")

Enter fullscreen mode Exit fullscreen mode


markdown

Notice that we never set NOT NULL in the expand phase. We'll do that later, after the backfill completes.

The Backfill Script (Where Migrations Go to Die)

The backfill is where 90% of migration disasters happen. Naive backfills look like this:

PythonCopy

Enter fullscreen mode Exit fullscreen mode


python

DO NOT DO THIS IN PROD.

def bad_backfill(session):
session.execute(text("UPDATE users SET email_verified_at = created_at WHERE email_verified_at IS NULL"))
session.commit()

Enter fullscreen mode Exit fullscreen mode


plaintext

This works on staging. On prod with 80M rows it holds a single transaction open for an hour, bloats the WAL, blocks autovacuum, and pushes replicas minutes behind. The right way is batched, throttled, and resumable.

PythonCopy

Enter fullscreen mode Exit fullscreen mode


python
'''Backfill email_verified_at in batches.'''
import logging
import time
from sqlalchemy import create_engine, text

log = logging.getLogger("backfill")
BATCH_SIZE = 2_000
SLEEP_SECONDS = 0.1 # throttle to let replicas catch up
MAX_ROWS = 10_000_000 # safety cap

def backfill(database_url: str, dry_run: bool = False) -> int:
engine = create_engine(database_url, pool_pre_ping=True)
total = 0
with engine.begin() as conn:
# Acquire an advisory lock so two backfills can't run at once.
acquired = conn.execute(text("SELECT pg_try_advisory_lock(727272)")).scalar()
if not acquired:
raise RuntimeError("Another backfill is already running.")

try:
while total < MAX_ROWS:
with engine.begin() as conn:
# Batch update with rowcount. The partial index from the
# migration makes this seek fast.
result = conn.execute(text(
"UPDATE users "
"SET email_verified_at = created_at "
"WHERE id IN ("
" SELECT id FROM users "
" WHERE email_verified_at IS NULL "
" ORDER BY id LIMIT :limit FOR UPDATE SKIP LOCKED"
")"
), {"limit": BATCH_SIZE})
affected = result.rowcount
conn.execute(text("SELECT pg_advisory_unlock(727272)")) # noop if not held
total += affected
log.info("updated=%d total=%d", affected, total)
if affected < BATCH_SIZE:
break # nothing left
time.sleep(SLEEP_SECONDS)
finally:
with engine.begin() as conn:
conn.execute(text("SELECT pg_advisory_unlock(727272)"))
return total

Enter fullscreen mode Exit fullscreen mode


markdown

The key tricks here are FOR UPDATE SKIP LOCKED (so other workers don't pick the same rows), the partial index on email_verified_at IS NULL (so the seek is fast), the advisory lock (so only one backfill runs), and the sleep (so replicas can catch up). This script is resumable-kill it anytime and restart, and it picks up where it left off.

Adding the NOT NULL Constraint Safely

Once the backfill completes, you might be tempted to run ALTER TABLE users ALTER COLUMN email_verified_at SET NOT NULL. On Postgres 11 and earlier this scans the entire table to verify no nulls, holding an AccessExclusiveLock that blocks everything. On Postgres 12+ it's faster if you've already added a CHECK constraint with NOT VALID, then validated it concurrently.

PythonCopy

Enter fullscreen mode Exit fullscreen mode


python
def upgrade() -> None:
# Add a NOT VALID check constraint - no scan, no long lock.
op.execute(
"ALTER TABLE users "
"ADD CONSTRAINT users_email_verified_at_not_null "
"CHECK (email_verified_at IS NOT NULL) NOT VALID"
)
# Validate concurrently - scans but doesn't block writes.
op.execute(
"ALTER TABLE users "
"VALIDATE CONSTRAINT users_email_verified_at_not_null"
)

def downgrade() -> None:
op.execute("ALTER TABLE users DROP CONSTRAINT IF EXISTS users_email_verified_at_not_null")

Enter fullscreen mode Exit fullscreen mode


plaintext

Once the check constraint is valid, you can promote it to NOT NULL in a follow-up deploy with a near-instant operation:

PythonCopy

Enter fullscreen mode Exit fullscreen mode


python
def upgrade() -> None:
# Postgres sees the existing valid CHECK and skips the scan.
op.alter_column(
"users", "email_verified_at",
nullable=False,
existing_type=sa.DateTime(timezone=True),
)
# Drop the now-redundant CHECK.
op.execute("ALTER TABLE users DROP CONSTRAINT users_email_verified_at_not_null")

Enter fullscreen mode Exit fullscreen mode


markdown

This is the kind of two-step dance that looks paranoid until you've watched a 30-minute SET NOT NULL on a critical table during peak traffic. Then it looks like basic hygiene.

Feature Flags: The Other Half of Zero-Downtime

Schema migrations are only half the problem. The other half is the code that reads and writes the new schema. If you deploy code that assumes the new column exists before the migration runs, you get exceptions. If you deploy code that writes to the old column after the migration drops it, you get exceptions. Feature flags bridge this.

PythonCopy

Enter fullscreen mode Exit fullscreen mode


python
from functools import lru_cache
import os

@lru_cache(maxsize=1)
def flag_use_email_verified_at() -> bool:
# Simple env-var flag. In prod, wire to LaunchDarkly, Statsig, Unleash, etc.
return os.getenv("FLAG_USE_EMAIL_VERIFIED_AT", "false").lower() == "true"

def mark_email_verified(user):
if flag_use_email_verified_at():
user.email_verified_at = datetime.now(timezone.utc)
# Always update the old column too during the expand/migrate phase.
user.email_verified = True

Enter fullscreen mode Exit fullscreen mode


markdown

The flag has three states across the migration:

  1. Expand phase - flag off. New column exists, app writes both old and new (so when you flip the flag, the data is already there).
  2. Migrate phase - flag off but backfill is running. App still reads old. Backfill fills new.
  3. Contract phase - flag on. App reads new. Old column kept for one more deploy "just in case." Then drop.

The mistake is reaching for the flag the moment you need it. Set up the flag infrastructure before you need migrations, so the migration path is just a config change.

Blue-Green Deployments and Database Migrations

Blue-green deployments assume you can run two versions of the app against the same database simultaneously. That's only true if your migrations follow the expand/contract pattern. If your migration drops a column the old version still needs, blue-green breaks.

CodeCopy

Enter fullscreen mode Exit fullscreen mode


plaintext
┌─────────────┐ ┌─────────────┐
│ Blue (v1) │────┬────│ Green (v2) │
└─────────────┘ │ └─────────────┘
│
▼
┌───────────────┐
│ Database │ <-- both versions read/write here
│ (expanded) │ schema must satisfy both
└───────────────┘

T1: Deploy green v2 alongside blue v1. Both work because schema is expanded.
T2: Shift traffic green-ward. Both still work.
T3: Tear down blue. Now safe to contract schema.

Enter fullscreen mode Exit fullscreen mode


markdown

The rule is simple: never contract the schema while both versions are live. If you're doing canary deploys, the contract migration must wait until the canary is at 100% and the old version is fully drained. The expand migration, on the other hand, must run before either version expects the new schema-and both versions must tolerate the new schema existing.

This sounds obvious until you realize that most teams' "deploy scripts" run migrations as part of the deploy. That's wrong. Migrations are a separate deploy step, run before the code that needs them, with its own rollback plan.

Monitoring During Migration

You don't run a prod migration blind. Here's what I watch in a second terminal while a migration runs:

SQLCopy

Enter fullscreen mode Exit fullscreen mode


sql
-- Long-running queries (including my migration)
SELECT pid, now() - xact_start AS duration, state, query
FROM pg_stat_activity
WHERE state != 'idle' AND now() - xact_start > interval '10 seconds'
ORDER BY duration DESC;

-- Locks waiting behind my migration
SELECT blocked.pid AS blocked_pid,
blocked.query AS blocked_query,
blocking.pid AS blocking_pid,
blocking.query AS blocking_query
FROM pg_stat_activity blocked
JOIN pg_stat_activity blocking ON blocking.pid = ANY(pg_blocking_pids(blocked.pid));

-- Replication lag (if you have replicas)
SELECT application_name,
state,
sent_lsn,
replay_lsn,
sent_lsn - replay_lsn AS lag_bytes
FROM pg_stat_replication;

-- Table bloat from a long backfill
SELECT relname, n_live_tup, n_dead_tup,
round(n_dead_tup::numeric / NULLIF(n_live_tup, 0) * 100, 2) AS dead_pct
FROM pg_stat_user_tables
WHERE relname = 'users';

Enter fullscreen mode Exit fullscreen mode


markdown

If blocked_pid starts accumulating, kill the migration and re-run with smaller batches. If lag_bytes exceeds your SLA threshold, pause and let replicas catch up. If dead_pct climbs above ~20%, you're creating bloat that autovacuum will need to clean up later-slow down.

I also watch the app's error rate in Datadog/Grafana during migrations. If 500s tick up, the migration is interfering with queries. Stop, investigate, don't push through.

Common Mistakes

Running the migration in the deploy script. Every framework's default is migrate && restart app. On prod this means a deploy blocks on a migration that might take 30 minutes, and a rollback undoes the migration (which often fails because the app already wrote data with the new schema). Run migrations as a separate step, manually, with monitoring.

Autogenerating migrations and shipping them. Alembic's --autogenerate is a starting point, not a final answer. It doesn't know to add CONCURRENTLY, doesn't know to split ADD COLUMN NOT NULL DEFAULT into safe steps, and doesn't know about backfills. Review every generated migration by hand.

Forgetting to update the ORM models. If your migration adds a column but your ORM model doesn't include it, queries that SELECT * will work (Postgres returns the column) but inserts won't write it. The column ends up null and you wonder why. Keep migrations and ORM models in the same PR.

Dropping a column the same deploy you stop using it. Old code may still be running-on a canary pod, a stuck worker, a background job that didn't get the memo. Wait at least one full deploy cycle (24 hours is conservative, 1 hour is risky) between "stop writing to X" and "drop X."

Trusting LOCK TABLE to be fast. It's not. Even a brief AccessExclusiveLock blocks all reads and writes. If you must take an exclusive lock, do it during a maintenance window and announce it.

Using ALTER TABLE ... TYPE to change a column type. This rewrites the table. Instead, add a new column with the right type, dual-write, backfill, switch reads, then drop the old column. Yes it's more work. Yes you have to do it.

Troubleshooting

"My migration is stuck and nothing is happening." Check pg_stat_activity for your migration's pid. If state = 'idle in transaction', the migration is waiting on a lock. Find the blocking pid with pg_blocking_pids(). Either wait, kill the blocker, or kill your migration and retry when traffic is lower.

"Replicas are minutes behind after my backfill." Your batches are too big. Drop BATCH_SIZE from 5,000 to 500, increase SLEEP_SECONDS from 0.1 to 0.5, and add a pg_stat_replication check inside the loop that pauses if lag exceeds 1MB.

"Autovacuum is going crazy after my backfill." Normal-a backfill updates a lot of rows and creates a lot of dead tuples. Either let autovacuum catch up (it will), or run VACUUM (ANALYZE, FREEZE) on the table after the backfill to clean up before peak traffic.

"My ADD COLUMN ... DEFAULT now() migration took 20 minutes on prod." Postgres 11+ should handle this without a rewrite. Check your version. If you're on Postgres 10, the rewrite is expected-plan for it or upgrade.

"I dropped a column and now a legacy worker is erroring." Don't drop columns that any code might still reference. Add a SELECT pg_sleep(interval) style canary deployment that runs the old code against prod for an hour before you actually drop. Or just wait 24 hours-it's almost always cheaper than fixing the breakage.

"My CREATE INDEX CONCURRENTLY failed with 'tuple concurrently updated'." This happens when another transaction modifies rows the index build is scanning. The index is left in INVALID state. Drop it and retry, or wait until a quieter moment. Don't ship the migration with an invalid index.

CI/CD Considerations

Migrations belong in CI but with limits. Here's the pipeline I use:

  1. PR checks - Run alembic upgrade head against a fresh containerized Postgres. Catches syntax errors and obvious issues. Does not catch lock behavior on large tables.
  2. Migration plan diff - For Postgres, run EXPLAIN on the migration SQL and assert that no AccessExclusiveLock appears on hot tables. (Atlas does this automatically; for Alembic, write a small linter.)
  3. Staging apply - Auto-apply to staging with a copy of prod data. Watch the duration; if staging (1/10th prod size) takes 30 seconds, prod will take minutes.
  4. Production apply - Manual trigger, with a runbook. Requires two-person approval for migrations touching tables with >1M rows.
  5. Post-apply verification - Automated check that the new schema is queryable, the app's health endpoint is green, and error rates haven't spiked.

The CI should also lint for the obvious mistakes: ADD COLUMN ... NOT NULL without a default on a large table, CREATE INDEX (not CONCURRENTLY), DROP COLUMN in the same migration as the expand. These belong in a custom lint script-here's a sketch:

PythonCopy

Enter fullscreen mode Exit fullscreen mode


python
'''Lint Alembic migrations for common prod-unsafe patterns.'''
import re
import sys
from pathlib import Path

DANGEROUS_PATTERNS = [
(r"\bCREATE\s+INDEX\s+(?!.*CONCURRENTLY)", "CREATE INDEX without CONCURRENTLY"),
(r"\bALTER\s+TABLE\s+\w+\s+DROP\s+COLUMN", "DROP COLUMN - ensure old code is fully drained"),
(r"\bALTER\s+TABLE\s+\w+\s+ADD\s+COLUMN.*NOT\s+NULL", "ADD COLUMN NOT NULL - split into expand + backfill"),
(r"\bLOCK\s+TABLE", "LOCK TABLE - blocks all access"),
]

def lint_migration(path: Path) -> list[str]:
sql = path.read_text()
issues = []
for pattern, message in DANGEROUS_PATTERNS:
if re.search(pattern, sql, re.IGNORECASE):
issues.append(f"{path.name}: {message}")
return issues

if name == "main":
migrations_dir = Path("alembic/versions")
all_issues = []
for sql_file in migrations_dir.glob("*.py"):
all_issues.extend(lint_migration(sql_file))
if all_issues:
print("\n".join(all_issues))
sys.exit(1)

Enter fullscreen mode Exit fullscreen mode

Run this in CI on every PR that touches the migrations directory. It catches 80% of the prod-unsafe patterns before a human reviewer has to.

Cost Considerations

Schema migrations themselves are cheap-it's the operational cost of getting them wrong that bites. The big costs:

  • Replica lag during backfill - If your read replicas serve analytics or async workers, lag spikes can break those workloads. Budget for slower async processing during backfill windows.
  • Storage bloat - A backfill that updates 80M rows creates 80M dead tuples. Autovacuum reclaims them, but until then your table is bigger on disk. Plan for ~20% extra storage during migration windows.
  • Compute for parallel backfills - Running 4 parallel backfill workers costs 4x CPU on the database. Either scale up during the migration or accept that it takes 4x longer with one worker.
  • Engineer time - The first few times you do expand/contract, it takes an hour to plan a single migration. After a year it's 10 minutes. The investment pays back the first time you avoid a Sunday 2am call.

The cheapest migration is one you've done before. Document your migration runbooks-when something breaks at 3am, the runbook is what saves you, not the framework.

Alternatives and When to Use Them

Approach When it fits When it doesn't
Expand/contract (this article) Most schema changes on busy tables Trivial migrations on small tables (use plain DDL)
pt-online-schema-change (MySQL) MySQL 5.7 or large MySQL tables Postgres, or MySQL 8 with instant DDL
gh-ost (MySQL) MySQL, when pt-osc triggers fail Postgres, or when you need synchronous behavior
pg_repack (Postgres) Removing bloat without long locks Routine schema changes (it's for physical reorganization)
Logical replication + cutover Very large tables (TB-scale) that need a schema change Anything smaller-too much operational overhead
Maintenance window + plain DDL Small apps with low traffic Anything with a 24/7 SLA

For the 95% case-schema changes on tables under 100M rows-the expand/contract pattern in this article is the right answer. The exotic tools exist for the 5% case where even expand/contract isn't enough.

Real-World Use Case: Renaming a Column Without Downtime

Renaming users.email to users.primary_email is the canonical scary migration. Done wrong, every login breaks. Done with expand/contract:

  1. Expand - Add primary_email column, nullable, no default. Add a trigger that copies email → primary_email on every insert/update. Backfill existing rows. Deploy app code that reads primary_email (falls back to email if null) and writes both.
  2. Migrate - Run the backfill. Verify primary_email is populated for all rows. Deploy app code that reads only primary_email. Trigger still keeps them in sync.
  3. Contract - Wait one deploy cycle. Drop the trigger. Drop the email column. Remove the fallback code.

Each step is independently safe and reversible. The whole thing takes a week of calendar time and 30 minutes of engineer time. The alternative-ALTER TABLE users RENAME COLUMN email TO primary_email in one deploy-takes 5 seconds of engineer time and an unpredictable amount of customer-support time afterward.

Conclusion

Zero-downtime migrations aren't a tool you buy or a framework you adopt. They're a discipline: expand the schema, migrate the data, contract the old. It's slower than alembic upgrade head in your deploy script, but it's the difference between a migration that ships at 2pm on a Tuesday and one that ships at 2am on a Saturday with the on-call engineer watching.

The pattern is boring on purpose. Boring is what you want when prod is on the line.


Originally published on Mango Developer.

Top comments (1)

Collapse
 
maxpaint profile image
Maksym Danylenko •

Expand/contract gives you room to recover. One correction to the table: PostgreSQL ADD COLUMN can still need an ACCESS EXCLUSIVE lock even when it avoids a table rewrite. I would set a short lock_timeout and retry later rather than let waiting DDL build a queue behind it. The release check should cover lock acquisition as well as migration runtime.