Skip to content

feat(ansible): add vm dirty/writeback tuning params to tuned profile#2249

Draft
hunleyd wants to merge 1 commit into
developfrom
INDATA-378-vm
Draft

feat(ansible): add vm dirty/writeback tuning params to tuned profile#2249
hunleyd wants to merge 1 commit into
developfrom
INDATA-378-vm

Conversation

@hunleyd

@hunleyd hunleyd commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature — additional kernel sysctl tuning for the PostgreSQL tuned profile.

What is the current behavior?

The tuned profile (ansible/tasks/setup-tuned.yml) sets a range of fs.*, kernel.*, net.*, and a single vm.panic_on_oom sysctl parameter, but does not tune the kernel's dirty-page writeback behavior. Defaults leave large amounts of dirty page cache to accumulate before flushing.

What is the new behavior?

Adds four vm.dirty_* sysctl parameters to the sysctl section of the tuned profile, inserted in alphabetical order:

Parameter Value
vm.dirty_background_ratio 10
vm.dirty_expire_centisecs 3000
vm.dirty_ratio 40
vm.dirty_writeback_centisecs 500

These give PostgreSQL more predictable, smoother I/O: background flushing kicks in at 10% of memory and writeback runs every 5s, so dirty pages are written out steadily rather than in large bursts. This reduces the chance of long write stalls and latency spikes during checkpoints and heavy write workloads, while the 40% hard dirty_ratio still bounds total dirty memory.

Additional context

  • vm.panic_on_oom was already present in the loop and is left unchanged.
  • vm.swappiness is intentionally left in the existing zswap conditional block (only applied when swap is present) rather than moved into the unconditional sysctl loop.
  • yamllint and ansible-lint both pass with no rule violations.
Add vm.dirty_background_ratio, vm.dirty_expire_centisecs, vm.dirty_ratio,
and vm.dirty_writeback_centisecs to the sysctl section of the PostgreSQL
tuned profile.
@blacksmith-sh

blacksmith-sh Bot commented Jun 30, 2026

Copy link
Copy Markdown

Found 75 test failures on Blacksmith runners:

Failures

Test View Logs
test_ami_nix/test_apparmor_allows_basic_sql_and_extensions View Logs
test_ami_nix/test_apparmor_allows_basic_sql_and_extensions View Logs
test_ami_nix/test_apparmor_allows_basic_sql_and_extensions View Logs
test_ami_nix/test_apparmor_allows_pg_dump View Logs
test_ami_nix/test_apparmor_allows_pg_dump View Logs
test_ami_nix/test_apparmor_allows_pg_dump View Logs
test_ami_nix/test_apparmor_allows_walg View Logs
test_ami_nix/test_apparmor_allows_walg View Logs
test_ami_nix/test_apparmor_allows_walg View Logs
test_ami_nix/test_apparmor_blocks_disallowed_shell_commands View Logs
test_ami_nix/test_apparmor_blocks_disallowed_shell_commands View Logs
test_ami_nix/test_apparmor_blocks_disallowed_shell_commands View Logs
test_ami_nix/test_apparmor_denies_access_to_sensitive_paths View Logs
test_ami_nix/test_apparmor_denies_access_to_sensitive_paths View Logs
test_ami_nix/test_apparmor_denies_access_to_sensitive_paths View Logs
test_ami_nix/test_apparmor_permits_allowlisted_commands View Logs
test_ami_nix/test_apparmor_permits_allowlisted_commands View Logs
test_ami_nix/test_apparmor_permits_allowlisted_commands View Logs
test_ami_nix/test_apparmor_postgresql_service_uses_profile View Logs
test_ami_nix/test_apparmor_postgresql_service_uses_profile View Logs
test_ami_nix/test_apparmor_postgresql_service_uses_profile View Logs
test_ami_nix/test_apparmor_sbpostgres_profile_enforced View Logs
test_ami_nix/test_apparmor_sbpostgres_profile_enforced View Logs
test_ami_nix/test_apparmor_sbpostgres_profile_enforced View Logs
test_ami_nix/test_jit_pam_gatekeeper_profile View Logs
test_ami_nix/test_jit_pam_gatekeeper_profile View Logs
test_ami_nix/test_jit_pam_gatekeeper_profile View Logs
test_ami_nix/test_jit_pam_module_dependencies View Logs
test_ami_nix/test_jit_pam_module_dependencies View Logs
test_ami_nix/test_jit_pam_module_dependencies View Logs
test_ami_nix/test_jit_pam_module_installed View Logs
test_ami_nix/test_jit_pam_module_installed View Logs
test_ami_nix/test_jit_pam_module_installed View Logs
test_ami_nix/test_jit_pam_postgresql_integration View Logs
test_ami_nix/test_jit_pam_postgresql_integration View Logs
test_ami_nix/test_jit_pam_postgresql_integration View Logs
test_ami_nix/test_libpq5_version View Logs
test_ami_nix/test_libpq5_version View Logs
test_ami_nix/test_libpq5_version View Logs
test_ami_nix/test_pam_postgresql_config View Logs
test_ami_nix/test_pam_postgresql_config View Logs
test_ami_nix/test_pam_postgresql_config View Logs
test_ami_nix/test_postgresql_version View Logs
test_ami_nix/test_postgresql_version View Logs
test_ami_nix/test_postgresql_version View Logs
test_ami_nix/test_postgrest_can_connect_to_db View Logs
test_ami_nix/test_postgrest_can_connect_to_db View Logs
test_ami_nix/test_postgrest_can_connect_to_db View Logs
test_ami_nix/test_postgrest_ending_apikey_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_ending_apikey_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_ending_apikey_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_ending_empty_key_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_ending_empty_key_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_ending_empty_key_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_is_running View Logs
test_ami_nix/test_postgrest_is_running View Logs
test_ami_nix/test_postgrest_is_running View Logs
test_ami_nix/test_postgrest_middle_apikey_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_middle_apikey_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_middle_apikey_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_middle_empty_key_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_middle_empty_key_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_middle_empty_key_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_read_only_session_attrs View Logs
test_ami_nix/test_postgrest_read_only_session_attrs View Logs
test_ami_nix/test_postgrest_read_only_session_attrs View Logs
test_ami_nix/test_postgrest_responds_to_requests View Logs
test_ami_nix/test_postgrest_responds_to_requests View Logs
test_ami_nix/test_postgrest_responds_to_requests View Logs
test_ami_nix/test_postgrest_starting_apikey_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_starting_apikey_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_starting_apikey_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_starting_empty_key_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_starting_empty_key_query_parameter_is_removed View Logs
test_ami_nix/test_postgrest_starting_empty_key_query_parameter_is_removed View Logs

Fix in Cursor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant