⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Databases & Storage Interview Questions Scenario 18 of 54 in Databases & Storage
Staff SRE / Principal Architect [L3] Database Linux / SRE — Scenario-Based Interview Questions Staff SRE Scenario [L3]
🎯 Target Role / Context: Linux Scenario #26 (L3) · Linux / SRE — Scenario-Based Interview Questions

Q: A database server has 64GB of RAM and Swap enabled. Swappiness is set to the default of 60. You notice the database occasionally acts sluggish because Linux is using 5GB of Swap, even though 10GB of RAM is perfectly free. You disable Swap entirely via `swapoff -a` to force it entirely into RAM, and sudden OOM Outages begin. Explain this behavior.

Linux actively manages memory between Application Memory (Anonymous) and File Caching (Page Cache).

#Linux #L3 #SRE #Systems #Troubleshooting
🎙️ Candidate Opening & Architectural Context
""In an interview, I explain my systematic Linux troubleshooting methodology using Brendan Gregg's USE method. The interviewer is testing: vm.swappiness, Anonymous memory vs Page Cache, memory pressure.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's PostgreSQL Database Administration & High Availability Course covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: "In an interview, I explain my systematic Linux troubleshooting methodology using Brendan Gregg's USE method. The interviewer is testing: vm.swappiness, Anonymous memory vs Page Cache, memory pressure.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."

1️⃣

Production Solution & Architecture

Linux actively manages memory between Application Memory (Anonymous) and File Caching (Page Cache). A swappiness of 60 aggressively pages out idle, rarely used application memory to the relatively slow Swap partition to free up RAM so Linux can cache heavily requested disk files, speeding up overall I/O. When you ran swapoff, you ripped away the safety net. Now, when the database makes a sudden, massive memory allocation request, Linux has no Swap to move the idle pages to. It must drop disk caches to find space. If the cache dropping isn't fast enough to satisfy the allocation speed, the kernel enters an Out Of Memory condition and the OOM Killer aggressively terminates the database to save the OS. *Fix:* Turn Swap back on, but drastically tune sysctl vm.swappiness=1 (or 10) to instruct the kernel to only swap out memory absolutely as a last resort before an OOM.

💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Linux actively manages memory between Application Memory (Anonymous) and File Caching (Page Cache).."
⚡ 60-Second Elevator Pitch Talking Points
  • Immediate Triage: Linux actively manages memory between Application Memory (Anonymous) and File Caching (Page Cac
  • Run targeted verification commands before modifying configuration.
  • Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Promoting an asynchronous database read replica without confirming replication lag and WAL synchronization Promoting an asynchronous replica that lags behind the primary causes transaction loss and data inconsistency.
  2. Connecting distributed application microservices directly without a proxy connection pooler (PgBouncer) Direct connections create thread-per-client overhead, consuming database memory and hitting max_connections limits under sudden traffic spikes.
  3. Overlooking WAL and binary log volume growth on database instances during intensive batch write jobs Unchecked replication or unpurged transaction logs rapidly exhaust disk space, placing the database into read-only recovery mode.
  4. Neglecting row-level lock contention and lock ordering across concurrent distributed transactions in linux-sre-q026-a-database-server-has-64gb-of-ram-a Inconsistent lock ordering across distributed workers causes cyclic lock waits, resulting in aborted transactions and high error rates.
Advertisement
Want more Databases & Storage scenarios?
Explore our complete collection of scenario-based Databases & Storage interview runbooks.
Browse All Databases & Storage Questions →