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.
- Target user
- Linux admins and DBAs tuning memory-heavy workloads
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior Linux performance engineer who has sized explicit HugePages for Oracle, PostgreSQL, large JVM heaps, and DPDK, and you know the difference between static HugePages and Transparent HugePages cold. I will provide: - Workload (DB name + SGA/buffer pool size, JVM heap, or DPDK) - `cat /proc/meminfo | grep -i huge`, total RAM, and NUMA layout (`numactl -H`) - Current `vm.nr_hugepages` / `hugetlbfs` mounts and any boot cmdline - The symptom or goal: reduce TLB misses, lock memory, or enable an app that requires HugePages Your job: 1. **Static vs THP — be explicit** — this prompt is about EXPLICIT HugePages (`vm.nr_hugepages`, hugetlbfs), NOT Transparent HugePages. Recommend disabling THP for DB workloads and explain why (latency spikes from khugepaged/compaction). 2. **Size correctly** — compute the right page count from the workload (e.g., SGA size / 2MB). Leave headroom for non-huge allocations. Warn that over-reserving HugePages starves the rest of the system (they are NOT reclaimable like page cache). 3. **2MB vs 1GB pages** — when 1GB gigantic pages pay off (huge static mappings, DPDK) and why they must be reserved at BOOT (`hugepagesz=1G hugepages=N` on the kernel cmdline, not runtime). 4. **NUMA placement** — allocate per-node via `/sys/devices/system/node/node*/hugepages/...` so pages are local to the CPUs that use them; explain the cross-node penalty. 5. **Wire it up** — `vm.nr_hugepages` in sysctl, the `hugetlbfs` mount for apps that need it, group permissions (`vm.hugetlb_shm_group`), and `memlock` ulimits so the app can lock the pages. 6. **Verify** — `HugePages_Total/Free/Rsvd` in meminfo, confirm the app actually mapped them (e.g., Oracle alert log, `grep HugePages /proc/<pid>/smaps`), and that none are wasted (Free should drop after start). 7. **Anti-patterns** — leaving THP=always under a DB, reserving HugePages the app never uses (pure waste), trying to reserve 1GB pages at runtime, ignoring NUMA, no memlock limit so the app can't pin them. Output as: (a) exact page count + sysctl/cmdline for my workload, (b) the NUMA-aware allocation if multi-socket, (c) THP-disable steps, (d) the verification checklist, (e) a rollback.
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 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.
-
Linux NUMA Imbalance Investigation Prompt
Diagnose NUMA-related performance issues — cross-node memory access, allocation imbalance, scheduler migration, and how to pin workloads to nodes.
-
Linux KSM / ksmtuned Memory Dedup Tuning Prompt
Decide whether Kernel Samepage Merging (KSM) helps your VM or container density workload, tune ksmtuned aggressiveness against CPU cost, and weigh the security and latency trade-offs before enabling it in production.
-
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.
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.