Skip to content

Commit

Permalink
Increase MySQL connection pool TTLs for funrun (#31367)
Browse files Browse the repository at this point in the history
We've seen a ~40ms overhead when acquiring a new connection (as opposed to reusing an existing one). The current parameters try and keep the pool small but are from an era before funrun as well as before we were using RDS proxy. This makes it so that funrun keeps connections around for longer so we can benefit from connection reuse.

GitOrigin-RevId: db9e30bcb89ab159bacfaccadf545d6b6547b9df
  • Loading branch information
sshader authored and Convex, Inc. committed Nov 6, 2024
1 parent 474532b commit 4710609
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/common/src/knobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,8 @@ pub static MYSQL_MAX_QUERY_DYNAMIC_BATCH_SIZE: LazyLock<usize> =
/// Close a connection after it has been idle for some time. RDS proxy closes
/// connections after idle_client_timeout in mysql.tf, which should be
/// configured to be higher than this.
///
/// This is overridden to 30 min in funrun
pub static MYSQL_INACTIVE_CONNECTION_LIFETIME: LazyLock<Duration> = LazyLock::new(|| {
Duration::from_secs(env_config("MYSQL_INACTIVE_CONNECTION_LIFETIME_SECS", 90))
});
Expand All @@ -807,6 +809,8 @@ pub static MYSQL_INACTIVE_CONNECTION_LIFETIME: LazyLock<Duration> = LazyLock::ne
/// connections if the SQL query which exceeded the 16384 byte limit. Having a
/// hard limit on connection lifetime helps us reduce pinning and improve
/// connection reuse.
///
/// This is overridden to 30 min in funrun
pub static MYSQL_MAX_CONNECTION_LIFETIME: LazyLock<Duration> =
LazyLock::new(|| Duration::from_secs(env_config("MYSQL_MAX_CONNECTION_LIFETIME_SECS", 600)));

Expand Down

0 comments on commit 4710609

Please sign in to comment.