Skip to content

Commit

Permalink
ClickHouse SetMaxIdleConns zero
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzhichang committed Jan 15, 2021
1 parent 24c1525 commit 44d672c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pool/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ func InitConn(hosts [][]string, port int, db, username, password, dsnParams stri
return
}

// TODO, pool this
// TODO: ClickHouse creates a thread for each TCP/HTTP connection.
// If the number of sinkers is close to clickhouse max_concurrent_queries(default 100), user queries could be blocked or refused.
func setDBParams(sqlDB *sql.DB) {
sqlDB.SetMaxIdleConns(1)
sqlDB.SetConnMaxLifetime(120 * time.Second)
sqlDB.SetMaxOpenConns(1)
sqlDB.SetMaxIdleConns(0)
sqlDB.SetConnMaxIdleTime(10 * time.Second)
}

func FreeConn() {
Expand Down

0 comments on commit 44d672c

Please sign in to comment.