Skip to content

/dev/shm (POSIX Shared Memory / tmpfs)

In cloud Kubernetes clusters (AWS EKS, GCP GKE, Azure AKS), containers do not run on dedicated bare-metal NVMe drives by default. They are constrained by:

  1. Network-Attached Persistent Volumes (AWS EBS / GCP PD): Remote disk latency fluctuates between 1ms and 350ms during multi-tenant throttling, burning burst IOPS credits.
  2. Docker / Containerd Overlay Filesystem: Copy-on-write overlay filesystems trigger inode contention and high write amplification.
  3. Strict Ephemeral-Storage Quotas: If a container cache fills /tmp, the Kubernetes kubelet terminates the pod immediately (Pod was evicted).
  4. Zero-Trust Security Policies: Hardened enterprise clusters enforce readOnlyRootFilesystem: true, blocking writes to standard filesystem directories.

The Solution: Target /dev/shm

TriCache automatically detects Linux container runtimes and targets /dev/shm when writable and provided with adequate capacity (256 MB total and 128 MB available space).

Node.js POSIX Shared Memory Architecture

Memory Bus & Spill Topology
                      ┌─────────────────────────────────────────┐
                      │            Node.js Process              │
                      │  [L1 V8 Heap: 512MB] (Zero GC Pauses)   │
                      └────────────────────┬────────────────────┘
                                           │ Spill on Eviction

┌────────────────────────────────────────────────────────────────────────────────────────┐
│   Linux /dev/shm (POSIX Shared Memory / tmpfs)                                         │
│   • Path: /dev/shm/tricache-disk                                                       │
│   • Speed: 0.02ms latency (Pure RAM bus, bypasses storage controllers entirely)        │
│   • GC Impact: Zero V8 GC pressure (stored as raw binary buffers/msgpackr)             │
│   • Security: 100% compliant with readOnlyRootFilesystem: true                         │
│   • Cloud IOPS: 0 IOPS burned (Zero AWS EBS volume cost)                              │
└────────────────────────────────────────────────────────────────────────────────────────┘

Why SREs Approve This Pattern

  • Zero V8 GC Overhead: Large JavaScript objects are serialized into flat msgpackr binary buffers in off-heap memory. Even with 4 GB of cached data, Node.js event-loop GC pauses stay under 5ms.
  • Pure Memory Bus Speed: Reads and writes complete in ~20 microseconds (0.02ms), 100× faster than network Redis (1–2ms).
  • Zero Cloud IOPS: Does not touch cloud storage volumes, eliminating EBS burst credit exhaustion.
  • CIS / SOC2 Compliant: Functions cleanly within readOnlyRootFilesystem: true containers when /dev/shm is mounted as an emptyDir.