Skip to content
LESSON 14 / 50Expertwiredtiger

The Lookaside Table (LAS) & Cache Pressure Overflow

The WiredTiger Lookaside Table (LAS) acts as an overflow swap area on disk for old transaction updates when the in-memory cache experiences extreme pressure.

Interactive Engine Simulator

WiredTiger Storage Engine: Cache, Journal & Checkpoints

Simulate RAM page states, dirty page eviction thresholds, WAL journaling, and 60-second checkpoint disk flushes.

Dirty Page Ratio
50%
Eviction triggers at 80%
Journal WAL LSN
#1048
Flushed every 100ms
Last Checkpoint
18s ago
Default period: 60s
Node State
HEALTHY
WiredTiger Engine
1. RAM Cache (Volatile)4 Pages
p-1users: [u1..u20]
CLEAN
p-2orders: [o101..o150]
DIRTY
p-3products: [p1..p50]
CLEAN
p-4users: [u21..u40]
DIRTY
2. Journal (WAL Ring Buffer)fsync 100ms
Active Journal File:WiredTigerLog.0000000001
Current LSN:#1048
Persistence guarantee:Write Concern j:true
Sequential append-only log enables instant crash recovery by replaying changes between last checkpoint and current LSN.
3. Disk Storage (.wt B-Trees)Checkpointed
Data Tables:collection-*.wt
Index Tables:index-*.wt
Root Pointer:WiredTiger.turtle
Disk files store B-Tree pages with Snappy / zlib compression. Only updated during checkpoint flush or heavy eviction.
ENGINE_LOG:Engine initialized. WiredTiger cache allocated (50% RAM minus 1GB).

1. Formal Definition & Architecture Intent

The Lookaside Table (WiredTigerLAS.wt) is a specialized on-disk file used by WiredTiger during intense memory cache pressure. When an active page needs to be evicted to free RAM, but that page contains uncommitted modifications or updates required by older concurrent transactions, WiredTiger writes those historical version deltas into the Lookaside Table.

2. Explain Like I'm 5 (Mental Model)

Imagine your desk is overflowing with papers. You need to clear space, but some old documents belong to a colleague who is still on vacation. Instead of throwing them away or keeping them on your desk, you move them into a temporary storage locker in the hallway (the Lookaside table).

3. Real-World Architecture Example

A long-running report running for 45 minutes while thousands of concurrent updates modify the same records.

Sample BSON Documents:
Collection: db.serverStatus.wiredTiger.lookaside
{
  "lookaside table entries allocated": 250000,
  "lookaside table inserts": 180000,
  "lookaside table lookups": 95000
}

WiredTiger spills old version tuples to the LAS file so it can evict the parent pages from RAM without breaking the long-running query.

4. MQL Implementation Steps

Step 1: Monitor Lookaside table size and activity in serverStatus
const las = db.serverStatus().wiredTiger["lookaside table"];
print("LAS Inserts: " + las["lookaside table inserts"]);
print("LAS Lookups: " + las["lookaside table lookups"]);
Elevated LAS activity indicates prolonged cache starvation and long-running transactions.

5. Critical Engineering Rules

Rule / ConstraintUnderlying Reason & Impact
Trigger CauseActive cache eviction coupled with long-running transactions holding old snapshot timestamps.
Performance WarningWhen queries must read from the Lookaside table, read latency degrades drastically due to random disk reads.

6. Deep Dive: How Long-Running Queries Drive LAS Spilling

Under MVCC, every update creates a new row version while preserving the old version for concurrent readers. If a transaction opens a snapshot at timestamp T0 and runs for 1 hour, WiredTiger CANNOT discard any row versions modified after T0. When cache pressure demands page eviction, WiredTiger has no choice but to write these historical versions into WiredTigerLAS.wt on disk.

// Find long-running operations pinning historical snapshots:
db.currentOp({ "secs_running": { $gt: 300 } });
Production Warning: Never allow reporting queries or batch updates to run for hours without paginating.

7. Architectural Trade-offs

Advantages
  • •Prevents out-of-memory (OOM) crashes during severe cache starvation
  • •Allows long-running analytical queries to finish without failing with snapshot isolation errors
Disadvantages & Gotchas
  • •High disk I/O latency when queries must probe the on-disk LAS table to reconstruct snapshots
  • •Excessive LAS usage indicates that system RAM is undersized for the workload

8. Technical Interview Questions

Q1: What is the primary cause of high WiredTiger Lookaside Table (LAS) activity?

High LAS activity is triggered when long-running read operations or uncommitted transactions pin old snapshot timestamps, preventing the engine from purging dead MVCC row versions, while concurrent write traffic forces the cache eviction server to spill these uncommitted or historical deltas to the LAS file on disk.

9. Staff-Level Ready Answer

"The Lookaside Table (LAS) is WiredTiger's overflow swap file for MVCC historical versions. When the cache is full and pages must be evicted, but contain row versions required by active older transactions, those versions are written to the LAS file on disk to prevent OOM errors."

10. Quick Knowledge Check

Which metric in db.serverStatus() indicates that WiredTiger is swapping historical MVCC versions to disk?