Skip to content

Commit

Permalink
Configure tcp_keepalives settings for PostgreSQL
Browse files Browse the repository at this point in the history
These TCP Keepalive settings help manage persistent connections in PostgreSQL, particularly in scenarios where a client might unexpectedly disconnect. They ensure timely detection and cleanup of "dead" connections to maintain system resources optimally.

tcp_keepalives_idle: After 300 seconds of inactivity, PostgreSQL will start sending keepalive probes.
tcp_keepalives_interval: If no acknowledgment of the keepalive probe is received, PostgreSQL will resend the probe every 30 seconds.
tcp_keepalives_count: If no acknowledgment is received after 10 probes, PostgreSQL will consider the connection dead and will close it.
These settings optimize resource usage and system responsiveness.
  • Loading branch information
vitabaks committed Jun 29, 2023
1 parent 3111db6 commit 53edccd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ postgresql_parameters:
- { option: "max_parallel_workers", value: "8" }
- { option: "max_parallel_workers_per_gather", value: "2" }
- { option: "max_parallel_maintenance_workers", value: "2" }
- { option: "tcp_keepalives_count", value: "10" }
- { option: "tcp_keepalives_idle", value: "300" }
- { option: "tcp_keepalives_interval", value: "30" }
# - { option: "old_snapshot_threshold", value: "60min" }
# - { option: "", value: "" }
# - { option: "", value: "" }
Expand Down

0 comments on commit 53edccd

Please sign in to comment.