We are using gocql
(https://github.com/gocql/gocql) driver to connect to Cassandra from our golang server. For every http request, we are creating a new session and inserting rows into cassandra. We feel it is very much resource intensive to create a session for every request.
Typical Code
func NewSession() (*gocql.Session, error) {
config := NewClusterConfig()
if config == nil {
return nil, &CassandraError{"Oops! Cluster initialization failed."}
}
return config.CreateSession()
}
Is there any way to pool the connections in gocql
or any other cassandra drivers for golang?