databricks-sql-go icon indicating copy to clipboard operation
databricks-sql-go copied to clipboard

Improve http client set up

Open andrefurlan-db opened this issue 3 years ago • 2 comments

Reuse http client across connections

Go http client is meant to be reused as it has its own connection pool. This would reduce the need to many https handshakes on connection creation. Be careful to not reuse the thrift client as that one is not thread safe.

Increase http client MaxIdleConnsPerHost

Our use case it pretty much all about connecting to the same host. So we should set MaxIdleConnsPerHost to a number way higher than default 2.

andrefurlan-db avatar Dec 12 '22 17:12 andrefurlan-db

@andrefurlan-db the most common tuned value I've seen for MaxIdleConnsPerHost is 100. I definitely think it's a great idea to increase this from the default value of 2, but should this value also be configurable by users, such as from query params in the DSN?

zcking avatar Dec 14 '22 06:12 zcking

Hi @zcking , until we have some real requests and use cases on why setting this is important to our users, I will prefer to not make it configurable. So, I am not disagreeing with you, I just want to wait and see if there is demand for such low consequence knob.

andrefurlan-db avatar Dec 14 '22 22:12 andrefurlan-db