Skip to content

Add TCP keep-alive configuration support#30

Merged
levkk merged 5 commits intopgdogdev:mainfrom
maherbeg:maherbeg/tcp-ka
Nov 7, 2025
Merged

Add TCP keep-alive configuration support#30
levkk merged 5 commits intopgdogdev:mainfrom
maherbeg:maherbeg/tcp-ka

Conversation

@maherbeg
Copy link
Copy Markdown
Contributor

@maherbeg maherbeg commented Nov 6, 2025

Adds support for configuring TCP keep-alive settings for database connections.

Changes

  • Add optional tcpKeepalives, tcpTime, tcpInterval, and tcpRetries parameters to
    values.yaml
  • Generate [tcp] section in pgdog.toml when any TCP keep-alive parameter is set
  • Document TCP keep-alive configuration in README

Configuration Example

tcpKeepalives: true
tcpTime: 7200
tcpInterval: 75
tcpRetries: 9

All parameters are optional and only included in the config when explicitly set.

Example output

helm template test-pgdog . --set tcpKeepalives=true,tcpTime=7200

# Source: pgdog/templates/config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
    name: test-pgdog
data:
    # This is pgdog.toml. You can configure anything here, incl. databases.
    # Note: don't change the port value, since it's pulled from Values.
    pgdog.toml: |
        [general]
        port                      =   6432
        workers                   =   2
        default_pool_size         =   10
        pooler_mode               =   "transaction"
        healthcheck_interval      =   30_000
        idle_healthcheck_interval =   30_000
        idle_healthcheck_delay    =   5_000
        healthcheck_timeout       =   5_000
        rollback_timeout          =   5_000
        load_balancing_strategy   =   "round_robin"
        read_write_strategy       =   "conservative"
        read_write_split          =   "exclude_primary"
        tls_verify                =   "prefer"
        shutdown_timeout          =   60_000
        prepared_statements       =   "extended"
        passthrough_auth          =   "disabled"
        connect_timeout           =   5_000
        connect_attempts          =   1
        connect_attempt_delay     =   0
        checkout_timeout          =   5_000
        dry_run                   =   false
        mirror_queue              =   128
        mirror_exposure           =   1.0
        auth_type                 =   "scram"
        cross_shard_disabled      =   false
        openmetrics_port = 9090
        openmetrics_namespace = "pgdog_"
        server_lifetime = 86400000
        [tcp]
        keepalives = true
        time = 7200

Copy link
Copy Markdown
Contributor

@levkk levkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you!

Comment thread templates/config.yaml Outdated
@levkk
Copy link
Copy Markdown
Contributor

levkk commented Nov 6, 2025

Actually could you double check the name of the tcp parameters, just to be sure there are no typos 🙇

Comment thread templates/config.yaml Outdated
Comment thread README.md Outdated
Comment thread templates/config.yaml Outdated
@levkk levkk merged commit c0a3e9d into pgdogdev:main Nov 7, 2025
@maherbeg
Copy link
Copy Markdown
Contributor Author

maherbeg commented Nov 7, 2025

Amazing, thank you! Looking forward to testing this out when the chart version gets bumped!

@levkk
Copy link
Copy Markdown
Contributor

levkk commented Nov 7, 2025

Should be available now as v0.15.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants