Pranjut
Pranjut

Reputation: 1777

Slick 3.0 with default connection pooling and postgresql 9.4.4 is throughing "too many clients already" error

Currently I am building an application with micro services. I have three instances which are actually interacting with the database i.e. Postgresql 9.4.4.

Below is my connection properties with slick 3.0

dev {

# Development Database configuration
# ~~~~~
dbconf {
    dataSourceClass="org.postgresql.ds.PGSimpleDataSource"
    properties {
        user="xyz"
        password="dev@xyz"
        databaseName="dev_xyz"
        serverName="localhost"
    }
    numThreads=10
}
}

The problem is that I am getting this FATAL: sorry, too many clients already error. max_connections in postgresql is 100 which is the default. As per the discussions in the web I might have to use a connection pool for this, which is I am doing by using Slick's default connection pool HikariCP. I am damn confuse right now, what step should I take to resolved this issue.

Upvotes: 3

Views: 442

Answers (1)

jkinkead
jkinkead

Reputation: 4421

Add the maxConnections parameter to your configuration.

dbconf {
  numThreads=10
  maxConnections=10
}

Upvotes: 2

Related Questions