Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async fn crdb_from_env(_client_name: String) -> Result<Option<CrdbPool>, Error>
// Increase lifetime to mitigate: https://github.com/launchbadge/sqlx/issues/2854
//
// See max lifetime https://www.cockroachlabs.com/docs/stable/connection-pooling#set-the-maximum-lifetime-of-connections
.max_lifetime(Duration::from_secs(30 * 60))
.max_lifetime(Duration::from_secs(15 * 60))
// Remove connections after a while in order to reduce load
// on CRDB after bursts
.idle_timeout(Some(Duration::from_secs(3 * 60)))
Expand Down
8 changes: 4 additions & 4 deletions lib/pools/src/utils/sql_query_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ lazy_static::lazy_static! {
governor::clock::DefaultClock,
governor::middleware::NoOpMiddleware
> = governor::RateLimiter::direct(
// Limit how many connections can be created to the database
governor::Quota::per_second(std::num::NonZeroU32::new(10).unwrap())
// Allow creating at most 5 connections at the same time
.allow_burst(std::num::NonZeroU32::new(5).unwrap())
// Limit how fast the pool size can grow in order to encourage reusuing existing
// connections instead of opening new ones.
governor::Quota::per_minute(std::num::NonZeroU32::new(10 * 60).unwrap())
.allow_burst(std::num::NonZeroU32::new(500).unwrap())
);
}

Expand Down
4 changes: 2 additions & 2 deletions svc/pkg/cluster/standalone/default-update/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ pub async fn run_from_env(use_autoscaler: bool) -> GlobalResult<()> {
.into_iter()
.map(|(pool_type, pool)| {
let desired_count = match pool_type {
PoolType::Ats => Some(pool.desired_count),
PoolType::Job | PoolType::Gg => {
PoolType::Ats | PoolType::Gg => Some(pool.desired_count),
PoolType::Job => {
Comment on lines +189 to +190
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure to remove this once we enable the autoscaler for gg and ats

if use_autoscaler {
None
} else {
Expand Down