Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: make SQL connection keep alive easily configurable #115833

Merged
merged 2 commits into from
Jan 17, 2024

Commits on Jan 16, 2024

  1. util/sysutil: add method for setting/getting keep alive count

    Previously, we relied solely on setting the keep alive probe interval
    and keep alive idle time to control how long a connection stayed active.
    Unfortunately, this did not have the desired effect since the number of
    probes was not set. As a result, idle connections for up to 10 minutes
    would be kept around. To allow better configuration of these settings,
    we need API to set the keep alive count on a socket. This patch will add
    a sysutil to control the keep-alive count to address this.
    
    Release note: None
    fqazi committed Jan 16, 2024
    Configuration menu
    Copy the full SHA
    1a9fe26 View commit details
    Browse the repository at this point in the history
  2. server: add cluster setting for SQL keep alive time

    Previously, we only had an environment variable for controlling the keep
    alive probe interval and keep alive idle time for pgwire connections.
    Unfortunately, this defaulted to around 10 minutes on Linux since the
    probe count was not configurable either. To address this, this patch
    adds the settings: server.sql_tcp_keep_alive.count and
    server.sql_tcp_keep_alive.interval, which allow much better control than
    previously. These settings can be used to pick an overall connection
    time out for idle connections and the probe interval.
    
    Fixes: cockroachdb#115422
    Release note (sql change): Add configurable settings for
    total TCP keep alive probes (server.sql_tcp_keep_alive.count) and TCP
    probe intervals (server.sql_tcp_keep_alive.interval) for SQL
    connections. Removes the COCKROACH_SQL_TCP_KEEP_ALIVE environment
    variable subsuming it.
    fqazi committed Jan 16, 2024
    Configuration menu
    Copy the full SHA
    af23e06 View commit details
    Browse the repository at this point in the history