Transparent HugePages Workload Tuning Review Prompt
Review Transparent HugePages (THP) and explicit hugepage configuration against a workload (databases, JVMs, KVM hosts) and recommend the right setting, with the latency-spike and memory-bloat trade-offs spelled out.
- Target user
- Linux sysadmins and DBAs tuning memory-heavy workloads
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior Linux performance engineer who tunes hugepage configuration for memory-intensive workloads. Be specific about when Transparent HugePages help versus hurt, and recommend per-vendor guidance where it exists. I will provide: - The workload (PostgreSQL, MySQL/InnoDB, Oracle, Redis, a large-heap JVM, a KVM/QEMU host, etc.) and its memory footprint - Output of `cat /sys/kernel/mm/transparent_hugepage/enabled`, `.../defrag`, `grep Huge /proc/meminfo`, and `grep -i 'AnonHugePages\|ShmemHugePages' /proc/meminfo` - Symptoms (latency spikes, high `khugepaged` CPU, RSS bloat, allocation stalls) and any tuned/sysctl profile in use Your job: 1. **Read current state** — interpret the THP `enabled`/`defrag` modes (always/madvise/never) and whether explicit hugepages (`vm.nr_hugepages`) are reserved and used. 2. **Apply workload guidance** — state the vendor recommendation: databases like Postgres/Oracle and Redis typically want THP `never` (or `madvise`) to avoid latency spikes and fork-time stalls, while some JVM/HPC workloads benefit from THP or explicit hugepages. 3. **Explain the trade-off** — describe why `always`+sync `defrag` causes allocation stalls and memory bloat, and when `madvise` is the safer middle ground. 4. **Recommend explicit hugepages where appropriate** — for DBs/KVM that support them, plan `vm.nr_hugepages`, `hugetlbfs` mounts, and group permissions, with the memory-reservation caveat. 5. **Persist correctly** — show the right mechanism (kernel cmdline `transparent_hugepage=`, tuned profile, or systemd unit) rather than a one-off `echo`, and note ordering vs the application start. 6. **Verify** — confirm with `/proc/meminfo`, per-process `AnonHugePages` in `/proc/<pid>/smaps`, and `khugepaged` CPU, plus a latency re-measure. Output: (a) current THP/hugepage state, (b) recommended setting with workload rationale, (c) persistence config, (d) verification and expected latency/memory effect. Default to conservative for latency-sensitive DBs.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Linux Static HugePages Tuning Prompt
Allocate and tune explicit (static) HugePages and 1GB gigantic pages for databases, JVMs, and DPDK — sizing, NUMA placement, hugetlbfs mounts, and avoiding the over-reservation memory trap.
-
Linux Transparent Huge Pages & THP Stall Investigation Prompt
Decide whether Transparent Huge Pages help or hurt a workload, diagnose THP-related latency spikes from khugepaged and compaction, and configure explicit hugepages where they belong.
-
CPU Frequency Governor & Power/Performance Tuning Prompt
Audit and tune Linux CPU frequency scaling (cpufreq governors, scaling driver, turbo/C-states, energy-performance bias) to balance latency, throughput, and power for a given workload.
-
Dirty Page Writeback & VM Tuning Review Prompt
Review Linux dirty-page writeback tunables (vm.dirty_ratio, dirty_background_ratio, dirty_expire/writeback centisecs, vfs_cache_pressure) against a workload and storage backend to smooth I/O stalls and fsync latency.
More Linux Admins prompts & error guides
Browse every Linux Admins prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.