feat(tuned): ensure CPUs are giving it their all#2069
Conversation
This commit enhances the custom `tuned` profile for PostgreSQL by forcing the CPU into a maximum performance state. These changes are critical for maintaining consistent low-latency database performance. Key Changes and Benefits: - CPU Governor & Energy Bias: Switched to 'performance' mode. This prevents the kernel from scaling down CPU frequencies during periods of lower activity, eliminating the "ramp-up" latency when a burst of queries arrives. - Min Performance Percentage: Fixed at 100% to ensure the processor stays at its maximum base frequency, reducing jitter in query execution times.
There was a problem hiding this comment.
Pull request overview
Enhances the Ansible-managed custom tuned PostgreSQL profile to keep CPUs in a maximum-performance state, aiming to reduce latency/jitter for bursty database workloads.
Changes:
- Ensures the “Create a tuned profile” task runs with privilege escalation (
become: true). - Renames the THP task for clearer intent and standardizes loop item formatting.
- Adds a new task intended to configure CPU performance-related tuned settings in
/etc/tuned/postgresql/tuned.conf.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…-475 * 'INDATA-475' of github.com:supabase/postgres: Update ansible/tasks/setup-tuned.yml Update ansible/tasks/setup-tuned.yml
|
samrose
left a comment
There was a problem hiding this comment.
Critical Issues (fix before merge)
- Typo: min_pef_pct → min_perf_pct (setup-tuned.yml:79)
The option name is misspelled — missing the r in perf. The tuned daemon will silently write the malformed key and ignore it, meaning the CPU minimum P-state floor will
never be enforced despite the intent. This is the most impactful bug.
Wrong:
- { section: 'cpu', option: 'min_pef_pct', value: '100' }
Correct:
- { section: 'cpu', option: 'min_perf_pct', value: '100' }
- Symlink creation will fail on existing hosts (setup-tuned.yml:23-31)
If a host was provisioned before this branch (where /etc/tuned/postgresql was a directory), the state: 'link' task will fail with [Errno 17] File exists. Ansible won't
remove an existing directory to create a symlink in its place. This is lower risk in an AMI build workflow (fresh builds), but needs a force: true or pre-removal task for
safe re-application.
Important Issues
-
ARM/Graviton instances silently ignore energy_perf_bias and P-state settings: these are Intel-only controls. Consider a when: platform == 'amd64' guard or
documentation. -
tuned-adm profile postgresql always reports changed: add changed_when: false since activating an already-active profile is a no-op.
-
Unconditional state: 'restarted' on tuned service:: safe in AMI builds, but risky if the playbook is ever re-applied to a live production instance (causes a brief
performance regression window).
i think this is acceptable as that's how we currently run (w/o optimizations) and we definitely want any new updates to the profile to be applied, which we wouldn't get with |
…-475 * 'INDATA-475' of github.com:supabase/postgres: feat: add `supabase_privileged_role` (#2040)
This commit enhances the custom
tunedprofile for PostgreSQL by forcing the CPU into a maximum performancestate. These changes are critical for maintaining consistent low-latency database performance.
Key Changes and Benefits:
(ripgrep of all Supa repos for the 3 tunables herein returned nothing, so no chance of clobbering the setting)